]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Merge of r1426802,1744460,1829799,1824716,1838318,1840678,1861294
authorStefan Eissing <icing@apache.org>
Thu, 18 Jul 2019 13:55:35 +0000 (13:55 +0000)
committerStefan Eissing <icing@apache.org>
Thu, 18 Jul 2019 13:55:35 +0000 (13:55 +0000)
  *) easy patches to synch 2.4.x and trunk:
        - core: extend description of r->hostname
        - mod_proxy_http: Avoid memory allocation before making sure that this handler can handle the URL
        - core: Save a few cycles in 'ap_parse_form_data()'
        - mod_cache_socache: Save some cycles
        - mod_proxy_ftp: Save some cycle
        - vhost: move an assignment to the end of the loop to ease readability and please a compiler
        - core: Be a little more verbose when an error in trigerred in 'ap_set_file_slot()'

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1863316 13f79535-47bb-0310-9956-ffa450edef68

STATUS
include/httpd.h
modules/cache/mod_cache_socache.c
modules/proxy/mod_proxy_ftp.c
modules/proxy/mod_proxy_http.c
server/config.c
server/util.c
server/vhost.c

diff --git a/STATUS b/STATUS
index 84b2eecb9a2731b10105c9c7d4a506e9b86d3671..54913c9dfbce86afa86418d5760e3e147690341f 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -127,25 +127,6 @@ RELEASE SHOWSTOPPERS:
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-  *) easy patches to synch 2.4.x and trunk:
-        - core: extend description of r->hostname
-        - mod_proxy_http: Avoid memory allocation before making sure that this handler can handle the URL
-        - core: Save a few cycles in 'ap_parse_form_data()'
-        - mod_cache_socache: Save some cycles
-        - mod_proxy_ftp: Save some cycle
-        - vhost: move an assignment to the end of the loop to ease readability and please a compiler
-        - core: Be a little more verbose when an error in trigerred in 'ap_set_file_slot()'
-     trunk patch:
-        - http://svn.apache.org/r1426802
-        - http://svn.apache.org/r1744460
-        - http://svn.apache.org/r1829799
-        - http://svn.apache.org/r1824716
-        - http://svn.apache.org/r1838318
-        - http://svn.apache.org/r1840678
-        - http://svn.apache.org/r1861294
-     2.4.x patch: svn merge -c 1426802,1744460,1829799,1824716,1838318,1840678,1861294 ^/httpd/httpd/trunk . 
-     +1: jailletc36, jim, icing
-
   *) cache_storage: be consistent when building a cache key value when CacheKeyBaseURL is used with
                     an URL that contains a :port.
                     PR 53915 [Rein Tollevik <rein basefarm.no>]
index 3391e9e18c6b9bc7ce115ab9331cc57125d875ea..98a410199bdf93315a32a537cd209013af7f815a 100644 (file)
@@ -826,7 +826,9 @@ struct request_rec {
     int proto_num;
     /** Protocol string, as given to us, or HTTP/0.9 */
     char *protocol;
-    /** Host, as set by full URI or Host: */
+    /** Host, as set by full URI or Host: header.
+     *  For literal IPv6 addresses, this does NOT include the surrounding [ ]
+     */
     const char *hostname;
 
     /** Time when the request started */
index ecaf3763b1d3c58c63f4133d6c92d6aa3805116e..d5bba99d3ebe081ea55ed1ac1a49575c74166c82 100644 (file)
@@ -217,8 +217,8 @@ static apr_status_t read_table(cache_handle_t *handle, request_rec *r,
             while (apr_isspace(buffer[colon]) && (colon < *slider)) {
                 colon++;
             }
-            apr_table_addn(table, apr_pstrndup(r->pool, (const char *) buffer
-                    + key, len - key), apr_pstrndup(r->pool,
+            apr_table_addn(table, apr_pstrmemdup(r->pool, (const char *) buffer
+                    + key, len - key), apr_pstrmemdup(r->pool,
                     (const char *) buffer + colon, *slider - colon));
             (*slider)++;
             if (buffer[*slider] == '\n') {
index a29e085abf19018cc8c12b64d137a58f6e7753d2..49acdcbc1cd355fa2f9ba0d1c938acb339e30c97 100644 (file)
@@ -813,17 +813,19 @@ proxy_ftp_command(const char *cmd, request_rec *r, conn_rec *ftp_ctrl,
         APR_BRIGADE_INSERT_TAIL(bb, apr_bucket_flush_create(c->bucket_alloc));
         ap_pass_brigade(ftp_ctrl->output_filters, bb);
 
-        /* strip off the CRLF for logging */
-        apr_cpystrn(message, cmd, sizeof(message));
-        if ((crlf = strchr(message, '\r')) != NULL ||
-            (crlf = strchr(message, '\n')) != NULL)
-            *crlf = '\0';
-        if (strncmp(message,"PASS ", 5) == 0)
-            strcpy(&message[5], "****");
-        ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r, ">%s", message);
+        if (APLOGrtrace2(r)) {
+            /* strip off the CRLF for logging */
+            apr_cpystrn(message, cmd, sizeof(message));
+            if ((crlf = strchr(message, '\r')) != NULL ||
+                (crlf = strchr(message, '\n')) != NULL)
+                *crlf = '\0';
+            if (strncmp(message,"PASS ", 5) == 0)
+                strcpy(&message[5], "****");
+            ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r, ">%s", message);
+        }
     }
 
-    rc = ftp_getrc_msg(ftp_ctrl, bb, message, sizeof message);
+    rc = ftp_getrc_msg(ftp_ctrl, bb, message, sizeof(message));
     if (rc == -1 || rc == 421)
         strcpy(message,"<unable to read result>");
     if ((crlf = strchr(message, '\r')) != NULL ||
index e86ae1fb2f57cdf77c7b0fdc618545b3c7e0d1d2..ec1e042c4e0feff63d53087d09ca2285ab6e4c10 100644 (file)
@@ -1951,12 +1951,12 @@ static int proxy_http_handler(request_rec *r, proxy_worker *worker,
      * and avoid a memory leak
      */
     apr_pool_t *p = r->pool;
-    apr_uri_t *uri = apr_palloc(p, sizeof(*uri));
+    apr_uri_t *uri;
 
     /* find the scheme */
     u = strchr(url, ':');
     if (u == NULL || u[1] != '/' || u[2] != '/' || u[3] == '\0')
-       return DECLINED;
+        return DECLINED;
     if ((u - url) > 14)
         return HTTP_BAD_REQUEST;
     scheme = apr_pstrmemdup(p, url, u - url);
@@ -2041,6 +2041,7 @@ static int proxy_http_handler(request_rec *r, proxy_worker *worker,
     }
 
     /* Step One: Determine Who To Connect To */
+    uri = apr_palloc(p, sizeof(*uri));
     if ((status = ap_proxy_determine_connection(p, r, conf, worker, backend,
                                             uri, &locurl, proxyname,
                                             proxyport, req->server_portstr,
index 16d4d9fde8411df0eb96679b8002833f77e8e5f1..e5ec2b006ea439371e264824b574d3f07556aa86 100644 (file)
@@ -1542,8 +1542,8 @@ AP_DECLARE_NONSTD(const char *) ap_set_file_slot(cmd_parms *cmd, void *struct_pt
     path = ap_server_root_relative(cmd->pool, arg);
 
     if (!path) {
-        return apr_pstrcat(cmd->pool, "Invalid file path ",
-                           arg, NULL);
+        return apr_pstrcat(cmd->pool, cmd->cmd->name, ": Invalid file path '",
+                           arg, "'", NULL);
     }
 
     *(const char **) ((char*)struct_ptr + offset) = path;
index b235a12f5b6581e8811c30de9f0739b325f8c4a3..5cdd71d5683912ec73a8ac9cc21bf5d4d3a668a1 100644 (file)
@@ -2768,12 +2768,11 @@ AP_DECLARE(int) ap_parse_form_data(request_rec *r, ap_filter_t *f,
                     case FORM_NAME:
                         if (offset < HUGE_STRING_LEN) {
                             if ('=' == c) {
-                                buffer[offset] = 0;
-                                offset = 0;
                                 pair = (ap_form_pair_t *) apr_array_push(pairs);
-                                pair->name = apr_pstrdup(r->pool, buffer);
+                                pair->name = apr_pstrmemdup(r->pool, buffer, offset);
                                 pair->value = apr_brigade_create(r->pool, r->connection->bucket_alloc);
                                 state = FORM_VALUE;
+                                offset = 0;
                             }
                             else {
                                 buffer[offset++] = c;
index b23b2dd3179d22c52f50a1e2cb76305bbf913f88..87bdcceeeb5da003f27118cd48d17b203408dd13 100644 (file)
@@ -1031,7 +1031,6 @@ static void check_hostalias(request_rec *r)
                 goto found;
             }
         }
-        last_s = s;
 
         /* Fallback: does it match the virthost from the sar? */
         if (!strcasecmp(host, sar->virthost)) {
@@ -1040,6 +1039,8 @@ static void check_hostalias(request_rec *r)
                 virthost_s = s;
             }
         }
+
+        last_s = s;
     }
 
     /* If ServerName and ServerAlias check failed, we end up here.  If it