]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: http: make extract_cookie_value() return an int not size_t
authorWilly Tarreau <w@1wt.eu>
Wed, 11 Apr 2012 15:21:08 +0000 (17:21 +0200)
committerWilly Tarreau <w@1wt.eu>
Sun, 29 Apr 2012 22:19:28 +0000 (00:19 +0200)
It's very annoying that we have to deal with the crappy size_t and with ints
at some places because these ones don't mix well. Patch 6f61b2 changed the
chunk len to int but its size remains size_t and some functions are having
trouble being used by several callers depending on the type of their arguments.

Let's turn extract_cookie_value() to int for now on, and plan a massive cleanup
later to remove all size_t.

include/types/buffers.h
src/proto_http.c

index 6280c4f34aab5a17df07b692f4cecda254d3b73a..5d5ec1cc3ec3e3d76f28c1f2f8f38fec85e865a4 100644 (file)
 /* describes a chunk of string */
 struct chunk {
        char *str;      /* beginning of the string itself. Might not be 0-terminated */
-       size_t size;    /* total size of the buffer, 0 if the *str is read-only */
+       int size;       /* total size of the buffer, 0 if the *str is read-only */
        int len;        /* current size of the string from first to last char. <0 = uninit. */
 };
 
index 3c3bd1ce26d933464dc5bc564fa3edfcdfbae21e..98386aaa68f9a4ac58e13686ce33582424ec3c36 100644 (file)
@@ -8203,7 +8203,7 @@ acl_fetch_http_auth(struct proxy *px, struct session *s, void *l7, int dir,
 static char *
 extract_cookie_value(char *hdr, const char *hdr_end,
                  char *cookie_name, size_t cookie_name_l, int list,
-                 char **value, size_t *value_l)
+                 char **value, int *value_l)
 {
        char *equal, *att_end, *att_beg, *val_beg, *val_end;
        char *next;
@@ -8679,7 +8679,7 @@ static int
 find_cookie_value(struct http_msg *msg, struct http_txn *txn,
                  const char *hdr_name, int hdr_name_len,
                  char *cookie_name, size_t cookie_name_l, int list,
-                 char **value, size_t *value_l)
+                 char **value, int *value_l)
 {
        struct hdr_ctx ctx;
        int found = 0;
@@ -8706,7 +8706,7 @@ pattern_fetch_cookie(struct proxy *px, struct session *l4, void *l7, int dir,
        struct http_txn *txn = l7;
        struct http_msg *msg = &txn->req;
        char  *cookie_value;
-       size_t cookie_value_l;
+       int cookie_value_l;
        int found = 0;
 
        found = find_cookie_value(msg, txn, "Cookie", 6,
@@ -8728,7 +8728,7 @@ pattern_fetch_set_cookie(struct proxy *px, struct session *l4, void *l7, int dir
        struct http_txn *txn = l7;
        struct http_msg *msg = &txn->rsp;
        char  *cookie_value;
-       size_t cookie_value_l;
+       int cookie_value_l;
        int found = 0;
 
        found = find_cookie_value(msg, txn, "Set-Cookie", 10,