mirror of
https://github.com/moparisthebest/spdylay
synced 2024-11-12 04:25:09 -05:00
Send back Connection: keep-alive for the request with http/1.0 keep-alive
This commit is contained in:
parent
7319620160
commit
9303cca430
@ -116,6 +116,8 @@ void check_request_connection(bool *connection_close,
|
||||
if(util::strieq(item.first.c_str(), "connection")) {
|
||||
if(util::strifind(item.second.c_str(), "close")) {
|
||||
*connection_close = true;
|
||||
} else if(util::strifind(item.second.c_str(), "keep-alive")) {
|
||||
*connection_close = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -155,6 +157,16 @@ void Downstream::set_request_minor(int minor)
|
||||
request_minor_ = minor;
|
||||
}
|
||||
|
||||
int Downstream::get_request_major() const
|
||||
{
|
||||
return request_major_;
|
||||
}
|
||||
|
||||
int Downstream::get_request_minor() const
|
||||
{
|
||||
return request_minor_;
|
||||
}
|
||||
|
||||
Upstream* Downstream::get_upstream() const
|
||||
{
|
||||
return upstream_;
|
||||
|
@ -65,6 +65,8 @@ public:
|
||||
void set_request_path(const std::string& path);
|
||||
void set_request_major(int major);
|
||||
void set_request_minor(int minor);
|
||||
int get_request_major() const;
|
||||
int get_request_minor() const;
|
||||
int push_request_headers();
|
||||
bool get_chunked_request() const;
|
||||
bool get_request_connection_close() const;
|
||||
|
@ -476,6 +476,9 @@ int HttpsUpstream::on_downstream_header_complete(Downstream *downstream)
|
||||
}
|
||||
if(get_client_handler()->get_should_close_after_write()) {
|
||||
hdrs += "Connection: close\r\n";
|
||||
} else if(downstream->get_request_major() == 1 &&
|
||||
downstream->get_request_minor() == 0) {
|
||||
hdrs += "Connection: Keep-Alive\r\n";
|
||||
}
|
||||
hdrs += "Via: ";
|
||||
hdrs += via_value;
|
||||
|
Loading…
Reference in New Issue
Block a user