In doing a bit of performance tweaking on 1.3, I noticed that
ap_send_header_field() does an ap_rvputs() with each little piece of a
header which results in separate ap_bwrite() calls for "Primitive", ":",
"Value", "crlf" for each header line sent.  Rather than having these 1 and
2 character ap_bwrite() calls wouldn't it make more sense to ap_pstrcat()  
these little bits together and do a single ap_bputs()?

Trivial patch follows:

Index: http_protocol.c
===================================================================
RCS file: /home/cvs/apache-1.3/src/main/http_protocol.c,v
retrieving revision 1.330
diff -u -r1.330 http_protocol.c
--- http_protocol.c     3 Feb 2003 17:13:22 -0000       1.330
+++ http_protocol.c     28 Mar 2003 18:27:38 -0000
@@ -1566,7 +1566,7 @@
             return 1;
         }
     }
-    return (0 < ap_rvputs(r, fieldname, ": ", fieldval, CRLF, NULL));
+    return (0 < ap_bputs(ap_pstrcat(r->pool, fieldname, ": ", fieldval, CRLF, NULL), 
r->connection->client));
 }

 API_EXPORT(void) ap_basic_http_header(request_rec *r)
@@ -1595,7 +1595,7 @@
 #endif /*CHARSET_EBCDIC*/

     /* output the HTTP/1.x Status-Line */
-    ap_rvputs(r, protocol, " ", r->status_line, CRLF, NULL);
+    ap_bputs(ap_pstrcat(r->pool, protocol, " ", r->status_line, CRLF, NULL), 
r->connection->client);

     /* output the date header */
     ap_send_header_field(r, "Date", ap_gm_timestr_822(r->pool, r->request_time));

Reply via email to