Changes with Apache 2.4.24
+ *) core: New directive HttpProtocol which allows to disable HTTP/0.9
+ support. [Stefan Fritsch]
+
*) mod_http2: unannounced and multiple interim responses (status code < 200)
are parsed and forwarded to client until a final response arrives.
[Stefan Eissing]
* 20120211.65 (2.4.24-dev) Add ap_check_pipeline().
* 20120211.66 (2.4.24-dev) Rename ap_proxy_check_backend() to
* ap_proxy_check_connection().
+ * 20120211.67 (2.5.0-dev) Add http09_enable to core_server_config
*/
#define MODULE_MAGIC_COOKIE 0x41503234UL /* "AP24" */
#ifndef MODULE_MAGIC_NUMBER_MAJOR
#define MODULE_MAGIC_NUMBER_MAJOR 20120211
#endif
-#define MODULE_MAGIC_NUMBER_MINOR 66 /* 0...n */
+#define MODULE_MAGIC_NUMBER_MINOR 67 /* 0...n */
/**
* Determine if the server's current MODULE_MAGIC_NUMBER is at least a
#define AP_MERGE_TRAILERS_DISABLE 2
int merge_trailers;
-
-
apr_array_header_t *protocols;
int protocols_honor_order;
+
+#define AP_HTTP09_UNSET 0
+#define AP_HTTP09_ENABLE 1
+#define AP_HTTP09_DISABLE 2
+ char http09_enable;
+
} core_server_config;
/* for AddOutputFiltersByType in core.c */
if (virt->trace_enable != AP_TRACE_UNSET)
conf->trace_enable = virt->trace_enable;
+ if (virt->http09_enable != AP_HTTP09_UNSET)
+ conf->http09_enable = virt->http09_enable;
+
/* no action for virt->accf_map, not allowed per-vhost */
if (virt->protocol)
return NULL;
}
+static const char *set_http_protocol(cmd_parms *cmd, void *dummy,
+ const char *arg)
+{
+ core_server_config *conf =
+ ap_get_core_module_config(cmd->server->module_config);
+
+ if (strncmp(arg, "min=", 4) == 0) {
+ arg += 4;
+ if (strcmp(arg, "0.9") == 0)
+ conf->http09_enable = AP_HTTP09_ENABLE;
+ else if (strcmp(arg, "1.0") == 0)
+ conf->http09_enable = AP_HTTP09_DISABLE;
+ else
+ return "HttpProtocol min must be one of '0.9' and '1.0'";
+ return NULL;
+ }
+ return "HttpProtocol must be min=0.9|1.0";
+}
+
static apr_hash_t *errorlog_hash;
static int log_constant_item(const ap_errorlog_info *info, const char *arg,
AP_INIT_TAKE1("ProtocolsHonorOrder", set_protocols_honor_order, NULL, RSRC_CONF,
"'off' (default) or 'on' to respect given order of protocols, "
"by default the client specified order determines selection"),
+AP_INIT_TAKE1("HttpProtocol", set_http_protocol, NULL, RSRC_CONF,
+ "'min=0.9' (default) or 'min=1.0' to allow/deny HTTP/0.9"),
{ NULL }
};
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);
+ /* If we deny 0.9, send error message with 1.x */
+ r->assbackwards = 0;
+ r->proto_num = HTTP_VERSION(0, 9);
+ r->connection->keepalive = AP_CONN_CLOSE;
+ 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);
/* Get the request... */
if (!read_request_line(r, tmp_bb)) {
if (r->status == HTTP_REQUEST_URI_TOO_LARGE
- || r->status == HTTP_BAD_REQUEST) {
+ || r->status == HTTP_BAD_REQUEST
+ || r->status == HTTP_VERSION_NOT_SUPPORTED) {
if (r->status == HTTP_REQUEST_URI_TOO_LARGE) {
ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, APLOGNO(00565)
"request failed: client's request-line exceeds LimitRequestLine (longer than %d)",