MINOR: httpclient: Make the CLI flags public for future use
Those flags used by the http_client in its CLI function might come to
use for OCSP updates that will strongly rely on the http client.
diff --git a/include/haproxy/http_client-t.h b/include/haproxy/http_client-t.h
index 3d05c04..7ae0e61 100644
--- a/include/haproxy/http_client-t.h
+++ b/include/haproxy/http_client-t.h
@@ -59,4 +59,11 @@
#define HTTPCLIENT_USERAGENT "HAProxy"
+/* What kind of data we need to read */
+#define HC_F_RES_STLINE 0x01
+#define HC_F_RES_HDR 0x02
+#define HC_F_RES_BODY 0x04
+#define HC_F_RES_END 0x08
+
+
#endif /* ! _HAPROXY_HTTCLIENT__T_H */
diff --git a/src/http_client.c b/src/http_client.c
index c3e5add..b336640 100644
--- a/src/http_client.c
+++ b/src/http_client.c
@@ -59,12 +59,6 @@
* The functions will be starting by "hc_cli" for "httpclient cli"
*/
-/* What kind of data we need to read */
-#define HC_CLI_F_RES_STLINE 0x01
-#define HC_CLI_F_RES_HDR 0x02
-#define HC_CLI_F_RES_BODY 0x04
-#define HC_CLI_F_RES_END 0x08
-
/* the CLI context for the httpclient command */
struct hcli_svc_ctx {
struct httpclient *hc; /* the httpclient instance */
@@ -83,7 +77,7 @@
return;
ctx = appctx->svcctx;
- ctx->flags |= HC_CLI_F_RES_STLINE;
+ ctx->flags |= HC_F_RES_STLINE;
appctx_wakeup(appctx);
}
@@ -96,7 +90,7 @@
return;
ctx = appctx->svcctx;
- ctx->flags |= HC_CLI_F_RES_HDR;
+ ctx->flags |= HC_F_RES_HDR;
appctx_wakeup(appctx);
}
@@ -109,7 +103,7 @@
return;
ctx = appctx->svcctx;
- ctx->flags |= HC_CLI_F_RES_BODY;
+ ctx->flags |= HC_F_RES_BODY;
appctx_wakeup(appctx);
}
@@ -122,7 +116,7 @@
return;
ctx = appctx->svcctx;
- ctx->flags |= HC_CLI_F_RES_END;
+ ctx->flags |= HC_F_RES_END;
appctx_wakeup(appctx);
}
@@ -197,15 +191,15 @@
struct httpclient *hc = ctx->hc;
struct http_hdr *hdrs, *hdr;
- if (ctx->flags & HC_CLI_F_RES_STLINE) {
+ if (ctx->flags & HC_F_RES_STLINE) {
chunk_printf(&trash, "%.*s %d %.*s\n", (unsigned int)istlen(hc->res.vsn), istptr(hc->res.vsn),
hc->res.status, (unsigned int)istlen(hc->res.reason), istptr(hc->res.reason));
if (applet_putchk(appctx, &trash) == -1)
goto more;
- ctx->flags &= ~HC_CLI_F_RES_STLINE;
+ ctx->flags &= ~HC_F_RES_STLINE;
}
- if (ctx->flags & HC_CLI_F_RES_HDR) {
+ if (ctx->flags & HC_F_RES_HDR) {
chunk_reset(&trash);
hdrs = hc->res.hdrs;
for (hdr = hdrs; isttest(hdr->v); hdr++) {
@@ -216,10 +210,10 @@
goto too_many_hdrs;
if (applet_putchk(appctx, &trash) == -1)
goto more;
- ctx->flags &= ~HC_CLI_F_RES_HDR;
+ ctx->flags &= ~HC_F_RES_HDR;
}
- if (ctx->flags & HC_CLI_F_RES_BODY) {
+ if (ctx->flags & HC_F_RES_BODY) {
int ret;
ret = httpclient_res_xfer(hc, sc_ib(sc));
@@ -228,12 +222,12 @@
/* remove the flag if the buffer was emptied */
if (httpclient_data(hc))
goto more;
- ctx->flags &= ~HC_CLI_F_RES_BODY;
+ ctx->flags &= ~HC_F_RES_BODY;
}
/* we must close only if F_END is the last flag */
- if (ctx->flags == HC_CLI_F_RES_END) {
- ctx->flags &= ~HC_CLI_F_RES_END;
+ if (ctx->flags == HC_F_RES_END) {
+ ctx->flags &= ~HC_F_RES_END;
goto end;
}