mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-04-11 03:31:36 +00:00
MINOR: flags/htx: use flag dumping to show htx and start-line flags
The function are respectively htx_show_flags() and hsl_show_flags().
This commit is contained in:
parent
cdefa80e6c
commit
5349779e40
@ -5,6 +5,7 @@
|
||||
#include <haproxy/connection-t.h>
|
||||
#include <haproxy/stconn-t.h>
|
||||
#include <haproxy/http_ana-t.h>
|
||||
#include <haproxy/htx-t.h>
|
||||
#include <haproxy/stream-t.h>
|
||||
#include <haproxy/task-t.h>
|
||||
|
||||
@ -18,10 +19,12 @@
|
||||
#define SHOW_AS_TASK 0x00000040
|
||||
#define SHOW_AS_TXN 0x00000080
|
||||
#define SHOW_AS_SD 0x00000100
|
||||
#define SHOW_AS_HSL 0x00000200
|
||||
#define SHOW_AS_HTX 0x00000400
|
||||
|
||||
// command line names, must be in exact same order as the SHOW_AS_* flags above
|
||||
// so that show_as_words[i] matches flag 1U<<i.
|
||||
const char *show_as_words[] = { "ana", "chn", "conn", "sc", "stet", "strm", "task", "txn", "sd", };
|
||||
const char *show_as_words[] = { "ana", "chn", "conn", "sc", "stet", "strm", "task", "txn", "sd", "hsl", "htx", };
|
||||
|
||||
/* will be sufficient for even largest flag names */
|
||||
static char buf[4096];
|
||||
@ -124,6 +127,8 @@ int main(int argc, char **argv)
|
||||
if (show_as & SHOW_AS_STRM) printf("strm->flags = %s\n", (strm_show_flags (buf, bsz, " | ", flags), buf));
|
||||
if (show_as & SHOW_AS_TASK) printf("task->state = %s\n", (task_show_state (buf, bsz, " | ", flags), buf));
|
||||
if (show_as & SHOW_AS_TXN) printf("txn->flags = %s\n", (txn_show_flags (buf, bsz, " | ", flags), buf));
|
||||
if (show_as & SHOW_AS_HSL) printf("sl->flags = %s\n", (hsl_show_flags (buf, bsz, " | ", flags), buf));
|
||||
if (show_as & SHOW_AS_HTX) printf("htx->flags = %s\n", (htx_show_flags (buf, bsz, " | ", flags), buf));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
#include <haproxy/api.h>
|
||||
#include <haproxy/http-t.h>
|
||||
#include <haproxy/show_flags-t.h>
|
||||
|
||||
/*
|
||||
* The internal representation of an HTTP message, called HTX, is a structure
|
||||
@ -122,7 +123,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/* HTX start-line flags */
|
||||
/* HTX start-line flags.
|
||||
* Please also update the se_show_flags() function below in case of changes.
|
||||
*/
|
||||
#define HTX_SL_F_NONE 0x00000000
|
||||
#define HTX_SL_F_IS_RESP 0x00000001 /* It is the response start-line (unset means the request one) */
|
||||
#define HTX_SL_F_XFER_LEN 0x00000002 /* The message xfer size can be dertermined */
|
||||
@ -138,7 +141,31 @@
|
||||
#define HTX_SL_F_NORMALIZED_URI 0x00000800 /* The received URI is normalized (an implicit absolute-uri form) */
|
||||
#define HTX_SL_F_CONN_UPG 0x00001000 /* The message contains "connection: upgrade" header */
|
||||
|
||||
/* HTX flags */
|
||||
/* This function is used to report flags in debugging tools. Please reflect
|
||||
* below any single-bit flag addition above in the same order via the
|
||||
* __APPEND_FLAG macro. The new end of the buffer is returned.
|
||||
*/
|
||||
static forceinline char *hsl_show_flags(char *buf, size_t len, const char *delim, uint flg)
|
||||
{
|
||||
#define _(f, ...) __APPEND_FLAG(buf, len, delim, flg, f, #f, __VA_ARGS__)
|
||||
/* prologue */
|
||||
_(0);
|
||||
/* flags */
|
||||
|
||||
_(HTX_SL_F_IS_RESP, _(HTX_SL_F_XFER_LEN, _(HTX_SL_F_XFER_ENC,
|
||||
_(HTX_SL_F_CLEN, _(HTX_SL_F_CHNK, _(HTX_SL_F_VER_11,
|
||||
_(HTX_SL_F_BODYLESS, _(HTX_SL_F_HAS_SCHM, _(HTX_SL_F_SCHM_HTTP,
|
||||
_(HTX_SL_F_SCHM_HTTPS, _(HTX_SL_F_HAS_AUTHORITY,
|
||||
_(HTX_SL_F_NORMALIZED_URI, _(HTX_SL_F_CONN_UPG)))))))))))));
|
||||
/* epilogue */
|
||||
_(~0U);
|
||||
return buf;
|
||||
#undef _
|
||||
}
|
||||
|
||||
/* HTX flags.
|
||||
* Please also update the htx_show_flags() function below in case of changes.
|
||||
*/
|
||||
#define HTX_FL_NONE 0x00000000
|
||||
#define HTX_FL_PARSING_ERROR 0x00000001 /* Set when a parsing error occurred */
|
||||
#define HTX_FL_PROCESSING_ERROR 0x00000002 /* Set when a processing error occurred */
|
||||
@ -147,6 +174,24 @@
|
||||
#define HTX_FL_EOM 0x00000010 /* Set when end-of-message is reached from the HTTP point of view
|
||||
* (at worst, on the EOM block is missing)
|
||||
*/
|
||||
/* This function is used to report flags in debugging tools. Please reflect
|
||||
* below any single-bit flag addition above in the same order via the
|
||||
* __APPEND_FLAG macro. The new end of the buffer is returned.
|
||||
*/
|
||||
static forceinline char *htx_show_flags(char *buf, size_t len, const char *delim, uint flg)
|
||||
{
|
||||
#define _(f, ...) __APPEND_FLAG(buf, len, delim, flg, f, #f, __VA_ARGS__)
|
||||
/* prologue */
|
||||
_(0);
|
||||
/* flags */
|
||||
_(HTX_FL_PARSING_ERROR, _(HTX_FL_PROCESSING_ERROR,
|
||||
_(HTX_FL_FRAGMENTED, _(HTX_FL_PROXY_RESP, _(HTX_FL_EOM)))));
|
||||
/* epilogue */
|
||||
_(~0U);
|
||||
return buf;
|
||||
#undef _
|
||||
}
|
||||
|
||||
|
||||
/* HTX block's type (max 15). */
|
||||
enum htx_blk_type {
|
||||
|
Loading…
Reference in New Issue
Block a user