BUG/MINOR: httpclient: only ask for more room on failed writes
There's a tiny issue in the I/O handler by which both a failed request
emission and missing response data will want to subscribe for more room
on output. That's not correct in that only the case where the request
buffer is full should cause this, the other one should just wait for
incoming data. This could theoretically cause spurious wakeups at
certain key points (e.g. connect() time maybe) though this could not
be reproduced but better fix this while it's easy enough.
It doesn't seem necessary to backport it right now, though this may
have to in case a concrete reproducible case is discovered.
diff --git a/src/http_client.c b/src/http_client.c
index 8bc6555..4e7f0a4 100644
--- a/src/http_client.c
+++ b/src/http_client.c
@@ -660,14 +660,14 @@
* request from the httpclient buffer */
ret = b_xfer(&req->buf, &hc->req.buf, b_data(&hc->req.buf));
if (!ret)
- goto more;
+ goto full;
if (!b_data(&hc->req.buf))
b_free(&hc->req.buf);
htx = htx_from_buf(&req->buf);
if (!htx)
- goto more;
+ goto full;
channel_add_input(req, htx->data);
@@ -912,11 +912,12 @@
sc_will_read(sc);
return;
-more:
- /* There was not enough data in the response channel */
-
+full:
+ /* There was not enough room in the response channel */
sc_need_room(sc);
+more:
+ /* we'll automatically be called again on missing data */
if (appctx->st0 == HTTPCLIENT_S_RES_END)
goto end;