Skip to content

Commit 8242f74

Browse files
authored
Merge pull request #12 from nginx-modules/dev/fix-broken-reponse-body
fix broken tail character of response body
2 parents 0360117 + e7ec4f7 commit 8242f74

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

ngx_cache_purge_module.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ static size_t ngx_http_cache_purge_content_type_xml_size = sizeof(ngx_http_cache
5353
static size_t ngx_http_cache_purge_content_type_text_size = sizeof(ngx_http_cache_purge_content_type_text);
5454

5555
static const char ngx_http_cache_purge_body_templ_json[] = "{\"Key\": \"%s\"}";
56-
static const char ngx_http_cache_purge_body_templ_html[] = "<html><head><title>Successful purge</title></head><body bgcolor=\"white\"><center><h1>Successful purge</h1><br>Key : %s</center></body></html>";
56+
static const char ngx_http_cache_purge_body_templ_html[] = "<html><head><title>Successful purge</title></head><body bgcolor=\"white\"><center><h1>Successful purge</h1><p>Key : %s</p></center></body></html>";
5757
static const char ngx_http_cache_purge_body_templ_xml[] = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><status><Key><![CDATA[%s]]></Key></status>";
5858
static const char ngx_http_cache_purge_body_templ_text[] = "Key:%s\n";
5959

@@ -1527,7 +1527,7 @@ ngx_http_cache_purge_send_response(ngx_http_request_t *r) {
15271527
break;
15281528
}
15291529

1530-
body_len = resp_body_size - 4 - 1;
1530+
body_len = resp_body_size - 2 - 1;
15311531
r->headers_out.content_type.len = resp_ct_size - 1;
15321532
r->headers_out.content_type.data = (u_char *) resp_ct;
15331533

@@ -1538,7 +1538,6 @@ ngx_http_cache_purge_send_response(ngx_http_request_t *r) {
15381538
return NGX_HTTP_INTERNAL_SERVER_ERROR;
15391539
}
15401540

1541-
15421541
//p = ngx_snprintf(buf, resp_tmpl_len, resp_body , buf_keydata, r->cache->file.name.data);
15431542
p = ngx_snprintf(buf, resp_tmpl_len, resp_body , buf_keydata, buf_keydata);
15441543
if (p == NULL) {

0 commit comments

Comments
 (0)