summaryrefslogtreecommitdiffstats
path: root/modules/http2/h2_stream.c
diff options
context:
space:
mode:
authorStefan Eissing <icing@apache.org>2023-06-21 14:14:08 +0200
committerStefan Eissing <icing@apache.org>2023-06-21 14:14:08 +0200
commitac9f45877649038f7e1e983b1c56a0e3de7787c1 (patch)
tree5b43798cf81d0ef28d138b3ff08b36bdf5c95596 /modules/http2/h2_stream.c
parenthttp_protocol: make request processing more robust for incomplete data (diff)
downloadapache2-ac9f45877649038f7e1e983b1c56a0e3de7787c1.tar.xz
apache2-ac9f45877649038f7e1e983b1c56a0e3de7787c1.zip
*) mod_http2: adding checks for websocket support on platform and
server versions. Give error message accordingly when trying to enable websockets in unsupported configurations. Add test and code to check the, finally selected, server of a request_rec for websocket support or 501 the request. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1910535 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/http2/h2_stream.c')
-rw-r--r--modules/http2/h2_stream.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/modules/http2/h2_stream.c b/modules/http2/h2_stream.c
index 24d0268f38..19527600e0 100644
--- a/modules/http2/h2_stream.c
+++ b/modules/http2/h2_stream.c
@@ -900,11 +900,23 @@ apr_status_t h2_stream_end_headers(h2_stream *stream, int eos, size_t raw_bytes)
* of CONNECT requests (see [RFC7230], Section 5.3)).
*/
if (!ap_cstr_casecmp(req->method, "CONNECT")) {
- if (req->protocol && !strcmp("websocket", req->protocol)) {
- if (!req->scheme || !req->path) {
- ap_log_cerror(APLOG_MARK, APLOG_INFO, 0, stream->session->c1,
- H2_STRM_LOG(APLOGNO(10457), stream, "Request to websocket CONNECT "
- "without :scheme or :path, sending 400 answer"));
+ if (req->protocol) {
+ if (!strcmp("websocket", req->protocol)) {
+ if (!req->scheme || !req->path) {
+ ap_log_cerror(APLOG_MARK, APLOG_INFO, 0, stream->session->c1,
+ H2_STRM_LOG(APLOGNO(10457), stream, "Request to websocket CONNECT "
+ "without :scheme or :path, sending 400 answer"));
+ set_error_response(stream, HTTP_BAD_REQUEST);
+ goto cleanup;
+ }
+ }
+ else {
+ /* do not know that protocol */
+ ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, stream->session->c1, APLOGNO(10460)
+ "':protocol: %s' header present in %s request",
+ req->protocol, req->method);
+ set_error_response(stream, HTTP_NOT_IMPLEMENTED);
+ goto cleanup;
}
}
else if (req->scheme || req->path) {