From: Sascha Schumann Date: Sun, 18 Feb 2001 19:03:36 +0000 (+0000) Subject: Save 50% of the syscalls when writing the HTTP header. X-Git-Tag: php-4.0.5RC1~249 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8c92cdd897b6a4d32a39694ecf20a2766f3c236b;p=php Save 50% of the syscalls when writing the HTTP header. --- diff --git a/sapi/thttpd/thttpd.c b/sapi/thttpd/thttpd.c index 947e00c9d9..7975979d30 100644 --- a/sapi/thttpd/thttpd.c +++ b/sapi/thttpd/thttpd.c @@ -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)