]> granicus.if.org Git - php/commitdiff
Save 50% of the syscalls when writing the HTTP header.
authorSascha Schumann <sas@php.net>
Sun, 18 Feb 2001 19:03:36 +0000 (19:03 +0000)
committerSascha Schumann <sas@php.net>
Sun, 18 Feb 2001 19:03:36 +0000 (19:03 +0000)
sapi/thttpd/thttpd.c

index 947e00c9d948734b69209ee715db4a77b83bb4f2..7975979d30afcc6ed08d975b2c92a38479463f82 100644 (file)
@@ -83,14 +83,20 @@ static int sapi_thttpd_send_headers(sapi_headers_struct *sapi_headers SLS_DC)
 
 static void sapi_thttpd_send_header(sapi_header_struct *sapi_header, void *server_context)
 {
+       struct iovec vec[2];
+       int n = 0;
        TLS_FETCH();
 
        if (sapi_header) {
-               send(TG(hc)->conn_fd, sapi_header->header, sapi_header->header_len, 0);
+               vec[n].iov_base = sapi_header->header;
+               vec[n++].iov_len = sapi_header->header_len;
                TG(hc)->bytes += sapi_header->header_len;
        }
-       send(TG(hc)->conn_fd, "\r\n", sizeof("\r\n") - 1, 0);
+       vec[n].iov_base = "\r\n";
+       vec[n++].iov_len = 2;
        TG(hc)->bytes += 2;
+       
+       writev(TG(hc)->conn_fd, vec, n);
 }
 
 static int sapi_thttpd_read_post(char *buffer, uint count_bytes SLS_DC)