]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
first request on master connection only reports more preferred protocols in Upgrade...
authorStefan Eissing <icing@apache.org>
Mon, 26 Oct 2015 12:15:43 +0000 (12:15 +0000)
committerStefan Eissing <icing@apache.org>
Mon, 26 Oct 2015 12:15:43 +0000 (12:15 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1710583 13f79535-47bb-0310-9956-ffa450edef68

include/http_protocol.h
server/core.c
server/protocol.c

index 20e1b782e74ea71cb4847f256a2d88e4016ebc00..34d62ad29afcd64b50fd26cc060c301529ad3b7f 100644 (file)
@@ -788,14 +788,19 @@ AP_DECLARE_HOOK(const char *,protocol_get,(const conn_rec *c))
  * upgrade to - besides the protocol currently active on the connection. These
  * values may be used to announce to a client what choices it has.
  *
+ * If report_all == 0, only protocols more preferable than the one currently
+ * being used, are reported. Otherwise, all available protocols beside the
+ * current one are being reported.
+ *
  * @param c The current connection
  * @param r The current request or NULL
  * @param s The server/virtual host selected or NULL
+ * @param report_all include also protocols less preferred than the current one
  * @param pupgrades on return, possible protocols to upgrade to in descending order 
  *                 of preference. Maybe NULL if none are available.    
  */
 AP_DECLARE(apr_status_t) ap_get_protocol_upgrades(conn_rec *c, request_rec *r, 
-                                                  server_rec *s, 
+                                                  server_rec *s, int report_all, 
                                                   const apr_array_header_t **pupgrades);
                                                   
 /**
index de1c19c835816d927a62ba1f4b85ea164b7d7538..5602e5730a27ba2304034d0dc14454c75559b56c 100644 (file)
@@ -5392,7 +5392,7 @@ static int core_upgrade_handler(request_rec *r)
          * client. If the client is already talking a protocol with requests
          * on slave connections, leave it be. */
         const apr_array_header_t *upgrades;
-        ap_get_protocol_upgrades(c, r, NULL, &upgrades);
+        ap_get_protocol_upgrades(c, r, NULL, 0, &upgrades);
         if (upgrades && upgrades->nelts > 0) {
             char *protocols = apr_array_pstrcat(r->pool, upgrades, ',');
             apr_table_setn(r->headers_out, "Upgrade", protocols);
index f8b9b103a4578182c6ab24a850ec78fbeba02adc..810d3b056bed0ff4d35457dec62601dc98595945 100644 (file)
@@ -1983,7 +1983,7 @@ AP_DECLARE(const char *) ap_get_protocol(conn_rec *c)
 }
 
 AP_DECLARE(apr_status_t) ap_get_protocol_upgrades(conn_rec *c, request_rec *r, 
-                                                  server_rec *s, 
+                                                  server_rec *s, int report_all, 
                                                   const apr_array_header_t **pupgrades)
 {
     apr_pool_t *pool = r? r->pool : c->pool;
@@ -2012,6 +2012,9 @@ AP_DECLARE(apr_status_t) ap_get_protocol_upgrades(conn_rec *c, request_rec *r,
                     /* not the one we have and possible, add in this order */
                     APR_ARRAY_PUSH(upgrades, const char*) = p;
                 }
+                else if (!report_all) {
+                    break;
+                }
             }
         }
     }