mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-04-01 22:48:25 +00:00
BUG/MEDIUM: httpclient: Xfer the request when the stream is created
Since the HTTP legacy mode was removed, it is unexpected to create an HTTP stream without a valid request. Thanks to this change, the wait_for_request analyzer was significatly simplified. And it is possible because HTTP multiplexers already take care to have a valid request to create a stream. But it means that any HTTP applet on the client side must do the same. The httpclient client is one of them. And it is not a problem because the request is generated before starting the applet. We must just take care to set the right state. For now it works "by chance", because the applet seems to be scheduled before the stream itself. But if this change, this will lead to crash because the stream expects to have a request when wait_for_request analyzer. This patch should be backported to 2.5.
This commit is contained in:
parent
600985df41
commit
6ced61dd0a
@ -441,7 +441,7 @@ struct appctx *httpclient_start(struct httpclient *hc)
|
||||
ha_alert("httpclient: out of memory in %s:%d.\n", __FUNCTION__, __LINE__);
|
||||
goto out_free_appctx;
|
||||
}
|
||||
if ((s = stream_new(sess, &appctx->obj_type, &BUF_NULL)) == NULL) {
|
||||
if ((s = stream_new(sess, &appctx->obj_type, &hc->req.buf)) == NULL) {
|
||||
ha_alert("httpclient: Failed to initialize stream %s:%d.\n", __FUNCTION__, __LINE__);
|
||||
goto out_free_appctx;
|
||||
}
|
||||
@ -478,7 +478,11 @@ struct appctx *httpclient_start(struct httpclient *hc)
|
||||
hc->appctx = appctx;
|
||||
hc->flags |= HTTPCLIENT_FS_STARTED;
|
||||
appctx->ctx.httpclient.ptr = hc;
|
||||
appctx->st0 = HTTPCLIENT_S_REQ;
|
||||
|
||||
/* The request was transferred when the stream was created. So switch
|
||||
* directly to REQ_BODY or RES_STLINE state
|
||||
*/
|
||||
appctx->st0 = (hc->ops.req_payload ? HTTPCLIENT_S_REQ_BODY : HTTPCLIENT_S_RES_STLINE);
|
||||
|
||||
return appctx;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user