Welcome! Log In Create A New Profile

Advanced

[nginx] svn commit: r4906 - in branches/stable-1.2: . src/http src/http/modules

Anonymous User
November 13, 2012 05:46AM
Author: mdounin
Date: 2012-11-13 10:45:23 +0000 (Tue, 13 Nov 2012)
New Revision: 4906
URL: http://trac.nginx.org/nginx/changeset/4906/nginx

Log:
Merge of r4886, r4887, r4894: log variables generalization:

*) Log: $apache_bytes_sent removed. It was renamed to $body_bytes_sent
in nginx 0.3.10 and the old name is deprecated since then.

*) Variable $bytes_sent. It replicates variable $bytes_sent as previously
available in log module only. Patch by Benjamin Gr?\195?\182ssing (with minor
changes).

*) Variables $connection and $connection_requests. Log module
counterparts are removed as they aren't used often and there is no
need to preserve them for efficiency.


Modified:
branches/stable-1.2/
branches/stable-1.2/src/http/modules/ngx_http_log_module.c
branches/stable-1.2/src/http/ngx_http_variables.c

Index: branches/stable-1.2
===================================================================
--- branches/stable-1.2 2012-11-13 10:42:16 UTC (rev 4905)
+++ branches/stable-1.2 2012-11-13 10:45:23 UTC (rev 4906)

Property changes on: branches/stable-1.2
___________________________________________________________________
Modified: svn:mergeinfo
## -1 +1 ##
-/trunk:4611-4632,4636-4657,4671-4672,4674-4676,4682,4684-4699,4704-4706,4713,4736-4741,4754,4756-4771,4775,4777-4780,4782-4785,4795,4811-4820,4822-4824,4828-4835,4840-4844,4865-4872,4885,4890,4893,4895
+/trunk:4611-4632,4636-4657,4671-4672,4674-4676,4682,4684-4699,4704-4706,4713,4736-4741,4754,4756-4771,4775,4777-4780,4782-4785,4795,4811-4820,4822-4824,4828-4835,4840-4844,4865-4872,4885-4887,4890,4893-4895
\ No newline at end of property
Modified: branches/stable-1.2/src/http/modules/ngx_http_log_module.c
===================================================================
--- branches/stable-1.2/src/http/modules/ngx_http_log_module.c 2012-11-13 10:42:16 UTC (rev 4905)
+++ branches/stable-1.2/src/http/modules/ngx_http_log_module.c 2012-11-13 10:45:23 UTC (rev 4906)
@@ -78,10 +78,6 @@
static ssize_t ngx_http_log_script_write(ngx_http_request_t *r,
ngx_http_log_script_t *script, u_char **name, u_char *buf, size_t len);

-static u_char *ngx_http_log_connection(ngx_http_request_t *r, u_char *buf,
- ngx_http_log_op_t *op);
-static u_char *ngx_http_log_connection_requests(ngx_http_request_t *r,
- u_char *buf, ngx_http_log_op_t *op);
static u_char *ngx_http_log_pipe(ngx_http_request_t *r, u_char *buf,
ngx_http_log_op_t *op);
static u_char *ngx_http_log_time(ngx_http_request_t *r, u_char *buf,
@@ -194,9 +190,6 @@


static ngx_http_log_var_t ngx_http_log_vars[] = {
- { ngx_string("connection"), NGX_ATOMIC_T_LEN, ngx_http_log_connection },
- { ngx_string("connection_requests"), NGX_INT_T_LEN,
- ngx_http_log_connection_requests },
{ ngx_string("pipe"), 1, ngx_http_log_pipe },
{ ngx_string("time_local"), sizeof("28/Sep/1970:12:00:00 +0600") - 1,
ngx_http_log_time },
@@ -209,8 +202,6 @@
{ ngx_string("bytes_sent"), NGX_OFF_T_LEN, ngx_http_log_bytes_sent },
{ ngx_string("body_bytes_sent"), NGX_OFF_T_LEN,
ngx_http_log_body_bytes_sent },
- { ngx_string("apache_bytes_sent"), NGX_OFF_T_LEN,
- ngx_http_log_body_bytes_sent },
{ ngx_string("request_length"), NGX_SIZE_T_LEN,
ngx_http_log_request_length },

@@ -502,22 +493,6 @@


static u_char *
-ngx_http_log_connection(ngx_http_request_t *r, u_char *buf,
- ngx_http_log_op_t *op)
-{
- return ngx_sprintf(buf, "%uA", r->connection->number);
-}
-
-
-static u_char *
-ngx_http_log_connection_requests(ngx_http_request_t *r, u_char *buf,
- ngx_http_log_op_t *op)
-{
- return ngx_sprintf(buf, "%ui", r->connection->requests);
-}
-
-
-static u_char *
ngx_http_log_pipe(ngx_http_request_t *r, u_char *buf, ngx_http_log_op_t *op)
{
if (r->pipeline) {
@@ -1143,12 +1118,6 @@
goto invalid;
}

- if (ngx_strncmp(var.data, "apache_bytes_sent", 17) == 0) {
- ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
- "use \"$body_bytes_sent\" instead of "
- "\"$apache_bytes_sent\"");
- }
-
for (v = ngx_http_log_vars; v->name.len; v++) {

if (v->name.len == var.len

Modified: branches/stable-1.2/src/http/ngx_http_variables.c
===================================================================
--- branches/stable-1.2/src/http/ngx_http_variables.c 2012-11-13 10:42:16 UTC (rev 4905)
+++ branches/stable-1.2/src/http/ngx_http_variables.c 2012-11-13 10:45:23 UTC (rev 4906)
@@ -69,6 +69,8 @@
ngx_http_variable_value_t *v, uintptr_t data);
static ngx_int_t ngx_http_variable_remote_user(ngx_http_request_t *r,
ngx_http_variable_value_t *v, uintptr_t data);
+static ngx_int_t ngx_http_variable_bytes_sent(ngx_http_request_t *r,
+ ngx_http_variable_value_t *v, uintptr_t data);
static ngx_int_t ngx_http_variable_body_bytes_sent(ngx_http_request_t *r,
ngx_http_variable_value_t *v, uintptr_t data);
static ngx_int_t ngx_http_variable_request_completion(ngx_http_request_t *r,
@@ -95,6 +97,11 @@
static ngx_int_t ngx_http_variable_sent_transfer_encoding(ngx_http_request_t *r,
ngx_http_variable_value_t *v, uintptr_t data);

+static ngx_int_t ngx_http_variable_connection(ngx_http_request_t *r,
+ ngx_http_variable_value_t *v, uintptr_t data);
+static ngx_int_t ngx_http_variable_connection_requests(ngx_http_request_t *r,
+ ngx_http_variable_value_t *v, uintptr_t data);
+
static ngx_int_t ngx_http_variable_nginx_version(ngx_http_request_t *r,
ngx_http_variable_value_t *v, uintptr_t data);
static ngx_int_t ngx_http_variable_hostname(ngx_http_request_t *r,
@@ -212,6 +219,9 @@

{ ngx_string("remote_user"), NULL, ngx_http_variable_remote_user, 0, 0, 0 },

+ { ngx_string("bytes_sent"), NULL, ngx_http_variable_bytes_sent,
+ 0, 0, 0 },
+
{ ngx_string("body_bytes_sent"), NULL, ngx_http_variable_body_bytes_sent,
0, 0, 0 },

@@ -260,6 +270,12 @@
offsetof(ngx_http_request_t, limit_rate),
NGX_HTTP_VAR_CHANGEABLE|NGX_HTTP_VAR_NOCACHEABLE, 0 },

+ { ngx_string("connection"), NULL,
+ ngx_http_variable_connection, 0, 0, 0 },
+
+ { ngx_string("connection_requests"), NULL,
+ ngx_http_variable_connection_requests, 0, 0, 0 },
+
{ ngx_string("nginx_version"), NULL, ngx_http_variable_nginx_version,
0, 0, 0 },

@@ -1434,6 +1450,27 @@


static ngx_int_t
+ngx_http_variable_bytes_sent(ngx_http_request_t *r,
+ ngx_http_variable_value_t *v, uintptr_t data)
+{
+ u_char *p;
+
+ p = ngx_pnalloc(r->pool, NGX_OFF_T_LEN);
+ if (p == NULL) {
+ return NGX_ERROR;
+ }
+
+ v->len = ngx_sprintf(p, "%O", r->connection->sent) - p;
+ v->valid = 1;
+ v->no_cacheable = 0;
+ v->not_found = 0;
+ v->data = p;
+
+ return NGX_OK;
+}
+
+
+static ngx_int_t
ngx_http_variable_body_bytes_sent(ngx_http_request_t *r,
ngx_http_variable_value_t *v, uintptr_t data)
{
@@ -1788,6 +1825,48 @@


static ngx_int_t
+ngx_http_variable_connection(ngx_http_request_t *r,
+ ngx_http_variable_value_t *v, uintptr_t data)
+{
+ u_char *p;
+
+ p = ngx_pnalloc(r->pool, NGX_ATOMIC_T_LEN);
+ if (p == NULL) {
+ return NGX_ERROR;
+ }
+
+ v->len = ngx_sprintf(p, "%uA", r->connection->number) - p;
+ v->valid = 1;
+ v->no_cacheable = 0;
+ v->not_found = 0;
+ v->data = p;
+
+ return NGX_OK;
+}
+
+
+static ngx_int_t
+ngx_http_variable_connection_requests(ngx_http_request_t *r,
+ ngx_http_variable_value_t *v, uintptr_t data)
+{
+ u_char *p;
+
+ p = ngx_pnalloc(r->pool, NGX_INT_T_LEN);
+ if (p == NULL) {
+ return NGX_ERROR;
+ }
+
+ v->len = ngx_sprintf(p, "%ui", r->connection->requests) - p;
+ v->valid = 1;
+ v->no_cacheable = 0;
+ v->not_found = 0;
+ v->data = p;
+
+ return NGX_OK;
+}
+
+
+static ngx_int_t
ngx_http_variable_nginx_version(ngx_http_request_t *r,
ngx_http_variable_value_t *v, uintptr_t data)
{

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] svn commit: r4906 - in branches/stable-1.2: . src/http src/http/modules

Anonymous User 953 November 13, 2012 05:46AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 238
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready