Fixed free() for new. Any 2xx status means success in CONNECT response

This commit is contained in:
Tatsuhiro Tsujikawa 2012-07-15 03:32:05 +09:00
parent 7465289919
commit 317ad6f4ad
2 changed files with 4 additions and 3 deletions

View File

@ -78,7 +78,7 @@ Downstream::~Downstream()
if(dconn_) {
delete dconn_;
}
free(response_htp_);
delete response_htp_;
if(ENABLE_LOG) {
LOG(INFO) << "Deleted";
}
@ -692,7 +692,8 @@ void Downstream::set_recv_window_size(int32_t new_size)
bool Downstream::tunnel_established() const
{
return request_method_ == "CONNECT" && response_http_status_ == 200;
return request_method_ == "CONNECT" &&
200 <= response_http_status_ && response_http_status_ < 300;
}
} // namespace shrpx

View File

@ -56,7 +56,7 @@ HttpsUpstream::HttpsUpstream(ClientHandler *handler)
HttpsUpstream::~HttpsUpstream()
{
free(htp_);
delete htp_;
for(std::deque<Downstream*>::iterator i = downstream_queue_.begin();
i != downstream_queue_.end(); ++i) {
delete *i;