~ubuntu-branches/ubuntu/jaunty/nginx/jaunty-updates

« back to all changes in this revision

Viewing changes to src/http/ngx_http_variables.c

  • Committer: Bazaar Package Importer
  • Author(s): Jose Parrella
  • Date: 2007-12-08 11:27:54 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20071208112754-23ohg2b1zshkdayw
Tags: 0.5.33-1
* New stable upstream release (Closes: #451173)
* nginx now provides httpd, httpd-cgi virtual packages
  (Closes: #439468, #452025)
* sites-enabled/default link is now provided only on fresh 
  installations (Closes: #432961)
* Updated code for online upgrading of nginx (Closes: #445246)
* Reviewed maintainer scripts for correct behaviour on updates
  (Closes: #452787, #435965)
* Removed debian/nginx.links and debian/preinst.
* Changing Maintainer address to bureado@debian.org.
* Welcoming Fabio Tranchitella <kobold@debian.org> as an nginx 
  uploader for Debian. Thanks for your patches.

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
#include <ngx_core.h>
9
9
#include <ngx_event.h>
10
10
#include <ngx_http.h>
 
11
#include <nginx.h>
11
12
 
12
13
 
13
14
static ngx_int_t ngx_http_variable_request(ngx_http_request_t *r,
14
15
    ngx_http_variable_value_t *v, uintptr_t data);
 
16
static void ngx_http_variable_request_set(ngx_http_request_t *r,
 
17
    ngx_http_variable_value_t *v, uintptr_t data);
15
18
static void ngx_http_variable_request_set_size(ngx_http_request_t *r,
16
19
    ngx_http_variable_value_t *v, uintptr_t data);
17
20
static ngx_int_t ngx_http_variable_header(ngx_http_request_t *r,
38
41
    ngx_http_variable_value_t *v, uintptr_t data);
39
42
static ngx_int_t ngx_http_variable_scheme(ngx_http_request_t *r,
40
43
    ngx_http_variable_value_t *v, uintptr_t data);
 
44
static ngx_int_t ngx_http_variable_is_args(ngx_http_request_t *r,
 
45
    ngx_http_variable_value_t *v, uintptr_t data);
41
46
static ngx_int_t ngx_http_variable_document_root(ngx_http_request_t *r,
42
47
    ngx_http_variable_value_t *v, uintptr_t data);
43
48
static ngx_int_t ngx_http_variable_request_filename(ngx_http_request_t *r,
66
71
static ngx_int_t ngx_http_variable_sent_transfer_encoding(ngx_http_request_t *r,
67
72
    ngx_http_variable_value_t *v, uintptr_t data);
68
73
 
 
74
static ngx_int_t ngx_http_variable_nginx_version(ngx_http_request_t *r,
 
75
    ngx_http_variable_value_t *v, uintptr_t data);
69
76
 
70
77
/*
71
78
 * TODO:
152
159
      offsetof(ngx_http_request_t, args),
153
160
      NGX_HTTP_VAR_NOCACHABLE, 0 },
154
161
 
155
 
    { ngx_string("args"), NULL, ngx_http_variable_request,
 
162
    { ngx_string("args"),
 
163
      ngx_http_variable_request_set,
 
164
      ngx_http_variable_request,
156
165
      offsetof(ngx_http_request_t, args),
157
 
      NGX_HTTP_VAR_NOCACHABLE, 0 },
 
166
      NGX_HTTP_VAR_CHANGABLE|NGX_HTTP_VAR_NOCACHABLE, 0 },
 
167
 
 
168
    { ngx_string("is_args"), NULL, ngx_http_variable_is_args,
 
169
      0, NGX_HTTP_VAR_NOCACHABLE, 0 },
158
170
 
159
171
    { ngx_string("request_filename"), NULL,
160
172
      ngx_http_variable_request_filename, 0,
205
217
      offsetof(ngx_http_request_t, limit_rate),
206
218
      NGX_HTTP_VAR_CHANGABLE|NGX_HTTP_VAR_NOCACHABLE, 0 },
207
219
 
 
220
    { ngx_string("nginx_version"), NULL, ngx_http_variable_nginx_version,
 
221
      0, 0, 0 },
 
222
 
208
223
    { ngx_null_string, NULL, NULL, 0, 0, 0 }
209
224
};
210
225
 
495
510
 
496
511
 
497
512
static void
 
513
ngx_http_variable_request_set(ngx_http_request_t *r,
 
514
    ngx_http_variable_value_t *v, uintptr_t data)
 
515
{
 
516
    ngx_str_t  *s;
 
517
 
 
518
    s = (ngx_str_t *) ((char *) r + data);
 
519
 
 
520
    s->len = v->len;
 
521
    s->data = v->data;
 
522
}
 
523
 
 
524
 
 
525
static void
498
526
ngx_http_variable_request_set_size(ngx_http_request_t *r,
499
527
    ngx_http_variable_value_t *v, uintptr_t data)
500
528
{
501
529
    ssize_t    s, *sp;
502
530
    ngx_str_t  val;
503
531
 
504
 
    val.len = v->len & 0xffff;
 
532
    val.len = v->len;
505
533
    val.data = v->data;
506
534
 
507
535
    s = ngx_parse_size(&val);
854
882
 
855
883
 
856
884
static ngx_int_t
 
885
ngx_http_variable_is_args(ngx_http_request_t *r,
 
886
    ngx_http_variable_value_t *v, uintptr_t data)
 
887
{
 
888
    v->valid = 1;
 
889
    v->no_cachable = 0;
 
890
    v->not_found = 0;
 
891
 
 
892
    if (r->args.len == 0) {
 
893
        v->len = 0;
 
894
        v->data = NULL;
 
895
        return NGX_OK;
 
896
    }
 
897
 
 
898
    v->len = 1;
 
899
    v->data = (u_char *) "?";
 
900
 
 
901
    return NGX_OK;
 
902
}
 
903
 
 
904
 
 
905
static ngx_int_t
857
906
ngx_http_variable_document_root(ngx_http_request_t *r,
858
907
    ngx_http_variable_value_t *v, uintptr_t data)
859
908
{
1205
1254
}
1206
1255
 
1207
1256
 
 
1257
static ngx_int_t
 
1258
ngx_http_variable_nginx_version(ngx_http_request_t *r,
 
1259
    ngx_http_variable_value_t *v, uintptr_t data)
 
1260
{
 
1261
    v->len = sizeof(NGINX_VERSION) - 1;
 
1262
    v->valid = 1;
 
1263
    v->no_cachable = 0;
 
1264
    v->not_found = 0;
 
1265
    v->data = (u_char *) NGINX_VERSION;
 
1266
 
 
1267
    return NGX_OK;
 
1268
}
 
1269
 
 
1270
 
1208
1271
ngx_int_t
1209
1272
ngx_http_variables_add_core_vars(ngx_conf_t *cf)
1210
1273
{