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

Side by Side Diff: net/http/http_request_headers.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/http/http_request_headers.h ('k') | net/http/http_request_headers_unittest.cc » ('j') | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #include "net/http/http_request_headers.h" 5 #include "net/http/http_request_headers.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/string_split.h" 8 #include "base/string_split.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "net/http/http_util.h" 10 #include "net/http/http_util.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 if (it == headers_.end()) 69 if (it == headers_.end())
70 return false; 70 return false;
71 out->assign(it->value); 71 out->assign(it->value);
72 return true; 72 return true;
73 } 73 }
74 74
75 void HttpRequestHeaders::Clear() { 75 void HttpRequestHeaders::Clear() {
76 headers_.clear(); 76 headers_.clear();
77 } 77 }
78 78
79 void HttpRequestHeaders::SetHeaderIfMissing(const base::StringPiece& key,
80 const base::StringPiece& value) {
81 HeaderVector::iterator it = FindHeader(key);
82 if (it == headers_.end())
83 headers_.push_back(HeaderKeyValuePair(key.as_string(), value.as_string()));
84 }
85
79 void HttpRequestHeaders::SetHeader(const base::StringPiece& key, 86 void HttpRequestHeaders::SetHeader(const base::StringPiece& key,
80 const base::StringPiece& value) { 87 const base::StringPiece& value) {
81 HeaderVector::iterator it = FindHeader(key); 88 HeaderVector::iterator it = FindHeader(key);
82 if (it != headers_.end()) 89 if (it != headers_.end())
83 it->value = value.as_string(); 90 it->value = value.as_string();
84 else 91 else
85 headers_.push_back(HeaderKeyValuePair(key.as_string(), value.as_string())); 92 headers_.push_back(HeaderKeyValuePair(key.as_string(), value.as_string()));
86 } 93 }
87 94
88 void HttpRequestHeaders::RemoveHeader(const base::StringPiece& key) { 95 void HttpRequestHeaders::RemoveHeader(const base::StringPiece& key) {
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 it != headers_.end(); ++it) { 196 it != headers_.end(); ++it) {
190 if (key.length() == it->key.length() && 197 if (key.length() == it->key.length() &&
191 !base::strncasecmp(key.data(), it->key.data(), key.length())) 198 !base::strncasecmp(key.data(), it->key.data(), key.length()))
192 return it; 199 return it;
193 } 200 }
194 201
195 return headers_.end(); 202 return headers_.end();
196 } 203 }
197 204
198 } // namespace net 205 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_request_headers.h ('k') | net/http/http_request_headers_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698