summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authormbelshe@google.com <mbelshe@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-29 02:17:11 +0000
committermbelshe@google.com <mbelshe@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-29 02:17:11 +0000
commit337515616bdf6d3cc49cfbbceaa6400f40784369 (patch)
tree40ea133e29fcc049fc6dcdc0b4c6f19aaf4f7fcd /net
parent20aa3e526e7a8717a6ea1033580b5bc5d47275ab (diff)
downloadchromium_src-337515616bdf6d3cc49cfbbceaa6400f40784369.zip
chromium_src-337515616bdf6d3cc49cfbbceaa6400f40784369.tar.gz
chromium_src-337515616bdf6d3cc49cfbbceaa6400f40784369.tar.bz2
FLIP requests were missing the host header.
Update the unit test as well. BUG=none TEST=flip_transaction_unittest.cc Review URL: http://codereview.chromium.org/340025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30420 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/flip/flip_network_transaction_unittest.cc42
-rw-r--r--net/flip/flip_session.cc2
2 files changed, 26 insertions, 18 deletions
diff --git a/net/flip/flip_network_transaction_unittest.cc b/net/flip/flip_network_transaction_unittest.cc
index 84e0e78..4f41063 100644
--- a/net/flip/flip_network_transaction_unittest.cc
+++ b/net/flip/flip_network_transaction_unittest.cc
@@ -147,15 +147,18 @@ TEST_F(FlipNetworkTransactionTest, Constructor) {
TEST_F(FlipNetworkTransactionTest, Get) {
static const unsigned char syn[] = {
0x80, 0x01, 0x00, 0x01, // header
- 0x01, 0x00, 0x00, 0x30, // FIN, len
+ 0x01, 0x00, 0x00, 0x46, // FIN, len
0x00, 0x00, 0x00, 0x01, // stream id
- 0xc0, 0x00, 0x00, 0x03, // 4 headers
- 0x00, 0x06, 'm', 'e', 't', 'h', 'o', 'd', // "hello"
- 0x00, 0x03, 'G', 'E', 'T', // "bye"
- 0x00, 0x03, 'u', 'r', 'l', // "url"
- 0x00, 0x01, '/', // "/"
- 0x00, 0x07, 'v', 'e', 'r', 's', 'i', 'o', 'n', // "status"
- 0x00, 0x08, 'H', 'T', 'T', 'P', '/', '1', '.', '1', // "200"
+ 0xc0, 0x00, 0x00, 0x04, // 4 headers
+ 0x00, 0x04, 'h', 'o', 's', 't',
+ 0x00, 0x0e, 'w', 'w', 'w', '.', 'g', 'o', 'o', 'g', 'l', 'e',
+ '.', 'c', 'o', 'm',
+ 0x00, 0x06, 'm', 'e', 't', 'h', 'o', 'd',
+ 0x00, 0x03, 'G', 'E', 'T',
+ 0x00, 0x03, 'u', 'r', 'l',
+ 0x00, 0x01, '/',
+ 0x00, 0x07, 'v', 'e', 'r', 's', 'i', 'o', 'n',
+ 0x00, 0x08, 'H', 'T', 'T', 'P', '/', '1', '.', '1',
};
static const unsigned char syn_reply[] = {
@@ -221,16 +224,19 @@ TEST_F(FlipNetworkTransactionTest, Post) {
// TODO(mbelshe): Hook up the write validation.
//static const unsigned char syn[] = {
- // 0x80, 0x01, 0x00, 0x01, // header
- // 0x00, 0x00, 0x00, 0x30, // FIN, len
- // 0x00, 0x00, 0x00, 0x01, // stream id
- // 0xc0, 0x00, 0x00, 0x03, // 4 headers
- // 0x00, 0x06, 'm', 'e', 't', 'h', 'o', 'd', // "hello"
- // 0x00, 0x03, 'G', 'E', 'T', // "bye"
- // 0x00, 0x03, 'u', 'r', 'l', // "url"
- // 0x00, 0x01, '/', // "/"
- // 0x00, 0x07, 'v', 'e', 'r', 's', 'i', 'o', 'n', // "status"
- // 0x00, 0x08, 'H', 'T', 'T', 'P', '/', '1', '.', '1', // "200"
+ // 0x80, 0x01, 0x00, 0x01, // header
+ // 0x01, 0x00, 0x00, 0x46, // FIN, len
+ // 0x00, 0x00, 0x00, 0x01, // stream id
+ // 0xc0, 0x00, 0x00, 0x04, // 4 headers
+ // 0x00, 0x04, 'h', 'o', 's', 't',
+ // 0x00, 0x0e, 'w', 'w', 'w', '.', 'g', 'o', 'o', 'g', 'l', 'e',
+ // '.', 'c', 'o', 'm',
+ // 0x00, 0x06, 'm', 'e', 't', 'h', 'o', 'd',
+ // 0x00, 0x03, 'G', 'E', 'T',
+ // 0x00, 0x03, 'u', 'r', 'l',
+ // 0x00, 0x01, '/',
+ // 0x00, 0x07, 'v', 'e', 'r', 's', 'i', 'o', 'n',
+ // 0x00, 0x08, 'H', 'T', 'T', 'P', '/', '1', '.', '1',
//};
//static const unsigned char upload_frame[] = {
diff --git a/net/flip/flip_session.cc b/net/flip/flip_session.cc
index 70a4abe..c081c5d 100644
--- a/net/flip/flip_session.cc
+++ b/net/flip/flip_session.cc
@@ -12,6 +12,7 @@
#include "base/string_util.h"
#include "net/base/bandwidth_metrics.h"
#include "net/base/load_flags.h"
+#include "net/base/net_util.h"
#include "net/flip/flip_frame_builder.h"
#include "net/flip/flip_protocol.h"
#include "net/http/http_network_session.h"
@@ -195,6 +196,7 @@ void CreateFlipHeadersFromHttpRequest(
(*headers)["method"] = info->method;
(*headers)["url"] = hack_url;
(*headers)["version"] = kHttpProtocolVersion;
+ (*headers)["host"] = GetHostAndOptionalPort(info->url);
if (info->user_agent.length())
(*headers)["user-agent"] = info->user_agent;
if (!info->referrer.is_empty())