diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2013-03-09 14:43:07 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2013-03-09 14:43:07 +0000 |
commit | 02569e290afd89e1447717ea9f4584eaf4382ad8 (patch) | |
tree | 3a7248734cfb5e9977dd3b3d57b3b666747e435c /usr.sbin/relayd/relay_http.c | |
parent | 6caaed06a7a2993dffb256c95dfa4ab9f364cf41 (diff) |
Enable TCP socket splicing for HTTP persistent connection and chunked
transfer encoding. This speeds up relayd for more protocol modes
by zero-copy TCP forwarding.
OK reyk@ benno@
Diffstat (limited to 'usr.sbin/relayd/relay_http.c')
-rw-r--r-- | usr.sbin/relayd/relay_http.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/usr.sbin/relayd/relay_http.c b/usr.sbin/relayd/relay_http.c index 4a8b3a4fbc9..cfbf7cb13fa 100644 --- a/usr.sbin/relayd/relay_http.c +++ b/usr.sbin/relayd/relay_http.c @@ -1,4 +1,4 @@ -/* $OpenBSD: relay_http.c,v 1.9 2013/02/15 12:15:12 bluhm Exp $ */ +/* $OpenBSD: relay_http.c,v 1.10 2013/03/09 14:43:06 bluhm Exp $ */ /* * Copyright (c) 2006 - 2012 Reyk Floeter <reyk@openbsd.org> @@ -375,6 +375,8 @@ relay_read_http(struct bufferevent *bev, void *arg) if (EVBUFFER_LENGTH(src) && bev->readcb != relay_read_http) bev->readcb(bev, arg); bufferevent_enable(bev, EV_READ); + if (relay_splice(cre) == -1) + relay_close(con, strerror(errno)); return; fail: relay_abort_http(con, 500, strerror(errno), 0); @@ -398,6 +400,8 @@ relay_read_httpcontent(struct bufferevent *bev, void *arg) __func__, cre->dir, size, cre->toread); if (!size) return; + if (relay_spliceadjust(cre) == -1) + goto fail; if (cre->toread > 0) { /* Read content data */ @@ -449,6 +453,8 @@ relay_read_httpchunks(struct bufferevent *bev, void *arg) __func__, cre->dir, size, cre->toread); if (!size) return; + if (relay_spliceadjust(cre) == -1) + goto fail; if (cre->toread > 0) { /* Read chunk data */ |