Nginx-ru mailing list archive (nginx-ru@sysoev.ru)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ внутренний редирект из мод уля фильтра ]
- To: nginx-ru@xxxxxxxxx
- Subject: [ внутренний редирект из мод уля фильтра ]
- From: Denis Gabaidulin <gabaden@xxxxxxxxx>
- Date: Sun, 15 Feb 2009 19:15:24 +0300
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type:content-transfer-encoding; bh=4oxG+75UaDkxY91ULm35QIErY3yH68tckld6UQWJZrA=; b=hOeIbvFRaBRsox00xq3MTctNFKy6ALKgURvRsqtoI2eXdIqAxlHyGqIyi55bWtIhTO 3zAZD40VHRJAFpT/AkdrhmvbMLsPEEYBbNvvsVbpBIdXMJz02pkCi7kV1FrS9nnKFyCF G+L9pW6WcuZiGkMEqlSo5TYTF8P2C/ip+NJ6c=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; b=k8rgQHDwUzhzspXWbIheNXbFXpFj+YAwgvhjGbDJ8jZujv92U3qO3Q9RXJ9TFUDGuh AucQJXc0Qr+4wV6e9h1SUloDjbRhGNbeX/oU91WrRiRLSE/lx9OdQWN9B0ybnfYDhn+p +Ahh1a97d5XJjIU3Cr01krwZsgOrl2CiOjNrM=
Помогите разобраться что я делаю не так. У меня есть модуль-фильтр.
В нем предусмотрен редирект на одну из локаций, если выполняется
некоторое условие.
В коде это выглядит примерно так:
if (!is_redirect(r)) {
(void) ngx_http_internal_redirect(r, &conf->redirect_location, NULL);
return NGX_OK;
}
В итоге получается segfault, bt:
(gdb) bt
#0 0x0000000000424027 in ngx_http_output_filter (r=0x2474ad0,
in=0x7fff1b28c280) at src/http/ngx_http_core_module.c:1626
#1 0x000000000045349e in ngx_http_empty_gif_handler (r=0x2474ad0) at
src/http/modules/ngx_http_empty_gif_module.c:159
#2 0x0000000000426a19 in ngx_http_core_content_phase (r=0x2474ad0,
ph=0x24894e0) at src/http/ngx_http_core_module.c:1221
#3 0x00000000004223d3 in ngx_http_core_run_phases (r=0x2474ad0) at
src/http/ngx_http_core_module.c:768
#4 0x0000000000422508 in ngx_http_handler (r=0x2474ad0) at
src/http/ngx_http_core_module.c:751
#5 0x000000000042b70e in ngx_http_process_request (r=0x2474ad0) at
src/http/ngx_http_request.c:1524
#6 0x000000000042bfb1 in ngx_http_process_request_headers
(rev=0x2475698) at src/http/ngx_http_request.c:986
#7 0x000000000042c53e in ngx_http_process_request_line
(rev=0x24b24f0) at src/http/ngx_http_request.c:796
#8 0x000000000042911a in ngx_http_init_request (rev=0x24b24f0) at
src/http/ngx_http_request.c:471
#9 0x000000000041f123 in ngx_epoll_process_events (cycle=0x246a2d8,
timer=<value optimized out>, flags=<value optimized out>)
at src/event/modules/ngx_epoll_module.c:518
#10 0x0000000000417564 in ngx_process_events_and_timers
(cycle=0x246a2d8) at src/event/ngx_event.c:245
#11 0x000000000041dd18 in ngx_worker_process_cycle (cycle=0x246a2d8,
data=<value optimized out>) at src/os/unix/ngx_process_cycle.c:767
#12 0x000000000041c640 in ngx_spawn_process (cycle=0x246a2d8,
proc=0x41d6f5 <ngx_worker_process_cycle>, data=0x0, name=0x458af3
"worker process",
respawn=0) at src/os/unix/ngx_process.c:187
#13 0x000000000041e62e in ngx_master_process_cycle (cycle=0x246a2d8)
at src/os/unix/ngx_process_cycle.c:569
#14 0x0000000000403fc4 in main (argc=3, argv=0x7fff1b28c998) at
src/core/nginx.c:363
(gdb) fr 0
#0 0x0000000000424027 in ngx_http_output_filter (r=0x2474ad0,
in=0x7fff1b28c280) at src/http/ngx_http_core_module.c:1626
1626 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
(gdb) p r->connection
$1 = (ngx_connection_t *) 0x246e290
(gdb) p *r->connection
$2 = {data = 0x0, read = 0x4011, write = 0x2474ac0, fd = 312420960,
recv = 0, send = 0, recv_chain = 0x6567572000746e65, send_chain =
0x342e31312e312f74,
listening = 0x7470656363410a00, sent = 5190961701677834240, log =
0x6f6f62200074736f, pool = 0x6f622e6d656f2e6b, sockaddr =
0x656e6e6f430a006f,
socklen = 1869182051, addr_text = {len = 8532469996221130085, data =
0x412d700a0d0a0065 <Address 0x412d700a0d0a0065 out of bounds>},
buffer = 0x6f430a006576696c, number = 7599015132331076463, buffered
= 100, log_error = 1, single_connection = 1, unexpected_eof = 1,
timedout = 1,
error = 1, destroyed = 0, idle = 0, close = 1, sendfile = 0,
sndlowat = 0, tcp_nodelay = 2, tcp_nopush = 1}
(gdb) p r->connection->log
$3 = (ngx_log_t *) 0x6f6f62200074736f
(gdb) p *r->connection->log
Cannot access memory at address 0x6f6f62200074736f
А теперь самое интересное. Если переделать фильтр в обычный модуль,
который сам формирует ответ, то все прекрасно работает.
|