From 91a41cb32dbf6428fd44ca7f375c243f0b1a675a Mon Sep 17 00:00:00 2001 From: James Rosewell Date: Fri, 18 Sep 2015 17:11:16 +0100 Subject: [PATCH] MINOR: http: made CHECK_HTTP_MESSAGE_FIRST accessible to other functions Added the definition of CHECK_HTTP_MESSAGE_FIRST and the declaration of smp_prefetch_http to the header. Changed smp_prefetch_http implementation to remove the static qualifier. --- include/proto/proto_http.h | 12 ++++++++++++ src/proto_http.c | 13 +------------ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/include/proto/proto_http.h b/include/proto/proto_http.h index d62cd9b9bd..8385dc6932 100644 --- a/include/proto/proto_http.h +++ b/include/proto/proto_http.h @@ -135,6 +135,18 @@ struct action_kw *action_http_req_custom(const char *kw); struct action_kw *action_http_res_custom(const char *kw); int val_hdr(struct arg *arg, char **err_msg); +int smp_prefetch_http(struct proxy *px, struct stream *s, unsigned int opt, + const struct arg *args, struct sample *smp, int req_vol); + +/* Note: these functions *do* modify the sample. Even in case of success, at + * least the type and uint value are modified. + */ +#define CHECK_HTTP_MESSAGE_FIRST() \ + do { int r = smp_prefetch_http(smp->px, smp->strm, smp->opt, args, smp, 1); if (r <= 0) return r; } while (0) + +#define CHECK_HTTP_MESSAGE_FIRST_PERM() \ + do { int r = smp_prefetch_http(smp->px, smp->strm, smp->opt, args, smp, 0); if (r <= 0) return r; } while (0) + static inline void http_req_keywords_register(struct action_kw_list *kw_list) { LIST_ADDQ(&http_req_keywords.list, &kw_list->list); diff --git a/src/proto_http.c b/src/proto_http.c index eb3582bd77..0fb57d39d8 100644 --- a/src/proto_http.c +++ b/src/proto_http.c @@ -10015,8 +10015,7 @@ struct redirect_rule *http_parse_redirect_rule(const char *file, int linenum, st * we'll never have any HTTP message there ; * 1 if an HTTP message is ready */ -static int -smp_prefetch_http(struct proxy *px, struct stream *s, unsigned int opt, +int smp_prefetch_http(struct proxy *px, struct stream *s, unsigned int opt, const struct arg *args, struct sample *smp, int req_vol) { struct http_txn *txn; @@ -10110,16 +10109,6 @@ smp_prefetch_http(struct proxy *px, struct stream *s, unsigned int opt, return 1; } -/* Note: these functinos *do* modify the sample. Even in case of success, at - * least the type and uint value are modified. - */ -#define CHECK_HTTP_MESSAGE_FIRST() \ - do { int r = smp_prefetch_http(smp->px, smp->strm, smp->opt, args, smp, 1); if (r <= 0) return r; } while (0) - -#define CHECK_HTTP_MESSAGE_FIRST_PERM() \ - do { int r = smp_prefetch_http(smp->px, smp->strm, smp->opt, args, smp, 0); if (r <= 0) return r; } while (0) - - /* 1. Check on METHOD * We use the pre-parsed method if it is known, and store its number as an * integer. If it is unknown, we use the pointer and the length.