]> git.ipfire.org Git - thirdparty/git.git/commit - http-backend.c
http-backend: buffer headers before sending
authorEric Wong <e@80x24.org>
Tue, 9 Aug 2016 23:47:31 +0000 (23:47 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 10 Aug 2016 16:27:26 +0000 (09:27 -0700)
commitb36045c1dc43e36f6fb84b041b59317b7f02b58c
treefa2d7692447f207f7431c3f2740078afda7460c8
parent00f27feb6afaa9e5f91a0852a5a20c041ba0a421
http-backend: buffer headers before sending

Avoid waking up the readers for unnecessary context switches for
each line of header data being written, as all the headers are
written in short succession.

It is unlikely any HTTP/1.x server would want to read a CGI
response one-line-at-a-time and trickle each to the client.
Instead, I'd expect HTTP servers want to minimize syscall and
TCP/IP framing overhead by trying to send all of its response
headers in a single syscall or even combining the headers and
first chunk of the body with MSG_MORE or writev.

Verified by strace-ing response parsing on the CGI side.

Signed-off-by: Eric Wong <e@80x24.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
http-backend.c