diff src/http/modules/perl/ngx_http_perl_module.c @ 172:1b490fc19afa NGINX_0_3_33

nginx 0.3.33 *) Feature: the "http_503" parameter of the "proxy_next_upstream" or "fastcgi_next_upstream" directives. *) Bugfix: ngx_http_perl_module did not work with inlined in the configuration code, if it was not started with the "sub" word. *) Bugfix: in the "post_action" directive.
author Igor Sysoev <http://sysoev.ru>
date Wed, 15 Mar 2006 00:00:00 +0300
parents 3314be145cb9
children 87699398f955
line wrap: on
line diff
--- a/src/http/modules/perl/ngx_http_perl_module.c
+++ b/src/http/modules/perl/ngx_http_perl_module.c
@@ -692,10 +692,18 @@ ngx_http_perl_call_handler(pTHX_ ngx_htt
 static void
 ngx_http_perl_eval_anon_sub(pTHX_ ngx_str_t *handler, SV **sv)
 {
-    if (ngx_strncmp(handler->data, "sub ", 4) == 0
-        || ngx_strncmp(handler->data, "use ", 4) == 0)
+    u_char  *p;
+
+    for (p = handler->data; *p; p++) {
+        if (*p != ' ' && *p != '\t' && *p != CR && *p != LF) {
+            break;
+        }
+    }
+
+    if (ngx_strncmp(p, "sub ", 4) == 0
+        || ngx_strncmp(p, "use ", 4) == 0)
     {
-        *sv = eval_pv((char *) handler->data, FALSE);
+        *sv = eval_pv((char *) p, FALSE);
 
         return;
     }