diff options
| author | Igor Sysoev <igor@sysoev.ru> | 2006-01-17 20:04:32 +0000 |
|---|---|---|
| committer | Igor Sysoev <igor@sysoev.ru> | 2006-01-17 20:04:32 +0000 |
| commit | ae33d014ad64c380446d8113bc7b2de115ffa23f (patch) | |
| tree | 29a2f51bb8ba23c2a698732fc543bed6798d5967 /src/http/modules | |
| parent | 4a32307de74116ec3aca40cd15e37e26e3bddd79 (diff) | |
| download | nginx-release-0.3.22.tar.gz nginx-release-0.3.22.tar.bz2 | |
nginx-0.3.22-RELEASE importrelease-0.3.22
*) Feature: the ngx_http_perl_module supports the $r->args and
$r->unescape methods.
*) Feature: the method $r->query_string of ngx_http_perl_module was
canceled.
*) Bugfix: segmentation fault was occurred if the "none" or "blocked"
values was specified in the "valid_referers" directive; the bug had
appeared in 0.3.18.
Diffstat (limited to 'src/http/modules')
| -rw-r--r-- | src/http/modules/ngx_http_referer_module.c | 7 | ||||
| -rw-r--r-- | src/http/modules/perl/nginx.pm | 7 | ||||
| -rw-r--r-- | src/http/modules/perl/nginx.xs | 47 |
3 files changed, 44 insertions, 17 deletions
diff --git a/src/http/modules/ngx_http_referer_module.c b/src/http/modules/ngx_http_referer_module.c index 0d3ee6f7a..459984eaa 100644 --- a/src/http/modules/ngx_http_referer_module.c +++ b/src/http/modules/ngx_http_referer_module.c @@ -90,10 +90,7 @@ ngx_http_referer_variable(ngx_http_request_t *r, ngx_http_variable_value_t *v, rlcf = ngx_http_get_module_loc_conf(r, ngx_http_referer_module); - if (rlcf->hash.buckets == NULL - && rlcf->dns_wildcards == NULL - && rlcf->dns_wildcards->hash.buckets == NULL) - { + if (rlcf->hash.buckets == NULL && rlcf->dns_wildcards == NULL) { goto valid; } @@ -145,7 +142,7 @@ ngx_http_referer_variable(ngx_http_request_t *r, ngx_http_variable_value_t *v, } } - if (rlcf->dns_wildcards && rlcf->dns_wildcards->hash.buckets) { + if (rlcf->dns_wildcards) { uri = ngx_hash_find_wildcard(rlcf->dns_wildcards, buf, len); if (uri) { goto uri; diff --git a/src/http/modules/perl/nginx.pm b/src/http/modules/perl/nginx.pm index 66ff64f9a..c0f3f27eb 100644 --- a/src/http/modules/perl/nginx.pm +++ b/src/http/modules/perl/nginx.pm @@ -17,7 +17,7 @@ our @EXPORT = qw( HTTP_SERVER_ERROR ); -our $VERSION = '0.3.21'; +our $VERSION = '0.3.22'; require XSLoader; XSLoader::load('nginx', $VERSION); @@ -48,11 +48,6 @@ nginx - Perl interface to the nginx HTTP server API This module provides a Perl interface to the nginx HTTP server API. -=head2 EXPORT - -None by default. - - =head1 SEE ALSO diff --git a/src/http/modules/perl/nginx.xs b/src/http/modules/perl/nginx.xs index 21d2deb99..d41bf684f 100644 --- a/src/http/modules/perl/nginx.xs +++ b/src/http/modules/perl/nginx.xs @@ -156,13 +156,13 @@ uri(r, ...) char * -query_string(r, ...) +args(r, ...) nginx r CODE: if (items != 1) { - croak("$r->query_string(text) is not implemented"); + croak("$r->args(text) is not implemented"); } RETVAL = ngx_palloc(r->pool, r->args.len + 1); @@ -360,6 +360,9 @@ print(r, ...) b->start = p; b->end = b->last; + ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, + "$r->print: read-only SV: %z", len); + goto out; } } @@ -374,12 +377,11 @@ print(r, ...) sv = SvRV(sv); } - ngx_log_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, - "SV: %p %d %Xd", - sv, SvREFCNT(sv), SvREADONLY(sv)); - (void) SvPV(sv, len); + ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, + "$r->print: copy SV: %z", len); + size += len; } @@ -513,6 +515,8 @@ rflush(r) b->flush = 1; + ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "$r->rflush"); + RETVAL = ngx_http_perl_output(r, b); done: @@ -549,3 +553,34 @@ internal_redirect(r, uri) XSRETURN_EMPTY; } } + + +char * +unescape(r, text, type = 0) + nginx r + SV *text + int type + + PREINIT: + + u_char *p, *dst, *src; + STRLEN n; + + CODE: + + src = (u_char *) SvPV(text, n); + + p = ngx_palloc(r->pool, n + 1); + if (p == NULL) { + XSRETURN_UNDEF; + } + + dst = p; + + ngx_unescape_uri(&dst, &src, n, (ngx_uint_t) type); + *dst = '\0'; + + RETVAL = (char *) p; + + OUTPUT: + RETVAL |
