summaryrefslogtreecommitdiffstats
path: root/server/protocol.c
diff options
context:
space:
mode:
authorStefan Fritsch <sf@apache.org>2012-11-09 22:17:04 +0100
committerStefan Fritsch <sf@apache.org>2012-11-09 22:17:04 +0100
commitb5a7699209b806193ab273c556a455e9afbf4de5 (patch)
treef1214018673b5c5b25331263afade625efc14fe7 /server/protocol.c
parentxforms (diff)
downloadapache2-b5a7699209b806193ab273c556a455e9afbf4de5.tar.xz
apache2-b5a7699209b806193ab273c556a455e9afbf4de5.zip
Make HttpProtocol accept a range of allowed versions.
Bump MMN git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1407643 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--server/protocol.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/server/protocol.c b/server/protocol.c
index 2fa3895cbd..a3710a58f6 100644
--- a/server/protocol.c
+++ b/server/protocol.c
@@ -566,6 +566,8 @@ static int read_request_line(request_rec *r, apr_bucket_brigade *bb)
apr_size_t len;
int num_blank_lines = 0;
int max_blank_lines = r->server->limit_req_fields;
+ core_server_config *conf =
+ ap_get_core_module_config(r->server->module_config);
if (max_blank_lines <= 0) {
max_blank_lines = DEFAULT_LIMIT_REQUEST_FIELDS;
@@ -644,19 +646,9 @@ static int read_request_line(request_rec *r, apr_bucket_brigade *bb)
pro = ll;
len = strlen(ll);
} else {
- core_server_config *conf;
- conf = ap_get_core_module_config(r->server->module_config);
r->assbackwards = 1;
pro = "HTTP/0.9";
len = 8;
- if (conf->http09_enable == AP_HTTP09_DISABLE) {
- r->status = HTTP_VERSION_NOT_SUPPORTED;
- r->protocol = apr_pstrmemdup(r->pool, pro, len);
- r->proto_num = HTTP_VERSION(0, 9);
- ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(02401)
- "HTTP/0.9 denied by server configuration");
- return 0;
- }
}
r->protocol = apr_pstrmemdup(r->pool, pro, len);
@@ -674,6 +666,21 @@ static int read_request_line(request_rec *r, apr_bucket_brigade *bb)
else
r->proto_num = HTTP_VERSION(1, 0);
+ if (conf->min_http_version != AP_HTTP_VERSION_UNSET
+ && ( conf->min_http_version > r->proto_num
+ || conf->max_http_version < r->proto_num)) {
+ r->status = HTTP_VERSION_NOT_SUPPORTED;
+ if (r->proto_num == HTTP_VERSION(0, 9)) {
+ /* If we deny 0.9, send error message with 1.x */
+ r->assbackwards = 0;
+ }
+ ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(02401)
+ "HTTP/%d.%d denied by server configuration",
+ HTTP_VERSION_MAJOR(r->proto_num),
+ HTTP_VERSION_MINOR(r->proto_num));
+ return 0;
+ }
+
return 1;
}