comparison src/http/ngx_http_core_module.c @ 5825:51fe42cc7876

Fixed ETag memory allocation error handling. The etag->hash must be set to 0 to avoid an empty ETag header being returned with the 500 Internal Server Error page after the memory allocation failure. Reported by Markus Linnala.
author Maxim Dounin <mdounin@mdounin.ru>
date Mon, 08 Sep 2014 21:36:03 +0400
parents c5ec6944de98
children c76d851c5e7a
comparison
equal deleted inserted replaced
5824:e7f6991eca47 5825:51fe42cc7876
1835 etag->hash = 1; 1835 etag->hash = 1;
1836 ngx_str_set(&etag->key, "ETag"); 1836 ngx_str_set(&etag->key, "ETag");
1837 1837
1838 etag->value.data = ngx_pnalloc(r->pool, NGX_OFF_T_LEN + NGX_TIME_T_LEN + 3); 1838 etag->value.data = ngx_pnalloc(r->pool, NGX_OFF_T_LEN + NGX_TIME_T_LEN + 3);
1839 if (etag->value.data == NULL) { 1839 if (etag->value.data == NULL) {
1840 etag->hash = 0;
1840 return NGX_ERROR; 1841 return NGX_ERROR;
1841 } 1842 }
1842 1843
1843 etag->value.len = ngx_sprintf(etag->value.data, "\"%xT-%xO\"", 1844 etag->value.len = ngx_sprintf(etag->value.data, "\"%xT-%xO\"",
1844 r->headers_out.last_modified_time, 1845 r->headers_out.last_modified_time,