Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / net / http / http_network_transaction.cc
index 10501a4..7e9819a 100644 (file)
@@ -62,6 +62,7 @@
 #include "url/gurl.h"
 
 #if defined(SPDY_PROXY_AUTH_ORIGIN)
+#include <algorithm>
 #include "net/proxy/proxy_server.h"
 #endif
 
@@ -1018,14 +1019,21 @@ int HttpNetworkTransaction::DoReadHeadersComplete(int result) {
 #endif
 
     if (chrome_proxy_used || chrome_fallback_proxy_used) {
-      if (response_.headers->GetChromeProxyInfo(&chrome_proxy_info)) {
+      // A Via header might not be present in a 304. Since the goal of a 304
+      // response is to minimize information transfer, a sender in general
+      // should not generate representation metadata other than Cache-Control,
+      // Content-Location, Date, ETag, Expires, and Vary.
+      if (!response_.headers->IsChromeProxyResponse() &&
+          (response_.headers->response_code() != HTTP_NOT_MODIFIED)) {
+        proxy_bypass_event = ProxyService::MISSING_VIA_HEADER;
+      } else if (response_.headers->GetChromeProxyInfo(&chrome_proxy_info)) {
         if (chrome_proxy_info.bypass_duration < TimeDelta::FromMinutes(30))
           proxy_bypass_event = ProxyService::SHORT_BYPASS;
         else
           proxy_bypass_event = ProxyService::LONG_BYPASS;
       } else {
         // Additionally, fallback if a 500, 502 or 503 is returned via the data
-        // reduction proxy. This is conservative, as the 500, 501 or 502 might
+        // reduction proxy. This is conservative, as the 500, 502 or 503 might
         // have been generated by the origin, and not the proxy.
         if (response_.headers->response_code() == HTTP_INTERNAL_SERVER_ERROR ||
             response_.headers->response_code() == HTTP_BAD_GATEWAY ||
@@ -1053,10 +1061,11 @@ int HttpNetworkTransaction::DoReadHeadersComplete(int result) {
             }
         }
 #endif
-        if (proxy_service->MarkProxiesAsBad(proxy_info_,
-                                            chrome_proxy_info.bypass_duration,
-                                            proxy_server,
-                                            net_log_)) {
+        if (proxy_service->MarkProxiesAsBadUntil(
+                proxy_info_,
+                chrome_proxy_info.bypass_duration,
+                proxy_server,
+                net_log_)) {
           // Only retry idempotent methods. We don't want to resubmit a POST
           // if the proxy took some action.
           if (request_->method == "GET" ||