Commit Graph

128 Commits

Author SHA1 Message Date
679f82a1d2 Rearranged the loop in fix_hostname() to run faster in the
common case in which lowercase characters are the most frequent
characters in the hostname


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@96616 13f79535-47bb-0310-9956-ffa450edef68
2002-09-02 01:37:54 +00:00
d982829aa1 Continue the Bill Rowe apr_size_t crusade.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95993 13f79535-47bb-0310-9956-ffa450edef68
2002-07-10 06:01:14 +00:00
f24fa31695 Convert the hostname to all-lowercase in fix_hostname() so that
the implementation matches the comments.  (Note: The current virtual
hosting code does case-insensitive host matching, so this fix is useful
mostly to help ensure that custom modules and any future vhosting code
don't get tripped up by case-sensitivity issues.)
Submitted by:	Perry Harrington <pedward@webcom.com>
Reviewed by:	Brian Pane


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95866 13f79535-47bb-0310-9956-ffa450edef68
2002-06-23 08:10:49 +00:00
c871b41d3c stop using APLOG_NOERRNO in calls to ap_log_?error()
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95149 13f79535-47bb-0310-9956-ffa450edef68
2002-05-17 11:11:39 +00:00
e556e52b59 Eliminate some sprintf calls
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94885 13f79535-47bb-0310-9956-ffa450edef68
2002-05-01 06:41:36 +00:00
e955e53d37 Allow empty Host: header arguments.
Previously, request that sent:

GET / HTTP/1.1
Host:

would get a 400.  RFC 2616 specifically allows for a "blank" host field.

The read_request code properly handled this, but the fix_hostname in
vhost.c would cause the 400.  Now, simply return in fix_hostname when
we see a blank hostname rather than erroring out.

PR: 7441


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94655 13f79535-47bb-0310-9956-ffa450edef68
2002-04-15 02:58:11 +00:00
d2fdf5ba21 Fix for vhosts where the hostname is followed by '.'
PR: 9187
Submitted by:	Ryan Cruse <ryan@estara.com>


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93988 13f79535-47bb-0310-9956-ffa450edef68
2002-03-18 01:43:17 +00:00
a070cd5c90 clean up the use of apr_sockaddr_t (stay out of family-specific
struct sockaddr* as much as possible)


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93960 13f79535-47bb-0310-9956-ffa450edef68
2002-03-15 17:47:48 +00:00
2d9939a923 Fix win32 compile breakage.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93922 13f79535-47bb-0310-9956-ffa450edef68
2002-03-13 22:34:46 +00:00
845cbfd508 Update our copyright for this year.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93918 13f79535-47bb-0310-9956-ffa450edef68
2002-03-13 20:48:07 +00:00
0e1f9478dc fix a v4-specific INADDR_ANY check that kept name-based virtual hosts
from working with IPv6


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93494 13f79535-47bb-0310-9956-ffa450edef68
2002-02-19 16:17:24 +00:00
eb6c5908db use a new APR function to perform socket address comparison so
that we don't have to handle v4-mapped IPv6 addresses here


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@92611 13f79535-47bb-0310-9956-ffa450edef68
2001-12-26 21:25:54 +00:00
860303d77e Fix matching of vhosts by ip address so we find IPv4
vhost address when target address is v4-mapped form of
that address.

This problem was reported by Don Hughes.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@92607 13f79535-47bb-0310-9956-ffa450edef68
2001-12-26 15:51:08 +00:00
af4e5791f0 add a comment about the need to check for a host after returning
from apr_parse_addr_port()


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@92600 13f79535-47bb-0310-9956-ffa450edef68
2001-12-25 21:46:10 +00:00
34dd63965e Fixed a segfault that occurred during startup if a VirtualHost
directive had a port but no address
Reported by: Don Hughes <support@sannotes.org>


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@92599 13f79535-47bb-0310-9956-ffa450edef68
2001-12-25 21:41:59 +00:00
854cfbc210 Get IPv6 vhosts working (again ?).
There were a couple of bogus IPv4-specific comparisons which prevented
the data structures from being built correctly in ap_fini_vhost_config().
One of these (INADDR_ANY) can be easily rewritten to work with IPv6.  The
other (DEFAULT_VHOST_ADDR) isn't necessary for IPv6.  Note that this is
because we don't support the various flavors of _default_ that
Apache-1.3+KAME-patch supports.

PR:      8118


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@92054 13f79535-47bb-0310-9956-ffa450edef68
2001-11-20 18:27:07 +00:00
0c05b625ac Begin to abstract out the underlying transport layer.
The first step is to remove the socket from the conn_rec,
the server now lives in a context that is passed to the
core's input and output filters. This forces us to be very
careful when adding calls that use the socket directly,
because the socket isn't available in most locations.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91887 13f79535-47bb-0310-9956-ffa450edef68
2001-11-12 23:49:08 +00:00
ac0d5e6317 Fixed previous patch to reflect what Apache-1.3 did regarding self-
referential uri's, and updated the manual accordingly.
XXX There is a kludge here: XXX the port number from the client's Host:
header used to be tossed, and there is no clean mechanism to pass it
(in the request_rec) to other consumers. As the unparsed_uri structure
(which could avoid repeated parsing of URI, Host, Port etc) seems to be
mostly unused currently, I used that to pass the port.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91798 13f79535-47bb-0310-9956-ffa450edef68
2001-11-08 14:29:37 +00:00
78b3a0130c Please do not mix spaces and tabs within the same blocks, and please do not
arbitrarily and inconsistently wrap lines. I apologise ahead of time for
mucking up the cvslog, but this needed to be done.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91792 13f79535-47bb-0310-9956-ffa450edef68
2001-11-07 19:59:51 +00:00
ad334fdd90 insure that a '*' in <VirtualHost *> or NameVirtualHost * matches all ports.
The recent change to eliminate the Port directive exposed this problem.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91470 13f79535-47bb-0310-9956-ffa450edef68
2001-10-15 15:32:14 +00:00
d8af1a375b Fix a segfault when a numeric host (e.g., "Host: 123") was specified.
apr_parse_addr_port() assumes that if there is just a number it must
be a port, but here we need to assume that it is a host.

todo: pass a flag into apr_parse_addr_port()?  unclear whether or
      not that is cleaner overall


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90734 13f79535-47bb-0310-9956-ffa450edef68
2001-08-27 19:51:34 +00:00
ee3fe477e3 *) fix inline handling. we had: apr_inline, APR_INLINE, USE_GNU_INLINE, and
INLINE. Now, we just have APR_INLINE and APR_HAS_INLINE.
   - convert all usage
   - note that apr_general messed up the defn (compared to apr.h)
   - simplify the inline decision logic in os/*/os.h
   - simplify the code in os/*/os-inline.c

*) toss ap_checkconv() [no longer used]


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@88298 13f79535-47bb-0310-9956-ffa450edef68
2001-02-24 11:23:31 +00:00
381f88d56a Update copyright to 2001
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@88184 13f79535-47bb-0310-9956-ffa450edef68
2001-02-16 04:26:53 +00:00
f202bd3cb9 include <arpa/inet.h> for the declarations for htons() et al; OS/390 has
macros in arpa/inet.h which turn such "calls" into nothing and does not
have functions to link against in libc


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@88120 13f79535-47bb-0310-9956-ffa450edef68
2001-02-12 21:03:35 +00:00
bb282b75f7 Clean up some of the includes:
- explicitly include apr_lib.h since ap_config.h doesn't
- use apr_want.h where possible
- use APR_HAVE_ where possible
- remove some unneeded includes


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@88060 13f79535-47bb-0310-9956-ffa450edef68
2001-02-10 13:05:29 +00:00
88d3406f9a renaming various functions for consistency sake
see: http://apr.apache.org/~dougm/apr_rename.pl
PR:
Obtained from:
Submitted by:
Reviewed by:


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@88019 13f79535-47bb-0310-9956-ffa450edef68
2001-02-08 07:45:33 +00:00
73baa4f319 Relax the checking of Host: headers so that only character sequences that
are sensitive to the filesystem are rejected, i.e. forward slashes,
backward slashes, and sequences of more than one dot. This supports iDNS
without compromising the safety of mass vhosting.

PR: 6635


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@87803 13f79535-47bb-0310-9956-ffa450edef68
2001-01-24 01:05:47 +00:00
7c8a252a45 Some missing exports
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@87725 13f79535-47bb-0310-9956-ffa450edef68
2001-01-18 23:52:03 +00:00
a0765fdc7a Get "NameVirtualHost *" option working in Apache 2.0
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@87393 13f79535-47bb-0310-9956-ffa450edef68
2000-12-18 02:30:32 +00:00
4b8b17382e Clean up some formatting. Using a tab of 22 characters makes the output
very annoying to read.  8 looks much more reasonable to me.
PR:
Obtained from:
Submitted by:
Reviewed by:


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@87392 13f79535-47bb-0310-9956-ffa450edef68
2000-12-17 23:05:24 +00:00
ab3721d8e2 Get -t -D DUMP_VHOSTS working and properly documented. This removes the
-S option from the docs.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@87391 13f79535-47bb-0310-9956-ffa450edef68
2000-12-17 22:47:32 +00:00
dece16955a get_addresses()
. use apr_parse_addr_port() so we handle IPv6 addresses on
   NameVirtualHost and <VirtualHost > directives
 . don't hardcode AF_INET when a hostname or IP address was
   coded

dump_a_vhost()
 . check the address family before looking for certain IPv4
   addresses

ap_fini_vhost_config()
 . pass apr_status_t to ap_log_error() after apr_getnameinfo()
   fails


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@87377 13f79535-47bb-0310-9956-ffa450edef68
2000-12-16 21:36:33 +00:00
6b3c397afb Use apr_parse_addr_port() in fix_hostname(). This simplifies the
code by a small (okay, tiny) amount and lets IPv6 numeric address
strings be passed through.
Obtained from:  the idea is from the KAME IPv6 patch for Apache 1.3


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@87370 13f79535-47bb-0310-9956-ffa450edef68
2000-12-16 12:54:53 +00:00
8cb9685fc0 Fix a problem with the last commit... I missed one of the hashing changes
so some of the code had an unnecessary IPv4 assumption.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@87367 13f79535-47bb-0310-9956-ffa450edef68
2000-12-16 11:36:16 +00:00
43f1418ebd Get rid of some IPv4 dependencies by passing the hash function the
apr_sockaddr_t * instead of the IPv4 address.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@87366 13f79535-47bb-0310-9956-ffa450edef68
2000-12-16 11:10:31 +00:00
7e1800931c Fix the call to apr_snprintf() for formatting the sockaddr in
a vhost entry when dumping the vhost config.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@87365 13f79535-47bb-0310-9956-ffa450edef68
2000-12-16 02:26:08 +00:00
290df5f182 move closer to IPv6 support by changing the server_addr_rec
representation of the bound address to something which handles
IPv6; this also allows us to switch to APR resolver routines
in places instead of calling gethostbyname() and gethostbyaddr()
directly

Issues remaining with this set of changes:

1) apr_snprintf()'s %pA formatting needs to change to take
   apr_sockaddr_t * instead of sockaddr_in * -OR- just get rid
   of that type of formatting
2) apr_get_inaddr() is no longer used and should be removed


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@87363 13f79535-47bb-0310-9956-ffa450edef68
2000-12-15 19:20:12 +00:00
b1e8b050e9 The local_addr and remote_addr fields in the conn_rec are now
apr_sockaddr_t * instead of sockaddr_in.  This is a small step
towards IPv6 support.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@87342 13f79535-47bb-0310-9956-ffa450edef68
2000-12-14 18:47:30 +00:00
d4df2029ae updates to changed interfaces to apr_set_port(), apr_get_port(),
apr_set_ipaddr(), and apr_get_ipaddr()


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@87050 13f79535-47bb-0310-9956-ffa450edef68
2000-11-21 19:10:25 +00:00
425f55776c Change references of AF_ to reflect APR_ so they should work
on all systems.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@87012 13f79535-47bb-0310-9956-ffa450edef68
2000-11-18 16:04:06 +00:00
2377bb2ae0 More local/remote changes and tidy up http_vhost a bit.
Also add a new function to get an ap_ina_addr_t from a socket.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86910 13f79535-47bb-0310-9956-ffa450edef68
2000-11-10 16:11:14 +00:00
f971a5552e In mass hosting setups (using mod_vhost_alias or mod_rewrite) where
the hostname is interpolated into the filename, we need to be sure
that the result of interpolation doesn't expose parts of the
filesystem that should be private. This was done by checking the
syntax of the Host: header according to RFC 1123 and RFC 952. However,
many people have broken configurations that violate this syntax
(frequently because they use underscores in their names), and it also
doesn't accommodate the current effort to internationalize the DNS. I
don't think the former is a compelling reason to relax the syntax
checking, but the latter does justify this change.

The only RFC on internationalized DNS at the moment is RFC 2825 which
is an introduction to how difficult the whole thing is; the other
official documentation is a pile of Internet Drafts produced by the
Internationalized Domain Names Working Group of the IETF (with names
starting "draft-ietf-idn-"). However they have very little to say
about URIs, and the current Internet draft about internationalized
URIs (draft-masinter-url-i18n-05) has very little to say about
hostnames :-( On the gripping hand there is some useful information at
<http://www.apng.org/idns/> where there is some iDNS testbed work
going on. The basic idea is that although the format of the hostnames
in the DNS itself remains compatible with RFC 1123, the actual
hostname presented to the resolver is in UTF8, and therefore the
hostname in the URL and Host: header is also in UTF8.

This change relaxes the checking so that only character sequences that
are sensitive to the filesystem are rejected, i.e. forward slashes,
backward slashes, and sequences of more than one dot.

PR: 6635


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86898 13f79535-47bb-0310-9956-ffa450edef68
2000-11-10 01:34:46 +00:00
3dd5f4ad55 Bring the apr_in_addr type into line with naming conventions and make changes
where appropriate.  At least on my system virtual hosts seem to still work :)


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86895 13f79535-47bb-0310-9956-ffa450edef68
2000-11-10 00:58:25 +00:00
35034e600c Change the code to reflect the recent API changes...
Alter http_vhost.c to use the new apr_get_inaddr fucntion.  Old code is still
there just in case it breaks.  can someone check it who knows this stuff?


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86890 13f79535-47bb-0310-9956-ffa450edef68
2000-11-09 15:09:50 +00:00
ee4d19790d This adds the APR_LOCAL/APR_REMOTE to APR and changes the apr_get/set_port
functions to use it.  This is onyl the start and I'll pause a while before
I continue in case people really hate this.  The patch can be backed out and
all evidence will be removed, but I think this makes maintaining/developing
the code easier in the long term.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86870 13f79535-47bb-0310-9956-ffa450edef68
2000-11-08 14:47:33 +00:00
d31390922c More cleanup of apr_port_t stuff.
This file will need a lot of work as it's using a lot of "raw" information
from socket structures that won't work with IPv6.  Needs to be abstracted out
and use APR instead.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86869 13f79535-47bb-0310-9956-ffa450edef68
2000-11-08 12:07:27 +00:00
73a6c4c81f Doh! Missed this from the last commit...
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86868 13f79535-47bb-0310-9956-ffa450edef68
2000-11-08 11:48:09 +00:00
33aabfee3f Start of moving to apr_port_t in the server code. This will probably the first
of a few...


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86866 13f79535-47bb-0310-9956-ffa450edef68
2000-11-08 11:35:38 +00:00
d6f677fe54 Remove some more references to sockaddr structures...
Removing the rest will need someone who knows this code to look through
in more detail.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86824 13f79535-47bb-0310-9956-ffa450edef68
2000-11-03 15:09:16 +00:00
1d4c4128cf Tighten up the syntax checking of Host: headers to fix a
security bug in some mass virtual hosting configurations
that can allow a remote attacker to retrieve some files
on the system that should be inaccessible. The problem
occured with requests including the line "Host: ..." --
the last dot is stripped and the remaining ".." then
reveals a parent directory.

Reported by: Peter Christoffersen <pch@mindpass.com>
Message-ID: <8quts6$2el$1@news.inet.tele.dk>
Newsgroups: comp.infosystems.www.servers.unix


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86637 13f79535-47bb-0310-9956-ffa450edef68
2000-10-18 04:48:34 +00:00