OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/spdy_test_util_common.h" | 5 #include "net/spdy/spdy_test_util_common.h" |
6 | 6 |
7 #include <cstddef> | 7 #include <cstddef> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
969 } | 969 } |
970 | 970 |
971 SpdyFrame* SpdyTestUtil::ConstructSpdyConnect( | 971 SpdyFrame* SpdyTestUtil::ConstructSpdyConnect( |
972 const char* const extra_headers[], | 972 const char* const extra_headers[], |
973 int extra_header_count, | 973 int extra_header_count, |
974 int stream_id, | 974 int stream_id, |
975 RequestPriority priority, | 975 RequestPriority priority, |
976 const HostPortPair& host_port_pair) const { | 976 const HostPortPair& host_port_pair) const { |
977 SpdyHeaderBlock block; | 977 SpdyHeaderBlock block; |
978 block[GetMethodKey()] = "CONNECT"; | 978 block[GetMethodKey()] = "CONNECT"; |
979 block[GetPathKey()] = host_port_pair.ToString(); | 979 if (spdy_version() < HTTP2) { |
980 block[GetHostKey()] = (host_port_pair.port() == 443) | 980 block[GetPathKey()] = host_port_pair.ToString(); |
981 ? host_port_pair.host() | 981 block[GetHostKey()] = (host_port_pair.port() == 443) |
982 : host_port_pair.ToString(); | 982 ? host_port_pair.host() |
| 983 : host_port_pair.ToString(); |
| 984 } else { |
| 985 block[GetHostKey()] = host_port_pair.ToString(); |
| 986 } |
| 987 |
983 MaybeAddVersionHeader(&block); | 988 MaybeAddVersionHeader(&block); |
984 AppendToHeaderBlock(extra_headers, extra_header_count, &block); | 989 AppendToHeaderBlock(extra_headers, extra_header_count, &block); |
985 return ConstructSpdySyn(stream_id, block, priority, false, false); | 990 return ConstructSpdySyn(stream_id, block, priority, false, false); |
986 } | 991 } |
987 | 992 |
988 SpdyFrame* SpdyTestUtil::ConstructSpdyPush(const char* const extra_headers[], | 993 SpdyFrame* SpdyTestUtil::ConstructSpdyPush(const char* const extra_headers[], |
989 int extra_header_count, | 994 int extra_header_count, |
990 int stream_id, | 995 int stream_id, |
991 int associated_stream_id, | 996 int associated_stream_id, |
992 const char* url) { | 997 const char* url) { |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1328 } | 1333 } |
1329 } | 1334 } |
1330 | 1335 |
1331 void SpdyTestUtil::SetPriority(RequestPriority priority, | 1336 void SpdyTestUtil::SetPriority(RequestPriority priority, |
1332 SpdySynStreamIR* ir) const { | 1337 SpdySynStreamIR* ir) const { |
1333 ir->set_priority(ConvertRequestPriorityToSpdyPriority( | 1338 ir->set_priority(ConvertRequestPriorityToSpdyPriority( |
1334 priority, spdy_version())); | 1339 priority, spdy_version())); |
1335 } | 1340 } |
1336 | 1341 |
1337 } // namespace net | 1342 } // namespace net |
OLD | NEW |