comparison src/http/modules/ngx_http_userid_filter_module.c @ 463:a8424ffa495c NGINX_0_7_39

nginx 0.7.39 *) Bugfix: large response with SSI might hang, if gzipping was enabled; the bug had appeared in 0.7.28. Thanks to Artem Bokhan. *) Bugfix: a segmentation fault might occur in worker process, if short static variants are used in a "try_files" directive.
author Igor Sysoev <http://sysoev.ru>
date Mon, 02 Mar 2009 00:00:00 +0300
parents 984bb0b1399b
children 98143f74eb3d
comparison
equal deleted inserted replaced
462:9ef0e36f3cd5 463:a8424ffa495c
358 358
359 static ngx_int_t 359 static ngx_int_t
360 ngx_http_userid_set_uid(ngx_http_request_t *r, ngx_http_userid_ctx_t *ctx, 360 ngx_http_userid_set_uid(ngx_http_request_t *r, ngx_http_userid_ctx_t *ctx,
361 ngx_http_userid_conf_t *conf) 361 ngx_http_userid_conf_t *conf)
362 { 362 {
363 u_char *cookie, *p; 363 u_char *cookie, *p;
364 size_t len; 364 size_t len;
365 ngx_str_t src, dst; 365 ngx_str_t src, dst;
366 ngx_table_elt_t *set_cookie, *p3p; 366 ngx_table_elt_t *set_cookie, *p3p;
367 ngx_connection_t *c;
368 struct sockaddr_in *sin;
369 #if (NGX_HAVE_INET6)
370 struct sockaddr_in6 *sin6;
371 #endif
372
367 /* 373 /*
368 * TODO: in the threaded mode the sequencers should be in TLS and their 374 * TODO: in the threaded mode the sequencers should be in TLS and their
369 * ranges should be divided between threads 375 * ranges should be divided between threads
370 */ 376 */
371 377
386 if (conf->service == NGX_CONF_UNSET) { 392 if (conf->service == NGX_CONF_UNSET) {
387 if (ngx_http_server_addr(r, NULL) != NGX_OK) { 393 if (ngx_http_server_addr(r, NULL) != NGX_OK) {
388 return NGX_ERROR; 394 return NGX_ERROR;
389 } 395 }
390 396
391 ctx->uid_set[0] = htonl(r->in_addr); 397 c = r->connection;
398
399 switch (c->local_sockaddr->sa_family) {
400
401 #if (NGX_HAVE_INET6)
402 case AF_INET6:
403 sin6 = (struct sockaddr_in6 *) c->local_sockaddr;
404
405 p = (u_char *) &ctx->uid_set[0];
406
407 *p++ = sin6->sin6_addr.s6_addr[12];
408 *p++ = sin6->sin6_addr.s6_addr[13];
409 *p++ = sin6->sin6_addr.s6_addr[14];
410 *p = sin6->sin6_addr.s6_addr[15];
411
412 break;
413 #endif
414 default: /* AF_INET */
415 sin = (struct sockaddr_in *) c->local_sockaddr;
416 ctx->uid_set[0] = sin->sin_addr.s_addr;
417 break;
418 }
392 419
393 } else { 420 } else {
394 ctx->uid_set[0] = htonl(conf->service); 421 ctx->uid_set[0] = htonl(conf->service);
395 } 422 }
396 423