You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ic...@apache.org on 2015/10/26 13:15:43 UTC

svn commit: r1710583 - in /httpd/httpd/trunk: include/http_protocol.h server/core.c server/protocol.c

Author: icing
Date: Mon Oct 26 12:15:43 2015
New Revision: 1710583

URL: http://svn.apache.org/viewvc?rev=1710583&view=rev
Log:
first request on master connection only reports more preferred protocols in Upgrade header

Modified:
    httpd/httpd/trunk/include/http_protocol.h
    httpd/httpd/trunk/server/core.c
    httpd/httpd/trunk/server/protocol.c

Modified: httpd/httpd/trunk/include/http_protocol.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/http_protocol.h?rev=1710583&r1=1710582&r2=1710583&view=diff
==============================================================================
--- httpd/httpd/trunk/include/http_protocol.h (original)
+++ httpd/httpd/trunk/include/http_protocol.h Mon Oct 26 12:15:43 2015
@@ -788,14 +788,19 @@ AP_DECLARE_HOOK(const char *,protocol_ge
  * 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);
                                                   
 /**

Modified: httpd/httpd/trunk/server/core.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/core.c?rev=1710583&r1=1710582&r2=1710583&view=diff
==============================================================================
--- httpd/httpd/trunk/server/core.c (original)
+++ httpd/httpd/trunk/server/core.c Mon Oct 26 12:15:43 2015
@@ -5392,7 +5392,7 @@ static int core_upgrade_handler(request_
          * 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);

Modified: httpd/httpd/trunk/server/protocol.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/protocol.c?rev=1710583&r1=1710582&r2=1710583&view=diff
==============================================================================
--- httpd/httpd/trunk/server/protocol.c (original)
+++ httpd/httpd/trunk/server/protocol.c Mon Oct 26 12:15:43 2015
@@ -1983,7 +1983,7 @@ AP_DECLARE(const char *) ap_get_protocol
 }
 
 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
                     /* not the one we have and possible, add in this order */
                     APR_ARRAY_PUSH(upgrades, const char*) = p;
                 }
+                else if (!report_all) {
+                    break;
+                }
             }
         }
     }