[master] b43f31e Give chunked precedence over C-L per RFC7230
Poul-Henning Kamp
phk at FreeBSD.org
Tue May 5 11:50:58 CEST 2015
commit b43f31ec9ce1f32e007ba79f3c292721e916b0a2
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Tue May 5 09:49:38 2015 +0000
Give chunked precedence over C-L per RFC7230
diff --git a/bin/varnishtest/vtc_http.c b/bin/varnishtest/vtc_http.c
index 0e4cfbf..4e40ae1 100644
--- a/bin/varnishtest/vtc_http.c
+++ b/bin/varnishtest/vtc_http.c
@@ -472,15 +472,6 @@ http_swallow_body(struct http *hp, char * const *hh, int body)
hp->body = hp->rxbuf + hp->prxbuf;
ll = 0;
- p = http_find_header(hh, "content-length");
- if (p != NULL) {
- l = strtoul(p, NULL, 10);
- (void)http_rxchar(hp, l, 0);
- vtc_dump(hp->vl, 4, "body", hp->body, l);
- hp->bodyl = l;
- sprintf(hp->bodylen, "%d", l);
- return;
- }
p = http_find_header(hh, "transfer-encoding");
if (p != NULL && !strcasecmp(p, "chunked")) {
while (http_rxchunk(hp) != 0)
@@ -491,6 +482,15 @@ http_swallow_body(struct http *hp, char * const *hh, int body)
sprintf(hp->bodylen, "%d", ll);
return;
}
+ p = http_find_header(hh, "content-length");
+ if (p != NULL) {
+ l = strtoul(p, NULL, 10);
+ (void)http_rxchar(hp, l, 0);
+ vtc_dump(hp->vl, 4, "body", hp->body, l);
+ hp->bodyl = l;
+ sprintf(hp->bodylen, "%d", l);
+ return;
+ }
if (body) {
do {
i = http_rxchar(hp, 1, 1);
More information about the varnish-commit
mailing list