#include <haproxy/server-t.h>
#include <haproxy/task-t.h>
-#define HLD_HAS_HTTP_VER_0 (1U << HLD_HTTP_VER_0)
-#define HLD_HAS_HTTP_VER_1 (1U << HLD_HTTP_VER_1)
-#define HLD_HAS_HTTP_VER_2 (1U << HLD_HTTP_VER_2)
-#define HLD_HAS_HTTP_VER_3 (1U << HLD_HTTP_VER_3)
+#define HLD_HAS_PROTO_H0 (1U << HLD_PROTO_H0)
+#define HLD_HAS_PROTO_H1 (1U << HLD_PROTO_H1)
+#define HLD_HAS_PROTO_H2 (1U << HLD_PROTO_H2)
+#define HLD_HAS_PROTO_H3 (1U << HLD_PROTO_H3)
-enum hld_http_ver {
- HLD_HTTP_VER_0,
- HLD_HTTP_VER_1,
- HLD_HTTP_VER_2,
- HLD_HTTP_VER_3,
+enum hld_proto {
+ HLD_PROTO_H0,
+ HLD_PROTO_H1,
+ HLD_PROTO_H2,
+ HLD_PROTO_H3,
/* Do not add more enum below */
- HLD_HTTP_VER_MAX,
+ HLD_PROTO_MAX,
};
int is_quic;
int h2c;
int thnk_time;
- enum hld_http_ver http_ver;
+ enum hld_proto proto;
char *addr;
char *raw_addr; // used only to set the host header value
char *srv_opts;
extern int arg_thrd;
extern int arg_wait;
-extern unsigned int hld_ver_flags;
+extern unsigned int hld_proto_flags;
#endif /* _HAPROXY_HALOAD_H */
uint64_t *ttfb_pct; // counts per ttfb value for percentile
uint64_t *ttlb_pct; // counts per ttlb value for percentile
uint64_t tot_sc[5]; // total status codes on this thread: 1xx,2xx,3xx,4xx,5xx
- uint64_t vtot_sc[HLD_HTTP_VER_MAX][5]; // by version total status codes
+ uint64_t vtot_sc[HLD_PROTO_MAX][5]; // by protocol total status codes
// on this thread: 1xx,2xx,3xx,4xx,5xx
struct task *rate_task; // task used when <arg_rate> is set
__attribute__((aligned(64))) union { } __pad;
int usr_tid;
int usr_cnt; // user counter incremented by <mtask> main task
int running_tasks; // tasks counter for the users and for the conn rate
-unsigned int hld_ver_flags; // flags to identify the HTTP versions used
+unsigned int hld_proto_flags; // flags to identify the protocols used
char *hld_args[MAX_LINE_ARGS + 1];
if (arg_hscd == 2) {
int v, i;
- for (v = HLD_HTTP_VER_0; v < HLD_HTTP_VER_MAX; v++)
+ for (v = HLD_PROTO_H0; v < HLD_PROTO_MAX; v++)
for (i = 0; i < 5; i++)
HA_ATOMIC_STORE(&thrs_info[th].vtot_sc[v][i], 0);
}
{
int th;
uint64_t cur_conn, tot_conn, tot_req, tot_err, tot_rcvd, bytes;
- uint64_t tot_ttfb, tot_ttlb, tot_fbs, tot_lbs, tot_sc[5], vtot_sc[HLD_HTTP_VER_MAX][5];
+ uint64_t tot_ttfb, tot_ttlb, tot_fbs, tot_lbs, tot_sc[5], vtot_sc[HLD_PROTO_MAX][5];
static uint64_t prev_totc, prev_totr, prev_totb;
static uint64_t prev_ttfb, prev_ttlb, prev_fbs, prev_lbs, prev_sc[5],
- prev_vsc[HLD_HTTP_VER_MAX][5];
+ prev_vsc[HLD_PROTO_MAX][5];
static struct timeval prev_date = TV_UNSET;
double interval;
if (arg_hscd == 2) {
int v;
- for (v = HLD_HTTP_VER_0; v < HLD_HTTP_VER_MAX; v++)
+ for (v = HLD_PROTO_H0; v < HLD_PROTO_MAX; v++)
prev_vsc[v][0] = prev_vsc[v][1] = prev_vsc[v][2] = prev_vsc[v][3] = prev_vsc[v][4] = 0;
}
prev_date = TV_UNSET;
if (arg_hscd == 2) {
int v;
- for (v = HLD_HTTP_VER_0; v < HLD_HTTP_VER_MAX; v++)
+ for (v = HLD_PROTO_H0; v < HLD_PROTO_MAX; v++)
vtot_sc[v][0] = vtot_sc[v][1] = vtot_sc[v][2] = vtot_sc[v][3] = vtot_sc[v][4] = 0;
}
if (arg_hscd == 2) {
int v;
- for (v = HLD_HTTP_VER_0; v < HLD_HTTP_VER_MAX; v++) {
- if (!(hld_ver_flags & (1U << v)))
+ for (v = HLD_PROTO_H0; v < HLD_PROTO_MAX; v++) {
+ if (!(hld_proto_flags & (1U << v)))
continue;
vtot_sc[v][0]+= HA_ATOMIC_LOAD(&thrs_info[th].vtot_sc[v][0]);
if (arg_hscd == 2) {
int v;
- for (v = HLD_HTTP_VER_0; v < HLD_HTTP_VER_MAX; v++) {
- if (!(hld_ver_flags & (1U << v)))
+ for (v = HLD_PROTO_H0; v < HLD_PROTO_MAX; v++) {
+ if (!(hld_proto_flags & (1U << v)))
continue;
printf(" %3llu %3llu %3llu %3llu %3llu",
if (arg_hscd == 2) {
int v;
- for (v = HLD_HTTP_VER_0; v < HLD_HTTP_VER_MAX; v++) {
+ for (v = HLD_PROTO_H0; v < HLD_PROTO_MAX; v++) {
prev_vsc[v][0] = vtot_sc[v][0];
prev_vsc[v][1] = vtot_sc[v][1];
prev_vsc[v][2] = vtot_sc[v][2];
int i;
for (i = 0 ; i < 4; i++) {
- if (!(hld_ver_flags & (1 << i)))
+ if (!(hld_proto_flags & (1 << i)))
continue;
printf(" (h%d)1xx 2xx 3xx 4xx 5xx", i);
}
if (arg_hscd)
thrs_info[tid].tot_sc[status * 41 / 4096 - 1]++;
if (arg_hscd == 2) {
- thrs_info[tid].vtot_sc[hs->url->cfg->http_ver][status * 41 / 4096 - 1]++;
+ thrs_info[tid].vtot_sc[hs->url->cfg->proto][status * 41 / 4096 - 1]++;
}
if (hs->url->tot_req > 1 || !arg_accu) {
ttfb = tv_us(tv_diff(&hs->req_date, &date));
*/
static struct hld_url_cfg *hld_alloc_url(char *url, int is_quic,
char *alpn_param, int h2c_param,
- enum hld_http_ver http_ver)
+ enum hld_proto proto)
{
int ssl = 0;
char *addr = NULL, *raw_addr = NULL, *path = NULL;
hld_url_cfg->is_quic = is_quic;
hld_url_cfg->h2c = h2c_param;
hld_url_cfg->thnk_time = arg_thnk;
- hld_url_cfg->http_ver = http_ver;
+ hld_url_cfg->proto = proto;
hld_url_cfg->addr = addr;
hld_url_cfg->raw_addr = raw_addr;
if (alpn_param) {
struct hbuf gbuf = HBUF_NULL; // "global" section
struct hbuf tbuf = HBUF_NULL; // "traces" section
struct hbuf dbuf = HBUF_NULL; // "default" section
- int http_ver = HLD_HTTP_VER_1;
+ int proto = HLD_PROTO_H1;
if (argc <= 1)
hld_usage(progname, argc);
strcmp(opt, "h0") == 0) {
alpn = "hq-interop";
h2c = 0;
- http_ver = HLD_HTTP_VER_0;
+ proto = HLD_PROTO_H0;
}
else if (strcmp(opt, "1") == 0 ||
strcmp(opt, "h1") == 0) {
alpn = "http/1.1";
h2c = 0;
- http_ver = HLD_HTTP_VER_1;
+ proto = HLD_PROTO_H1;
}
else if (strcmp(opt, "2") == 0 ||
strcmp(opt, "h2") == 0) {
alpn = "h2";
h2c = 0;
- http_ver = HLD_HTTP_VER_2;
+ proto = HLD_PROTO_H2;
}
else if (strcmp(opt, "2c") == 0 ||
strcmp(opt, "h2c") == 0) {
alpn = NULL;
h2c = 1;
- http_ver = HLD_HTTP_VER_2;
+ proto = HLD_PROTO_H2;
}
else if (strcmp(opt, "3") == 0 ||
strcmp(opt, "h3") == 0) {
#if defined(USE_QUIC)
alpn = "h3";
h2c = 0;
- http_ver = HLD_HTTP_VER_3;
+ proto = HLD_PROTO_H3;
#else
ha_warning("QUIC support not compiled in. Rebuild with USE_QUIC=1.\n");
goto leave;
is_quic = strncmp(*argv, "quic://", 7) == 0;
if (is_quic)
- http_ver = HLD_HTTP_VER_3;
- hld_ver_flags |= (1 << http_ver);
+ proto = HLD_PROTO_H3;
+ hld_proto_flags |= (1 << proto);
url = hld_alloc_url(*argv, is_quic,
is_quic ? "h3" : alpn,
- is_quic ? 0 : h2c, http_ver);
+ is_quic ? 0 : h2c, proto);
if (!url) {
ha_alert("could not parse a new URL\n");
goto leave;
}
/* default version flag value */
- http_ver = HLD_HTTP_VER_3;
+ proto = HLD_PROTO_H3;
}
argv++; argc--;