#define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include DECLARE_TYPED_POOL(pool_head_hstream, "hstream", struct hstream); /* haterm stream state flags */ #define HS_ST_IN_ALLOC 0x0001 #define HS_ST_OUT_ALLOC 0x0002 #define HS_ST_CONN_ERROR 0x0004 #define HS_ST_HTTP_GOT_HDRS 0x0008 #define HS_ST_HTTP_HELP 0x0010 #define HS_ST_HTTP_EXPECT 0x0020 #define HS_ST_HTTP_RESP_SL_SENT 0x0040 #define HS_ST_OPT_CHUNK_RES 0x0080 /* chunk-encoded response (?k=1) */ #define HS_ST_OPT_REQ_AFTER_RES 0x0100 /* drain the request payload after the response (?A=1) */ #define HS_ST_OPT_RANDOM_RES 0x0200 /* random response (?R=1) */ #define HS_ST_OPT_NO_CACHE 0x0400 /* non-cacheable response (?c=0) */ #define HS_ST_OPT_NO_SPLICING 0x0800 /* no splicing (?S=1) */ const char *HTTP_HELP = "HAProxy's dummy HTTP server for benchmarks - version " HAPROXY_VERSION ".\n" "All integer argument values are in the form [digits]*[kmgr] (r=random(0..1)).\n" "The following arguments are supported to override the default objects :\n" " - /?s= return bytes.\n" " E.g. /?s=20k\n" " - /?r= present as the HTTP return code.\n" " E.g. /?r=404\n" " - /?c= set the return as not cacheable if <1.\n" " E.g. /?c=0\n" " - /?A= drain the request body after sending the response.\n" " E.g. /?A=1\n" " - /?C= force the response to use close if >0.\n" " E.g. /?C=1\n" " - /?K= force the response to use keep-alive if >0.\n" " E.g. /?K=1\n" " - /?t=