diff --git a/examples/spdycat.cc b/examples/spdycat.cc index 1c2a602..a915f13 100644 --- a/examples/spdycat.cc +++ b/examples/spdycat.cc @@ -46,6 +46,7 @@ #include #include #include +#include #include #include @@ -163,10 +164,14 @@ int communicate(const std::string& host, uint16_t port, nfds_t npollfds = 1; pollfd pollfds[1]; + std::stringstream ss; + ss << host << ":" << port; + std::string hostport = ss.str(); + for(int i = 0, n = reqvec.size(); i < n; ++i) { uri::UriStruct& us = reqvec[i].us; std::string path = us.dir+us.file+us.query; - int r = sc.submit_request(path, 3); + int r = sc.submit_request(hostport, path, 3); assert(r == 0); path2req[path] = &reqvec[i]; } diff --git a/examples/spdylay_ssl.cc b/examples/spdylay_ssl.cc index aef167d..c9e327e 100644 --- a/examples/spdylay_ssl.cc +++ b/examples/spdylay_ssl.cc @@ -104,9 +104,11 @@ int Spdylay::fd() const return fd_; } -int Spdylay::submit_request(const std::string& path, uint8_t pri) +int Spdylay::submit_request(const std::string& hostport, + const std::string& path, uint8_t pri) { const char *nv[] = { + "host", hostport.c_str(), "method", "GET", "scheme", "https", "url", path.c_str(), diff --git a/examples/spdylay_ssl.h b/examples/spdylay_ssl.h index 3ec3a6e..431532d 100644 --- a/examples/spdylay_ssl.h +++ b/examples/spdylay_ssl.h @@ -49,7 +49,8 @@ public: bool want_read(); bool want_write(); int fd() const; - int submit_request(const std::string& path, uint8_t pri); + int submit_request(const std::string& hostport, const std::string& path, + uint8_t pri); bool would_block(int r); private: int fd_;