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_balsa_utils.h" | 5 #include "net/tools/quic/spdy_balsa_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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 headers.header_lines_begin(); | 43 headers.header_lines_begin(); |
44 hi != headers.header_lines_end(); ++hi) { | 44 hi != headers.header_lines_end(); ++hi) { |
45 if ((hi->second.length() == 0) && !allow_empty_values) { | 45 if ((hi->second.length() == 0) && !allow_empty_values) { |
46 DVLOG(1) << "Dropping empty header " << hi->first.as_string() | 46 DVLOG(1) << "Dropping empty header " << hi->first.as_string() |
47 << " from headers"; | 47 << " from headers"; |
48 continue; | 48 continue; |
49 } | 49 } |
50 | 50 |
51 // This unfortunately involves loads of copying, but its the simplest way | 51 // This unfortunately involves loads of copying, but its the simplest way |
52 // to sort the headers and leverage the framer. | 52 // to sort the headers and leverage the framer. |
53 string name = hi->first.as_string(); | 53 string name = base::ToLowerASCII(hi->first.as_string()); |
54 base::StringToLowerASCII(&name); | |
55 SpdyHeaderBlock::iterator it = block->find(name); | 54 SpdyHeaderBlock::iterator it = block->find(name); |
56 if (it != block->end()) { | 55 if (it != block->end()) { |
57 it->second.reserve(it->second.size() + 1 + hi->second.size()); | 56 it->second.reserve(it->second.size() + 1 + hi->second.size()); |
58 it->second.append("\0", 1); | 57 it->second.append("\0", 1); |
59 it->second.append(hi->second.data(), hi->second.size()); | 58 it->second.append(hi->second.data(), hi->second.size()); |
60 } else { | 59 } else { |
61 block->insert(make_pair(name, hi->second.as_string())); | 60 block->insert(make_pair(name, hi->second.as_string())); |
62 } | 61 } |
63 } | 62 } |
64 } | 63 } |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 // static | 347 // static |
349 void SpdyBalsaUtils::SpdyHeadersToRequestHeaders(const SpdyHeaderBlock& block, | 348 void SpdyBalsaUtils::SpdyHeadersToRequestHeaders(const SpdyHeaderBlock& block, |
350 BalsaHeaders* headers, | 349 BalsaHeaders* headers, |
351 QuicVersion quic_version) { | 350 QuicVersion quic_version) { |
352 SpdyHeadersToBalsaHeaders(block, headers, quic_version, | 351 SpdyHeadersToBalsaHeaders(block, headers, quic_version, |
353 SpdyHeaderValidatorType::REQUEST); | 352 SpdyHeaderValidatorType::REQUEST); |
354 } | 353 } |
355 | 354 |
356 } // namespace tools | 355 } // namespace tools |
357 } // namespace net | 356 } // namespace net |
OLD | NEW |