struct sockaddr_storage dst; /* destination address */
struct appctx *appctx; /* HTTPclient appctx */
void *caller; /* ptr of the caller */
+ unsigned int flags; /* other flags */
};
+#define HTTPCLIENT_F_ENDED 0x00000001
+
/* States of the HTTP Client Appctx */
enum {
HTTPCLIENT_S_REQ = 0,
return b_data(&hc->res.buf);
}
+/* Return 1 if the httpclient ended and won't receive any new data */
+static inline int httpclient_ended(struct httpclient *hc)
+{
+ return !!(hc->flags & HTTPCLIENT_F_ENDED);
+}
+
#endif /* ! _HAPROXY_HTTCLIENT_H */
/* if there is no HTX data anymore and the EOM flag is
* set, leave (no body) */
- if (htx_is_empty(htx) && htx->flags & HTX_FL_EOM)
+ if (htx_is_empty(htx) && htx->flags & HTX_FL_EOM) {
appctx->st0 = HTTPCLIENT_S_RES_END;
- else
+ hc->flags |= HTTPCLIENT_F_ENDED;
+ } else {
appctx->st0 = HTTPCLIENT_S_RES_BODY;
+ }
}
break;
{
struct httpclient *hc = appctx->ctx.httpclient.ptr;
+ /* mark the httpclient as ended */
+ hc->flags |= HTTPCLIENT_F_ENDED;
/* the applet is leaving, remove the ptr so we don't try to call it
* again from the caller */
hc->appctx = NULL;