1
0
mirror of https://github.com/apache/httpd.git synced 2025-11-11 02:42:23 +03:00
Commit Graph

491 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
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
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
Fabien Coelho
310a0975a5 remove C99 features from 'Warning' directive handling
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1418734 13f79535-47bb-0310-9956-ffa450edef68
2012-12-08 19:06:50 +00:00
Fabien Coelho
0886d3fcaf Add minor 'Warning' directive as defined in current mod_macro.
* server/core.c: add 'Warning' directive by extending the 'Error'
  directive implementation. The 'Error' behavior is slightly changed
  so as to use verbose ap_log_error instead of returning the message.
* docs/manual/mod/core.xml: add documentation for 'Warning'.
* server/config.c: add comment about syntax vs configuration errors.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1418677 13f79535-47bb-0310-9956-ffa450edef68
2012-12-08 14:49:09 +00:00
Stefan Fritsch
8a6add5f37 Sort error message for ServerTokens by increasing verbosity. Add missing 'OS'
variant.

Remove some trailing whitespace.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1416150 13f79535-47bb-0310-9956-ffa450edef68
2012-12-02 10:33:27 +00:00
Eric Covener
ddabe66f5e PR54222: catch invalid ServerTokens args
Submitted by: Jackie Zhang  <jackie.qq.zhang gmail.com>
Reviewed/modified by: covener



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1415008 13f79535-47bb-0310-9956-ffa450edef68
2012-11-29 00:24:44 +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
f9d96c89db Expose ap_method_register() to the admin with a new RegisterHttpMethod
directive.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1407599 13f79535-47bb-0310-9956-ffa450edef68
2012-11-09 19:38:19 +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
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
Stefan Fritsch
0d734757ab Make <If> sections in virtual host context fill in cmd->path so that
other directive notice that they are in a config section.
    
This fixes LogLevel not working in <If> sections that are not in
Location/Directory/File sections.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1406493 13f79535-47bb-0310-9956-ffa450edef68
2012-11-07 08:29:49 +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
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
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
Eric Covener
4e21f3952f r1052419 changed the default value of Options to FollowSymlinks,
but inadvertently made "AllowOverride Options" behave like 
"AllowOverride Options=FollowSymLinks".

PR53444


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1359976 13f79535-47bb-0310-9956-ffa450edef68
2012-07-11 01:48:48 +00:00
Stefan Fritsch
5b0c08477f Fix merging of AllowOverrideList and ContentDigest.
Remove some useless code.
Pointed out by covener


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1304852 13f79535-47bb-0310-9956-ffa450edef68
2012-03-24 16:32:53 +00:00
Stefan Fritsch
285bd508ef Disallow directives in AllowOverrideList which are only allowed
in VirtualHost or server context. These are usually not prepared to be
called in .htaccess files.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1302665 13f79535-47bb-0310-9956-ffa450edef68
2012-03-19 21:34:03 +00:00
Stefan Fritsch
c9fa20fb10 In AllowOverrideList, do not allow 'None' together with other directives.
While there, improve log messages and save some memory by allocating correct
size for table.

PR 52823


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1302653 13f79535-47bb-0310-9956-ffa450edef68
2012-03-19 20:57:19 +00:00
Stefan Fritsch
03a8b1b4c2 Fix some typos
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1300766 13f79535-47bb-0310-9956-ffa450edef68
2012-03-14 22:21:50 +00:00
Jim Jagielski
fc1b444d2e Fold on Jeff's DefaultRuntimeDir impl... docs on the way
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1297955 13f79535-47bb-0310-9956-ffa450edef68
2012-03-07 12:31:58 +00:00
Stefan Fritsch
1bbff8f19b Replace ap_create_core_ctx()/ap_core_ctx_get_bb() with a hook
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1240470 13f79535-47bb-0310-9956-ffa450edef68
2012-02-04 09:44:19 +00:00
Nick Kew
e0ddfe0fdf Core configuration: add AllowOverride option to treat syntax
errors in .htaccess as non-fatal.
PR 52439



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1229021 13f79535-47bb-0310-9956-ffa450edef68
2012-01-09 04:01:06 +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
Stefan Fritsch
7f188926f7 Fix handling of piped, syslog, or inherited ErrorLog entries
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1225223 13f79535-47bb-0310-9956-ffa450edef68
2011-12-28 16:33:11 +00:00
Stefan Fritsch
4a62372445 Check during configtest that the directories for error logs exist
Testing under Windows is welcome

PR: 29941 


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1225199 13f79535-47bb-0310-9956-ffa450edef68
2011-12-28 14:54:49 +00:00
Stefan Fritsch
70cfa8d396 Fix -DDUMP_RUN_CFG output for piped and syslog loggers
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1225198 13f79535-47bb-0310-9956-ffa450edef68
2011-12-28 14:50:44 +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
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
Stefan Fritsch
40ac38ff05 Remove MPM-private stuff from conn_state_t
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1204104 13f79535-47bb-0310-9956-ffa450edef68
2011-11-19 23:35:46 +00:00
Greg Ames
f380e0c8ab ap_core_translate: factor out duplicate code. no functional change.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1202236 13f79535-47bb-0310-9956-ffa450edef68
2011-11-15 15:20:38 +00:00
Jeff Trawick
5405226ae2 end-generation hook: Fix false notification of end-of-generation for
temporary intervals with no active MPM children.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1200449 13f79535-47bb-0310-9956-ffa450edef68
2011-11-10 17:46:57 +00:00
Jeff Trawick
239e4c0466 config generation # (reported by ap_state_query(AP_SQ_CONFIG_GEN):
* start at 0 instead of 1
* don't increment until after pconf cleanups run, in case a 
  cleanup needs to check the related config generation


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1200147 13f79535-47bb-0310-9956-ffa450edef68
2011-11-10 04:52:52 +00:00
Stefan Fritsch
44cd57149b fix typo
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1199528 13f79535-47bb-0310-9956-ffa450edef68
2011-11-08 23:27:52 +00:00
Stefan Fritsch
b791885bad Only init the RNG once at startup. This saves some entropy and works around the APR bug
fixed in r1198921


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1198930 13f79535-47bb-0310-9956-ffa450edef68
2011-11-07 20:57:02 +00:00
Stefan Fritsch
7c5a4c2bc9 Call apr_random_after_fork() manually in the child processes because the MPMs
use plain fork() and not apr_proc_fork().
Also add some workaround for APR not changing the RNG state in the parent.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1198868 13f79535-47bb-0310-9956-ffa450edef68
2011-11-07 18:46:47 +00:00
Stefan Fritsch
0ddfb3e6cc Add -D DUMP_RUN_CFG option to dump some configuration items
from the parsed (or default) config. This is useful for init scripts that
need to setup temporary directories and permissions, for example if those
temporary directories are located on a ram disk.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1180681 13f79535-47bb-0310-9956-ffa450edef68
2011-10-09 18:35:23 +00:00
Stefan Fritsch
a216c436c6 Downgrade error log messages which accompany a 404 request status from loglevel
error to info.

List thread at
http://mail-archives.apache.org/mod_mbox/httpd-dev/201110.mbox/%3Calpine.DEB.2.00.1110041948280.664@eru.sfritsch.de%3E

PR: 35768


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1180328 13f79535-47bb-0310-9956-ffa450edef68
2011-10-08 07:36:56 +00:00
Stefan Fritsch
1951a037bf More cleanup: Expand tabs and some more indentation fixes
No functional change


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1174929 13f79535-47bb-0310-9956-ffa450edef68
2011-09-23 18:08:42 +00:00
Guenter Knauf
026b641a70 Fix cut'n'paste errors: APR_DECLARE -> AP_DECLARE / part2.
Submitted by: NormW <normw gknw.net>


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1171850 13f79535-47bb-0310-9956-ffa450edef68
2011-09-16 23:20:01 +00:00
Stefan Fritsch
2d4e23d88b Create wrapper API for apr_random;
use in mod_lbmethod_heartbeat and mod_serf to
- replace some needles use of apr_generate_random_bytes
- remove code duplication


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1171247 13f79535-47bb-0310-9956-ffa450edef68
2011-09-15 19:53:59 +00:00
Jim Jagielski
625b89a7e2 Add in MaxRangeOverlaps and MaxRangeReversals to accomodate
more control over acceptable Range headers:

        See: http://trac.tools.ietf.org/wg/httpbis/trac/ticket/311

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1169756 13f79535-47bb-0310-9956-ffa450edef68
2011-09-12 14:15:53 +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
Eric Covener
fe5f7b561d take care of some MaxRanges feedback:
* allow "none" to be expressed in config
 * send Accept-Ranges: none with MaxRanges none
 * stop accepting confusing/ambiguous "0", start accepting "unlimited".



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1166282 13f79535-47bb-0310-9956-ffa450edef68
2011-09-07 17:29:49 +00:00
Eric Covener
1aaea94cb5 add MaxRanges directive institute a default limit of 200 (post-merge where
applicable) Ranges before returning the complete resource.

(minor mmn bump for core_dir_config addition)



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1162584 13f79535-47bb-0310-9956-ffa450edef68
2011-08-28 20:35:07 +00:00
Stefan Fritsch
9bd21d2c8a Forbid some directives in .htaccess because of AllowOverrideList:
core:          AllowOverride, AllowOverrideList
mod_authn_dbd: AuthDBDUserPWQuery, AuthDBDUserRealmQuery
mod_authz_dbd: AuthzDBDQuery, AuthzDBDRedirectQuery
mod_proxy:     BalancerMember, ProxySet

Adjust for use in .htaccess:
mod_actions:   Script


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1153687 13f79535-47bb-0310-9956-ffa450edef68
2011-08-03 22:10:27 +00:00
Stefan Fritsch
9d2ca013b6 cleanups related to new AllowOverrideList functionality:
- add new NOT_IN_HTACCESS flag for ap_check_cmd_context() 
- describe the need for this in new_api_2_4.xml
- forbid Define and UnDefine in .htaccess


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1153676 13f79535-47bb-0310-9956-ffa450edef68
2011-08-03 21:36:18 +00:00
Stefan Fritsch
c1f50be04f Adjust some messages for <If> blocks and remove some dead code
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1153674 13f79535-47bb-0310-9956-ffa450edef68
2011-08-03 21:28:42 +00:00
Daniel Ruggeri
0d69087127 Add AllowOverrideList directive and documentation
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1151654 13f79535-47bb-0310-9956-ffa450edef68
2011-07-27 22:24:14 +00:00