Commit Graph

128 Commits

Author SHA1 Message Date
fb209dbba2 Fix some tiny style issues (missing space)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1777594 13f79535-47bb-0310-9956-ffa450edef68
2017-01-06 11:58:23 +00:00
9adefaa2cf '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.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1777593 13f79535-47bb-0310-9956-ffa450edef68
2017-01-06 11:52:15 +00:00
4bc922d0c3 remove initial isascii check entirely
We are already checking an even narrower set of characters
just below.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1775664 13f79535-47bb-0310-9956-ffa450edef68
2016-12-22 14:22:22 +00:00
1db2f476c5 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.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1775199 13f79535-47bb-0310-9956-ffa450edef68
2016-12-20 03:38:59 +00:00
1fea002b50 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.




git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1769965 13f79535-47bb-0310-9956-ffa450edef68
2016-11-16 12:05:53 +00:00
fc367d65ee 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.




git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1756540 13f79535-47bb-0310-9956-ffa450edef68
2016-08-16 18:11:14 +00:00
d79b514c4b Fix spelling in comments and text files.
No functional change.
PR 59990


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1756038 13f79535-47bb-0310-9956-ffa450edef68
2016-08-11 19:50:02 +00:00
af14d158a3 Added many log numbers to log statements that
had none.

Those were not detected by the coccinelle script.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1725485 13f79535-47bb-0310-9956-ffa450edef68
2016-01-19 12:02:41 +00:00
f889cb92be 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


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1525000 13f79535-47bb-0310-9956-ffa450edef68
2013-09-20 13:36:33 +00:00
75d64cebb7 PR54948: wildcard name-based vhosts printed twice in apachectl -S
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1481306 13f79535-47bb-0310-9956-ffa450edef68
2013-05-11 12:05:24 +00:00
3bd54f88b5 * Ensure that is_v6literal is always initialized
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1436457 13f79535-47bb-0310-9956-ffa450edef68
2013-01-21 16:23:43 +00:00
4b5fd517b2 remove comment; empty host headers can happen in proxy requests
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1426988 13f79535-47bb-0310-9956-ffa450edef68
2012-12-30 20:58:39 +00:00
8283707a4f add log tags missing in r1426877
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1426879 13f79535-47bb-0310-9956-ffa450edef68
2012-12-30 01:28:17 +00:00
f726113d33 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.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1426877 13f79535-47bb-0310-9956-ffa450edef68
2012-12-30 01:23:24 +00:00
33a2fbf2bc 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().


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1426827 13f79535-47bb-0310-9956-ffa450edef68
2012-12-29 20:39:49 +00:00
a686e267b5 log client error at level debug, log broken Host header value
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1407006 13f79535-47bb-0310-9956-ffa450edef68
2012-11-08 10:44:49 +00:00
92e366007c Add lots of unique tags to error log messages
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1209766 13f79535-47bb-0310-9956-ffa450edef68
2011-12-02 23:02:04 +00:00
427c85bd23 Cleanup effort in prep for GA push:
Trim trailing whitespace... no func change



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1174751 13f79535-47bb-0310-9956-ffa450edef68
2011-09-23 13:39:32 +00:00
cfe0a63cd5 * 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


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1172002 13f79535-47bb-0310-9956-ffa450edef68
2011-09-17 15:08:14 +00:00
87d9d36a40 * 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.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1147806 13f79535-47bb-0310-9956-ffa450edef68
2011-07-18 10:47:49 +00:00
51692222f6 Various code cleanup
PR: 51398
Submitted by: Christophe Jaillet <christophe jaillet wanadoo fr>


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1138627 13f79535-47bb-0310-9956-ffa450edef68
2011-06-22 20:45:34 +00:00
c9fd2623da Introduce ap_(get|set)_core_module_config() functions/macros and use them
everywhere.

We know that the core module has module_index 0. Therefore we can save
some pointer operations in ap_get_module_config(cv, &core_module) and
ap_set_module_config(cv, &core_module, val). As these are called rather often,
this may actually have some (small) measurable effect.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1132781 13f79535-47bb-0310-9956-ffa450edef68
2011-06-06 21:26:56 +00:00
53e4a906db prefer exact port matches in ip-based VH lookup over wildcards.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1053309 13f79535-47bb-0310-9956-ffa450edef68
2010-12-28 11:21:56 +00:00
458ab7f915 Remove need for NameVirtualHost directive by implicitly configuring any duplicated
VH addresses as name-based virtual hosts.  This also combines _default_ and *
into a single type of wildcard since these presented a false dichotomy between
address specs.

These are post-config only changes and do not change the runtime lookups.

The biggest loss here is that an unintended duplication of virtual host addresses
can no longer be reported as directly in the past, but should still be debuggabl
via apachectl -S (unintended NVH).  These problems are a drop in the bucket compared
to the difficulty users have with using NameVirtualHost.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1053230 13f79535-47bb-0310-9956-ffa450edef68
2010-12-28 00:46:50 +00:00
e4b94e1f8c Fail startup for vhost configuration problems, rather than
running with a configuration with undefined behavior.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@990844 13f79535-47bb-0310-9956-ffa450edef68
2010-08-30 16:09:50 +00:00
09e3207660 With -S, show ServerAlias values that go with the virtual hosts
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@982629 13f79535-47bb-0310-9956-ffa450edef68
2010-08-05 14:12:25 +00:00
ebb62867fb Use the new APLOG_USE_MODULE/AP_DECLARE_MODULE macros everywhere to take
advantage of per-module loglevels


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@951895 13f79535-47bb-0310-9956-ffa450edef68
2010-06-06 16:59:50 +00:00
ad563f431c Expand the "NameVirtualHost has no VirtualHosts" error message, since it
seems that we have to explain a dozen times a day what it really means.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@934984 13f79535-47bb-0310-9956-ffa450edef68
2010-04-16 16:33:20 +00:00
e2a34108a3 non-static directive parsers should be AP_DECLARE_NONSTD()
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@883860 13f79535-47bb-0310-9956-ffa450edef68
2009-11-24 20:32:42 +00:00
093b9d66a0 Vhosts: treating a pure-numeric Host header as a port is nonsense.
PR 44979


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@832172 13f79535-47bb-0310-9956-ffa450edef68
2009-11-02 22:51:45 +00:00
3474fcacee Output -M and -S dumps (modules and vhosts) to stdout instead of stderr.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@727452 13f79535-47bb-0310-9956-ffa450edef68
2008-12-17 18:03:09 +00:00
a324a1d72f Remove all references to CORE_PRIVATE.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@645455 13f79535-47bb-0310-9956-ffa450edef68
2008-04-07 10:45:43 +00:00
de659cbed0 update license header text
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@420983 13f79535-47bb-0310-9956-ffa450edef68
2006-07-11 20:33:53 +00:00
dd95d7c37c Update the copyright year in all .c, .h and .xml files
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@395228 13f79535-47bb-0310-9956-ffa450edef68
2006-04-19 12:11:27 +00:00
5061d9fa92 No functional Change: Removing trailing whitespace. This also
means that "blank" lines consisting of just spaces or
tabs are now really blank lines


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@332306 13f79535-47bb-0310-9956-ffa450edef68
2005-11-10 15:11:44 +00:00
5d2fae4818 No functional change: simple detabbing of indented code.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@332305 13f79535-47bb-0310-9956-ffa450edef68
2005-11-10 15:05:51 +00:00
8c1e315d3f Doxygen fixup / cleanup
submited by: Neale Ranns neale ranns.org
reviewed by: Ian Holsman



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@263931 13f79535-47bb-0310-9956-ffa450edef68
2005-08-28 23:03:59 +00:00
675c62c505 * server/vhost.c (get_addresses): Fix double negative and make errors
consistent; thanks Joshua.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@230469 13f79535-47bb-0310-9956-ffa450edef68
2005-08-05 13:49:07 +00:00
8b92612278 * server/vhost.c (get_addresses): Fail with an error message rather
than an assert() for errors which plague users on Solaris boxes which
don't have a properly configured resolver.

PR: 27525


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@230453 13f79535-47bb-0310-9956-ffa450edef68
2005-08-05 12:27:57 +00:00
03c53e0a5b Add ap_vhost_iterate_given_conn() as I had previously mentioned on the mailing list.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@164538 13f79535-47bb-0310-9956-ffa450edef68
2005-04-25 05:23:18 +00:00
905cdf9f0b Update copyright year to 2005 and standardize on current copyright owner line.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@151408 13f79535-47bb-0310-9956-ffa450edef68
2005-02-04 20:28:49 +00:00
77ed5d99b1 <VirtualHost myhost> now applies to all IP addresses for myhost
instead of just the first one reported by the resolver.  This
corrects a regression since 1.3.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@103897 13f79535-47bb-0310-9956-ffa450edef68
2004-06-11 13:44:14 +00:00
b39f62cdc4 * server/vhost.c (remove_unused_name_vhosts): Remove redundant check;
catch all port-based NameVirtualHosts without defined VirtualHosts,
preventing segfaults later in some misconfigurations.

PR: 27731


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@103400 13f79535-47bb-0310-9956-ffa450edef68
2004-04-15 20:36:45 +00:00
28f9afc89e * server/vhost.c: Fix comments which got search'n'replaced.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@102936 13f79535-47bb-0310-9956-ffa450edef68
2004-03-11 19:46:35 +00:00
eeb57c17ad fix name of The Apache Software Foundation
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@102619 13f79535-47bb-0310-9956-ffa450edef68
2004-02-09 20:40:53 +00:00
e88fcf3c64 fix copyright dates according to the first check in
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@102589 13f79535-47bb-0310-9956-ffa450edef68
2004-02-08 13:58:22 +00:00
4f02cb1e18 apply Apache License, Version 2.0
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@102525 13f79535-47bb-0310-9956-ffa450edef68
2004-02-06 22:58:42 +00:00
fb07607180 update license to 2004.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@102135 13f79535-47bb-0310-9956-ffa450edef68
2004-01-01 13:26:26 +00:00
07e907f0c2 stop using apr_sockaddr_port_get() accessor function, as it will
disappear from APR 1.0 API shortly


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@101991 13f79535-47bb-0310-9956-ffa450edef68
2003-12-05 00:59:29 +00:00
742af25096 finished that boring job:
update license to 2003.

Happy New Year! ;-))


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@98573 13f79535-47bb-0310-9956-ffa450edef68
2003-02-03 17:53:28 +00:00