1
0
mirror of https://github.com/apache/httpd.git synced 2025-08-05 16:55:50 +03:00

560 Commits

Author SHA1 Message Date
Jean-Frederic Clere
d21b4c41f6 Merge PR#419: make sure the right method is displayed.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1921973 13f79535-47bb-0310-9956-ffa450edef68
2024-11-20 13:11:11 +00:00
Ruediger Pluem
aa4b05ee05 * Always trust content types that we set literally
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1918814 13f79535-47bb-0310-9956-ffa450edef68
2024-07-02 06:35:53 +00:00
Eric Covener
925b6f0ceb add ap_set_content_type_ex to differentiate
trusted sources


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1918551 13f79535-47bb-0310-9956-ffa450edef68
2024-06-24 17:22:51 +00:00
Christophe Jaillet
517a0c3ec2 Add missing 'break'
[skip ci]

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1900679 13f79535-47bb-0310-9956-ffa450edef68
2022-05-08 06:16:58 +00:00
Stefan Eissing
fbb84e00fa Merge PR 311:
*) core/mod_http: use REQUEST meta buckets and a new HTTP/1.x specific
     input filter to separate the handling for HTTP requests from the
     handling of HTTP/1.x request parsing and checks.
     A new HTTP1_REQUEST_IN filter installs itself on http/1.1 connections
     before a request is being read. It generates either a REQUEST meta
     bucket on success or an ERROR bucket with the proposed response status.
     The core connection processing, relying on ap_read_request(), now expects
     a REQUEST or ERROR bucket from the input filters and is agnostic to
     specific HTTP versions and how they bring requests into the server.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1899799 13f79535-47bb-0310-9956-ffa450edef68
2022-04-13 07:40:17 +00:00
Stefan Eissing
0296d7dfea *) core/mod_http: use RESPONSE meta buckets and a new HTTP/1.x specific
filter to send responses through the output filter chain.
     Specifically: the HTTP_HEADER output filter and ap_send_interim_response()
     create a RESPONSE bucket and no longer are concerned with HTTP/1.x
     serialization.
     A new HTTP1_RESPONSE_OUT transcode filter writes the proper HTTP/1.x
     bytes when dealing with a RESPONSE bucket. That filter installs itself
     on the pre_read_request hook when the connection has protocol 'http/1.1'.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1899648 13f79535-47bb-0310-9956-ffa450edef68
2022-04-07 10:41:46 +00:00
Stefan Eissing
cc232ba454 *) core: add ap_h1_append_header() for single header values.
*) mod_proxy: use of new ap_h1_header(s) functions for
     formatting HTTP/1.1 requests.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1899550 13f79535-47bb-0310-9956-ffa450edef68
2022-04-04 09:41:25 +00:00
Stefan Eissing
4442201e61 *) core/mod_http/mod_http2:
- adds new meta bucket types REQUEST, RESPONSE and HEADERS to the API.
     - adds a new method for setting standard response headers Date and Server
     - adds helper methods for formatting parts of HTTP/1.x, like headers and 
       end chunks for use in non-core parts of the server, e.g. mod_proxy
     - splits the HTTP_IN filter into a "generic HTTP" and "specific HTTP/1.x" 
       filter. The latter one named HTTP1_BODY_IN.
     - Uses HTTP1_BODY_IN only for requests with HTTP version <= 1.1
     - Removes the chunked input simulation from mod_http2
     - adds body_indeterminate flag to request_rec that indicates that a request 
       body may be present and needs to be read/discarded. This replaces logic 
       that thinks without Content-Length and Transfer-Encoding, no request 
       body can exist.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1899547 13f79535-47bb-0310-9956-ffa450edef68
2022-04-04 08:24:09 +00:00
Eric Covener
90743b00c7 remove extra whitespace in HTTP_NOT_IMPLEMENTED
Github: closes #196
Submitted By: Rajeeva Lochana



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1891200 13f79535-47bb-0310-9956-ffa450edef68
2021-07-02 12:28:59 +00:00
Eric Covener
90215f5452 fix xlate of literal text ErrorDocument on EBCDIC
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1891145 13f79535-47bb-0310-9956-ffa450edef68
2021-06-29 15:57:55 +00:00
Joe Orton
2517583a44 Define ap_method_mask_t (typedef for apr_uint64_t) and use for method
bitmasks rather than apr_int64_t.  Fixes UBSan errors shifting to the
top bit of a signed integer.

* include/httpd.h: Add ap_method_mask_t, use it for AP_METHOD_BIT.
  (struct ap_method_mask_t): Likewise for method_mask field.
  (struct request_rec): Likewise for allowed field.

* include/http_config.h (struct cmd_parms): Likewise for limited field.

* include/ap_mmn.h: Bump MMN major.

* modules/*/*.c: Adjust all method masks to use ap_method_mask_t.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1874114 13f79535-47bb-0310-9956-ffa450edef68
2020-02-17 10:11:56 +00:00
Mike Rumph
85760859ca Fix spelling errors found by codespell. [skip ci]
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1873985 13f79535-47bb-0310-9956-ffa450edef68
2020-02-13 18:15:57 +00:00
Eric Covener
c1ac12fa3b factor out TE=chunked checking
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1873748 13f79535-47bb-0310-9956-ffa450edef68
2020-02-07 17:14:05 +00:00
Eric Covener
fbecdc0f1e PR62989: DOCTYPE tags in server-generated HTML.
Submitted By: Andra Farkas <deepbluemistake gmail.com>, Giovanni Bechis <giovanni paclan.it>




git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1873397 13f79535-47bb-0310-9956-ffa450edef68
2020-01-31 02:38:05 +00:00
Eric Covener
c0ce3a7292 remove request details from error documents (CVE-2019-10092).
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1864191 13f79535-47bb-0310-9956-ffa450edef68
2019-08-02 01:27:37 +00:00
Joe Orton
3a0f075a54 * include/httpd.h: Define HTTP_TOO_EARLY (425) per RFC 8470.
* modules/http/http_protocol.c (status_lines,
  get_canned_error_string): Add 425 response.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1842007 13f79535-47bb-0310-9956-ffa450edef68
2018-09-26 09:01:19 +00:00
Yann Ylavic
f673148e9b http: Enforce consistently no response body with both 204 and 304 statuses.
Provide AP_STATUS_IS_HEADER_ONLY() helper/macro to check for 204 or 304 and
use it where some special treatment is needed when no body is expected.

Some of those places handled 204 only.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1837056 13f79535-47bb-0310-9956-ffa450edef68
2018-07-30 13:08:23 +00:00
Luca Toscano
99f34e5f15 http_protocol.c: avoid duplicate headers when using
ap_send_error_response

While debugging PR 61860 I found a chain of events
that leads to duplicate headers in the HTTP response
if Header always set is used in the httpd's config.

As far as can understand, mod_headers uses err_headers_out
when dealing with the 'always' setting, since it is expected
to be preserved even on error. The current code seems
to correctly preserve the important headers like Location
(happening before the bit of code that changed), but then
it swaps headers_out with err_headers_out and clears
err_headers_out. My understanding is that this will cause
mod_headers, if called again, to re-insert the headers
set via 'always' again in err_headers_out, leading to a
duplication in the response. So far I managed to reproduce this
only with the specific use case outlined by the PR, but
there might be more.

r1831585 was added to the test suite for PR 61860,
(marked as TODO), and now it seems to pass as expected.

Since this part of the codebase has been working fine
for years I was reluctant to change it, but it seems
the right change to me. I didn't run into any regression
while testing this change (including running the test suite),
but as always I'd be glad to get feedback from a more expert
eye. If I missed a clear regression I'll make sure to
add it to the test suite as part of the follow up.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1832092 13f79535-47bb-0310-9956-ffa450edef68
2018-05-23 11:22:34 +00:00
Christophe Jaillet
99ab47d8ef Since r1753257, "HEAD" method is registered into the registry hash with the M_GET ID.
(r1757672 in 2.4.x)

We iterate over all the values of the registery, so there is no need anymore to have a special case for "HEAD" in  'make_allow()'. It has its own entry now.

With the current code, we have "HEAD" 3 times in the Allow Header field.
This is because we find M_GET 2 times in the registry hash. The first one gives "GET" and "HEAD" (as the special handling), and the second "HEAD" and "HEAD" (as the special handling).


BTW, use APR_ARRAY_PUSH instead of hand coding it, in oder to have the code more readable.

PR 61207

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1799784 13f79535-47bb-0310-9956-ffa450edef68
2017-06-25 06:09:43 +00:00
Stefan Eissing
2ebdeabd30 addendum to r1769760 to make it generate 100 status lines
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1770220 13f79535-47bb-0310-9956-ffa450edef68
2016-11-17 15:43:54 +00:00
Yann Ylavic
ef6e478b78 http: Allow unknown response status' lines returned in the form of:
HTTP/x.x xxx Status xxx



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1769760 13f79535-47bb-0310-9956-ffa450edef68
2016-11-15 09:06:55 +00:00
William A. Rowe Jr
ea506b6708 A whole lotta nope, if you implement HTCPCP then register your methods in init
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1753263 13f79535-47bb-0310-9956-ffa450edef68
2016-07-18 16:20:27 +00:00
William A. Rowe Jr
26e6eaab3e Restore 'HEAD' method as a special case of GET with the common ID
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1753257 13f79535-47bb-0310-9956-ffa450edef68
2016-07-18 16:01:21 +00:00
William A. Rowe Jr
4a87665e53 The method_registry is initialized in register_hooks() for mod_http
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1753245 13f79535-47bb-0310-9956-ffa450edef68
2016-07-18 15:31:39 +00:00
William A. Rowe Jr
448c82bfd5 Simplify; this code is executed one per request processed, saving
an immeasurably small quantum of CPU of a server under load.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1753223 13f79535-47bb-0310-9956-ffa450edef68
2016-07-18 13:41:26 +00:00
Jim Jagielski
256e5cbdad Add 451... Needed to adjust RESPONSE_CODES which
was not in the provided patch
BUGZ# 58985

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1730723 13f79535-47bb-0310-9956-ffa450edef68
2016-02-16 17:33:31 +00:00
Christophe Jaillet
25e83d29f4 Use 'ap_array_str_contains' to simplify code.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1720996 13f79535-47bb-0310-9956-ffa450edef68
2015-12-20 08:34:59 +00:00
Yann Ylavic
33d6aaf455 http, mod_ssl: Introduce and return the 421 (Misdirected Request) status code
for clients requesting a hostname on a reused connection whose SNI (from the
TLS handshake) does not match.
PR 5802.

This allows HTTP/2 clients to fall back to a new connection as per:
https://tools.ietf.org/html/rfc7540#section-9.1.2

Proposed by: Stefan Eissing <stefan eissing.org>
Reviewed by: ylavic


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1685069 13f79535-47bb-0310-9956-ffa450edef68
2015-06-12 11:33:22 +00:00
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
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
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
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
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
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
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
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
Eric Covener
c45e14b246 refactor to pull setting of Accept-Ranges header into http_protocol.c which
had been copied to other handlers.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1166663 13f79535-47bb-0310-9956-ffa450edef68
2011-09-08 12:56:08 +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
Guenter Knauf
e614b24dae Reverted r1040177 due to Joe's objection.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1041905 13f79535-47bb-0310-9956-ffa450edef68
2010-12-03 16:56:57 +00:00
Guenter Knauf
0ec3771d37 Supress compiler warning.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1040177 13f79535-47bb-0310-9956-ffa450edef68
2010-11-29 16:37:49 +00:00
Rich Bowen
21195ea61f Phrasing changes recommended by Jack Dozier. Bug #50145
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1026792 13f79535-47bb-0310-9956-ffa450edef68
2010-10-24 13:24:31 +00:00
Rich Bowen
10916d6d51 Take a slightly less "you broke it!!" tone in the default 500 Internal
Server Error default error message. (Bug #50145)


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1026473 13f79535-47bb-0310-9956-ffa450edef68
2010-10-22 20:03:22 +00:00
Nick Kew
ec0051094a Move AddOutputFilterByType implementation from core to mod_filter.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@966869 13f79535-47bb-0310-9956-ffa450edef68
2010-07-22 21:54:39 +00:00
Stefan Fritsch
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
Nick Kew
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
Ruediger Pluem
19831adabc * Add missing , to make it compile again.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@814114 13f79535-47bb-0310-9956-ffa450edef68
2009-09-12 07:59:31 +00:00
William A. Rowe Jr
6a92828171 Catch the somewhat absurd combination of a 417 error where no Expect header
was present.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@814048 13f79535-47bb-0310-9956-ffa450edef68
2009-09-11 21:55:46 +00:00
Jeff Trawick
b949658d4d axe ancient platform checks
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@759682 13f79535-47bb-0310-9956-ffa450edef68
2009-03-29 13:59:07 +00:00