]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: proto_http: few corrections for gcc warnings.
authorDavid Carlier <devnexen@gmail.com>
Mon, 4 Apr 2016 10:54:42 +0000 (11:54 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 5 Apr 2016 16:05:24 +0000 (18:05 +0200)
first, we modify the signatures of http_msg_forward_body and
http_msg_forward_chunked_body as they are declared as inline
below. Secondly, just verify the returns of the chunk initialization
which holds the Authorization Method (althought it is unlikely to fail  ...).
Both from gcc warnings.

src/proto_http.c

index 74cd260c34afe0b078eaa1aae877acf661631190..0c377360c90df32ae042e062995bd7416b509e7b 100644 (file)
@@ -275,8 +275,8 @@ fd_set http_encode_map[(sizeof(fd_set) > (256/8)) ? 1 : ((256/8) / sizeof(fd_set
 
 static int http_apply_redirect_rule(struct redirect_rule *rule, struct stream *s, struct http_txn *txn);
 
-static int http_msg_forward_body(struct stream *s, struct http_msg *msg);
-static int http_msg_forward_chunked_body(struct stream *s, struct http_msg *msg);
+static inline int http_msg_forward_body(struct stream *s, struct http_msg *msg);
+static inline int http_msg_forward_chunked_body(struct stream *s, struct http_msg *msg);
 
 /* This function returns a reason associated with the HTTP status.
  * This function never fails, a message is always returned.
@@ -1589,7 +1589,9 @@ get_http_auth(struct stream *s)
        if (!p || len <= 0)
                return 0;
 
-       chunk_initlen(&auth_method, h, 0, len);
+       if (chunk_initlen(&auth_method, h, 0, len) != 1)
+               return 0;
+
        chunk_initlen(&txn->auth.method_data, p + 1, 0, ctx.vlen - len - 1);
 
        if (!strncasecmp("Basic", auth_method.str, auth_method.len)) {