Re: ab: HTTP/1.1

2010-08-16 Thread Jeff Trawick
2010/8/15 Igor Galić 

>
> Hi folks,
>
> In stumbling over this: http://dpaste.de/NFVw/
> I put together a quick patch.
>

HTTP/1.0 defaults to "Connection: Close".  There's no need to transmit those
bytes when specifying 1.0.

Perhaps the server you're using doesn't handle that properly?



>
> Good night
> --
> Igor Galić
>
> Tel: +43 (0) 664 886 22 883
> Mail: i.ga...@brainsware.org
> URL: http://brainsware.org/
>



-- 
Born in Roswell... married an alien...


ab: HTTP/1.1

2010-08-15 Thread Igor Galić

Hi folks,

In stumbling over this: http://dpaste.de/NFVw/
I put together a quick patch.

Good night
-- 
Igor Galić

Tel: +43 (0) 664 886 22 883
Mail: i.ga...@brainsware.org
URL: http://brainsware.org/
Index: ab.c
===
--- ab.c	(revision 985779)
+++ ab.c	(working copy)
@@ -1643,17 +1643,17 @@
 /* setup request */
 if (!send_body) {
 snprintf_res = apr_snprintf(request, sizeof(_request),
-"%s %s HTTP/1.0\r\n"
+"%s %s HTTP/1.1\r\n"
 "%s" "%s" "%s"
 "%s" "\r\n",
 method_str[method],
 (isproxy) ? fullurl : path,
-keepalive ? "Connection: Keep-Alive\r\n" : "",
+keepalive ? "Connection: Keep-Alive\r\n" : "Connection: close\r\n",
 cookie, auth, hdrs);
 }
 else {
 snprintf_res = apr_snprintf(request,  sizeof(_request),
-"%s %s HTTP/1.0\r\n"
+"%s %s HTTP/1.1\r\n"
 "%s" "%s" "%s"
 "Content-length: %" APR_SIZE_T_FMT "\r\n"
 "Content-type: %s\r\n"
@@ -1661,7 +1661,7 @@
 "\r\n",
 method_str[method],
 (isproxy) ? fullurl : path,
-keepalive ? "Connection: Keep-Alive\r\n" : "",
+keepalive ? "Connection: Keep-Alive\r\n" : "Connection: close\r\n",
 cookie, auth,
 postlen,
 (content_type[0]) ? content_type : "text/plain", hdrs);