comparison src/http/ngx_http_variables.c @ 9263:388a801e9bb9

Request body: discarded body now treated as no body. Notably, proxying of such requests now uses no Content-Length instead of "Content-Length: 0", and the $content_length variable is empty (instead of "0"). This might be beneficial from correctness point of view, since requests with discarded body, such as during processing of error pages, do not pretend there is a zero-length body, but instead do not contain body at all. For example, this might be important for PUT requests, where a zero-length body could be incorrectly interpreted as a real request body. This also slightly simplifies the code.
author Maxim Dounin <mdounin@mdounin.ru>
date Sat, 27 Apr 2024 18:23:52 +0300
parents 106b3832e7ef
children 2fce021888f9
comparison
equal deleted inserted replaced
9262:106b3832e7ef 9263:388a801e9bb9
1194 } else if (r->reading_body) { 1194 } else if (r->reading_body) {
1195 v->not_found = 1; 1195 v->not_found = 1;
1196 v->no_cacheable = 1; 1196 v->no_cacheable = 1;
1197 1197
1198 } else if (r->discard_body) { 1198 } else if (r->discard_body) {
1199 v->len = 1; 1199 v->not_found = 1;
1200 v->data = (u_char *) "0";
1201 v->valid = 1;
1202 v->no_cacheable = 0;
1203 v->not_found = 0;
1204 1200
1205 } else if (r->headers_in.content_length_n >= 0) { 1201 } else if (r->headers_in.content_length_n >= 0) {
1206 p = ngx_pnalloc(r->pool, NGX_OFF_T_LEN); 1202 p = ngx_pnalloc(r->pool, NGX_OFF_T_LEN);
1207 if (p == NULL) { 1203 if (p == NULL) {
1208 return NGX_ERROR; 1204 return NGX_ERROR;