1
0
mirror of https://github.com/apache/httpd.git synced 2026-01-06 09:01:14 +03:00
Commit Graph

1641 Commits

Author SHA1 Message Date
Stefan Fritsch
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
Stefan Fritsch
5dd77695c6 extend description of r->hostname
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1426802 13f79535-47bb-0310-9956-ffa450edef68
2012-12-29 18:37:17 +00:00
Stefan Fritsch
25f0a51a21 add some nonnull fn attributes
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1425444 13f79535-47bb-0310-9956-ffa450edef68
2012-12-23 08:55:45 +00:00
Stefan Fritsch
b5c0966006 Change HttpProtocol to again only allow to enable/disable 0.9
This reverts r1407643, but changes the syntax of HttpProtocol to
min=0.9|1.0, which is less ambiguous than the previous +0.9|-0.9.
    
Allowing to configure an arbitrary version range was a bad idea,
because it only checked the version in the request line, without
affecting the semantics of the headers, etc.
    
A tighter restriction off the version in the request line is still
possible with <If "%{SERVER_PROTOCOL_NUM} ..."> .


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1425366 13f79535-47bb-0310-9956-ffa450edef68
2012-12-22 22:55:38 +00:00
Guenter Knauf
005c140b01 On NetWare skip these unsupported function prototypes.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1423933 13f79535-47bb-0310-9956-ffa450edef68
2012-12-19 16:44:18 +00:00
Stefan Fritsch
c39c61637e add new ap_bin2hex() utility function
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1422549 13f79535-47bb-0310-9956-ffa450edef68
2012-12-16 11:49:14 +00:00
Stefan Fritsch
d04d01c589 Add LogLevelOverride directive that allows to override the loglevel for
clients from certain IPs


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1418767 13f79535-47bb-0310-9956-ffa450edef68
2012-12-08 22:16:31 +00:00
Christophe Jaillet
d275f854fa Add some __attribute__ for automatic format checking.
Correct one catch in sed0.c.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1418556 13f79535-47bb-0310-9956-ffa450edef68
2012-12-07 23:39:05 +00:00
Gregg Lewis Smith
6b24eb5bb9 fixed types since MSVC doesnt have uint*_t.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1417585 13f79535-47bb-0310-9956-ffa450edef68
2012-12-05 18:46:35 +00:00
Stefan Fritsch
68bf694f87 s/;;/;/
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1410971 13f79535-47bb-0310-9956-ffa450edef68
2012-11-18 19:57:08 +00:00
Stefan Fritsch
53c102c372 add attribute nonnull to a few functions
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1410963 13f79535-47bb-0310-9956-ffa450edef68
2012-11-18 19:31:39 +00:00
Christophe Jaillet
6a25b57e0d Give the opportunity to the compiler to compute at compile time the strlen of the given
string. Most of the calls to ap_fputs are done with constant strings.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1409437 13f79535-47bb-0310-9956-ffa450edef68
2012-11-14 21:41:19 +00:00
Jim Jagielski
a24b85145b Pull out the "extended" pod functions used by event and worker
to core, since it will be used by Simple and Lean and
likely other MPMs. Avoid duplication.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1409214 13f79535-47bb-0310-9956-ffa450edef68
2012-11-14 14:26:26 +00:00
Eric Covener
0c13e0ffbe followup to r1348036, MSSDK's WinLdap.h uses an enum for LDAP_* status codes, so the block is not included
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1408402 13f79535-47bb-0310-9956-ffa450edef68
2012-11-12 18:54:43 +00:00
Stefan Fritsch
b5a7699209 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
2012-11-09 21:17:04 +00:00
Stefan Fritsch
ee1f762ec1 fix comment typo
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1407526 13f79535-47bb-0310-9956-ffa450edef68
2012-11-09 16:29:43 +00:00
Stefan Fritsch
c083c06191 New directive HttpProtocol which allows to disable HTTP/0.9 support.
The syntax is designed to allow addition of a +/- strict option
later on.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1406719 13f79535-47bb-0310-9956-ffa450edef68
2012-11-07 16:56:38 +00:00
Jeff Trawick
8db5bcb922 comment spelling fix
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1406616 13f79535-47bb-0310-9956-ffa450edef68
2012-11-07 13:27:51 +00:00
Stefan Fritsch
289ead8ef7 Make ap_check_cmd_context() treat <If> sections like <File> sections.
This is necessary to properly disallow directives that don't work in
<If>.
    
A separate NOT_IN_IF flag may be nicer, but would create much more
hassle when being backported to 2.4.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1406495 13f79535-47bb-0310-9956-ffa450edef68
2012-11-07 08:33:05 +00:00
Jim Jagielski
6ec40f4835 Allow for setting of sticky session split char...
Bugz 53893


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1404653 13f79535-47bb-0310-9956-ffa450edef68
2012-11-01 16:06:43 +00:00
Joe Orton
44cb002091 Extract some more data through the server load API:
* include/httpd.h (struct ap_sload_t): Add bytes_served, access_count
  fields.

* server/util.c (ap_get_sload): Fill in those fields.

Submitted by: Jan Kaluza <jkaluza redhat.com>


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1393338 13f79535-47bb-0310-9956-ffa450edef68
2012-10-03 08:20:50 +00:00
Jim Jagielski
176e7b8470 Document these new funcs and make it API aware
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1389573 13f79535-47bb-0310-9956-ffa450edef68
2012-09-24 20:59:09 +00:00
Jim Jagielski
1722688cb3 Break out loadavg from Apache load.... one is quick, the other
isn't so much, and so why load things up when wanting just
the server loadavg?

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1389564 13f79535-47bb-0310-9956-ffa450edef68
2012-09-24 20:50:58 +00:00
Jim Jagielski
1b69b60f1d minor name change, but I expect most will just want/need/use
the current load average, so simplify the name

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1389506 13f79535-47bb-0310-9956-ffa450edef68
2012-09-24 18:17:50 +00:00
Jim Jagielski
1134cfb81d Would be nice to have some sort of canonical definition
of server loading for Apache. So create a struct that
holds some useful data. The hope is that for those
platforms that lack getloadavg(), people will write
replacements.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1389481 13f79535-47bb-0310-9956-ffa450edef68
2012-09-24 16:56:58 +00:00
Jeff Trawick
dfc4862f0e add pre_htaccess hook; in conjunction with earlier dirwalk_stat
and post_perdir_config hooks, this should allow mpm-itk to be
used without patches to httpd core



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1389339 13f79535-47bb-0310-9956-ffa450edef68
2012-09-24 12:42:32 +00:00
Jeff Trawick
9105fe3d46 add dirwalk_stat hook, for use by mpm-itk
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1388447 13f79535-47bb-0310-9956-ffa450edef68
2012-09-21 11:59:06 +00:00
Jim Jagielski
b360fcb2d2 OK, enable/allow previous broken, bad behavior iff the user
really, really wants it. And warn that b-m isn't recommended
in those cases.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1388029 13f79535-47bb-0310-9956-ffa450edef68
2012-09-20 13:41:45 +00:00
Jim Jagielski
664dd95af2 Persist local balancer-manager changes across restart/graceful.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1387110 13f79535-47bb-0310-9956-ffa450edef68
2012-09-18 12:15:50 +00:00
Jim Jagielski
bbc1e878f5 Add in new type CLEARINUSE which allows the inuse table to
be cleared upon storage. This may be expected/wanted/required
by some applications


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1387088 13f79535-47bb-0310-9956-ffa450edef68
2012-09-18 10:59:20 +00:00
Jim Jagielski
1100ba4f0f Additional entry to slotmem struct requires minor bump
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1386883 13f79535-47bb-0310-9956-ffa450edef68
2012-09-17 22:28:28 +00:00
Jim Jagielski
6e77cfce51 Allow for a forced grab of a slotmem slot.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1386880 13f79535-47bb-0310-9956-ffa450edef68
2012-09-17 22:26:28 +00:00
Stefan Fritsch
ec5abc7ad6 ap_sub_req_lookup_dirent() depends on the over-allocation done by
ap_make_full_path and ap_escape_uri, so let's document it so that it is not
accidentally removed.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1384924 13f79535-47bb-0310-9956-ffa450edef68
2012-09-14 21:06:05 +00:00
Daniel Gruno
3b9804871f A dependant is depentent on a dependency (note the subtle difference in spelling)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1380525 13f79535-47bb-0310-9956-ffa450edef68
2012-09-04 10:29:47 +00:00
Guenter Knauf
6f79dac483 Move *_DECLARE_* macros to beginning of line in headers.
Patch submitted by: normw gknw net.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1374963 13f79535-47bb-0310-9956-ffa450edef68
2012-08-20 10:09:42 +00:00
Jeff Trawick
5497cdd2b2 fix typo in comment
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1374856 13f79535-47bb-0310-9956-ffa450edef68
2012-08-19 21:41:50 +00:00
Jeff Trawick
b6f86b92c2 The Pidfile directive and ap_log_pid()/ap_remove_pid()/ap_read_pid()
now respect DefaultRuntimeDir


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1369808 13f79535-47bb-0310-9956-ffa450edef68
2012-08-06 12:15:03 +00:00
Jeff Trawick
37d741a9ab core: Respect DefaultRuntimeDir/DEFAULT_REL_RUNTIMEDIR for the
scoreboard (ScoreBoardFile).


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1369477 13f79535-47bb-0310-9956-ffa450edef68
2012-08-04 21:40:08 +00:00
Daniel Gruno
abafe1bd90 Typo fix
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1368396 13f79535-47bb-0310-9956-ffa450edef68
2012-08-02 09:17:34 +00:00
Daniel Gruno
63ebd9031a bad header info: ap_rflush does not return the number of bytes flushed, it returns 0 on success, -1 on error.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1368393 13f79535-47bb-0310-9956-ffa450edef68
2012-08-02 09:05:49 +00:00
Jeff Trawick
7479b23caa core: Add post_perdir_config hook.
Submitted by: Steinar Gunderson <sgunderson bigfoot.com>

trawick added/fixed include/ pieces


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1368121 13f79535-47bb-0310-9956-ffa450edef68
2012-08-01 16:54:00 +00:00
Daniel Gruno
8e0f68ea78 ap_str(case)cmp_match returns the opposite of what is advertized in the header.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1366319 13f79535-47bb-0310-9956-ffa450edef68
2012-07-27 09:57:09 +00:00
Joe Orton
6c41025260 Fix handling of ProxyBlock if a forward proxy is configured, and fix
mod_proxy_connect to avoid an inappropriate DNS lookup:

* modules/proxy/proxy_util.c (ap_proxy_checkproxyblock): Take hostname
  argument, make address argument optional.  Check names against
  hostname arg, omit if addr not given.
  (ap_proxy_determine_connection): Adjust for the above; pass hostname
  from URI not the next hop.

* modules/proxy/mod_proxy_ftp.c (proxy_ftp_handler): Adjust for
  ap_proxy_checkproxyblock change.

* modules/proxy/mod_proxy_connect.c (proxy_connect_handler): Adjust
  similarly, and avoid the DNS lookup on the request-URI hostname if a
  proxy is used.

* include/ap_mmn.h: Bump MMN.

PR: 43697


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1365001 13f79535-47bb-0310-9956-ffa450edef68
2012-07-24 12:17:00 +00:00
Jeff Trawick
58c1a25a96 mod_lbmethod_heartbeat, mod_heartmonitor: Respect DefaultRuntimeDir/
DEFAULT_REL_RUNTIMEDIR for the heartbeat storage file.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1364695 13f79535-47bb-0310-9956-ffa450edef68
2012-07-23 16:01:43 +00:00
Jeff Trawick
fb2066579f modernize some commentary on APEXIT_foo values
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1363186 13f79535-47bb-0310-9956-ffa450edef68
2012-07-19 00:09:27 +00:00
Jeff Trawick
952186c9f5 avoid decls for some Unix-specific functions on Win32 too
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1363035 13f79535-47bb-0310-9956-ffa450edef68
2012-07-18 18:28:04 +00:00
Rainer Jung
da40d757e7 Bump it up because of r1361784.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1362020 13f79535-47bb-0310-9956-ffa450edef68
2012-07-16 13:06:37 +00:00
Rainer Jung
b010e7ec9e Fix indentation.
No functional change.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1361791 13f79535-47bb-0310-9956-ffa450edef68
2012-07-15 20:29:56 +00:00
Rainer Jung
bfbbc819d5 Add missing HTTP status codes taken from
http://www.iana.org/assignments/http-status-codes/http-status-codes.xml 

The new codes are now known and some canned error
strings are provided. The web server does not yet actually
produce them in responses or reacts on getting them
from an origin server when acting as a proxy or gateway.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1361784 13f79535-47bb-0310-9956-ffa450edef68
2012-07-15 20:22:03 +00:00
Stefan Fritsch
0d77ab651b make varbuf functions treat AP_VARBUF_UNKNOWN consistently, improve docs
ap_varbuf_pdup(): copying the whole buffer in case strlen ==
AP_VARBUF_UNKNOWN does not make sense as the caller can not set
the exact buffer size, only a minimum. No API change as previously
the behavior with AP_VARBUF_UNKNOWN was undocumented.

regsub_core(): Checking for vb->buf is useless, it cannot be NULL
unless ap_varbuf_init has not been called.

ap_varbuf_cfg_getline(): Initially, allocate enough memory to hold
an empty line. If strlen == AP_VARBUF_UNKNOWN, use strlen(buf) instead
of undefined behavior.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1359884 13f79535-47bb-0310-9956-ffa450edef68
2012-07-10 20:19:03 +00:00