nghttpd: Fix crash with CONNECT request
This commit is contained in:
parent
d7b0768ab8
commit
63aa3466e9
|
@ -1070,8 +1070,13 @@ namespace {
|
||||||
void prepare_response(Stream *stream, Http2Handler *hd,
|
void prepare_response(Stream *stream, Http2Handler *hd,
|
||||||
bool allow_push = true) {
|
bool allow_push = true) {
|
||||||
int rv;
|
int rv;
|
||||||
auto reqpath =
|
auto pathhdr =
|
||||||
http2::get_header(stream->hdidx, http2::HD__PATH, stream->headers)->value;
|
http2::get_header(stream->hdidx, http2::HD__PATH, stream->headers);
|
||||||
|
if (!pathhdr) {
|
||||||
|
prepare_status_response(stream, hd, 405);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
auto reqpath = pathhdr->value;
|
||||||
auto ims =
|
auto ims =
|
||||||
get_header(stream->hdidx, http2::HD_IF_MODIFIED_SINCE, stream->headers);
|
get_header(stream->hdidx, http2::HD_IF_MODIFIED_SINCE, stream->headers);
|
||||||
|
|
||||||
|
@ -1715,6 +1720,7 @@ enum {
|
||||||
IDX_301,
|
IDX_301,
|
||||||
IDX_400,
|
IDX_400,
|
||||||
IDX_404,
|
IDX_404,
|
||||||
|
IDX_405,
|
||||||
};
|
};
|
||||||
|
|
||||||
HttpServer::HttpServer(const Config *config) : config_(config) {
|
HttpServer::HttpServer(const Config *config) : config_(config) {
|
||||||
|
@ -1723,6 +1729,7 @@ HttpServer::HttpServer(const Config *config) : config_(config) {
|
||||||
{"301", make_status_body(301, config_->port)},
|
{"301", make_status_body(301, config_->port)},
|
||||||
{"400", make_status_body(400, config_->port)},
|
{"400", make_status_body(400, config_->port)},
|
||||||
{"404", make_status_body(404, config_->port)},
|
{"404", make_status_body(404, config_->port)},
|
||||||
|
{"405", make_status_body(405, config_->port)},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1975,6 +1982,8 @@ const StatusPage *HttpServer::get_status_page(int status) const {
|
||||||
return &status_pages_[IDX_400];
|
return &status_pages_[IDX_400];
|
||||||
case 404:
|
case 404:
|
||||||
return &status_pages_[IDX_404];
|
return &status_pages_[IDX_404];
|
||||||
|
case 405:
|
||||||
|
return &status_pages_[IDX_405];
|
||||||
default:
|
default:
|
||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue