Commit Graph

353 Commits

Author SHA1 Message Date
1731e8c0b5 Improve error message
PR 54384

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1433613 13f79535-47bb-0310-9956-ffa450edef68
2013-01-15 20:20:14 +00:00
39e31f5775 change protocol number parsing in strict mode according to HTTPbis draft
- only accept single digit version components
- don't accept white-space after protocol specification


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1426992 13f79535-47bb-0310-9956-ffa450edef68
2012-12-30 21:24:55 +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
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
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
393a2f2c69 remove obsolete comment from 1.3 days
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1407528 13f79535-47bb-0310-9956-ffa450edef68
2012-11-09 16:30:37 +00:00
3c40c42d60 remove some more old unused code
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1407088 13f79535-47bb-0310-9956-ffa450edef68
2012-11-08 14:11:47 +00:00
4919ad92fa Remove unused code. "Next week" hasn't happened in the last 10 years or so.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1407004 13f79535-47bb-0310-9956-ffa450edef68
2012-11-08 10:43:18 +00:00
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
9840fde938 core: ErrorDocument now works for requests without a Host header.
PR: 48357


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1392347 13f79535-47bb-0310-9956-ffa450edef68
2012-10-01 14:20:37 +00:00
83701ac5cc Make sure that a triggering LimitRequestFieldSize is always logged, even if the
first read already exeeds the limit and ap_rgetline does not return a header
name.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1352911 13f79535-47bb-0310-9956-ffa450edef68
2012-06-22 14:57:30 +00:00
95fba12ad8 s/insure/ensure/
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1237407 13f79535-47bb-0310-9956-ffa450edef68
2012-01-29 18:22:35 +00:00
76aa41352d CVE-2012-0053: Fix an issue in error responses that could expose
"httpOnly" cookies when no custom ErrorDocument is specified for 
status code 400.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1234837 13f79535-47bb-0310-9956-ffa450edef68
2012-01-23 15:04:09 +00:00
6635e5a3da Adjust CVE-2011-3368/CVE-2011-4317 fixes to rely solely on
core's translate-name to fail unsupported URIs.

Rewrite and proxy now decline what they don't support rather
than fail the request.

Suggested by: trawick
Implemented by: jorton
Tweaked by: wrowe


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1233604 13f79535-47bb-0310-9956-ffa450edef68
2012-01-19 22:23:15 +00:00
2aa21a62b1 Clean up size_t abuse, part 2. ap_malloc/calloc/realloc are explicitly
excluded from this cleanup as they must be signature identical to the
clib functions, and although the definition of size_t has been flakey,
the definition of those functions appears to be generally clean since
ANSI C.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1228323 13f79535-47bb-0310-9956-ffa450edef68
2012-01-06 18:15:08 +00:00
cb21a0dbcc Further clarify the naming of the entity that directly connects to us by
calling that entity a client instead of a peer.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1214015 13f79535-47bb-0310-9956-ffa450edef68
2011-12-14 01:10:52 +00:00
ad489c105b Further clarify the naming of the entity that originates the request by
calling that entity a useragent instead of a client.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1214005 13f79535-47bb-0310-9956-ffa450edef68
2011-12-14 00:33:46 +00:00
10baccbe56 zap an unhelpful, out of date comment from httpd 1.2
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1213391 13f79535-47bb-0310-9956-ffa450edef68
2011-12-12 19:47:19 +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
394e5594d6 Introduce a per connection "peer_ip" and a per request "client_ip" to
distinguish between the raw IP address of the connection and the effective
IP address of the request.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1206291 13f79535-47bb-0310-9956-ffa450edef68
2011-11-25 19:42:04 +00:00
4ee7eea4cf Introduce a per request version of the remote IP address, which can be
optionally modified by a module when the effective IP of the client
is not the same as the real IP of the client (such as a load balancer).


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1204968 13f79535-47bb-0310-9956-ffa450edef68
2011-11-22 13:10:39 +00:00
71fefb6951 * Correctly return a 400 (Bad request) in case of a HTTP/0.9 request like
GET @example.org/foo


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1188745 13f79535-47bb-0310-9956-ffa450edef68
2011-10-25 15:56:08 +00:00
c75f86b0c7 Downgrade some more log messages indicating client errors from level error to
info. Add log messages for various reasons to return HTTP_BAD_REQUEST.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1185385 13f79535-47bb-0310-9956-ffa450edef68
2011-10-17 21:30:40 +00:00
3371c66263 SECURITY (CVE-2011-3368): Prevent unintended pattern expansion in some
reverse proxy configurations by strictly validating the request-URI:

* server/protocol.c (read_request_line): Send a 400 response if the
  request-URI does not match the grammar from RFC 2616.  This ensures
  the input string for RewriteRule et al really is an absolute path.

Reviewed by: rpluem, wrowe, covener, fielding


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1179239 13f79535-47bb-0310-9956-ffa450edef68
2011-10-05 14:24:44 +00:00
a4092c7a7d Enforce LimitRequestFieldSize after multiple headers with the same
name have been merged.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1178566 13f79535-47bb-0310-9956-ffa450edef68
2011-10-03 20:37:49 +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
a895bc4ee4 Fix handling of offset in ap_send_fd()
PR: 51592
Submitted by: Torsten Foertsch <torsten foertsch gmx net>


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1153424 13f79535-47bb-0310-9956-ffa450edef68
2011-08-03 10:46:04 +00:00
fba947527f Introduce new function ap_get_conn_socket() to access the socket of
a connection


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1135153 13f79535-47bb-0310-9956-ffa450edef68
2011-06-13 16:02:18 +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
cdb37c5e4d Make ap_rputs an inline function, as it is mostly used with string constants
and this allows the compiler to optimize the strlen() call away.

Submitted by: Christophe Jaillet <christophe jaillet wanadoo fr>


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1131465 13f79535-47bb-0310-9956-ffa450edef68
2011-06-04 18:50:55 +00:00
61a0413706 Use APR_STATUS_IS_... in some more cases.
While this is not strictly necessary everywhere, it makes it much easier
to find the problematic cases.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1102124 13f79535-47bb-0310-9956-ffa450edef68
2011-05-11 22:51:46 +00:00
089dcf8cec use APR_STATUS_IS_TIMEUP() instead of direct comparison with APR_TIMEUP.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1100511 13f79535-47bb-0310-9956-ffa450edef68
2011-05-07 11:34:23 +00:00
9175224482 New hook: ap_run_pre_read_request()
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1070616 13f79535-47bb-0310-9956-ffa450edef68
2011-02-14 19:21:37 +00:00
7dc89fcc4e comment on where multiple headers with same name get merged
(some strict Cookie parsers can't handle what happens later,
but that is not our fault)


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1057372 13f79535-47bb-0310-9956-ffa450edef68
2011-01-10 21:21:45 +00:00
eedf130332 Introduce note_auth_failure hook to allow modules to add support
for additional auth types. This makes ap_note_auth_failure() work with
mod_auth_digest again.

PR: 48807


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@960399 13f79535-47bb-0310-9956-ffa450edef68
2010-07-04 21:16:53 +00:00
01b9f2e551 - Be less verbose at levels INFO and DEBUG in mod_proxy* and mod_ssl
- Add some trace logging to core and http


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@951900 13f79535-47bb-0310-9956-ffa450edef68
2010-06-06 17:07:12 +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
e8643541c5 style nit (fix the one unaligned "=" out of fifteen)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@921302 13f79535-47bb-0310-9956-ffa450edef68
2010-03-10 11:02:00 +00:00
bf715d43fc * Only log a 408 if it is no keepalive timeout.
PR: 39785
Submitted by: Mark Montague <markmont umich.edu>, rpluem
Reviewed by: rpluem


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@919323 13f79535-47bb-0310-9956-ffa450edef68
2010-03-05 07:37:15 +00:00
9911c19b54 overlooked for 10 years, impressive ;-)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@917615 13f79535-47bb-0310-9956-ffa450edef68
2010-03-01 17:58:40 +00:00
115c1e496d Correctly align the behavior of headers_in to be consistent with the
treatment of headers_out, resolving PR 48359 by keeping subrequest
scope changes out of the main request headers.  This ensures that all
requests-without-bodies behave as the requests-with-bodies code has.

Mitre: CVE-2010-0434


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@901578 13f79535-47bb-0310-9956-ffa450edef68
2010-01-21 07:19:41 +00:00
2af96f1528 Fix potential segfault when dereferencing NULL request_rec
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@895483 13f79535-47bb-0310-9956-ffa450edef68
2010-01-03 21:31:57 +00:00
cc8eabe9ec Fix up r892678 as pointed out by rpluem.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@892808 13f79535-47bb-0310-9956-ffa450edef68
2009-12-21 13:11:14 +00:00
c140c941e4 Reject requests containing (invalid) NULL characters in request line
or request headers.
PR 43039


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@892678 13f79535-47bb-0310-9956-ffa450edef68
2009-12-21 00:40:07 +00:00
33b33d1987 Don't keepalive when we send a non-100 response while Client is expecting 100
and may be feeding us continuation data.
PR 47087


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@888310 13f79535-47bb-0310-9956-ffa450edef68
2009-12-08 10:22:56 +00:00
c0a0d085b4 no declarations after statements.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@821599 13f79535-47bb-0310-9956-ffa450edef68
2009-10-04 20:18:51 +00:00
aa726d199a cleanup brigade before reusing it
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@821481 13f79535-47bb-0310-9956-ffa450edef68
2009-10-04 09:00:26 +00:00
fbdde88b36 core, mod_deflate, mod_sed: Reduce memory usage by reusing bucket
brigades in several places


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@821471 13f79535-47bb-0310-9956-ffa450edef68
2009-10-04 07:37:28 +00:00
b5532dce62 core: Treat timeout reading request as 408 error, not 400.
Log 408 errors in access log as was done in Apache 1.3.x.

PR: 39785
Submitted by: Nobutaka Mantani, Stefan Fritsch
Reviewed and added to by: Dan Poirier


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@820760 13f79535-47bb-0310-9956-ffa450edef68
2009-10-01 19:28:36 +00:00