]> git.kaiwu.me - nginx.git/commitdiff
nginx-0.3.22-RELEASE import release-0.3.22
authorIgor Sysoev <igor@sysoev.ru>
Tue, 17 Jan 2006 20:04:32 +0000 (20:04 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Tue, 17 Jan 2006 20:04:32 +0000 (20:04 +0000)
    *) 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.

15 files changed:
auto/cc/icc
auto/lib/perl/make
docs/xml/nginx/changes.xml
src/core/nginx.c
src/core/nginx.h
src/core/ngx_string.c
src/core/ngx_string.h
src/http/modules/ngx_http_referer_module.c
src/http/modules/perl/nginx.pm
src/http/modules/perl/nginx.xs
src/http/ngx_http_script.c
src/os/unix/ngx_freebsd_config.h
src/os/unix/ngx_linux_config.h
src/os/unix/ngx_posix_config.h
src/os/unix/ngx_solaris_config.h

index 81b042748cbadb7ab40023eecd30da2ec6695763..afcabe6e6ea5731572f3c4cccc6ffb9bfb26c666 100644 (file)
@@ -20,9 +20,6 @@ CFLAGS="$CFLAGS -O"
 # inline any function, at the compiler's discretion
 CFLAGS="$CFLAGS -Ob2"
 
-# single-file IP optimizations
-#IPO="-ip"
-
 # multi-file IP optimizations
 case "$NGX_ICC_VER" in
     9.*)
@@ -34,6 +31,9 @@ case "$NGX_ICC_VER" in
     ;;
 esac
 
+# single-file IP optimizations
+#IPO="-ip"
+
 CFLAGS="$CFLAGS $IPO"
 CORE_LINK="$CORE_LINK $IPO"
 CORE_LINK="$CORE_LINK -opt_report_file=$NGX_OBJS/opt_report_file"
index 36544223a8de87f486c9a9ce431551c2b97aaa50..b7c8cb3bd60171c8c09b96618aed7ed6645da75a 100644 (file)
@@ -15,14 +15,16 @@ $NGX_OBJS/src/http/modules/perl/blib/arch/auto/nginx/nginx.so:              \
        cd $NGX_OBJS/src/http/modules/perl && make
 
 
-$NGX_OBJS/src/http/modules/perl/Makefile: src/http/modules/perl/Makefile.PL
+$NGX_OBJS/src/http/modules/perl/Makefile:                              \
+               src/http/modules/perl/Makefile.PL                       \
+               src/http/modules/perl/nginx.pm
 
        cp -p src/http/modules/perl/nginx.* $NGX_OBJS/src/http/modules/perl/
        cp -p src/http/modules/perl/typemap $NGX_OBJS/src/http/modules/perl/
        cp -p src/http/modules/perl/Makefile.PL $NGX_OBJS/src/http/modules/perl/
 
        cd $NGX_OBJS/src/http/modules/perl                              \
-               && NGX_PERL_CFLAGS="$NGX_PERL_CFLAGS"                   \
+               && NGX_PERL_CFLAGS="$NGX_PERL_CFLAGS $NGX_CC_OPT"       \
                        NGX_PCRE=$PCRE                                  \
                        NGX_ZLIB=$ZLIB                                  \
                        NGX_OBJS=$NGX_OBJS                              \
index e4845f6b0de0c4490805cb30e2f125bb1f9d24b3..8ef64c9ca267bd4d3d45d101651ff0b37a23a66e 100644 (file)
@@ -9,6 +9,42 @@
 <title lang="en">nginx changelog</title>
 
 
+<changes ver="0.3.22" date="17.01.2006">
+
+<change type="feature">
+<para lang="ru">
+ÍÏÄÕÌØ ngx_http_perl_module ÐÏÄÄÅÒÖÉ×ÁÅÔ ÍÅÔÏÄÙ $r->args É $r->unescape.
+</para>
+<para lang="en">
+the ngx_http_perl_module supports the $r->args and $r->unescape methods.
+</para>
+</change>
+
+<change type="feature">
+<para lang="ru">
+ÍÅÔÏÄ $r->query_string × ÍÏÄÕÌÅ ngx_http_perl_module ÕÐÒÁÚÄΣÎ.
+</para>
+<para lang="en">
+the method $r->query_string of ngx_http_perl_module is canceled.
+</para>
+</change>
+
+<change type="bugfix">
+<para lang="ru">
+ÅÓÌÉ × ÄÉÒÅËÔÉ×Å valid_referers ÕËÁÚÁÎÙ ÔÏÌØËÏ none ÉÌÉ blocked, ÔÏ
+ÐÒÏÉÓÈÏÄÉÌ segmentation fault;
+ÏÛÉÂËÁ ÐÏÑ×ÉÌÁÓØ × 0.3.18.
+</para>
+<para lang="en">
+segmentation fault was occurred if the "none" or "blocked" values was
+specified in the "valid_referers" directive;
+bug appeared in 0.3.18.
+</para>
+</change>
+
+</changes>
+
+
 <changes ver="0.3.21" date="16.01.2006">
 
 <change type="feature">
index d30e127449c1b4aebfcc25879bcb6481871e77a3..a9a0dd9055a3ea506e0eed9223d918dd0be9a24d 100644 (file)
@@ -168,6 +168,8 @@ ngx_module_t  ngx_core_module = {
 
 ngx_uint_t  ngx_max_module;
 
+static char *ngx_null_environ = NULL;
+
 
 int ngx_cdecl
 main(int argc, char *const *argv)
@@ -232,6 +234,8 @@ main(int argc, char *const *argv)
         return 1;
     }
 
+    environ = &ngx_null_environ;
+
     ngx_max_module = 0;
     for (i = 0; ngx_modules[i]; i++) {
         ngx_modules[i]->index = ngx_max_module++;
index ec125d60e4724db1cde8de9fc5cb540bc9296e64..a2c696fea1f4c5c551bfac7167229b89b9f10340 100644 (file)
@@ -8,7 +8,7 @@
 #define _NGINX_H_INCLUDED_
 
 
-#define NGINX_VER          "nginx/0.3.21"
+#define NGINX_VER          "nginx/0.3.22"
 
 #define NGINX_VAR          "NGINX"
 #define NGX_OLDPID_EXT     ".oldbin"
index 2bb335a07d5cf39b97b304f66a5a254628155df0..c99778d87dc1a27defbd8ca09a6c0227acd6a6c2 100644 (file)
@@ -931,7 +931,7 @@ ngx_escape_uri(u_char *dst, u_char *src, size_t size, ngx_uint_t type)
 
 
 void
-ngx_unescape_uri(u_char **dst, u_char **src, size_t size)
+ngx_unescape_uri(u_char **dst, u_char **src, size_t size, ngx_uint_t type)
 {
     u_char  *d, *s, ch, c, decoded;
     enum {
@@ -952,7 +952,7 @@ ngx_unescape_uri(u_char **dst, u_char **src, size_t size)
 
         switch (state) {
         case sw_usual:
-            if (ch == '?') {
+            if (ch == '?' && type == NGX_UNESCAPE_URI) {
                 *d++ = ch;
                 goto done;
             }
@@ -995,12 +995,18 @@ ngx_unescape_uri(u_char **dst, u_char **src, size_t size)
             if (ch >= '0' && ch <= '9') {
                 ch = (u_char) ((decoded << 4) + ch - '0');
 
-                if (ch > '%' && ch < 0x7f) {
-                    *d++ = ch;
+                if (type == NGX_UNESCAPE_URI) {
+                    if (ch > '%' && ch < 0x7f) {
+                        *d++ = ch;
+                        break;
+                    }
+
+                    *d++ = '%'; *d++ = *(s - 2); *d++ = *(s - 1);
+
                     break;
                 }
 
-                *d++ = '%'; *d++ = *(s - 2); *d++ = *(s - 1);
+                *d++ = ch;
 
                 break;
             }
@@ -1009,17 +1015,22 @@ ngx_unescape_uri(u_char **dst, u_char **src, size_t size)
             if (c >= 'a' && c <= 'f') {
                 ch = (u_char) ((decoded << 4) + c - 'a' + 10);
 
-                if (ch == '?') {
-                    *d++ = ch;
-                    goto done;
-                }
+                if (type == NGX_UNESCAPE_URI) {
+                    if (ch == '?') {
+                        *d++ = ch;
+                        goto done;
+                    }
+
+                    if (ch > '%' && ch < 0x7f) {
+                        *d++ = ch;
+                        break;
+                    }
 
-                if (ch > '%' && ch < 0x7f) {
-                    *d++ = ch;
+                    *d++ = '%'; *d++ = *(s - 2); *d++ = *(s - 1);
                     break;
                 }
 
-                *d++ = '%'; *d++ = *(s - 2); *d++ = *(s - 1);
+                *d++ = ch;
 
                 break;
             }
index 0192a3068c03cba1aaab91c0fdcb64a6bdaedfa1..d76a0f555c3d7e508ef6728c7d4d09ac784a09cc 100644 (file)
@@ -144,13 +144,15 @@ size_t ngx_utf_length(ngx_str_t *utf);
 u_char * ngx_utf_cpystrn(u_char *dst, u_char *src, size_t n);
 
 
-#define NGX_ESCAPE_URI   0
-#define NGX_ESCAPE_ARGS  1
-#define NGX_ESCAPE_HTML  2
+#define NGX_ESCAPE_URI     0
+#define NGX_ESCAPE_ARGS    1
+#define NGX_ESCAPE_HTML    2
+
+#define NGX_UNESCAPE_URI   1
 
 uintptr_t ngx_escape_uri(u_char *dst, u_char *src, size_t size,
     ngx_uint_t type);
-void ngx_unescape_uri(u_char **dst, u_char **src, size_t size);
+void ngx_unescape_uri(u_char **dst, u_char **src, size_t size, ngx_uint_t type);
 
 
 #define  ngx_qsort                qsort
index 0d3ee6f7a6a613295178adb52a46129c26f23944..459984eaa383cbd8ed80f54300d2e6f3da1c24b5 100644 (file)
@@ -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;
index 66ff64f9a466c5233c1a653d3638c8ca9139861f..c0f3f27ebbed0378527d97725dc8ab577cb5ef93 100644 (file)
@@ -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
 
index 21d2deb992dd2db00fb78aeabe1dbde868e4e58d..d41bf684f3af557eb0f2ebad38c58eda2ebc1e01 100644 (file)
@@ -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
index 4986675a9ed7c36b65a26ea9035e03096f55ce65..b46c9bb3588dfed9842f96b722c78e9f7ecd79cb 100644 (file)
@@ -682,7 +682,7 @@ ngx_http_script_regex_end_code(ngx_http_script_engine_t *e)
         dst = e->buf.data;
         src = e->buf.data;
 
-        ngx_unescape_uri(&dst, &src, e->pos - e->buf.data);
+        ngx_unescape_uri(&dst, &src, e->pos - e->buf.data, NGX_UNESCAPE_URI);
 
         if (src < e->pos) {
             dst = ngx_copy(dst, src, e->pos - src);
index 73deb9ccdcbb3f8d1f9f27d13455e64939a2cdf2..c187191b9dd4279a5d24aa9b3bf13beccd7f8221 100644 (file)
@@ -97,9 +97,11 @@ pid_t rfork_thread(int flags, void *stack, int (*func)(void *arg), void *arg);
 #endif
 
 
-extern char *malloc_options;
-
 #define NGX_HAVE_OS_SPECIFIC_INIT    1
 
 
+extern char **environ;
+extern char *malloc_options;
+
+
 #endif /* _NGX_FREEBSD_CONFIG_H_INCLUDED_ */
index ac7d7a8df39611a0aa0f42ae3703c7ef49aa03b4..74bbfb1bd5e03a2304a6917f0cda4e99be22270d 100644 (file)
@@ -101,4 +101,7 @@ extern ssize_t sendfile(int s, int fd, int32_t *offset, size_t size);
 #define NGX_HAVE_OS_SPECIFIC_INIT    1
 
 
+extern char **environ;
+
+
 #endif /* _NGX_LINUX_CONFIG_H_INCLUDED_ */
index dc4341a94048c2c6afa150ad02ae3d6d737e4d32..984db967005c6b10eae23eb55c6b81d54b9dd161 100644 (file)
 #endif
 
 
+extern char **environ;
+
+
 #endif /* _NGX_POSIX_CONFIG_H_INCLUDED_ */
index a668b95e1b8ae1e4d1057623fa7486bddd74a624..ba1d351c773e4ad85c5e73bf4582bcedd7dbe20f 100644 (file)
@@ -88,4 +88,7 @@
 #define NGX_HAVE_OS_SPECIFIC_INIT    1
 
 
+extern char **environ;
+
+
 #endif /* _NGX_SOLARIS_CONFIG_H_INCLUDED_ */