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

1185 Commits

Author SHA1 Message Date
Graham Leggett
09c4bc62d0 http: Add support for RFC2324/RFC7168.
Sample implementation: http://people.apache.org/~minfrin/mod_teapot.c


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1670594 13f79535-47bb-0310-9956-ffa450edef68
2015-04-01 10:03:56 +00:00
Yann Ylavic
f6090114a8 core: Cleanup the request soon/even if some output filter fails to
handle the EOR bucket.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1666998 13f79535-47bb-0310-9956-ffa450edef68
2015-03-16 13:52:39 +00:00
Yann Ylavic
bce39a4336 ap_die(): follow up to r1657881.
Use log level DEBUG for AP_FILTER_ERROR => HTTP_INTERNAL_SERVER_ERROR.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1665643 13f79535-47bb-0310-9956-ffa450edef68
2015-03-10 17:58:01 +00:00
Yann Ylavic
0a431ef862 core, modules: like r1657897 but for core and other modules than mod_proxy.
More uses of ap_map_http_request_error() and AP_FILTER_ERROR so that we never
return an HTTP error status from a handler if some filter generated a response
already.

That is, from a handler, either ap_get_brigade() (an input filter) returned
AP_FILTER_ERROR and we must forward it to ap_die(), or ap_pass_brigade() (an
output filter) failed with any status and we must return AP_FILTER_ERROR in
any case for ap_die() to determine whether a response is needed or not.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1665625 13f79535-47bb-0310-9956-ffa450edef68
2015-03-10 17:25:17 +00:00
Yann Ylavic
03a97d3da0 core: Follow up to r1664071: comments on new keep_alive_timeout_set flag.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1664299 13f79535-47bb-0310-9956-ffa450edef68
2015-03-05 10:41:19 +00:00
Yann Ylavic
df173b940d core: If explicitly configured, use the KeepaliveTimeout value of the
virtual host which handled the latest request on the connection, or by
default the one of the first virtual host bound to the same IP:port.

For non-async MPMs, use either r->server's or c->base_server's value in
ap_process_http_sync_connection() depending on a new server_rec's flag
called keep_alive_timeout_set and determined at config time.

For event MPM, use a queue per timeout value, chaining the queues per
type (keepalive wrt KeepAliveTimeout, write completion wrt to Timeout)
so that maintenance can be done on all the queues from the head, and such
that insertions/maintenance remain in O(1).
A server config is created and pointing to the queue of each vhost at
post_config time, hence the config can be associated to the connection
state (cs) at post_read_request time (keep_alive_timeout_set is used to
determine r->server vs c->base_server here), and we can simply insert
with TO_QUEUE_INSERT(cs->sc->q, cs).  PR56226.

While at it, since each queue now embeds it own timeout and hence the
expiration_time of the cs has changed to a queue_timestamp (the time it
was queued), we can detect clock skews and expire entries immediatly if
the system is set (eg. far) in the past during runtime and we want to
avoid waiting for (eg.) centuries before the current logic kills them.
Any entry which is registered above now + q->timeout is concerned, and
is now cleaned from the queue when encountered.  PR57374.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1664071 13f79535-47bb-0310-9956-ffa450edef68
2015-03-04 16:58:01 +00:00
Yann Ylavic
be12754eed http: Make ap_die() robust against any HTTP error code and not modify
response status (finally logged) when nothing is to be done.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1657881 13f79535-47bb-0310-9956-ffa450edef68
2015-02-06 16:16:52 +00:00
Eric Covener
ce217cfc64 Remove the bitfield spec from the http_ctx_t.state enum
as it causes an error-prone mismatch between the enum values and the
state values.  Caused a busy loop in windows.  

Added in r1484852 and trunk-only.

Submitted By: Edward Lu, Yann Ylavic
Committed By: covener



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1653539 13f79535-47bb-0310-9956-ffa450edef68
2015-01-21 14:09:49 +00:00
Ruediger Pluem
bcf652f6fc * Fix If-Match handling:
- We need to fail if we do NOT match.
  - ETag comparison only makes sense if we have an ETag

PR: 57358
Submitted by: Kunihiko Sakamoto <ksakamoto google.com>
Reviewed by: rpluem


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1646282 13f79535-47bb-0310-9956-ffa450edef68
2014-12-17 15:39:15 +00:00
Christophe Jaillet
a9c4c3a37d Concat string at compile time when possible.
Doing so, sometimes also give the opportunity to turn a 'ap_fputstrs' into a 'ap_fputs'.
PR 53741

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1626050 13f79535-47bb-0310-9956-ffa450edef68
2014-09-18 19:06:52 +00:00
Christophe Jaillet
fb0ad3fd89 Turn some APR_BUCKET_REMOVE(e)+apr_bucket_destroy(e) into the equivalent apr_bucket_delete(e) to reduce code verbosity
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1615026 13f79535-47bb-0310-9956-ffa450edef68
2014-08-01 04:23:50 +00:00
Christophe Jaillet
654889ccbc Add missing APLOGNO.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1611979 13f79535-47bb-0310-9956-ffa450edef68
2014-07-19 22:03: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
Christophe Jaillet
3b365793c1 fix logic in ap_method_list_(add|remove) in order:
- to correctly reset bits
       - not to modify the 'method_mask' bitfield unnecessarily

Also remove a useless 'register' in the declaration of a variable.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1610813 13f79535-47bb-0310-9956-ffa450edef68
2014-07-15 19:09:06 +00:00
Christophe Jaillet
5b6b58bbf2 Simplify code.
Cases where 'loc' doesn't have any ':' or is  starting with ':' are already handled by 'ap_ir_url()'
Calling 'apr_isascii()' seems useless.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1610383 13f79535-47bb-0310-9956-ffa450edef68
2014-07-14 10:52:39 +00:00
Jeff Trawick
6f8dfb8ed9 Include any error notes set by modules in the canned error
response for 403 errors.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1609938 13f79535-47bb-0310-9956-ffa450edef68
2014-07-12 14:52:08 +00:00
Yann Ylavic
ff4ff27e69 Use unsigned bit flags (otherwise the non-zero value to be used is -1).
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1603863 13f79535-47bb-0310-9956-ffa450edef68
2014-06-19 12:43:05 +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
William A. Rowe Jr
6c8aff78f1 Use a distinguishing APLOGNO for unk t-e with read-until-close behavior
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1541368 13f79535-47bb-0310-9956-ffa450edef68
2013-11-13 02:55:06 +00:00
Jim Jagielski
a194875231 80 rule
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1541290 13f79535-47bb-0310-9956-ffa450edef68
2013-11-12 22:48:33 +00:00
William A. Rowe Jr
9a8af6d236 Wrap at 80 still, here at httpd project
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1541270 13f79535-47bb-0310-9956-ffa450edef68
2013-11-12 22:14:54 +00:00
Jim Jagielski
a95d847f66 PR 55475: Detect incomplete body in HTTP input filter and return APR_INCOMPLETE
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1538776 13f79535-47bb-0310-9956-ffa450edef68
2013-11-04 21:31:27 +00:00
Chris Darroch
151a95ae46 Correct typo in comments for ap_map_http_request_error().
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1529991 13f79535-47bb-0310-9956-ffa450edef68
2013-10-07 16:14:39 +00:00
Rainer Jung
6a76621f9f core: Add missing Reason-Phrase in HTTP response headers.
PR 54946.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1529014 13f79535-47bb-0310-9956-ffa450edef68
2013-10-03 21:50:07 +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
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
Graham Leggett
0632971eac Update the log message number.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1494549 13f79535-47bb-0310-9956-ffa450edef68
2013-06-19 11:19:50 +00:00
Graham Leggett
98552db215 Ensure that any meta buckets are stripped while parsing a chunk.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1485772 13f79535-47bb-0310-9956-ffa450edef68
2013-05-23 16:31:01 +00:00
Graham Leggett
be4fefc51e core: Use a matching counter type.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1485266 13f79535-47bb-0310-9956-ffa450edef68
2013-05-22 16:11:23 +00:00
Graham Leggett
2a729432cd core: Make sure we allow unconstrained bodies from a proxy.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1485257 13f79535-47bb-0310-9956-ffa450edef68
2013-05-22 15:49:57 +00:00
Graham Leggett
d0dccd8815 core: Remove apr_brigade_flatten(), buffering and duplicated code
from the HTTP_IN filter, parse chunks in a single pass with zero copy.
Reduce memory usage by 48 bytes per request.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1484852 13f79535-47bb-0310-9956-ffa450edef68
2013-05-21 16:10:02 +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
Graham Leggett
9bc9d79079 core: Stop the HTTP_IN filter from attempting to write error buckets
to the output filters, which is bogus in the proxy case. Create a
clean mapping from APR codes to HTTP status codes, and use it where
needed.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1482522 13f79535-47bb-0310-9956-ffa450edef68
2013-05-14 18:58:06 +00:00
Graham Leggett
61f014bf78 Fix spelling mistake, no code change.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1480046 13f79535-47bb-0310-9956-ffa450edef68
2013-05-07 19:36:33 +00:00
Graham Leggett
6194962c46 core, mod_cache: Ensure RFC2616 compliance in ap_meets_conditions()
with weak validation combined with If-Range and Range headers. Break
out explicit conditional header checks to be useable elsewhere in the
server. Ensure weak validation RFC compliance in the byteranges filter.
Ensure RFC validation compliance when serving cached entities. PR 16142


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1479905 13f79535-47bb-0310-9956-ffa450edef68
2013-05-07 13:42:31 +00:00
Graham Leggett
997e0f6d33 core: Add the ability to do explicit matching on weak and strong ETags
as per RFC2616 Section 13.3.3.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1479528 13f79535-47bb-0310-9956-ffa450edef68
2013-05-06 11:41:10 +00:00
Guenter Knauf
2eb1a07d4a Stupid CodeWarrior compiler cant take vars with struct inits.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1428145 13f79535-47bb-0310-9956-ffa450edef68
2013-01-03 02:25:23 +00:00
Stefan Fritsch
d47f71f7d9 Remove support for Request-Range header sent by Navigator 2-3 and
MSIE 3


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1427465 13f79535-47bb-0310-9956-ffa450edef68
2013-01-01 17:00:23 +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
Christophe Jaillet
af32fbebef Avoid unnecessary %s substitution
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1419755 13f79535-47bb-0310-9956-ffa450edef68
2012-12-10 20:53:24 +00:00
Eric Covener
7eb8fbe0ba also copy r->invoke_mtx when creating a subrequest
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1402924 13f79535-47bb-0310-9956-ffa450edef68
2012-10-28 02:37:41 +00:00
Stefan Fritsch
8ec0c56b02 Code clean up (remove useless memory allocation)
Submitted by: Christophe JAILLET <christophe jaillet wanadoo fr>
PR: 52648


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1361803 13f79535-47bb-0310-9956-ffa450edef68
2012-07-15 21:19:54 +00:00
Stefan Fritsch
8c960a8c15 Various code clean up
Submitted by: Christophe JAILLET <christophe jaillet wanadoo fr>
PR: 52893 


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1361801 13f79535-47bb-0310-9956-ffa450edef68
2012-07-15 21:14:00 +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
Graham Leggett
e666d3a64e mod_mime: Don't arbitrarily bypass AddOutputFilter during a ProxyPass,
but then allow AddOutputFilter during a RewriteRule [P]. Make mod_mime
behave identically in both cases. PR52342.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1222370 13f79535-47bb-0310-9956-ffa450edef68
2011-12-22 17:48:17 +00:00
Stefan Fritsch
76f782e188 Various code cleanup to avoid compiler, cppcheck, or clang warnings:
modules/debugging/mod_firehose.c: Make some internal functions static
                                  (to do: logs_cleanup() is unused)

modules/filters/mod_charset_lite.c: Remove dead assignments

modules/filters/mod_include.c: likewise

modules/metadata/mod_usertrack.c: likewise

modules/proxy/mod_proxy_ftp.c: likewise

modules/ssl/ssl_engine_pphrase.c: likewise

modules/proxy/mod_proxy_balancer.c: likewise;
                                    Remove NULL check that can never happen

modules/proxy/proxy_util.c: Axe NULL-check that can never happen and if it
                            would, it would just mask another bug

os/unix/unixd.c: likewise

modules/http/http_filters.c: Remove sub-condition that is always true

modules/lua/mod_lua.c: Add default cases to switch statements

modules/generators/mod_autoindex.c: Unsigned value can never be < 0

server/util_expr_eval.c: Fix compiler warnings with VC and on OS2



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1220493 13f79535-47bb-0310-9956-ffa450edef68
2011-12-18 17:52:59 +00:00
Graham Leggett
2af2fa44ad 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@1214003 13f79535-47bb-0310-9956-ffa450edef68
2011-12-14 00:31:51 +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