http_client_debug: detect GZIP payload
@@ -38,11 +38,25 @@ static void debug_cb_request_headers(char *name, void *p1, void *p2)
static void debug_cb_request_payload(char *name, void *p1, void *p2)
{
+ unsigned char *ptr;
struct flb_http_client *c = p1;
+ if (c->body_len > 3) {
+ ptr = c->body_buf;
+ if (ptr[0] == 0x1F && ptr[1] == 0x8B && ptr[2] == 0x08) {
+ flb_idebug("[http] request payload (%lu bytes)\n[GZIP binary content...]",
+ c->body_len);
+ }
+ else {
flb_idebug("[http] request payload (%lu bytes)\n%s",
c->body_len, c->body_buf);
}
+ }
+ else {
+ flb_idebug("[http] request payload (%lu bytes)\n%s",
+ c->body_len, c->body_buf);
+ }
+}
static void debug_cb_response_headers(char *name, void *p1, void *p2)
{
@@ -179,6 +193,5 @@ int flb_http_client_debug_setup(struct flb_callback *cb_ctx,
}
}
}
-
return 0;
}
