diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2007-03-02 11:32:41 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2007-03-02 11:32:41 +0000 |
commit | cbf005ba666d772bc3266b4717b12de55a105d36 (patch) | |
tree | 1649e144ff82fbbd55624fc5593204b3ba860df9 /usr.sbin/hoststated | |
parent | 076a07b2a31ef577c2be4fa80f242d9942ba0418 (diff) |
when the http read callback changes and some data is still left in the
input buffer, we call the new callback to handle the remaining data.
this change makes sure that we only do this after the read callback
was actually changed (read header -> read content, read content ->
read header, read chunks...) to avoid a possible loop which could
happen in some rare cases.
Diffstat (limited to 'usr.sbin/hoststated')
-rw-r--r-- | usr.sbin/hoststated/relay.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.sbin/hoststated/relay.c b/usr.sbin/hoststated/relay.c index d407e8d1047..dfdf2982634 100644 --- a/usr.sbin/hoststated/relay.c +++ b/usr.sbin/hoststated/relay.c @@ -1,4 +1,4 @@ -/* $OpenBSD: relay.c,v 1.14 2007/02/27 13:38:58 reyk Exp $ */ +/* $OpenBSD: relay.c,v 1.15 2007/03/02 11:32:40 reyk Exp $ */ /* * Copyright (c) 2006, 2007 Reyk Floeter <reyk@openbsd.org> @@ -899,6 +899,8 @@ relay_read_httpcontent(struct bufferevent *bev, void *arg) size, cre->toread); if (con->done) goto done; + if (EVBUFFER_LENGTH(src) && bev->readcb != relay_read_httpcontent) + bev->readcb(bev, arg); bufferevent_enable(bev, EV_READ); return; done: @@ -993,7 +995,7 @@ relay_read_httpchunks(struct bufferevent *bev, void *arg) if (con->done) goto done; - if (EVBUFFER_LENGTH(src)) + if (EVBUFFER_LENGTH(src) && bev->readcb != relay_read_httpchunks) bev->readcb(bev, arg); bufferevent_enable(bev, EV_READ); return; @@ -1270,7 +1272,7 @@ next: } if (con->done) goto done; - if (EVBUFFER_LENGTH(src)) + if (EVBUFFER_LENGTH(src) && bev->readcb != relay_read_http) bev->readcb(bev, arg); bufferevent_enable(bev, EV_READ); return; |