Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Side by Side Diff: webkit/glue/weburlloader_impl.cc

Issue 6065008: Do not override User-Agent header added by WebCore (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/url_request/url_request_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // An implementation of WebURLLoader in terms of ResourceLoaderBridge. 5 // An implementation of WebURLLoader in terms of ResourceLoaderBridge.
6 6
7 #include "webkit/glue/weburlloader_impl.h" 7 #include "webkit/glue/weburlloader_impl.h"
8 8
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 has_accept_header_(false) { 62 has_accept_header_(false) {
63 } 63 }
64 64
65 virtual void visitHeader(const WebString& name, const WebString& value) { 65 virtual void visitHeader(const WebString& name, const WebString& value) {
66 // TODO(darin): is UTF-8 really correct here? It is if the strings are 66 // TODO(darin): is UTF-8 really correct here? It is if the strings are
67 // already ASCII (i.e., if they are already escaped properly). 67 // already ASCII (i.e., if they are already escaped properly).
68 const std::string& name_utf8 = name.utf8(); 68 const std::string& name_utf8 = name.utf8();
69 const std::string& value_utf8 = value.utf8(); 69 const std::string& value_utf8 = value.utf8();
70 70
71 // Skip over referrer headers found in the header map because we already 71 // Skip over referrer headers found in the header map because we already
72 // pulled it out as a separate parameter. We likewise prune the UA since 72 // pulled it out as a separate parameter.
73 // that will be added back by the network layer. 73 if (LowerCaseEqualsASCII(name_utf8, "referer"))
74 if (LowerCaseEqualsASCII(name_utf8, "referer") ||
75 LowerCaseEqualsASCII(name_utf8, "user-agent"))
76 return; 74 return;
77 75
78 // Skip over "Cache-Control: max-age=0" header if the corresponding 76 // Skip over "Cache-Control: max-age=0" header if the corresponding
79 // load flag is already specified. FrameLoader sets both the flag and 77 // load flag is already specified. FrameLoader sets both the flag and
80 // the extra header -- the extra header is redundant since our network 78 // the extra header -- the extra header is redundant since our network
81 // implementation will add the necessary headers based on load flags. 79 // implementation will add the necessary headers based on load flags.
82 // See http://code.google.com/p/chromium/issues/detail?id=3434. 80 // See http://code.google.com/p/chromium/issues/detail?id=3434.
83 if ((load_flags_ & net::LOAD_VALIDATE_CACHE) && 81 if ((load_flags_ & net::LOAD_VALIDATE_CACHE) &&
84 LowerCaseEqualsASCII(name_utf8, "cache-control") && 82 LowerCaseEqualsASCII(name_utf8, "cache-control") &&
85 LowerCaseEqualsASCII(value_utf8, "max-age=0")) 83 LowerCaseEqualsASCII(value_utf8, "max-age=0"))
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
752 750
753 void WebURLLoaderImpl::cancel() { 751 void WebURLLoaderImpl::cancel() {
754 context_->Cancel(); 752 context_->Cancel();
755 } 753 }
756 754
757 void WebURLLoaderImpl::setDefersLoading(bool value) { 755 void WebURLLoaderImpl::setDefersLoading(bool value) {
758 context_->SetDefersLoading(value); 756 context_->SetDefersLoading(value);
759 } 757 }
760 758
761 } // namespace webkit_glue 759 } // namespace webkit_glue
OLDNEW
« no previous file with comments | « net/url_request/url_request_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698