spdycat: Added host header field to SYN_STREAM.
This commit is contained in:
parent
42f8ef5f99
commit
45376c6b11
|
@ -46,6 +46,7 @@
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
#include <openssl/ssl.h>
|
#include <openssl/ssl.h>
|
||||||
#include <openssl/err.h>
|
#include <openssl/err.h>
|
||||||
|
@ -163,10 +164,14 @@ int communicate(const std::string& host, uint16_t port,
|
||||||
nfds_t npollfds = 1;
|
nfds_t npollfds = 1;
|
||||||
pollfd pollfds[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) {
|
for(int i = 0, n = reqvec.size(); i < n; ++i) {
|
||||||
uri::UriStruct& us = reqvec[i].us;
|
uri::UriStruct& us = reqvec[i].us;
|
||||||
std::string path = us.dir+us.file+us.query;
|
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);
|
assert(r == 0);
|
||||||
path2req[path] = &reqvec[i];
|
path2req[path] = &reqvec[i];
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,9 +104,11 @@ int Spdylay::fd() const
|
||||||
return fd_;
|
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[] = {
|
const char *nv[] = {
|
||||||
|
"host", hostport.c_str(),
|
||||||
"method", "GET",
|
"method", "GET",
|
||||||
"scheme", "https",
|
"scheme", "https",
|
||||||
"url", path.c_str(),
|
"url", path.c_str(),
|
||||||
|
|
|
@ -49,7 +49,8 @@ public:
|
||||||
bool want_read();
|
bool want_read();
|
||||||
bool want_write();
|
bool want_write();
|
||||||
int fd() const;
|
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);
|
bool would_block(int r);
|
||||||
private:
|
private:
|
||||||
int fd_;
|
int fd_;
|
||||||
|
|
Loading…
Reference in New Issue