| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/spdy/hpack_header_table.h" | 5 #include "net/spdy/hpack_header_table.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "net/spdy/hpack_constants.h" | 10 #include "net/spdy/hpack_constants.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 const char* const value; | 25 const char* const value; |
| 26 const size_t value_len; | 26 const size_t value_len; |
| 27 }; | 27 }; |
| 28 | 28 |
| 29 // The "constructor" for a StaticEntry that computes the lengths at | 29 // The "constructor" for a StaticEntry that computes the lengths at |
| 30 // compile time. | 30 // compile time. |
| 31 #define STATIC_ENTRY(name, value) \ | 31 #define STATIC_ENTRY(name, value) \ |
| 32 { name, arraysize(name) - 1, value, arraysize(value) - 1 } | 32 { name, arraysize(name) - 1, value, arraysize(value) - 1 } |
| 33 | 33 |
| 34 const StaticEntry kStaticTable[] = { | 34 const StaticEntry kStaticTable[] = { |
| 35 STATIC_ENTRY(":authority" , ""), // 1 | 35 STATIC_ENTRY(":authority" , ""), // 1 |
| 36 STATIC_ENTRY(":method" , "GET"), // 2 | 36 STATIC_ENTRY(":method" , "GET"), // 2 |
| 37 STATIC_ENTRY(":method" , "POST"), // 3 | 37 STATIC_ENTRY(":method" , "POST"), // 3 |
| 38 STATIC_ENTRY(":path" , "/"), // 4 | 38 STATIC_ENTRY(":path" , "/"), // 4 |
| 39 STATIC_ENTRY(":path" , "/index.html"), // 5 | 39 STATIC_ENTRY(":path" , "/index.html"), // 5 |
| 40 STATIC_ENTRY(":scheme" , "http"), // 6 | 40 STATIC_ENTRY(":scheme" , "http"), // 6 |
| 41 STATIC_ENTRY(":scheme" , "https"), // 7 | 41 STATIC_ENTRY(":scheme" , "https"), // 7 |
| 42 STATIC_ENTRY(":status" , "200"), // 8 | 42 STATIC_ENTRY(":status" , "200"), // 8 |
| 43 STATIC_ENTRY(":status" , "204"), // 9 | 43 STATIC_ENTRY(":status" , "204"), // 9 |
| 44 STATIC_ENTRY(":status" , "206"), // 10 | 44 STATIC_ENTRY(":status" , "206"), // 10 |
| 45 STATIC_ENTRY(":status" , "304"), // 11 | 45 STATIC_ENTRY(":status" , "304"), // 11 |
| 46 STATIC_ENTRY(":status" , "400"), // 12 | 46 STATIC_ENTRY(":status" , "400"), // 12 |
| 47 STATIC_ENTRY(":status" , "404"), // 13 | 47 STATIC_ENTRY(":status" , "404"), // 13 |
| 48 STATIC_ENTRY(":status" , "500"), // 14 | 48 STATIC_ENTRY(":status" , "500"), // 14 |
| 49 STATIC_ENTRY("accept-charset" , ""), // 15 | 49 STATIC_ENTRY("accept-charset" , ""), // 15 |
| 50 STATIC_ENTRY("accept-encoding" , ""), // 16 | 50 STATIC_ENTRY("accept-encoding" , "gzip, deflate"), // 16 |
| 51 STATIC_ENTRY("accept-language" , ""), // 17 | 51 STATIC_ENTRY("accept-language" , ""), // 17 |
| 52 STATIC_ENTRY("accept-ranges" , ""), // 18 | 52 STATIC_ENTRY("accept-ranges" , ""), // 18 |
| 53 STATIC_ENTRY("accept" , ""), // 19 | 53 STATIC_ENTRY("accept" , ""), // 19 |
| 54 STATIC_ENTRY("access-control-allow-origin" , ""), // 20 | 54 STATIC_ENTRY("access-control-allow-origin", ""), // 20 |
| 55 STATIC_ENTRY("age" , ""), // 21 | 55 STATIC_ENTRY("age" , ""), // 21 |
| 56 STATIC_ENTRY("allow" , ""), // 22 | 56 STATIC_ENTRY("allow" , ""), // 22 |
| 57 STATIC_ENTRY("authorization" , ""), // 23 | 57 STATIC_ENTRY("authorization" , ""), // 23 |
| 58 STATIC_ENTRY("cache-control" , ""), // 24 | 58 STATIC_ENTRY("cache-control" , ""), // 24 |
| 59 STATIC_ENTRY("content-disposition" , ""), // 25 | 59 STATIC_ENTRY("content-disposition" , ""), // 25 |
| 60 STATIC_ENTRY("content-encoding" , ""), // 26 | 60 STATIC_ENTRY("content-encoding" , ""), // 26 |
| 61 STATIC_ENTRY("content-language" , ""), // 27 | 61 STATIC_ENTRY("content-language" , ""), // 27 |
| 62 STATIC_ENTRY("content-length" , ""), // 28 | 62 STATIC_ENTRY("content-length" , ""), // 28 |
| 63 STATIC_ENTRY("content-location" , ""), // 29 | 63 STATIC_ENTRY("content-location" , ""), // 29 |
| 64 STATIC_ENTRY("content-range" , ""), // 30 | 64 STATIC_ENTRY("content-range" , ""), // 30 |
| 65 STATIC_ENTRY("content-type" , ""), // 31 | 65 STATIC_ENTRY("content-type" , ""), // 31 |
| 66 STATIC_ENTRY("cookie" , ""), // 32 | 66 STATIC_ENTRY("cookie" , ""), // 32 |
| 67 STATIC_ENTRY("date" , ""), // 33 | 67 STATIC_ENTRY("date" , ""), // 33 |
| 68 STATIC_ENTRY("etag" , ""), // 34 | 68 STATIC_ENTRY("etag" , ""), // 34 |
| 69 STATIC_ENTRY("expect" , ""), // 35 | 69 STATIC_ENTRY("expect" , ""), // 35 |
| 70 STATIC_ENTRY("expires" , ""), // 36 | 70 STATIC_ENTRY("expires" , ""), // 36 |
| 71 STATIC_ENTRY("from" , ""), // 37 | 71 STATIC_ENTRY("from" , ""), // 37 |
| 72 STATIC_ENTRY("host" , ""), // 38 | 72 STATIC_ENTRY("host" , ""), // 38 |
| 73 STATIC_ENTRY("if-match" , ""), // 39 | 73 STATIC_ENTRY("if-match" , ""), // 39 |
| 74 STATIC_ENTRY("if-modified-since" , ""), // 40 | 74 STATIC_ENTRY("if-modified-since" , ""), // 40 |
| 75 STATIC_ENTRY("if-none-match" , ""), // 41 | 75 STATIC_ENTRY("if-none-match" , ""), // 41 |
| 76 STATIC_ENTRY("if-range" , ""), // 42 | 76 STATIC_ENTRY("if-range" , ""), // 42 |
| 77 STATIC_ENTRY("if-unmodified-since" , ""), // 43 | 77 STATIC_ENTRY("if-unmodified-since" , ""), // 43 |
| 78 STATIC_ENTRY("last-modified" , ""), // 44 | 78 STATIC_ENTRY("last-modified" , ""), // 44 |
| 79 STATIC_ENTRY("link" , ""), // 45 | 79 STATIC_ENTRY("link" , ""), // 45 |
| 80 STATIC_ENTRY("location" , ""), // 46 | 80 STATIC_ENTRY("location" , ""), // 46 |
| 81 STATIC_ENTRY("max-forwards" , ""), // 47 | 81 STATIC_ENTRY("max-forwards" , ""), // 47 |
| 82 STATIC_ENTRY("proxy-authenticate" , ""), // 48 | 82 STATIC_ENTRY("proxy-authenticate" , ""), // 48 |
| 83 STATIC_ENTRY("proxy-authorization" , ""), // 49 | 83 STATIC_ENTRY("proxy-authorization" , ""), // 49 |
| 84 STATIC_ENTRY("range" , ""), // 50 | 84 STATIC_ENTRY("range" , ""), // 50 |
| 85 STATIC_ENTRY("referer" , ""), // 51 | 85 STATIC_ENTRY("referer" , ""), // 51 |
| 86 STATIC_ENTRY("refresh" , ""), // 52 | 86 STATIC_ENTRY("refresh" , ""), // 52 |
| 87 STATIC_ENTRY("retry-after" , ""), // 53 | 87 STATIC_ENTRY("retry-after" , ""), // 53 |
| 88 STATIC_ENTRY("server" , ""), // 54 | 88 STATIC_ENTRY("server" , ""), // 54 |
| 89 STATIC_ENTRY("set-cookie" , ""), // 55 | 89 STATIC_ENTRY("set-cookie" , ""), // 55 |
| 90 STATIC_ENTRY("strict-transport-security" , ""), // 56 | 90 STATIC_ENTRY("strict-transport-security" , ""), // 56 |
| 91 STATIC_ENTRY("transfer-encoding" , ""), // 57 | 91 STATIC_ENTRY("transfer-encoding" , ""), // 57 |
| 92 STATIC_ENTRY("user-agent" , ""), // 58 | 92 STATIC_ENTRY("user-agent" , ""), // 58 |
| 93 STATIC_ENTRY("vary" , ""), // 59 | 93 STATIC_ENTRY("vary" , ""), // 59 |
| 94 STATIC_ENTRY("via" , ""), // 60 | 94 STATIC_ENTRY("via" , ""), // 60 |
| 95 STATIC_ENTRY("www-authenticate" , ""), // 61 | 95 STATIC_ENTRY("www-authenticate" , ""), // 61 |
| 96 }; | 96 }; |
| 97 | 97 |
| 98 #undef STATIC_ENTRY | 98 #undef STATIC_ENTRY |
| 99 | 99 |
| 100 } // namespace | 100 } // namespace |
| 101 | 101 |
| 102 bool HpackHeaderTable::EntryComparator::operator() ( | 102 bool HpackHeaderTable::EntryComparator::operator() ( |
| 103 const HpackEntry* lhs, const HpackEntry* rhs) const { | 103 const HpackEntry* lhs, const HpackEntry* rhs) const { |
| 104 int result = lhs->name().compare(rhs->name()); | 104 int result = lhs->name().compare(rhs->name()); |
| 105 if (result != 0) | 105 if (result != 0) |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 DVLOG(2) << " " << it->GetDebugString(); | 297 DVLOG(2) << " " << it->GetDebugString(); |
| 298 } | 298 } |
| 299 DVLOG(2) << "Full Index:"; | 299 DVLOG(2) << "Full Index:"; |
| 300 for (OrderedEntrySet::const_iterator it = index_.begin(); | 300 for (OrderedEntrySet::const_iterator it = index_.begin(); |
| 301 it != index_.end(); ++it) { | 301 it != index_.end(); ++it) { |
| 302 DVLOG(2) << " " << (*it)->GetDebugString(); | 302 DVLOG(2) << " " << (*it)->GetDebugString(); |
| 303 } | 303 } |
| 304 } | 304 } |
| 305 | 305 |
| 306 } // namespace net | 306 } // namespace net |
| OLD | NEW |