Welcome! Log In Create A New Profile

Advanced

[nginx] svn commit: r4887 - trunk/src/http

Anonymous User
October 03, 2012 11:26AM
Author: mdounin
Date: 2012-10-03 15:25:36 +0000 (Wed, 03 Oct 2012)
New Revision: 4887
URL: http://trac.nginx.org/nginx/changeset/4887/nginx

Log:
Variable $bytes_sent.

It replicates variable $bytes_sent as previously available in log module
only.

Patch by Benjamin Gr?\195?\182ssing (with minor changes).


Modified:
trunk/src/http/ngx_http_variables.c

Modified: trunk/src/http/ngx_http_variables.c
===================================================================
--- trunk/src/http/ngx_http_variables.c 2012-10-03 15:25:06 UTC (rev 4886)
+++ trunk/src/http/ngx_http_variables.c 2012-10-03 15:25:36 UTC (rev 4887)
@@ -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,
@@ -212,6 +214,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 },

@@ -1434,6 +1439,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)
{

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

[nginx] svn commit: r4887 - trunk/src/http

Anonymous User 803 October 03, 2012 11:26AM



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

Online Users

Guests: 141
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