Skip to content

Commit

Permalink
Merge pull request alibaba#299 from lilbedwin/referer
Browse files Browse the repository at this point in the history
fix bug in http_referer_module
  • Loading branch information
yaoweibin committed Aug 12, 2013
2 parents 71418fa + b105161 commit 4960575
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/http/modules/ngx_http_referer_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,12 @@ ngx_http_referer_variable(ngx_http_request_t *r, ngx_http_variable_value_t *v,

if (ngx_strncasecmp(ref, (u_char *) "http://", 7) == 0) {
ref += 7;
len -= 7;
goto valid_scheme;

} else if (ngx_strncasecmp(ref, (u_char *) "https://", 8) == 0) {
ref += 8;
len -= 8;
goto valid_scheme;
}
}
Expand Down Expand Up @@ -191,7 +193,7 @@ ngx_http_referer_variable(ngx_http_request_t *r, ngx_http_variable_value_t *v,
ngx_int_t rc;
ngx_str_t referer;

referer.len = len - 7;
referer.len = len;
referer.data = ref;

rc = ngx_regex_exec_array(rlcf->regex, &referer, r->connection->log);
Expand Down

0 comments on commit 4960575

Please sign in to comment.