Last active
August 29, 2015 14:06
-
-
Save Noctem/a0ba1477dbc11b5108b2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/support/ab.c b/support/ab.c | |
index 2bb7eef..cbf6c55 100644 | |
--- a/support/ab.c | |
+++ b/support/ab.c | |
@@ -1509,6 +1509,8 @@ static void read_connection(struct connection * c) | |
} | |
} | |
else { | |
+ char *cl; | |
+ | |
/* have full header */ | |
if (!good) { | |
/* | |
@@ -1551,24 +1553,24 @@ static void read_connection(struct connection * c) | |
} | |
c->gotheader = 1; | |
*s = 0; /* terminate at end of header */ | |
+ cl = strstr(c->cbuff, "Content-Length:"); | |
+ /* handle NCSA, which sends Content-length: */ | |
+ if (!cl) | |
+ cl = strstr(c->cbuff, "Content-length:"); | |
+ if (cl) { | |
+ /* response to HEAD doesn't have entity body */ | |
+ c->length = method != HEAD ? atoi(cl + 16) : 0; | |
+ } | |
+ /* The response may not have a Content-Length header */ | |
+ if (!cl) { | |
+ c->keepalive = 1; | |
+ c->length = 0; | |
+ } | |
+ | |
if (keepalive && | |
(strstr(c->cbuff, "Keep-Alive") | |
|| strstr(c->cbuff, "keep-alive"))) { /* for benefit of MSIIS */ | |
- char *cl; | |
- cl = strstr(c->cbuff, "Content-Length:"); | |
- /* handle NCSA, which sends Content-length: */ | |
- if (!cl) | |
- cl = strstr(c->cbuff, "Content-length:"); | |
- if (cl) { | |
- c->keepalive = 1; | |
- /* response to HEAD doesn't have entity body */ | |
- c->length = method != HEAD ? atoi(cl + 16) : 0; | |
- } | |
- /* The response may not have a Content-Length header */ | |
- if (!cl) { | |
- c->keepalive = 1; | |
- c->length = 0; | |
- } | |
+ c->keepalive = 1; | |
} | |
c->bread += c->cbx - (s + l - c->cbuff) + r - tocopy; | |
totalbread += c->bread; | |
@@ -1614,6 +1616,13 @@ static void read_connection(struct connection * c) | |
c->start = c->connect = lasttime = apr_time_now(); | |
write_request(c); | |
} | |
+ | |
+ if (c->length && (c->bread >= c->length)) { | |
+ /* finished a non keep-alive connection */ | |
+ good++; | |
+ close_connection(c); | |
+ return; | |
+ } | |
} | |
/* --------------------------------------------------------- */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment