OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/tools/quic/spdy_utils.h" | 5 #include "net/tools/quic/spdy_utils.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 ++hi) { | 39 ++hi) { |
40 if ((hi->second.length() == 0) && !allow_empty_values) { | 40 if ((hi->second.length() == 0) && !allow_empty_values) { |
41 DVLOG(1) << "Dropping empty header " << hi->first.as_string() | 41 DVLOG(1) << "Dropping empty header " << hi->first.as_string() |
42 << " from headers"; | 42 << " from headers"; |
43 continue; | 43 continue; |
44 } | 44 } |
45 | 45 |
46 // This unfortunately involves loads of copying, but its the simplest way | 46 // This unfortunately involves loads of copying, but its the simplest way |
47 // to sort the headers and leverage the framer. | 47 // to sort the headers and leverage the framer. |
48 string name = hi->first.as_string(); | 48 string name = hi->first.as_string(); |
49 StringToLowerASCII(&name); | 49 base::StringToLowerASCII(&name); |
50 SpdyHeaderBlock::iterator it = block->find(name); | 50 SpdyHeaderBlock::iterator it = block->find(name); |
51 if (it != block->end()) { | 51 if (it != block->end()) { |
52 it->second.reserve(it->second.size() + 1 + hi->second.size()); | 52 it->second.reserve(it->second.size() + 1 + hi->second.size()); |
53 it->second.append("\0", 1); | 53 it->second.append("\0", 1); |
54 it->second.append(hi->second.data(), hi->second.size()); | 54 it->second.append(hi->second.data(), hi->second.size()); |
55 } else { | 55 } else { |
56 block->insert(make_pair(name, hi->second.as_string())); | 56 block->insert(make_pair(name, hi->second.as_string())); |
57 } | 57 } |
58 } | 58 } |
59 } | 59 } |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 for (BlockIt it = header_block.begin(); it != header_block.end(); ++it) { | 257 for (BlockIt it = header_block.begin(); it != header_block.end(); ++it) { |
258 if (!IsSpecialSpdyHeader(it, request_headers)) { | 258 if (!IsSpecialSpdyHeader(it, request_headers)) { |
259 request_headers->AppendHeader(it->first, it->second); | 259 request_headers->AppendHeader(it->first, it->second); |
260 } | 260 } |
261 } | 261 } |
262 return true; | 262 return true; |
263 } | 263 } |
264 | 264 |
265 } // namespace tools | 265 } // namespace tools |
266 } // namespace net | 266 } // namespace net |
OLD | NEW |