#include "url/gurl.h"
#if defined(SPDY_PROXY_AUTH_ORIGIN)
+#include <algorithm>
#include "net/proxy/proxy_server.h"
#endif
#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 ||
}
}
#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" ||