httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bri...@apache.org
Subject cvs commit: httpd-2.0/modules/http http_protocol.c
Date Sun, 22 Sep 2002 00:05:08 GMT
brianp      2002/09/21 17:05:08

  Modified:    modules/http http_protocol.c
  Log:
  Switch the most frequent apr_brigade_write() and apr_brigade_puts()
  calls to apr_brigade_writev() for improved efficiency
  
  Revision  Changes    Path
  1.459     +26 -10    httpd-2.0/modules/http/http_protocol.c
  
  Index: http_protocol.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/http/http_protocol.c,v
  retrieving revision 1.458
  retrieving revision 1.459
  diff -u -r1.458 -r1.459
  --- http_protocol.c	6 Sep 2002 01:27:48 -0000	1.458
  +++ http_protocol.c	22 Sep 2002 00:05:08 -0000	1.459
  @@ -1133,11 +1133,21 @@
       ap_xlate_proto_to_ascii(headfield, len);
       apr_brigade_write(h->bb, NULL, NULL, headfield, len);
   #else
  -    apr_brigade_puts(h->bb, NULL, NULL, fieldname);
  -    apr_brigade_write(h->bb, NULL, NULL, ": ", sizeof(": ") - 1);
  -    apr_brigade_puts(h->bb, NULL, NULL, fieldval);
  -    apr_brigade_write(h->bb, NULL, NULL, CRLF, sizeof(CRLF) - 1);
  -#endif /* APR_CHARSET_EBCDIC */
  +    struct iovec vec[4];
  +    struct iovec *v = vec;
  +    v->iov_base = (void *)fieldname;
  +    v->iov_len = strlen(fieldname);
  +    v++;
  +    v->iov_base = ": ";
  +    v->iov_len = sizeof(": ") - 1;
  +    v++;
  +    v->iov_base = (void *)fieldval;
  +    v->iov_len = strlen(fieldval);
  +    v++;
  +    v->iov_base = CRLF;
  +    v->iov_len = sizeof(CRLF) - 1;
  +    apr_brigade_writev(h->bb, NULL, NULL, vec, 4);
  +#endif /* !APR_CHARSET_EBCDIC */
       return 1;
   }
   
  @@ -1183,10 +1193,8 @@
                                 const char *protocol)
   {
       char *date;
  -    char *tmp;
       const char *server;
       header_struct h;
  -    apr_size_t len;
       struct iovec vec[4];
   
       if (r->assbackwards) {
  @@ -1204,9 +1212,17 @@
       vec[2].iov_len  = strlen(r->status_line);
       vec[3].iov_base = (void *)CRLF;
       vec[3].iov_len  = sizeof(CRLF) - 1;
  -    tmp = apr_pstrcatv(r->pool, vec, 4, &len);
  -    ap_xlate_proto_to_ascii(tmp, len);
  -    apr_brigade_write(bb, NULL, NULL, tmp, len);
  +#if APR_CHARSET_EBCDIC
  +    {
  +        char *tmp;
  +        apr_size_t len;
  +        tmp = apr_pstrcatv(r->pool, vec, 4, &len);
  +        ap_xlate_proto_to_ascii(tmp, len);
  +        apr_brigade_write(bb, NULL, NULL, tmp, len);
  +    }
  +#else
  +    apr_brigade_writev(bb, NULL, NULL, vec, 4);
  +#endif
   
       date = apr_palloc(r->pool, APR_RFC822_DATE_LEN);
       ap_recent_rfc822_date(date, r->request_time);
  
  
  

Mime
View raw message