aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2010-03-03 10:21:12 +0000
committerIgor Sysoev <igor@sysoev.ru>2010-03-03 10:21:12 +0000
commit750a65ef84bdf407127fccf86640639223518b26 (patch)
tree6e678549a44352b88c4ff758167c19ac27a22156
parentf953436886ad8def8eda55d0693f609d8a8b5a89 (diff)
downloadnginx-750a65ef84bdf407127fccf86640639223518b26.tar.gz
nginx-750a65ef84bdf407127fccf86640639223518b26.zip
allow HTTPS referers
-rw-r--r--src/http/modules/ngx_http_referer_module.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/http/modules/ngx_http_referer_module.c b/src/http/modules/ngx_http_referer_module.c
index e655be967..78cc7f4dd 100644
--- a/src/http/modules/ngx_http_referer_module.c
+++ b/src/http/modules/ngx_http_referer_module.c
@@ -124,18 +124,27 @@ ngx_http_referer_variable(ngx_http_request_t *r, ngx_http_variable_value_t *v,
len = r->headers_in.referer->value.len;
ref = r->headers_in.referer->value.data;
- if (len < sizeof("http://i.ru") - 1
- || (ngx_strncasecmp(ref, (u_char *) "http://", 7) != 0))
- {
- if (rlcf->blocked_referer) {
- goto valid;
+ if (len >= sizeof("http://i.ru") - 1) {
+ last = ref + len;
+
+ if (ngx_strncasecmp(ref, (u_char *) "http://", 7) == 0) {
+ ref += 7;
+ goto valid_scheme;
+
+ } else if (ngx_strncasecmp(ref, (u_char *) "https://", 8) == 0) {
+ ref += 8;
+ goto valid_scheme;
}
+ }
- goto invalid;
+ if (rlcf->blocked_referer) {
+ goto valid;
}
- last = ref + len;
- ref += 7;
+ goto invalid;
+
+valid_scheme:
+
i = 0;
key = 0;