Index: trunk/debs/nginx/modules/nginx-udplog/ngx_http_udplog_module.c |
— | — | @@ -212,29 +212,27 @@ |
213 | 213 | ngx_http_variable_value_t *v, uintptr_t data) |
214 | 214 | { |
215 | 215 | u_char *ua; |
216 | | - u_char *eua; |
217 | 216 | uintptr_t escape; |
218 | | - size_t l; |
| 217 | + size_t l; |
219 | 218 | |
220 | 219 | ua = r->headers_in.user_agent->value.data; |
221 | | - l = ngx_strlen(ua); |
| 220 | + l = r->headers_in.user_agent->value.len; |
222 | 221 | escape = 2 * ngx_escape_uri(NULL, ua, l, NGX_ESCAPE_URI); |
223 | 222 | |
224 | | - eua = ngx_pnalloc(r->pool, l + escape); |
225 | | - if (eua == NULL) { |
| 223 | + v->data = ngx_pnalloc(r->pool, l + escape); |
| 224 | + if (v->data == NULL) { |
226 | 225 | return NGX_ERROR; |
227 | | - } |
| 226 | + } |
228 | 227 | |
229 | | - ngx_escape_uri(eua, ua, l, NGX_ESCAPE_URI); |
| 228 | + ngx_escape_uri(v->data, ua, l, NGX_ESCAPE_URI); |
230 | 229 | |
231 | | - v->data = eua; |
232 | | - v->len = ngx_strlen(eua); |
233 | | - |
| 230 | + v->len = l + escape; |
234 | 231 | v->valid = 1; |
235 | 232 | v->no_cacheable = 0; |
236 | 233 | v->not_found = 0; |
237 | 234 | |
238 | 235 | return NGX_OK; |
| 236 | + |
239 | 237 | } |
240 | 238 | |
241 | 239 | static ngx_int_t |