Mercurial > hg > nginx
comparison src/http/modules/ngx_http_dav_module.c @ 8786:d514f88053e5 quic
Merged with the default branch.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Fri, 28 May 2021 13:33:08 +0300 |
parents | 1bde031b59ff |
children | d26db4f82d7d |
comparison
equal
deleted
inserted
replaced
8785:e6c26cb4d38b | 8786:d514f88053e5 |
---|---|
1070 | 1070 |
1071 | 1071 |
1072 static ngx_int_t | 1072 static ngx_int_t |
1073 ngx_http_dav_location(ngx_http_request_t *r) | 1073 ngx_http_dav_location(ngx_http_request_t *r) |
1074 { | 1074 { |
1075 u_char *p; | |
1076 size_t len; | |
1077 uintptr_t escape; | |
1078 | |
1075 r->headers_out.location = ngx_list_push(&r->headers_out.headers); | 1079 r->headers_out.location = ngx_list_push(&r->headers_out.headers); |
1076 if (r->headers_out.location == NULL) { | 1080 if (r->headers_out.location == NULL) { |
1077 return NGX_ERROR; | 1081 return NGX_ERROR; |
1078 } | 1082 } |
1079 | 1083 |
1080 r->headers_out.location->hash = 1; | 1084 r->headers_out.location->hash = 1; |
1081 ngx_str_set(&r->headers_out.location->key, "Location"); | 1085 ngx_str_set(&r->headers_out.location->key, "Location"); |
1082 r->headers_out.location->value = r->uri; | 1086 |
1087 escape = 2 * ngx_escape_uri(NULL, r->uri.data, r->uri.len, NGX_ESCAPE_URI); | |
1088 | |
1089 if (escape) { | |
1090 len = r->uri.len + escape; | |
1091 | |
1092 p = ngx_pnalloc(r->pool, len); | |
1093 if (p == NULL) { | |
1094 ngx_http_clear_location(r); | |
1095 return NGX_ERROR; | |
1096 } | |
1097 | |
1098 r->headers_out.location->value.len = len; | |
1099 r->headers_out.location->value.data = p; | |
1100 | |
1101 ngx_escape_uri(p, r->uri.data, r->uri.len, NGX_ESCAPE_URI); | |
1102 | |
1103 } else { | |
1104 r->headers_out.location->value = r->uri; | |
1105 } | |
1083 | 1106 |
1084 return NGX_OK; | 1107 return NGX_OK; |
1085 } | 1108 } |
1086 | 1109 |
1087 | 1110 |