OLD | NEW |
---|---|
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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
153 for (HeaderVector::const_iterator it = other.headers_.begin(); | 153 for (HeaderVector::const_iterator it = other.headers_.begin(); |
154 it != other.headers_.end(); ++it ) { | 154 it != other.headers_.end(); ++it ) { |
155 SetHeader(it->key, it->value); | 155 SetHeader(it->key, it->value); |
156 } | 156 } |
157 } | 157 } |
158 | 158 |
159 std::string HttpRequestHeaders::ToString() const { | 159 std::string HttpRequestHeaders::ToString() const { |
160 std::string output; | 160 std::string output; |
161 for (HeaderVector::const_iterator it = headers_.begin(); | 161 for (HeaderVector::const_iterator it = headers_.begin(); |
162 it != headers_.end(); ++it) { | 162 it != headers_.end(); ++it) { |
163 if (!it->value.empty()) | 163 if (!it->value.empty()) |
brettw
2010/11/15 00:09:23
also {} on both the if (because it's >1 line) and
tfarina
2010/11/15 01:21:25
Done.
| |
164 StringAppendF(&output, "%s: %s\r\n", it->key.c_str(), it->value.c_str()); | 164 base::StringAppendF(&output, "%s: %s\r\n", |
165 it->key.c_str(), it->value.c_str()); | |
165 else | 166 else |
166 StringAppendF(&output, "%s:\r\n", it->key.c_str()); | 167 base::StringAppendF(&output, "%s:\r\n", it->key.c_str()); |
167 } | 168 } |
168 output.append("\r\n"); | 169 output.append("\r\n"); |
169 return output; | 170 return output; |
170 } | 171 } |
171 | 172 |
172 HttpRequestHeaders::HeaderVector::iterator | 173 HttpRequestHeaders::HeaderVector::iterator |
173 HttpRequestHeaders::FindHeader(const base::StringPiece& key) { | 174 HttpRequestHeaders::FindHeader(const base::StringPiece& key) { |
174 for (HeaderVector::iterator it = headers_.begin(); | 175 for (HeaderVector::iterator it = headers_.begin(); |
175 it != headers_.end(); ++it) { | 176 it != headers_.end(); ++it) { |
176 if (key.length() == it->key.length() && | 177 if (key.length() == it->key.length() && |
(...skipping 10 matching lines...) Expand all Loading... | |
187 it != headers_.end(); ++it) { | 188 it != headers_.end(); ++it) { |
188 if (key.length() == it->key.length() && | 189 if (key.length() == it->key.length() && |
189 !base::strncasecmp(key.data(), it->key.data(), key.length())) | 190 !base::strncasecmp(key.data(), it->key.data(), key.length())) |
190 return it; | 191 return it; |
191 } | 192 } |
192 | 193 |
193 return headers_.end(); | 194 return headers_.end(); |
194 } | 195 } |
195 | 196 |
196 } // namespace net | 197 } // namespace net |
OLD | NEW |