Welcome! Log In Create A New Profile

Advanced

Re: signal 11

Maxim Dounin
October 31, 2009 06:24PM
Hello!

On Sat, Oct 31, 2009 at 03:12:07PM +0300, Maxim Dounin wrote:

> Hello!
>
> On Sat, Oct 31, 2009 at 07:42:45AM -0400, ethaniel wrote:
>
> > так и не получил ответа. есть еще одна мысль - может это как-то связано с длиной log_format?
>
> Это связано с логированием $limit_rate. Эту переменную читать
> нельзя (точнее - нельзя использовать результат чтения, там мусор),
> её можно только устанавливать.
>
> Патч у меня где-то валялся, найду - пришлю.

Патч.

Maxim Dounin
# HG changeset patch
# User Maxim Dounin <mdounin@mdounin.ru>
# Date 1257026907 -10800
# Node ID ecbed719d238b2311b3aac80a82a9aa3717e925e
# Parent c88014f7483250ce1e3e93f0a179a21c719198d2
Fix reading $limit_rate variable.

diff --git a/src/http/ngx_http_variables.c b/src/http/ngx_http_variables.c
--- a/src/http/ngx_http_variables.c
+++ b/src/http/ngx_http_variables.c
@@ -14,6 +14,8 @@ static ngx_int_t ngx_http_variable_reque
ngx_http_variable_value_t *v, uintptr_t data);
static void ngx_http_variable_request_set(ngx_http_request_t *r,
ngx_http_variable_value_t *v, uintptr_t data);
+static ngx_int_t ngx_http_variable_request_size(ngx_http_request_t *r,
+ ngx_http_variable_value_t *v, uintptr_t data);
static void ngx_http_variable_request_set_size(ngx_http_request_t *r,
ngx_http_variable_value_t *v, uintptr_t data);
static ngx_int_t ngx_http_variable_header(ngx_http_request_t *r,
@@ -238,7 +240,7 @@ static ngx_http_variable_t ngx_http_cor
offsetof(ngx_http_request_t, headers_out.cache_control), 0, 0 },

{ ngx_string("limit_rate"), ngx_http_variable_request_set_size,
- ngx_http_variable_request,
+ ngx_http_variable_request_size,
offsetof(ngx_http_request_t, limit_rate),
NGX_HTTP_VAR_CHANGEABLE|NGX_HTTP_VAR_NOCACHEABLE, 0 },

@@ -568,6 +570,29 @@ ngx_http_variable_request_set(ngx_http_r
}


+static ngx_int_t
+ngx_http_variable_request_size(ngx_http_request_t *r,
+ ngx_http_variable_value_t *v, uintptr_t data)
+{
+ size_t *sp;
+
+ sp = (size_t *) ((char *) r + data);
+
+ v->data = ngx_pnalloc(r->pool, NGX_SIZE_T_LEN);
+ if (v->data == NULL) {
+ return NGX_ERROR;
+ }
+
+ v->valid = 1;
+ v->no_cacheable = 0;
+ v->not_found = 0;
+
+ v->len = ngx_sprintf(v->data, "%uz", *sp) - v->data;
+
+ return NGX_OK;
+}
+
+
static void
ngx_http_variable_request_set_size(ngx_http_request_t *r,
ngx_http_variable_value_t *v, uintptr_t data)
Subject Author Posted

signal 11

Arkadiy Kulev October 30, 2009 04:24AM

Re: signal 11

Igor Sysoev October 30, 2009 04:42AM

Re: signal 11

ethaniel October 30, 2009 04:56AM

Re: signal 11

Igor Sysoev October 30, 2009 05:16AM

Re: signal 11

ethaniel October 30, 2009 05:38AM

Re: signal 11

Andrey N. Oktyabrski October 30, 2009 05:52AM

Re: signal 11

ethaniel October 30, 2009 06:06AM

Re: signal 11

Igor Sysoev October 30, 2009 06:54AM

Re: signal 11

Igor Sysoev October 30, 2009 06:54AM

Re: signal 11

ethaniel October 30, 2009 07:28AM

Re: signal 11

Igor Sysoev October 30, 2009 07:50AM

Re: signal 11

ethaniel October 30, 2009 08:08AM

Re: signal 11

Igor Sysoev October 30, 2009 09:28AM

Re: signal 11

ethaniel October 30, 2009 09:54AM

Re: signal 11

Igor Sysoev October 30, 2009 10:12AM

Re: signal 11

Andrey N. Oktyabrski October 30, 2009 06:54AM

Re: signal 11

ethaniel October 30, 2009 11:05AM

Re: signal 11

ethaniel October 31, 2009 07:42AM

Re: signal 11

Maxim Dounin October 31, 2009 08:24AM

Re: signal 11

ethaniel October 31, 2009 08:42AM

Re: signal 11

Maxim Dounin October 31, 2009 06:24PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 340
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready