http server: added dump request trace
This commit is contained in:
parent
be8279c60a
commit
16363a4ae3
1 changed files with 35 additions and 1 deletions
36
src/http.c
36
src/http.c
|
@ -603,6 +603,39 @@ http_process_request(http_connection_t *hc, htsbuf_queue_t *spill)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
#if ENABLE_TRACE
|
||||
static void
|
||||
dump_request(http_connection_t *hc)
|
||||
{
|
||||
char buf[2048] = "";
|
||||
http_arg_t *ra;
|
||||
int first;
|
||||
|
||||
first = 1;
|
||||
TAILQ_FOREACH(ra, &hc->hc_req_args, link) {
|
||||
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), first ? "?%s=%s" : "&%s=%s", ra->key, ra->val);
|
||||
first = 0;
|
||||
}
|
||||
|
||||
first = 1;
|
||||
TAILQ_FOREACH(ra, &hc->hc_args, link) {
|
||||
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), first ? "{{%s=%s" : ",%s=%s", ra->key, ra->val);
|
||||
first = 0;
|
||||
}
|
||||
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "}}");
|
||||
|
||||
tvhtrace("http", "%s%s", hc->hc_url, buf);
|
||||
}
|
||||
#else
|
||||
static inline void
|
||||
dump_request(http_connection_t *hc)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Process a request, extract info from headers, dispatch command and
|
||||
* clean up
|
||||
|
@ -613,6 +646,8 @@ process_request(http_connection_t *hc, htsbuf_queue_t *spill)
|
|||
char *v, *argv[2];
|
||||
int n, rval = -1;
|
||||
uint8_t authbuf[150];
|
||||
|
||||
dump_request(hc);
|
||||
|
||||
hc->hc_url_orig = tvh_strdupa(hc->hc_url);
|
||||
|
||||
|
@ -717,7 +752,6 @@ http_arg_set(struct http_arg_list *list, const char *key, const char *val)
|
|||
ra->val = strdup(val);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Split a string in components delimited by 'delimiter'
|
||||
*/
|
||||
|
|
Loading…
Add table
Reference in a new issue