1
0
mirror of https://github.com/apache/httpd.git synced 2025-11-14 01:22:37 +03:00
Commit Graph

269 Commits

Author SHA1 Message Date
Christophe Jaillet
f1176161be Fix sscanf format spotted by cppcheck.
Improve alignment.
Untested.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1621419 13f79535-47bb-0310-9956-ffa450edef68
2014-08-30 06:51:11 +00:00
Christophe Jaillet
56d0c25725 Add missing APLOGNO.
Refactor some lines to keep APLOGNO on the same line as ap_log_error, when applicable.
Split lines longer than 80.
Improve alignment.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1612068 13f79535-47bb-0310-9956-ffa450edef68
2014-07-20 09:32:58 +00:00
Eric Covener
8cc5e00f9e *) SECURITY: CVE-2013-5704 (cve.mitre.org)
core: HTTP trailers could be used to replace HTTP headers
     late during request processing, potentially undoing or
     otherwise confusing modules that examined or modified
     request headers earlier.  Adds "MergeTrailers" directive to restore
     legacy behavior.  

Submitted By: Edward Lu, Yann Ylavic, Joe Orton, Eric Covener
Committed By: covener



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1610814 13f79535-47bb-0310-9956-ffa450edef68
2014-07-15 19:11:02 +00:00
Jim Jagielski
a20df5d2d0 new logno
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1554522 13f79535-47bb-0310-9956-ffa450edef68
2013-12-31 14:35:41 +00:00
Justin Erenkrantz
93143eb07b Add directives to control two protocol options:
HttpContentLengthHeadZero - allow Content-Length of 0 to be returned on HEAD
 HttpExpectStrict - allow admin to control whether we must see "100-continue"

This is helpful when using Ceph's radosgw and httpd.

Inspired by: Yehuda Sadeh <yehuda@inktank.com>
See https://github.com/ceph/apache2/commits/precise

* include/http_core.h
  (core_server_config): Add http_cl_head_zero and http_expect_strict fields.
* modules/http/http_filters.c
  (ap_http_header_filter): Only clear out the C-L if http_cl_head_zero is not
  explictly set.
* server/core.c
  (merge_core_server_configs): Add new fields.
  (set_cl_head_zero, set_expect_strict): New config helpers.
  (HttpContentLengthHeadZero, HttpExpectStrict): Declare new directives.
* server/protocol.c
  (ap_read_request): Allow http_expect_strict to control if we return 417.
* include/ap_mmn.h
  (MODULE_MAGIC_NUMBER_MAJOR, MODULE_MAGIC_NUMBER_MINOR): Bump.
* CHANGES: Add a brief description.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1554303 13f79535-47bb-0310-9956-ffa450edef68
2013-12-30 20:01:14 +00:00
Christophe Jaillet
553054d0ba Fix missing spaces in messages
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1546860 13f79535-47bb-0310-9956-ffa450edef68
2013-12-01 21:13:56 +00:00
Kaspar Brand
31156ac269 PR 55616 (add missing APLOGNO), part 1
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1527925 13f79535-47bb-0310-9956-ffa450edef68
2013-10-01 06:24:29 +00:00
Jim Jagielski
5e6a9dee07 draft-ietf-httpbis-p1-messaging-23 fixes regarding interactions
between TE and content-length in the same req/resp.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1524770 13f79535-47bb-0310-9956-ffa450edef68
2013-09-19 15:30:10 +00:00
Jim Jagielski
21bfe0fdc6 Update rationale
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1524192 13f79535-47bb-0310-9956-ffa450edef68
2013-09-17 19:44:08 +00:00
Jim Jagielski
b18fa49a75 revert 1524161 for the time being
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1524190 13f79535-47bb-0310-9956-ffa450edef68
2013-09-17 19:37:03 +00:00
Jim Jagielski
a10a8937ac RFC2616 issue
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1524161 13f79535-47bb-0310-9956-ffa450edef68
2013-09-17 18:37:18 +00:00
Joe Orton
c0bfdbf212 * server/protocol.c (r_flush): Use int return type as per declaration
of apr_vformatter(); no functional change.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1487528 13f79535-47bb-0310-9956-ffa450edef68
2013-05-29 16:09:24 +00:00
Christophe Jaillet
370e4a5e04 Avoid over allocation when dealing with the common case. As stated in the comment above : "We'll assume the common case where one bucket is enough".
Doing so should save a few hundreds bytes in the 'request' pool when processing a request

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1483005 13f79535-47bb-0310-9956-ffa450edef68
2013-05-15 18:52:49 +00:00
Graham Leggett
715ac06c81 core: Use the proper macro for HTTP/1.1.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1482996 13f79535-47bb-0310-9956-ffa450edef68
2013-05-15 18:40:14 +00:00
Graham Leggett
324994c36a core: Stop ap_finalize_request_protocol() and ap_get_client_block() from silently
swallowing errors from the filter stack, create error buckets and return them
appropriately.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1482918 13f79535-47bb-0310-9956-ffa450edef68
2013-05-15 15:46:01 +00:00
Joe Schaefer
f24ffba0d0 ap_rgetline_core() now pulls from r->proto_input_filters
for better input filtering behavior during chunked trailer
processing by ap_http_filter().


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1446421 13f79535-47bb-0310-9956-ffa450edef68
2013-02-15 01:32:45 +00:00
Christophe Jaillet
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
Stefan Fritsch
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
Stefan Fritsch
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
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
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
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
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
Stefan Fritsch
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
Stefan Fritsch
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
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
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
Stefan Fritsch
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
Jeff Trawick
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
Eric Covener
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
Jeff Trawick
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
William A. Rowe Jr
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
Graham Leggett
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
Graham Leggett
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
Jeff Trawick
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
Stefan Fritsch
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
Graham Leggett
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
Graham Leggett
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
Ruediger Pluem
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
Stefan Fritsch
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
Joe Orton
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
Stefan Fritsch
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
Jim Jagielski
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
Stefan Fritsch
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
Stefan Fritsch
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
Stefan Fritsch
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
Stefan Fritsch
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
Stefan Fritsch
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
Eric Covener
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
Jim Jagielski
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