comparison src/http/modules/ngx_http_geoip_module.c @ 594:3436cf38d59e NGINX_0_8_49

nginx 0.8.49 *) Feature: the "image_filter_jpeg_quality" directive supports variables. *) Bugfix: a segmentation fault might occur in a worker process, if the $geoip_region_name variables was used; the bug had appeared in 0.8.48. *) Bugfix: errors intercepted by error_page were cached only for next request; the bug had appeared in 0.8.48.
author Igor Sysoev <http://sysoev.ru>
date Mon, 09 Aug 2010 00:00:00 +0400
parents 09d5f308901f
children
comparison
equal deleted inserted replaced
593:ad310549c5d4 594:3436cf38d59e
229 goto no_value; 229 goto no_value;
230 } 230 }
231 231
232 len = ngx_strlen(val); 232 len = ngx_strlen(val);
233 v->data = ngx_pnalloc(r->pool, len); 233 v->data = ngx_pnalloc(r->pool, len);
234
235 if (v->data == NULL) { 234 if (v->data == NULL) {
236 GeoIPRecord_delete(gr); 235 GeoIPRecord_delete(gr);
237 return NGX_ERROR; 236 return NGX_ERROR;
238 } 237 }
239 238
273 goto not_found; 272 goto not_found;
274 } 273 }
275 274
276 val = GeoIP_region_name_by_code(gr->country_code, gr->region); 275 val = GeoIP_region_name_by_code(gr->country_code, gr->region);
277 276
277 GeoIPRecord_delete(gr);
278
279 if (val == NULL) {
280 goto not_found;
281 }
282
278 len = ngx_strlen(val); 283 len = ngx_strlen(val);
279 v->data = ngx_pnalloc(r->pool, len); 284 v->data = ngx_pnalloc(r->pool, len);
280
281 if (v->data == NULL) { 285 if (v->data == NULL) {
282 GeoIPRecord_delete(gr);
283 return NGX_ERROR; 286 return NGX_ERROR;
284 } 287 }
285 288
286 ngx_memcpy(v->data, val, len); 289 ngx_memcpy(v->data, val, len);
287 290
288 v->len = len; 291 v->len = len;
289 v->valid = 1; 292 v->valid = 1;
290 v->no_cacheable = 0; 293 v->no_cacheable = 0;
291 v->not_found = 0; 294 v->not_found = 0;
292
293 GeoIPRecord_delete(gr);
294 295
295 return NGX_OK; 296 return NGX_OK;
296 297
297 not_found: 298 not_found:
298 299