Checkout Tools
  • last updated 6 hours ago
Constraints
Constraints: committers
 
Constraints: files
Constraints: dates
Reverse the order of 2 tests to potentially save a few cycles.
move the assignment to the end of the loop.

This is more readable and isn't miscompiled w/ -O3 on a certain

unnamed EBCDIC platforms compiler.

fix StrictHostCheck in single/non-NVH vhosts

While all VH'es are NVH'es in 2.4 and later, something special happens

once a second NVH in a set is added. This case covers the

global server config scenario as well.

Add StrictHostCheck

.. to allow ucnonfigured hostnames to be rejected.

The checks happen during NVH mapping and checks that the

mapped VH itself has the host as a name or alias.

  1. … 6 more files in changeset.
Re-allow '_' (underscore) in hostnames.

'_' was not permitted in hostnames since 2.4.25's "HTTP Strict"

changes.

  1. … 1 more file in changeset.
* server/vhost.c: Remove redundant vhost_check_config hook which never

fails, r1053230 removed all the places where config_error was set.

On the trunk:

adding AP_DECLARE for ap_parse_vhost_addrs() and minor bumb mmn. Resolves

building mod_ssl on Windows.

  1. … 3 more files in changeset.
On the trunk:

updated missing log tags.

  1. … 4 more files in changeset.
Support IPv6 link-local scope IDs in Listen and VirtualHost, if built

with APR 1.7 or later:

* server/listen.c (match_address): New function, factored out from

find_listeners.

(find_listeners): Use it; add scope and temp pool arguments.

(alloc_listener): Take scope_id and pool arguments and pass through;

set zone for addresses if present.

(ap_set_listener): Pass through temp pool and scope id.

* server/vhost.c (get_addresses): Set zone for vhost address if

present.

  1. … 2 more files in changeset.
Fix some tiny style issues (missing space)
'repl' is already allocated in the request pool by 'construct_host_header()' the line just before.

So this is safe to use the 'apr_table_setn' variant in order to save a few bytes of memory.

remove initial isascii check entirely

We are already checking an even narrower set of characters

just below.

Fix strict Host: header checking on EBCDIC

on zOS, isascii() really means 7 bit ascii, but our strings

are in ebcdic for 99.95% of the lifetime of the server.

Actually cause the Host header to be overridden, as noted by rpluem,

and simplify now that there isn't a log-only mode.

I believe this logic to be busted. Given this request;

GET http://distant-host.com/ HTTP/1.1

Host: proxy-host

we would now fail to evaluate the proxy-host virtual host rules.

This seems like a breaking change to our config. mod_proxy already

follows this rule of RFC7230 section 5.4;

When a proxy receives a request with an absolute-form of

request-target, the proxy MUST ignore the received Host header field

(if any) and instead replace it with the host information of the

request-target. A proxy that forwards such a request MUST generate a

new Host field-value based on the received request-target rather than

forward the received Host field-value.

Section 5.5 of RFC7230 has this to say;

Once the effective request URI has been constructed, an origin server

needs to decide whether or not to provide service for that URI via

the connection in which the request was received. For example, the

request might have been misdirected, deliberately or accidentally,

such that the information within a received request-target or Host

header field differs from the host or port upon which the connection

has been made. If the connection is from a trusted gateway, that

inconsistency might be expected; otherwise, it might indicate an

attempt to bypass security filters, trick the server into delivering

non-public content, or poison a cache. See Section 9 for security

considerations regarding message routing.

Section 5.3.1 states;

To allow for transition to the absolute-form for all requests in some

future version of HTTP, a server MUST accept the absolute-form in

requests, even though HTTP/1.1 clients will only send them in

requests to proxies.

It seems to me we should simply trust the Host: header and dump this whole

mess. If we want to reject requests in absolute form after the proxy modules

have had a chance to accept them, that wouldn't be a bad solution.

Rename the previously undocumented HTTPProtocol directive

to EnforceHTTPProtocol, and invert the default behavior

to strictly observe RFC 7230 unless otherwise configured.

And Document This.

The relaxation option is renamed 'Unsafe'. 'Strict' is no

longer case sensitive. 'min=0.9|1.0' is now the verbose

'Allow0.9' or 'Require1.0' case-insenstive grammer. The

exclusivity tests have been modified to detect conflicts.

The 'strict,log' option failed to enforce strict conformance,

and has been removed. Unsafe, informational logging is possible

in any loadable module, after the request data is unsafely

accepted.

This triggers a group of failures in t/apache/headers.t as

expected since those patterns violated RFC 7230 section 3.2.4.

  1. … 4 more files in changeset.
Fix spelling in comments and text files.

No functional change.

PR 59990

  1. … 69 more files in changeset.
Added many log numbers to log statements that

had none.

Those were not detected by the coccinelle script.

  1. … 34 more files in changeset.
name-based vhosts listed twice with apachectl -S

When processing a vhost with * or _default_, we'd add the "names" once

for 0.0.0.0 and once for [::], but these are stored in the same "default"

ip chain. Catch the back-to-back wildcard + same port and short-circuit the

second add.

Submitted By: rjung

Committed By: covener

PR54948: wildcard name-based vhosts printed twice in apachectl -S

  1. … 1 more file in changeset.
* Ensure that is_v6literal is always initialized
remove comment; empty host headers can happen in proxy requests

add log tags missing in r1426877

  1. … 3 more files in changeset.
Add an option to enforce stricter HTTP conformance

This is a first stab, the checks will likely have to be revised.

For now, we check

* if the request line contains control characters

* if the request uri has fragment or username/password

* that the request method is standard or registered with RegisterHttpMethod

* that the request protocol is of the form HTTP/[1-9]+.[0-9]+,

or missing for 0.9

* if there is garbage in the request line after the protocol

* if any request header contains control characters

* if any request header has an empty name

* for the host name in the URL or Host header:

- if an IPv4 dotted decimal address: Reject octal or hex values, require

exactly four parts

- if a DNS host name: Reject non-alphanumeric characters besides '.' and

'-'. As a side effect, this rejects multiple Host headers.

* if any response header contains control characters

* if any response header has an empty name

* that the Location response header (if present) has a valid scheme and is

absolute

If we have a host name both from the URL and the Host header, we replace the

Host header with the value from the URL to enforce RFC conformance.

There is a log-only mode, but the loglevels of the logged messages need some

thought/work. Currently, the checks for incoming data log for 'core' and the

checks for outgoing data log for 'http'. Maybe we need a way to configure the

loglevels separately from the core/http loglevels.

  1. … 8 more files in changeset.
Correctly parse an IPv6 literal host specification in an absolute URL

in the request line.

- Fix handling of brackets [ ] surrounding the IPv6 address.

- Skip parsing r->hostname again if not necessary.

- Do some checks that the IPv6 address is sane. This is not done by

apr_parse_addr_port().

  1. … 1 more file in changeset.
log client error at level debug, log broken Host header value

Add lots of unique tags to error log messages

  1. … 172 more files in changeset.
Cleanup effort in prep for GA push:

Trim trailing whitespace... no func change

  1. … 118 more files in changeset.
* Correctly obey ServerName / ServerAlias if the Host header from the

request matches the VirtualHost address.

PR: 51709

Submitted by: Micha Lenk <micha lenk.info>

Reviewed by: rpluem

  1. … 1 more file in changeset.
* server/vhost.c (get_addresses): For '*' and '_default_', return

address(es) for any address family, not IPv4 only.

(dump_a_vhost): Use '*' for v4 or v6 wildcard address.

  1. … 1 more file in changeset.
Various code cleanup

PR: 51398

Submitted by: Christophe Jaillet <christophe jaillet wanadoo fr>

  1. … 8 more files in changeset.