Skip to content

Instantly share code, notes, and snippets.

@ilyaevseev
Last active December 4, 2016 20:06
Show Gist options
  • Save ilyaevseev/c268bbb36d3523b85fd5eadef4a76cd0 to your computer and use it in GitHub Desktop.
Save ilyaevseev/c268bbb36d3523b85fd5eadef4a76cd0 to your computer and use it in GitHub Desktop.
ngx_http_slice_filter_module: print mismatching ETags to error_log
--- nginx-1.11.5/src/http/modules/ngx_http_slice_filter_module.c.orig 2016-10-11 18:03:02.000000000 +0300
+++ nginx-1.11.5/src/http/modules/ngx_http_slice_filter_module.c 2016-12-02 04:22:14.000000000 +0300
@@ -131,8 +131,12 @@
|| ngx_strncmp(h->value.data, ctx->etag.data, ctx->etag.len)
!= 0)
{
- ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
- "etag mismatch in slice response");
+ char msg[1024];
+ snprintf(msg, sizeof(msg), "etag mismatch in slice response: ctx_len=%u, ctx_etag=%s, r_len=%u, r_etag=%s",
+ (unsigned)ctx->etag.len, (const char*)ctx->etag.data, h ? (unsigned)h->value.len : 0, h ? (const char*)h->value.data : "(null)" );
+ msg[sizeof(msg)-1] = 0;
+ ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, msg);
+
return NGX_ERROR;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment