fix r2590: error_page made an external redirect without query string
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c
index ffdd0b0..b6f4b11 100644
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -3875,7 +3875,7 @@
     args.len = 0;
     args.data = NULL;
 
-    if (cv.lengths == NULL) {
+    if (cv.lengths == NULL && uri.data[0] == '/') {
         p = (u_char *) ngx_strchr(uri.data, '?');
 
         if (p) {
diff --git a/src/http/ngx_http_special_response.c b/src/http/ngx_http_special_response.c
index 38d0d39..f50f105 100644
--- a/src/http/ngx_http_special_response.c
+++ b/src/http/ngx_http_special_response.c
@@ -451,15 +451,15 @@
         return NGX_ERROR;
     }
 
-    if (err_page->value.lengths) {
-        ngx_http_split_args(r, &uri, &args);
-
-    } else {
-        args = err_page->args;
-    }
-
     if (uri.data[0] == '/') {
 
+        if (err_page->value.lengths) {
+            ngx_http_split_args(r, &uri, &args);
+
+        } else {
+            args = err_page->args;
+        }
+
         if (r->method != NGX_HTTP_HEAD) {
             r->method = NGX_HTTP_GET;
             r->method_name = ngx_http_get_name;