Parent Directory
|
Revision Log
| Links to HEAD: | (view) (annotate) |
| Sticky Revision: |
* Fix 'may be used uninitialized in this function' compiler warning.
merge if blocks
Make sure to not destroy bucket brigades that have been created by earlier filters. Otherwise the pool cleanups would be removed causing potential memory leaks later on.
defined apr_status_t rv one time at entry of ap_core_output_filter() instead of multiple times within the code which caused compile break every now and then.
* Replace brigade_move with apr_brigade_split_ex as spotted by pquerna.
* Lower memory usage by reusing the brigade instead of constantly recerating one. Submitted by: Stefan Fritsch <sf sfritsch.de> Reviewed by: rpluem
remove leader, perchild, and threadpool MPMs (other than non-English bits in common parts of the manual)
Introduce a new set of APIs to allow MPMs to be proper modules instead of integral parts which share global variables, functions, and macros with the rest of httpd. Converted now: prefork, worker, event, simple, WinNT* *WinNT hasn't been built or tested, and relies on a hack to include the WinNT mpm.h to disable Unixy MPM support routines in mpm_common.c
API Cleanup in preperation for 2.4.x, make sure all exported functions or variables contain an ap_ prefix.
* Do more greedy reads in the core input filter to get more closer to the number of bytes requested.
Remove all references to CORE_PRIVATE.
Otherwise it doesn't compile on HP-UX when using cc.
Only cleanup new_bb, if it isn't NULL, fixing a crash in the event MPM when write compeltion is active and a client disconnects.
* server/core_filters.c (ap_core_output_filter): Fail quickly with APR_ECONNABORTED if the c->aborted flag is already set. PR: 39605
Fix a typo.
sendfile_nonblocking() takes the _brigade_ as an argument, gets the first bucket from the brigade, finds it not to be a FILE bucket and barfs. The fix is to pass a bucket rather than a brigade.
Fix warning on Darwin 8.7.0 (OS X 10.4.7) due to the prototype for sendfile_nonblocking being declared outside ifdefs even though the function is defined and used only when APR_HAS_SENDFILE
update license header text
Update the copyright year in all .c, .h and .xml files
* Fix a regression from 2.2.x: Set c->aborted to 1 if the return code from writing to the client is different from APR_SUCCESS in the blocking case or APR_SUCCESS or APR_EAGAIN in the non blocking case.
* Move code for broken backend detection out of core filter into a new http protocol filter (ap_http_broken_backend_filter) that is only run in the proxy case.
* If the mod_proxy backend connection broke in the middle of the response,
then
- Do not cache it.
- Signal the client that something went wrong by closing the connection
and not sending the last-chunk marker if the response was T-E chunked.
server/core_filters.c : Close the connection to the client by setting
c->keepalive to AP_CONN_CLOSE.
modules/http/chunk_filter.c : Do not send last-chunk marker in the case
the backend broke.
modules/proxy/mod_proxy_http.c: Signal that the backend connection broke.
modules/cache/mod_disk_cache.c: Respect r->no_cache for discarding the response
Submitted by: Roy T. Fielding, Jim Jagielski, Ruediger Pluem
Reviewed by: Roy T. Fielding, Jim Jagielski, Ruediger Pluem
Only define sendfile_nonblocking if APR_HAS_SENDFILE is true.
drop dependency on apr_wait_for_io_or_timeout()
No functional Change: Removing trailing whitespace. This also means that "blank" lines consisting of just spaces or tabs are now really blank lines
Restore the socket timeout after setting it to zero for nonblocking writes in ap_core_output_filter. (This fixes the mod_proxy errors that the new core output filter had been causing.)
remove debugging code
New version of ap_core_output_filter that does nonblocking writes (backport from async-dev branch to 2.3 trunk)
NET_TIME, as a standalone feature, was a horrid idea. The core filter will NOT operate correctly across platforms (even between Linux/Solaris) without setting up the conn->timeout, so always apply the timeout when establishing the core filter. The keep-alive-timeout is entirely an HTTP-ism, and needs to move to the http protocol handler. Note #1; this isn't triggered in the event mpm, but the event mpm introspects s->keep_alive_timeout directly adding it to the pollset, so this is a non-sequitor. Finally, once the headers are read, the named virtual host may have a different (more/less permissive) timeout for the remainder of the request body. This http-centric patch picks up that subtle detail and can switch to a named-vhost timeout.
Doxygen fixup / cleanup submited by: Neale Ranns neale ranns.org reviewed by: Ian Holsman
Commits 160348 and 160352 are obviated by commit 178340 in APR. httpd should have to deal with EAGAIN on a socket it doesn't know is non-blocking.
BRIGADE_NORMALIZE could produce invalid results with 0 length buckets. Submitted By: Rici Lake
Use APR_STATUS_IS_EAGAIN rather than comparing against APR_EAGAIN.
In emulate_sendfile(), handle APR_EAGAIN from apr_socket_send().
Remove unused variable.
*) include/httpd.h: Add a brigade for temporary uses in the core input filter context. *) server/core_filters.c: Do not use brigade_split, since it allocates a new brigade. Instead move buckets to our tmpbb, and reuse the tmpbb for every call. PR: 33382
Update copyright year to 2005 and standardize on current copyright owner line.
* core_filters.c: If APR_MAX_IOVEC_SIZE is defined, make sure we are under that limit.
Fix gcc "no previous prototype" warnings after reorganisation: * server/core_filters.c (ap_core_input_filter, ap_core_output_filter, ap_net_time_filter): Renamed to add ap_ prefixes for global symbols. * include/ap_listen.h: Don't export ap_listen_open at all, it's not used outside server/listen.c any more. * server/listen.c (open_listeners): Renamed from ap_listen_open.
Initial pass at refactoring some files to eliminate our 150K C source behemoths. * Makefile.in: Change order of dependencies to bring in exports.o first so that we have every symbol 'used' before the linker starts processing. * build/rules.mk.in: Add a 'program-install' target which just copies httpd. * server/Makefile.in, modules/http/config2.m4: Add in new file targets. * NWGNUmakefile, libhttpd.dsp: Blind updates for Netware and Win32. (I tried.) * server/core.c: Move core_input_filter, net_time_filter, and core_output_filter and all supporting functions to... * server/core_filters.c (copied): ...here. * modules/http/http_protocol.c: Move functions from here to there...namely: * modules/http/byterange_filter.c (copied): Relocate ap_byterange_filter() and friends. * modules/http/chunk_filter.c (copied): Relocate chunk_filter(). * modules/http/http_etag.c (copied): Relocate ap_set_etag and ap_make_etag(). * modules/http/http_filters.c (copied): Relocate ap_http_filter(), ap_http_header_filter(), ap_discard_request_body(), ap_setup_client_block(), ap_should_client_block(), and ap_get_client_block().
general property cleanup
Drop a worthless emit.
remove out-of-date comment... BillS reports that AP_MPM_DISABLE_NAGLE_ACCEPTED_SOCK provides the necessary capability to the MPM Submitted by: stoddard a.k.a. BillS a.k.a. FirstBill
Change core connection handling so that a connection-oriented error disabling nagle* is logged with the client IP address and a debug log level. We filter out not-implemented errors from platforms which don't support TCP_NODELAY. *This is typically EINVAL, which means that the client already dropped the connection. Also, mention an earlier change to include the client IP address when logging connection-oriented errors.
add ap_log_cerror(); use it in a couple of places in core output filter so that the client IP address is recorded in the log
veto and revert win64 patch: 64bit changes must percolate from the bottom (APR/system) up -- we can't give the client a 64bit API and then cast it to 32bits internally without introducing security holes on other platforms.
WIN64: API changes to clean up Windows 64bit compile warnings
WIN64: first in a series to get Windows IA64 builds clean, this serves pages
* server/core.c (merge_core_dir_configs): Fix Satisfy merging since per-method Satisfy feature was added. PR: 31315 Submitted by: Rici Lake <rici ricilake.net>
Fix typo in previous commit.
* server/core.c (default_handler): Fix the test for whether to split a file into several buckets: it is needed regardless of whether sendfile is enabled, and APR_HAS_LARGE_FILES is not sufficient to determine whether sizeof(apr_off_t) is greater than sizeof(apr_off_t). PR: 28898
* server/core.c (set_allow_opts): Fix gcc warning.
Replace the strsep() call to the more portable apr_strtok() call so that we can build again
Added 'AllowOverride Options=Indexes,MultiViews' to give an admin better control over what options can be used in .htaccess files. PR: 29310 Submitted by: Tom Alsberg <alsbergt-apache cs.huji.ac.il>
Nobody objected: <IfModule> now takes the module identifier in addition to the filename. CAUTION: this commit breaks the build on netware. It still needs to be adjusted. (but I don't have any netware knowledge...) Also, developers need to re-run buildconf on unices. PR: 29003 Submitted by: Edward Rudd <eddie omegaware.com>, Andr� Malo
allow LimitRequestBody to be reset to unlimited PR: 29106
use new apr_strtoff function to parse limitrequestbody
* server/core.c (core_output_filter): Don't explicitly delete the EOC bucket, and don't buffer the brigade if it ends in an EOC.
changed the following APIs to return an error instead of hard exiting: ap_add_module, ap_add_loaded_module, ap_setup_prelinked_modules, and ap_process_resource_config
Recursive Include directives no longer crash. The server stops including configuration files after a certain nesting level (128 as distributed). This is configurable at compile time using the -DAP_MAX_INCLUDE_DEPTH switch. PR: 28370
accept URLs as ServerAdmin contact. If it's not recognized as an URL, assume an email address and prepend it with mailto: in server outputs. PR: 28174
"ErrorDocument default" changes broke inheritance. consider: <Directory /foo> ErrorDocument 404 blah </Directory> <DIrectory /foo/bar> ErrorDocument 500 boo # 404 is now fallen back to default </Directory> This patch solves the problem.
Fix a bunch of cases where the return code of the regex compiler was not checked properly. This affects: mod_setenvif, mod_usertrack, mod_proxy, mod_proxy_ftp and core. PR: 28218
Enable special ErrorDocument value 'default' which restores the canned server response for the scope of the directive.
* server/core.c (core_output_filter): Tag the deferred_write pool.
Can't assume the filepointer is really 0 when offset is 0. A handler can create brigades containing multiple file buckets with arbitrary offsets
Fix memory corruption problem with ap_custom_response() function. The core per-dir config would later point to request pool data that would be reused for different purposes on different requests. This is based on an old 1.3 patch submitted by Will Lowe. It needs a minor tweak before committing to 1.3, but he had it pretty darn close.
use existing directive name ThreadStackSize instead of WorkerStackSize as made obvious by: Brad Nicholes
Satisfy directives now can be influenced by a surrounding <Limit> container. PR: 14726.
Threaded MPMs for Unix and Win32: Add WorkerStackSize directive to override default thread stack size for threads which handle client connections. Required for some third-party modules on platforms with small default thread stack size. This is also useful for trimming back the stack size on platforms with relatively large default stack size in order to conserve address space for supporting more threads per child.
*) Remove compile-time length limit on request strings. Length is
now enforced solely with the LimitRequestLine config directive.
[Paul J. Reder]
* server/core.c (core_output_filter): Avoid using EOC bucket after deleting it.
Send the 'Close Alert' message to the peer upon closing a SSL session. This required creating a new EOC (End-Of-Connection) bucket type to notify mod_ssl that the connection is about to be closed. Reviewed by: Joe Orton, Justin Erenkrantz
Add a new directive EnableExceptionHook that must be specified for exception hooks to be called (in addition to the build time requirements). The 2.1-dev feature is now more aligned with the 1.3.30-dev feature, in that there is a build-time requirement as well as a configuration requirement.
fix name of The Apache Software Foundation
fix copyright dates according to the first check in
apply Apache License, Version 2.0
Add core version query function ap_get_server_revision and accompanying ap_version_t structure (minor MMN bump). The function is similar to apr_version() and allow for exact querying of the core revision level.
Oops, fixed a bit too much
If large file support is enabled allow the file to be split into AP_MAX_SENDFILE sized buckets. Otherwise Apache will be unable to send files larger than 2 gig due to signed 32-bit limitations.
update license to 2004.
Fix <Limit> and <LimitExcept> parsing to require a closing '>' in the initial container. PR: 25414 Submitted by: Geoffrey Young <geoff apache.org>] Reviewed by: Jeff Trawick
Account for some bytes handed to the network layer prior to dropped connections. Such bytes were counted on some paths but not on others. If these bytes are to be counted in some error paths, they should be counted in the others. We don't know if they were actually presented to the client. AFAIK, this only affects mod_logio.
axe a comment... as with so many things, the true part isn't interesting and the interesting part isn't true
simplify just a bit
get rid of _FOREACH
parsed_uri.port is only valid iff parsed_uri.port_str != NULL. Old code simply checked if it was non-zero, not if it was *valid* PR: Obtained from: Submitted by: Reviewed by:
When UseCanonicalName is set to OFF, allow ap_get_server_port to check r->connection->local_addr->port before defaulting to server->port or ap_default_port().
Cosmetics: remove redundancy
change some error log messages to be more concise Submitted by: Bill Rowe
Log an error when requests for URIs which fail to map to a valid filesystem name are rejected with 403.
switch to APR 1.0 API (which is still in flux) because of the changes to the argument lists of apr_mmap_dup and apr_socket_create, 2.1-dev won't build with apr and apr-util's 0.9 branch anymore
fix doc typo PR: Obtained from: Submitted by: Reviewed by:
that loop was totally bogus. r->content_type contains no more than one c-t use ap_field_noparam to strip the decoration and just a single condition to check the validity of r->content_type
don't reverse the filter order in AddOutputFilterByType
DocumentRoot always used to be interpreted relative to ServerRoot. Make it server_root_relative like in Apache-1.3
core_output_filter: don't split the brigade after a FLUSH bucket if it's the last bucket. This prevents creating unneccessary empty brigades which may not be destroyed until the end of a keepalive connection. Submitted by: Juan Rivera <Juan.Rivera@NO_SPAM.citrix.com>
Rework of the recursion stopper - collapse recursion counters into one function Reviewed by: Justin Erenkrantz
Prevent the server from crashing when entering infinite loops. The new LimitInternalRecursion directive configures limits of subsequent internal redirects and nested subrequests, after which the request will be aborted. [William Rowe, Jeff Trawick, Andr� Malo] PR: 19753 (and probably others)
fix a bogus check for IPv6 support that led to an unnecessary string search on builds of Apache without IPv6 support Submitted by: Bill Stoddard
Porting to BS2000: the antique interface (BS2000Account) no longer exists
Throw a warning if AllowOverride is used inside of <Location> or <Files>. Unfortunately there's no clean way to detect <DirectoryMatch>. It would not be sufficient, because <Directory ~> should be checked then, too. Hmm. PR: 19512
Fix ap_construct_url() so that it surrounds IPv6 literal address strings with []. This fixes certain types of redirection. PR: 19207
finished that boring job: update license to 2003. Happy New Year! ;-))
here we go. add a directive that will keep %2f from being decoded into '/', allowing the *_walk to do their magic and return 404 if it's in the path, and allowing it in the path-info.
move rfc1413 code to a new module "metadata:mod_ident". The rfc1413 code itself is mostly c&p, but can still bear some rework ... This patch removes the global ap_rfc1413 function and the ap_rfc1413_timeout variable. It also introduces a new config directive IdentityCheckTimeout (default 30 sec). Reviewed by: Justin Erenkrantz
With the latest patch to config.c wildcards now work.
Once again, allow <Directory "C:\Users\*\html_files"> or other wildcard patterns in Directory blocks. Note a similar problem with Includes *.conf
core_output_filter: re-instate the deferred_write pool patch so we don't leak fd's until the end of a keepalive connection. Thanks to: Jeff Trawick for the original concept Sander Striker for the mmap ring idea Cliff Woolley for implementing the above change
core_output_filter: back out changes to clean up resources before the end of a keepalive connection until we can figure out how to do it safely for mmap buckets
core_output_filter: use the current input brigade's pool for the "more" brigade when we defer network writes due to small data + keepalives. This prevents leaking resources in the "more" brigade until the end of the connection.
can't mix declarations and statements except with gcc 3.2 :) (or possibly RedHat 8's patches to it)
prevent seg faults when running with Electric Fence. The "more" brigade (created by apr_brigade_split after seeing a FLUSH bucket) was in the deferred_write_pool. d_w_p is cleared, "more" is copied into b, then the while loop test for APR_BRIGADE_EMPTY(b) blows up.
core_output_filter: straighten out the parens for the decision to set aside. Pointed out by: gcc and Jeff Trawick
use a subpool of c->pool for resources which are set aside, then clear it after writing the data to the network. This closes files sooner with keepalive connections.
adjust some parents to make the expression a tiny bit clearer and to make gcc happy > core.c: In function `core_output_filter': > core.c:3884: warning: suggest parentheses around && within ||
no functional change...factor out a common subexpression
The value emitted by ServerSignature now mimics the Server HTTP header as controlled by ServerTokens. Submitted by: Francis Daly <deva@daoine.org> Reviewed by: Justin Erenkrantz
Small performance tweaks to net_time_filter and core_input_filter.
Fix streaming output from an nph- CGI script. CGI:IRC now works. core output filter needs to detect when no more data is available from a pipe for a while so that it can flush what is already there normally, content-length filter handles this but for nph- script we don't have content-length filter in place PR: 8482
mod_logio modification: count bytes-sent after the writev or sendfile call in the core_output_filter, in order to get a more accurate count of the total bytes transmitted in cases where the client terminates the connection before the entire response is sent. Note: This works by adding a flush bucket to each response when mod_logio is used; the side-effect is that pipelined responses get broken up into separate network writes per request (but there's no impact on pipelining when mod_logio is not enabled). Submitted by: Bojan Smojver <bojan@rexursive.com> Reviewed by: Brian Pane
Use a better name for the APR_SENDFILE_ENABLE flag.
Introduce an EnableSendfile directive (defaulted to ON) to allow users to disable sendfile mechanics for NFS volume mounts and other kernel objects that don't support sendfile. And EnableSendfile off can be used to help narrow bugs down to the sendfile mechanics or eliminate the possiblity that sendfile is a factor on any given platform.
What once were macros no longer need line continuation
Add logic to the default_handler to enable script delivery to script processors located in the output filter stack. This is on by default, but will change "soon" to off -- the processors will then need to enable it when they are installed into the filter chain.
*) SECURITY: [CAN-2002-0840] HTML-escape the address produced by
ap_server_signature() against this cross-site scripting
vulnerability exposed by the directive 'UseCanonicalName Off'.
Also HTML-escape the SERVER_NAME environment variable for CGI
and SSI requests. It's safe to escape as only the '<', '>',
and '&' characters are affected, which won't appear in a valid
hostname. Reported by Matthew Murphy <mattmurphy@kc.rr.com>.
[Brian Pane]
Until we have a mechanism to allow PHP and others to 'raise their hand' and claim 'POST' we have to continue to accept POST in the default handler. Revert to rev 1.206 per Rbb's and wrowe's veto.
Fix bug in the default handler. POST is not allowed on regular files. The resource must be handled by something *other* than the default handler.
Call out the success cases when we don't get APR_SUCCESS back from the network write. All other status codes result in c->aborted being set, which allows the logs to note that the connection was aborted. Previous to this patch, if the network cable was unplugged on the client, the server would get APR_ETIMEUP, but we wouldn't note that the connection was aborted. Submitted by: Ryan Morgan <rmorgan@covalent.net>
zap a gcc warning about using an uninitialized variable (new) and check for a possible syntax error
Modify ap_open_logs (an internal function) to follow the hook open_logs argument schema so it can be directly invoked by the hook handler. Also clean up the open_logs processing to return an error rather than simply exit()ing.
Allow AddOutputFilterByType to take in multiple filters.
Fix memory leak in core_output_filter. This would result in at least two EOS buckets being leaked per connection.
Major/Minor/Min[imal] now working as one (with a sane mind) would thing it should
new option to ServerTokens. "Maj[or]" which displays a server response similar to Apache/2.0 Also surfaced the directive in the standard config, defaulting to FULL
Zero-copy output for small files delivered over keepalive connections (previously, the setaside code in the core output filter would copy file buckets <8KB into the heap, resulting in poor keepalive performance)
Pardon je, it seems the most obvious solutions are always the easiest to incorporate new bugs. Solve the 0index.html bad uri bug.
This was never a 'vulnerability'... the APR_FILEPATH_SECUREROOT flag passed to apr_filepath_merge refused to merge any rooted 'addpath'. However, that isn't the traditional 1.3 behavior, so fly past any leading '/'s on the way to merging the uri to the DocumentRoot. PR: 10946
format to 80 chars
Timeout/time fixes
spell check a comment
Changes for deprecated apr_is_fnmatch
Renames Pending: This clears the list of renames pending in apr-util. Parts of this list was alreadu done, but the pending list hadn't been updated. apr_hook_debug_current from apr_current_hooking_module apr_hook_debug_show from apr_show_hook apr_hook_global_pool from apr_global_hook_pool apr_hook_sort_all from apr_sort_hooks apr_uri_port_of_scheme from apr_uri_default_port_for_scheme apr_uri_unparse from apr_uri_unparse_components apr_uri_parse from apr_uri_parse_components apr_uri_parse_hostinfo from apr_uri_parse_hostinfo_components apr_uri_t from apr_uri_components All APR_URI_* from all APU_URI_* symbols All APR_UNP_* from all UNP_* symbols PR: Obtained from: Submitted by: Thom May Reviewed by:
Add a new directive: MaxMemFree. MaxMemFree makes it possible to configure the maximum amount of memory the allocators will hold on to for reuse. Anything over the MaxMemFree threshold will be free()d. This directive is usefull when uncommon large peaks occur in memory usage. It should _not_ be used to mask defective modules' memory use.
Optimized the addition of the core output filter
Replaced ap_add_input_filter() call with cheaper ap_add_input_filter_handle()
Add a filter_init function to the filters so that a filter can execute arbitrary code before the handlers are invoked. This resolves an issue with incorrect 304s on If-Modified-Since mod_include requests since ap_meets_conditions() is not aware that this is a dynamic request and it is not possible to satisfy 304 for these requests (unless xbithack full is on, of course). When mod_include runs as a filter, it is too late to set any flag since the handler is responsible for calling ap_meets_conditions(), which it should do before generating any data. If a module doesn't need to run such arbitrary code, it can just pass NULL as the argument and all is well. PR: 9673 Reviewed by: Ryan Bloom and others
Strengthen error-detection code in HTTP_IN and core_input_filter so that invalid readbytes or errors reading brigades are properly handled. Reviewed by: Brian Pane
- Fix segfault in core_output_filter when we are passed an empty brigade. - Stash the remainder of the brigade in more when we see a flush bucket. Previous to this commit, we would only process the buckets before the flush on a HTTP/1.0 request and then return. We are proably only finding this now since we now correctly check for keepalive connection status.
Change conn_rec->keepalive to an enumerated value of AP_CONN_UNKNOWN AP_CONN_CLOSE AP_CONN_KEEPALIVE This also fixes a problem where ap_discard_request_body would not discard the body when keepalive was 0. This actually meant the keepalive status was unknown *not* closed, but no one ever remembered that. This problem was seen with mod_dav sending error responses (as reported by Karl Fogel). Suggested by: Greg "this isn't the '80s" Stein Reviewed by: Greg Ames
Make the default_handler catch all requests that aren't served by another handler. This also gets us to return a 404 if a directory is requested, there is no DirectoryIndex, and mod_autoindex isn't loaded. PR: 8045 Submitted by: Justin Erenkrantz
Solve the 80/20 by initializing and storing server_rec->timeout and server_rec->keep_alive_timeout in apr_time_interval_t format (in apr units, whatever they be), as both values exist to pass into APR, and all APR timeouts are in apr_time_t. Reviewed by: Cliff Woolley
The apr_bucket change requires a minor MMN bump. Also modify Apache's filters to use APR_BUCKET_IS_METADATA macro.
Resolve the EXEC_ON_READ bit for ServerRoot and other modules that test the directive context. Should eliminate the segfault.
Although it appears reasonable to immediately gather the Error log and level from the config; these are per-vhost entities that can't be processed as we preload the config tree. There is more work to do, as Cliff Woolley guesses, before we can make this change. In the meantime, -e and -E should provide the admin sufficient options to work around problematic configs. So I'm reverting those changes, for now. ServerRoot is global only, and it MUST be read immediately, so that part of the last patch stays.
Renames: APR_XtOffset -> APR_OFFSET APR_XtOffsetOf -> APR_OFFSETOF
We need to grab ServerRoot, LogLevel, and ErrorLog right off the bat as we are reading the config. This closes a bug where ServerRoot /foo + LoadModule relative/mod_foo.so won't load mod_foo.so. Reported by: Ron Leung <rleung@covalent.net>
stop using APLOG_NOERRNO in calls to ap_log_?error()
Added EnableMMAP directive to allow the server administrator to prevent mmap of file buckets upon read.
Moved ap_setup_make_content_type() declaration to http_protocol.h
Performance fix: replaced the strcasecmp calls in ap_make_content_type() with apr_strmatch()
default_handler: move the code to handle unusual methods out of the middle of the hot path without using goto. suggested by: Roy Fielding
remove a goto
default_handler: short circuit the method checks. Move the code to deal with unusual methods to the end of function to reduce i-cache clutter.
AcceptPathInfo was totally backwards... it would reject when set to on and by default and accept when set to off for the default handler, and would reject only if set to accept for mod_cgi(d) and mod_isapi. PR: 8234
Correct partitioning of filter handles between core and http, and export the handle pointers on Win32.
BUCKET FREELISTS Add an allocator-passing mechanism throughout the bucket brigades API. From Apache's standpoint, the apr_bucket_alloc_t* used throughout a given connection is stored in the conn_rec by the create_connection hook. That means it's the MPM's job to optimize recycling of apr_bucket_alloc_t's -- the MPM must ensure that no two threads can ever use the same one at the same time, for instance.
We have to return valid HTTP status codes from filters. This fixes two cases in the core_output_filters where there was a problem, and the core returned an error code instead of an HTTP status code. This keeps us from putting status codes like 32 and 104 in the access log. Submitted by: Ryan Morgan <rmorgan@covalent.net>
Fold the compiled-in knowledge of the allowable AcceptMutex settings into its help entry. Requires the use of a extern string rather than a function call for the initialization to be valid in the macro (Thx to Jeff!). In the meantime, bump down the error logging until we deal with true default and configured setting information ala 1.3. PR: Obtained from: Submitted by: Reviewed by:
Commit 2 of 2 to: 1. rename ap_rset_content_type to ap_set_content_type 2. reverse the arguments to aligh with ap_set_content_length
Final commit to add ap_rset_content_type accessor. Add AddOutputFiltersbyType filters during call to ap_rset_content_type()
Eliminate potential ap_server_root_relative segfaults, with the input of Jeff Trawick's style changes to the first patches. Doesn't include the fixes to ssl [more complex], and we won't trap errors that involve ap_serverroot, since we presume that was normalized on the way in. Therefore, testing ap_server_root_relative(DEFAULT_FOO) cases should never become necessary.
Update our copyright for this year.
As hinted on dev@httpd, change filter naming schemes to match our expectations of their usage. The reason that we should make this change now is that we have changed the implied meaning of AP_FTYPE_HTTP_HEADER - some users of this should be PROTOCOL while others should be CONTENT_SET. In order to clarify it, toss all of the bogus names and force the filter writers to make sure they understand what they are doing. CONTENT_SET is new (horrible name - change if you have better idea), but it indicates that it should run between RESOURCE and PROTOCOL. mod_deflate is the ideal CONTENT_SET filter. The changed type names are: CONTENT is now RESOURCE. HTTP_HEADER is now PROTOCOL. However, most filters that used HTTP_HEADER may want CONTENT_SET. (Only things like POP and HTTP belong as PROTOCOL.) MMN bump since all filters need to be recompiled due to filter reordering.
Remove the prev pointer from the filter chain. This removes the complexity of trying to set the filter chain correctly, with the side-effect of forcing us to walk the entire chain whenever we add a filter. Since the filter chains are small, the decrease in complexity is worth it. Reviewed by: Allan Edwards
Fix a bug in the APR_MODE_EXHAUSTIVE mode for the core input filter. This patch changes nothing outside of that mode. Also, why do we ever call apr_brigade_length() in the core? This doesn't seem right to me, so here's a comment above the other call.
Sander's Stylistic Submission (de-tab) PR: Obtained from: Submitted by: Reviewed by:
fix <Directory ~ blah> containers. also, eradicate a few nefarious tabs which were found lurking in the vicinity. Submitted by: Rob Simonson <simo@us.ibm.com> Reviewed by: Greg Ames
Only insert net_filter once per request. Initialize the output protocol filters.
Ensure that net_time filter isn't added on subreqs - we assume that it is added on !r->main requests. This led to infinite loop/SEGV when dealing with anything that created a subreq. (I don't think core_create_req is a good place for adding this filter.)
Classify some of the input filters as the correct types. Previous to this patch, the type wasn't too important, because all filters were put on the same list. After this patch, the filter type is very important, because there are three different types of filters, and they are all treated differently, namely: CONNECTION: Filters of this type are valid for the lifetime of this connection. PROTOCOL: Filters of this type are valid for the lifetime of this request from the point of view of the client, this means that the request is valid from the time that the request is sent until the time that the response is received. CONTENT: Filters of this type are valid for the time that this content is used to satisfy a request. For simple requests, this is identical to PROTOCOL, but internal redirects and sub-requests can change the content without ending the request. It is important to realize that the three major types above are actually broken down into smaller groups in the code, to ensure that the ordering of filters is always correct.
Fix segfault if content_type is NULL.
I learned about AP_MODE_EXHAUSTIVE while reading some of the new filter code earlier today. With this mode, the Perchild MPM can finally be fixed to work with filters. I have changed a comment in the core to make it clear that this mode is required, but I have mentioned how dangerous this mode is. Also add a comment to STATUS about my plans. Hopefully I'll have some time this week to hack through the MPM.
This code should be a noop today. But I did not feel comfortable about reusing/recopying each bucket -after- inserting it into the brigade. Also, copying bucket c from b from a seemed obtuse. This patch creates the single bucket, makes a copy of it for each sendfile chunk we are about to add to the brigade, and finally consumes that initial bucket as the final file bucket of the brigade.
Fix the close-on-sendfile bug where Win32 would transmit a single sendfile bucket and then lose it's socket, and fix a comment. Submitted by: Ryan Morgan <rmorgan@covalent.net>
Introduce AddOutputFilterByType directive. AddOutputFilterByType DEFLATE text/html (I will add docco soon, I promise. If someone beats me to it, cool...)
stop using APR_BRIGADE_NORMALIZE() (okay, making a copy of it is cheating perhaps, but the name of the game is to get APR_BRIGADE_NORMALIZE() out of the API)
Be a bit more sane with regard to CanonicalNames. If the user has specified they want to use the CanonicalName, but they have not configured a port with the ServerName, then use the same port that the original request used. Submitted by: Ryan Bloom and Ken Coar
yet another tweak to empty brigade checking on entry to core_input_filter(): since APR_BRIGADE_EMPTY() assumes a non-empty brigade, we have to check before invoking that macro since APR_BRIGADE_EMPTY() can make a brigade empty, we have to check after invoking that macro An obvious variation of this fix would be to change APR_BRIGADE_NORMALIZE() to deal with empty brigades.
- Fix up a comment so that it makes more sense and explains why we return APR_EOF instead of an EOS bucket. - Start to try to be nice when we *know* we are EOS by removing the bucket. This is only one case where we could end up with a 0 bucket in ctx->b, but let's remove it and move on. (If the bucket were to return 0 bytes and still have data left to read on blocking mode, it's blantly broken, IMHO)
In core_input_filter, check for an empty brigade after APR_BRIGADE_NORMALIZE(). Otherwise, we can get segfaults if a client says it will post some data but we get FIN before any data arrives.
Remove the install_transport_filters hook. The same function can be acheived with the pre_connection hook. I have added the socket to the pre_connection phase to make this possible. Reviewed by: Bill Stoddard
Reintroduce the create_connection hook. This hook is required to enable modules to completely take over all network i/o from the core.
Now how did this slip by. Fixes a segfault. I tested this code, really...
This patch restores most of Ryan's patch (11/12/2001) to remove the client_socket from the conn_rec. Diffs from Ryan's patch include: - rename the create_connection hook to install_transport_filters - move the point of invocation of the hook till after the call to after ap_update_vhost_given_ip to enable the hook to use vhost config info in its decision making.
Don't let the default handler try to serve a raw directory. At best you get gibberish. Much worse things can happen depending on the OS. This can happen when autoindex isn't loaded. On AIX, I had a directory file which was reported to be 1536 bytes in size. mmap() failed so we went to the fall-back logic. The first read() got 624 bytes and the next read() got 0 (supposedly EOF). This confused us greatly, we kept allocating buffers and reading and exercised the paging space. Reviewed by: Bill Rowe
Remove the create_connection hook and put the client_socket back into the conn_rec. The create_connection_hook has a design flaw that prevents it from making decisions based on vhost information.
Performance improvement: incorporated the use of the new ap_add_input_filter_handle() and ap_add_output_filter_handle() functions for core filters
avoid a palloc of zero bytes so memory debuggers don't barf
Change ap_get_brigade prototype to remove *readbytes in favor of readbytes. If you need the length, you should be using apr_brigade_length. This is much more consistent. Of all the places that call ap_get_brigade, only one (ap_http_filter) needs the length. This makes it now possible to pass constants down without assigning them to a temporary variable first. Also: - Change proxy_ftp to use EXHAUSTIVE mode (didn't catch its -1 before) - Fix buglet in mod_ssl that would cause it to return too much data in some circumstances
These changes are to allow caching of subrequests via a quick_handler. * Change SUBREQ_CORE so that it is a HTTP_HEADER (20) filter instead of a content filter (10) this allows subrequests to add content filters properly * Change subreq handling of 'handle-include' so that it splits/passes the brigade before the subreq is created. (This allows quick_handler to push content back from this phase)
Make core_input_filter use the new apr_brigade_split_line function.
Add AP_MODE_SPECULATIVE support to core_input_filter
Input filtering prototype change: Socket blocking type should be separate from the input filter mode type. We also no longer look at readbytes to determine the method of filter operation. This makes the use of filters more obvious and allows a wider range of options for input filters modes. To start with, the new input filter modes are: AP_MODE_READBYTES (no more than *readbytes returned) AP_MODE_GETLINE (old *readbytes == 0 case) AP_MODE_EATCRLF (old AP_MODE_PEEK) AP_MODE_SPECULATIVE (will be used in a future ap_getline rewrite) AP_MODE_EXHAUSTIVE (old *readbytes == -1 case) AP_MODE_INIT (special case for NNTP over SSL) The block parameter is an apr_read_type_e: APR_BLOCK_READ, APR_NONBLOCK_READ This also allows cleanup of mod_ssl's handling in the getline case. Reviewed by: Ryan Bloom (concept), Greg Stein (concept)
Move a check for an empty brigade to the start of core input filter to avoid segfaults. Using prefork MPM and APR_POOL_DEBUG and ElectricFence, I found a couple of paths where weren't able to report APR_EOF all the way back up the call tree, leading us back into core_input_filter with an empty brigade. Some of the paths in core_input_filter handled it, some didn't.
Bring forward the FileETag directive enhancement from 1.3.23-dev. (Passes all 61 of the apache/etags.t test.) Bump MMN due to change to core_dir_config structure (new fields at end).
Restore the apr_pool_clear calls to main.c in case we have third-parties who are overriding the open_logs hook, in which case they'd miss the plog being cleared. Submitted by: Justin <jerenkrantz@apache.org>
This small patch modifies the log's to use plog instead of pconf. Basically pconf is cleared at different times from plog, and this has the effect of leaving stderr closed when going into the next stage of the config. This also had the effect of allowing FreeBSD with threads to create a pipe with stderr's fd at one end, and this resulted in problems with the signal polling and high cpu usage. In addition, move the clearing of plog from main.c to core.c where it seems more appropriate. This solves the first and main problem that FreeBSD has with the threaded MPM's.
Fix LimitRequestBody directive by moving the relevant code from ap_*_client_block to ap_http_filter (aka HTTP_IN). This is the only appropriate place for limit checking to occur (otherwise, chunked input is not correctly limited). Also changed the type of limit_req_body to apr_off_t to match the other types inside of HTTP_IN. Also made the strtol call for limit_req_body a bit more robust.
Remove a needless immortal bucket creation. We can just leave the brigade as-is. Suggested by: Cliff
Generalized the recent prep_walk_cache optimizations to allow other modules to register "notes" within the array of working data in the core_request_config
Performance fix for prep_walk_cache(): Moved the directory/location/file-walk caches from the request's pool userdata hash table to the core_request_config struct. This change removes about 60% of the processing time from prep_walk_cache().
avoid some ugly sockaddr comparisons in do_double_reverse() by using apr_sockaddr_equal()
Change core code to allow an MPM to set hard thread/server limits at startup.
Whoops, that's quadstate, the value 3 is not-present.
As suggested by Josh Slive, add the explicit 'default' to AcceptPathInfo. I'll leave docs up to him. The conf becomes a quadstate (undef != default) but other than that, it should make things cleaner for the user.
If dconf->accept_path_info is tristate, why not r->used_path_info? This patch allows us to force path_info off in mod_cgi[d] etc, patch forthcoming. It also allows includes, php, etc to change the undefined value in the early handler or late fixup phases to Accept'ed.
Now all should be well. AcceptPathInfo on will give us a document with
path_info served from the core handler. Any filters can then manipulate
all the usual CGI envvars [as proven with this little excerpt with a
<!--#printenv --> document...
<FilesMatch ".*\.shtml.*">
Options +Includes
SetOutputFilter INCLUDES
AcceptPathInfo on
</FilesMatch>
a potentially questionable config, but effective.
Kill some redundancy (why test PUT when we disallow all but GET/POST?) and add some thoughts.
Periods aren't commas. Clear out some inappropriate casts while we are at it.
Whatever this was doing, it looks most unholy.
don't lose the const-ness of the string being searched
Replaced ap_strcmp_match call that checked for a '/' in the handler name with the equivalent (but less heavyweight) strchr call
Another performance-related change to core_output_filter(): if we get a long stream of small buckets, so that multiple concatenation steps are required in a single pass through the brigade, re-use the buckets from the previous temp brigade when creating the next one. This allows us to avoid making yet another copy of the previously concatenated data.
Optimization for core_output_filter: if the iovec is full, don't try to concatenate buffers if we already have at least 8KB of data ready to send. Instead, just split the brigade and send what's currently in the iovec.
The survey says yes, that is in fact the expected behavior. :)
Another fix for the core_output_filter() code that concatenates small buckets: It's possible for the temporary brigade to contain more than one bucket. If this happens, we need to recover the buckets after the first from the temporary brigade before destroying it.
More fixes for core_input_filter()'s concatenation of small buckets: update last_e and nbytes after compacting the brigade
Fix for the code in core_output_filter() that concatenates small buckets into one big bucket...it was putting a pointer to a deleted bucket in the iovec, so the output was corrupted.
change open_logs hook to return a value, allowing you to flag a error while opening logs Obtained from: Doug MacEachern
Fix a bug in the core_output_filter. If we are buffering, it helps to read from the correct bucket.
Modify post_config hook so that it can return a error, causing the server not to start. previous method was to call exit(1) which would not fail gracefully PR: Obtained from: Submitted by: Reviewed by: (Idea only Jeff Trawick)
Fix a bug in our output filter buffering. If a lot of small brigades are sent, the core will send the first 16 buckets, regardless of how much data there is. In the pathological case, this can cause a lot of 16 byte packets. Now, if we see less than AP_MIN_BYTES, we combine all of the buckets into a single bucket to be sent in a later packet. This can cause a lot of memory copies, but it eases our network traffic.
Fix the timeout logic that I broke last week. This adds a request level filter that sets the timeout on the socket that is connected to the client. Thanks Greg Stein for seeing this bug.
add new input filter mode AP_MODE_INIT: allows filters such as mod_ssl to initialize a client connection (ie handshake) before reading request data from the client. PR: Obtained from: Submitted by: dougm Reviewed by: wrowe
change the signature of ap_custom_response() to use a "const char *" instead of a "char *". PR: 8791 Submitted by: Kurt Brown kurtb149@yahoo.com Reviewed by: Ian Holsman
Pull lingering close out of the pool cleanup phase. This was causing too many bugs. Instead, it is called where it used to be called. I have abstracted some of the logic out of the lingering close so that it gets the socket from the connection using the core's conn_config vector. This is in anticipation of a change to use a hook for the lingering close, which I hope to do soon.
FTYPE_CONTENT - 1 isn't enough for OLD_WRITE. OLD_WRITE is a special filter, and it MUST run absolutely first. To allow other filters a little space to manuver, I am moving this to FTYPE_CONTENT - 10. Submitted by: John Sterling <sterling@covalent.net>
Get the proxy module compiling again. This is a hack to get past the current compiler errors. Basically, the core now puts the socket in the conn_rec->conn_config vector. The proxy grabs that socket and uses it where it used to use the client_socket field from the conn_rec. Long-term, all of the direct socket communication needs to be removed, and this should go through a filter stack. Short-term, this gets the proxy working again. I have tested http and connect, but I haven't looked at the FTP proxy, although it does compile now.
Move this to a HOOK_MIDDLE location. We need to add some logic to make sure that we have a socket that the core controls if we do this, but it is more correct. Submitted by: Greg Stein
Add the server_rec argument back to the create_connection hook. Submitted by: Greg Stein
Back out my last patch. The logic to add sockets to pollsets is back in the MPM
This allows modules to add socket descriptors to the pollset. I have only added this to the perfork MPM, and the others work without it. Tomorrow I will add it to the other MPMs.
Cleanup some code that was created during the abstration. This basically takes the old ap_new_connection, and puts into the new core_create_conn function. There is no good reason to have two functions to do this.
Remove more network logic from the MPMs. Essentially, each MPM can define AP_MPM_DISABLE_NAGLE_ACCEPTED_SOCK, which tells Apache to disable_nagle on the accepted socket.
Begin to abstract out the underlying transport layer. The first step is to remove the socket from the conn_rec, the server now lives in a context that is passed to the core's input and output filters. This forces us to be very careful when adding calls that use the socket directly, because the socket isn't available in most locations.
Fixed previous patch to reflect what Apache-1.3 did regarding self- referential uri's, and updated the manual accordingly. XXX There is a kludge here: XXX the port number from the client's Host: header used to be tossed, and there is no clean mechanism to pass it (in the request_rec) to other consumers. As the unparsed_uri structure (which could avoid repeated parsing of URI, Host, Port etc) seems to be mostly unused currently, I used that to pass the port.
When no port is given in a "ServerName host" directive, the server_rec->port is now set to zero, not 80. That allows for run-time deduction of the correct server port (depending on SSL/plain, and depending also on the current setting of UseCanonicalName). This change makes redirections work, even with https:// connections. [Martin Kraemer]
insure that we die quickly without looping etc. if somebody messes up *readbytes again.
whoops! can't use the return code to pass the length up the filter chain. with this and a request line that goes on forever, I now get: [Wed Oct 31 17:45:45 2001] [error] [client 127.0.0.1] request failed: URI too long ...in the error log, and a 414 in the access log.
return the actual number of bytes read when we're in "read a line" mode and it looks like the line may never end. This lets ap_getline determine whether there's excessive bytes or not, depending on the size of its caller's buffers. If the buffer can accomodate more bytes, ap_getline will continue to read.
Fix a big memory leak bug related to arbitrarily large header lines. The core input filter would happily consume all the data you gave it in a header line, looking for that one LF. This patch limits that "getline" functionality to HUGE_STRING_LEN (8192 bytes).
set the c->aborted flag when we get EPIPE
Fix a segfault seen on daedalus earlier this evening. All that was happening was that we forgot to check whether ctx->bb was empty, so when we pulled the first bucket, it would be the sentinel, and we'd segfault trying to apr_bucket_read the sentinel.
Fix two typos in the last patch... compiles/tests clean... Greg, please run this against Apache.org until the first core and post the results.
Perhaps fix the segfault... my earlier patch didn't since we already memcpy'ed the base into the merged per-dir config. This certainly cleans up that function though, and I hope increases it's legibility.
Canonicalize all absolute <Directory > sections, not simply those that fail to end in a '/'. Slash test is afterwords, once we've canonicalized any '\' and other aliases to '/'.
Listen to my own advise. Fortunately, the new apr_pool_readonly code catches these in no time ;)
Guys... please be _careful_ when you pcalloc -> palloc!!! Resolves GAmes' segfault observations
don't lose the retcode in core_create_proxy_req()
Cleanup the proxy code that creates a request to the origin server. This change adds an optional hook, which allows modules to gain control while the request is created if the proxy module is loaded. The purpose of this hook is to allow modules to add input and/or output filters to the request to the origin. While I was at it, I made the core use this hook, so that proxy request creation uses some of the code from the core. This can still be greatly improved, but this is a good start.
The problem here is that we are getting some zero-length buckets at the head of our brigade - which are in isolation okay. In this situation, they must be removed by the call to APR_BRIGADE_NORMALIZE. The way we partition the buckets means that we will never remove the zero-length bucket from the head - causing an infinite loop. We read only a single bucket now - previously partition with the blocking reads would read multiple buckets - but it forced having a defined length which we agreed was bogus. Therefore, if we have a zero-length bucket at the head, we would then try to partition and split at the zero-point of the brigade. That combination doesn't actually remove the zero-length bucket - it is still there - causing an infinite loop because we'll never go past the zero-length bucket. This call was originally present in core_input_filter. I think it might be better to fix partition/split/etc to eliminate a zero-length bucket and skip it. But, I'm not 100% sure that needs to happen.
We also need to increment *readbytes when we find a match in the middle of a bucket.
Yeah, let's just return this segment to how it was a few hours ago. If the status code is anything other than SUCCESS for PEEK, it isn't good. Just return the value. (I thought it should be this, but I wasn't 100% sure. Peer review == good.) Submitted by: Will Rowe
For some reason, I was thinking PEEK should read infinitely. Not. Return with APR_EOF if we get EAGAIN. (Whomever is calling this with PEEK should really be able to handle EOS bucket rather than relying on error codes.) Thanks to Greg Ames for pointing out this fubar.
Allow the bucket reading code in the core to handle EAGAIN properly.
We should only be doing one socket read under any circumstances (blocking or not). apr_brigade_partition would do reading multiple times and that's not really what we want (so I think). This may speed up POST requests that were waiting for all of the data to arrive before returning anything in blocking mode. Reviewed by: Greg Stein, Ryan Bloom
Allow the core input filter to handle AP_NONBLOCK_READ request for a finite number of bytes (i.e. *readbytes > 0). ap_brigade_partition does a blocking read. So, what we should do is apr_bucket_read on the socket for non-blocking. If we get less than what they asked for, that's okay and we should just return that amount. If they were non-blocking, we should always be non-blocking. Ryan, Greg, and others can figure out if ap_brigade_partition should be tweaked to handle AP_NONBLOCK_READ natively. I'm of a mixed mind, but this addresses the short term need.
get rid of an unused variable
Remove the Port directive. In it's place, the Listen directive is now a required directive, which tells Apache what port to listen on. The ServerName directive has also been extended to accept an optional port. If the port is specified to the ServerName, the server will report that port whenever it reports the port that it is listening on. This change was made to ease configuration errors that stem from having a Port directive, and a Listen directive. In that situation, the server would only listen to the port specified by the Listen command, which caused a lot of confusion to users.
Implement suggested input filter improvements from Greg and Ryan. - Clean up scopes and namings of certain variables - Add comments about potentially bogus modes - Consolidate a FOREACH loop into a single brigade_length call
Input filtering rewrite. Consolidate how we handle HTTP input parsing by rearranging and rethinking some things. The net result is that the HTTP filter is now a request filter and is now only responsible for HTTP things. The core input filter is now responsible for handling all of the dirty work. Highlights: - Removes the dechunk filter and merges it with ap_http_filter (aka HTTP_IN). The dechunk filter was incorrectly handling certain cases (trailers). - Moves ap_http_filter from a connection filter to a request filter to support the consolidation above (it needs header info). - Change support code to allow the http_filter to be a request filter (how the request is setup initially). - Move most of the logic from HTTP_IN to CORE_IN (core_input_filter). HTTP_IN is now only concerned about HTTP things. The core filter is now responsible for returning data. It is impossible to consolidate dechunk and http without this because HTTP_IN previously buffered data. As Greg has suggested, it may make sense to write some brigade functions that handle input (getline). It should be fairly trivial to add these. Some of the calls in ap_http_filter could be switched as well. This is the original patch as submitted to dev@httpd on Monday, Sep. 24th. Additional comments and some minor tweaks done after that submission are coming up next. This should allow people who reviewed the original patch to see what has changed and review them piecemeal. This test passes all current tests in httpd-test. Please perform chicken sacrifices to verify that this hasn't blown up your favorite input. Reviewed by: Greg Stein, Ryan Bloom, and Cliff Woolley (buckets)
Remove the translate_name hack that caused Greg Ames some grief with mod_rewrite.
This patch eliminates the wasteful run-time conversion of method names from strings to numbers in places where the methods are known at compile time. (Justin fixed the va_end() call to be correct.) Submitted by: Brian Pane <bpane@pacbell.net> Reviewed by: Justin Erenkrantz
Remove the Win32 script-processing exception from mod_cgi, and roll build_command_line/build_argv_list into a unified, overrideable ap_cgi_build_command optional function. Eliminates a ton of Win32 cruft from core.c for registry parsing. Win32 (through the default handler, and newest changes to the apr_proc_create fn) continues to serve .bat/.exe files. This is in preparation for adding modules/arch/win32/mod_win32 for scripts. Please review the mod_cgi.c behavior very carefully.
A very small optimization to the OLD_WRITE logic. This just makes us store a pointer to the OLD_WRITE frec, and instead of using strcmp or strcasecmp, we can just do a simple pointer comparison. This optimization is also available to other modules.
Can it be this simple? No, probably not, but this fast-hack will get us going again for a while. We are currently rejecting some internal file_sub_req()'s in the translate phase. I don't like this hack because of risks it potentially exposes, but for today, if we have a filename - and we are a subrequest, then let it fly without further mapping. This allows us to serve up the default "/" request (run through mod_dir->mod_negotiation->mod_mime) without a 400 error. The right solution is to set up some traps and escapes for the subreq mechanism, possibly with a subreq translate hook, and drop the URI entirely for these cases.
Same as Jeff Trawick's patch [thank you!] only a tad faster, and error
out on the old Set{Input|Output}Filter onefilter twofilter syntax
(prior to this patch, only the last filter in a space seperated list
would be configured.)
fix an endless loop (well, until you run out of storage from tiny apr_pstrdup() calls and your machine crashes) when you have a filter chain ap_getword() returns an empty string, not a NULL string, when there are no more words fix a segfault when you don't have a filter chain ap_getword() does not check for a NULL string to search
Thank you again for the proxy autobuild reports ;)
Changed syntax of Set{Input|Output}Filter. The list of filters
must be semicolon delimited (if more than one filter is given.)
The Set{Input|Output}Filter directive now overrides a parent
container's directive (e.g. SetInputFilter in <Directory /web/foo>
will override any SetInputFilter directive in <Directory /web>.)
This new syntax is more consistent with Add{Input|Output}Filter
directives defined in mod_mime. Also cures a bug in prior releases
where the Set{Input|Output}Filter directive would corrupt the
global configuration if the multiple directives were nested.
[William Rowe]
Since the mod_mime patch was applied, here is the rest of the patch to introduce the ForceType and SetHandler [absolute references] directly into the very top of the fixups phase. This means these will always override _any_ mime module, not just mod_mime. Ergo, other mime modules can continue to set charset, encodings, etc. Since these are globals, they belong in the core. This highlights a very serious drawback to the type_checker hook. By using run first, a module that identifies _partial_ information (maybe just the content type) won't pass the query on to other modules, like mod_mime, that might further define the encoding or charset. The type_checker hook should clearly become a run-all, and the modules should decline if they see someone ahead of them answered a question they were going to try to figure. Which means - if type_checker becomes RUN_ALL - this new override hook fn should become a type_checker again - and RUN_REALLY_FIRST, and let other modules _choose_ not to override this election. (We can run it again at the end, for a recount ;) Votes?
This is the same granularity of control as mod_mime gave to set handlers (and now AddInputFilter and AddOutputFilter by extension) so this seems entirely appropriate in the core as well. Options FileInfo is required to change the processing behavior of files.
Fix a growing connection pool in core_output_filter() for keepalive requests. We were allocating a brigade out of the connection pool; the number of these brigades allocated per connection was theoretically unlimited.
Solve a bug I introduced this weekend, we want to compare core_*->r as a boolean, not by value. Reported by: Barrie Slaymaker <barries@slaysys.com>
apr_pstrcat args were not NULL terminated
Eliminate proxy: (and all other 'special') processing from the ap_directory_walk() phase. Modules that want to use special walk logic should refer to the mod_proxy map_to_location example, with it's proxy_walk and proxysection implementation. This makes either directory_walk flavor much more legible, since that phase only runs against real <Directory > blocks. On a technical note, this patch also forces the Directory to be canonical (unless it is "/" or a regex.) It also allows us to be more explicit when declaring <Directory > block errors.
Introduce the map_to_storage hook, which allows modules to bypass the directory_walk and file_walk for non-file requests. TRACE shortcut moved to http_protocol.c as APR_HOOK_MIDDLE, and the directory_walk/file_walk happen as APR_HOOK_VERY_LAST in core.c. A seperate patch to mod_proxy is required to short circuit both the TRACE and directory_walk/file_walk stuff. That patch is next.
sec, sec, who's got a sec? This gave me a headache, but I had to clear out the last patch before I rearranged this to be _readable_. Next step for everyone's sanity, provide <Proxy > directives ;)
Commit this code before another patch becomes to difficult to follow. This patch does one thing, it changes the root path "/" to reflect an element count of Zero (0). directory_walk will always accept the zero element (which sorts first, thankfully) on it's first go around. So, Unix will accept "/" when it's parsing it's first element "/". Dos/Win32 will accept "/" and "C:/" when they parse their first element, "C:/". The root sorted first, so it behaves as users expect. The syntax "//" or "//machine" will be depreciated for now, the user needs to set up the extact "//machine/share/" that they want served on Win32.
Will I ever get my str*cmp semantics right? Not at this hour...
My initial changes failed to accomodate this faux entry. If you didn't see any <Directory > blocks working right, try this cvs update.
fix fubar with recent commit to ap_core_translate()
Fix my typo (I invented the silly constant, you would expect me to recall it.)
Increase security in core.c by testing (as we merge the path) that the URI does not go above the DocumentRoot (as defined by the OS, not by the URI specification), and give us the true name. When we are done, note the name is canonical for directory_walk.
Start with the presumption that canonical_filename is not likely to be set. Therefore we will canonicalize it when it doesn't match filename. The next optimization should take the path common to canonical_filename and filename, and start merging filename from there for canonicalization.
Eliminated ap_os_[systemcase|[case_]canonical]_filename() and changes for ap_os_is_path_absolute (moved to util.c).
Update the Apache code to account for the XtOffset change in APR.
Begin to sanitize the MPM configuration directives. Now, all MPMs use the same functions for all common MPM directives. This should make it easier to catch all bugs in these directives once. Everybody should check their favorite MPM to ensure that it still compiles, and that these directives work. This is a big patch, and although it looks good, and things compiled for me, that is no garauntee that it will work on all platforms. :-) Submitted by: Cody Sherr <csherr@covalent.net>
Fix the new method code. We need to cast 1 to an apr_int64_t or it will be treated as a 32-bit integer, and it will wrap after being shifted 32 times. Submitted by: Cody Sherr <csherr@covalent.net> and Ryan Morgan <rmorgan@covalent.net>
Remove all warnings from the input filtering stack.
Add the ability to extend the methods that Apache understands and have those methods <limit>able in the httpd.conf. It uses the same bit mask/shifted offset as the original HTTP methods such as M_GET or M_POST, but expands the total bits from an int to an ap_int64_t to handle more bits for new request methods than an int provides. Submitted by: Cody Sherr <csherr@covalent.net>
This patch fixes more untold breakage than you can shake a stick at.
Provide the same optimization to the dir_config structure to track d_is_absolute, along with d_is_fnmatch.
More obsessive changes to meet HTML 3.2, HTML 4.01 Transitional and XHTML 1.0 Transitional
Cliff's most sane advise :-)
This same patch is needed in mod_asis and others, I'm testing the waters for this solution. I'm easily convinced to choose AP_MAX_SENDFILE based on any reasonable argument, provided it's smaller than 2^30 :-)
Changes to respect the new apr bucket and brigade length types (either apr_size_t for bucket lengths, or apr_off_t for aggregate brigade lengths.)
Make scoreboard creation a hook. This allows management modules to have access to the scoreboard at the time that it is created, and at every restart request. Submitted by: Cody Sherr <csherr@covalent.net> Reviewed by: Ryan Bloom
Add error message and return if we fail reading from a bucket in the core_outout_filter(). core_output_filter() is in need of a rewrite, it is getting quite crufty.
emulate_sendfile() is a better name for what this function does. No function change is made by this patch, only a static function name change.
*) Account for the new pool parameter to apr_bucket_file_create() and apr_bucket_file_make(). *) Simplify mod_file_cache's sendfile_handler by taking advantage the new ability of file buckets to handle files opened in XTHREAD mode. [Also inlined some of the brigade construction stuff in mod_file_cache's handlers to save a palloc() or two.]
As with Apache 1.3, use priority APLOG_INFO (instead of APLOG_ERR) for log messages which report network errors writing to the client.
Back out the change to allocate files out of the main request pool, and implement pool-based setaside for FILE and MMAP buckets.
Define a hook for fetching management/status items. This patch was submitted by Ian Holsman. Greg revised some names, applied the Apache style, and namespace-prefixed the public symbols. Minor bugfix in the use of the hook implementation macro. Submitted by: Ian Holsman <IanH@cnet.com> Reviewed by: Greg Stein
Add a pool to the ap_save_brigade prototype. This removes a todo from the comments that is really necessary before the setaside stuff will work properly.
Fix seg faults and/or missing output from mod_include. The default_handler was using the subrequest pool for files and MMAPs, even though the associated APR structures typically live longer than the subrequest.
We need to increment i during this for loop. Without this change, we will end up in an infinite loop. Submitted by: Ryan Morgan
Back out the recent change to ap_get_brigade, to make it use indirection again. The problem is that the amount of data read from the network, is not necessarily the amount of data returned from the filters. It is possible for input filters to add bytes to the data read from the network. To fix the original bug, I just removed the line from ap_get_client_block that decremented r->remaining, we allow the http_filter to do that for us. I have also removed an incorrect comment.
Fix a bug in the input handling. ap_http_filter() was modifying *readbytes which corresponded to r->remaining (in ap_get_client_block). However, ap_get_client_block was *also* adjusting r->remaining. Net result was that PUT (and probably POST) was broken. (at least on large inputs) To fix it, I simply removed the indirection on "readbytes" for input filters. There is no reason for them to return data (the brigade length is the return length). This also simplifies a number of calls where people needed to do &zero just to pass zero. I also added a number of comments about operations and where things could be improved, or are (semi) broken.
Set the conn_rec->aborted flag when we detect a whacked connection on the write path.
Fix the logic for saving data onto the heap before sending it. Basically, we have to use nbytes+flen when figuring out how much data we have, and when looking at the fact that we have a buffer to save aside before sending it, we also need to look at the length, to ensure that we aren't saving too much. Submitted by: Bill Stoddard and Ryan Bloom
AP_MIN_BYTES_TO_WRITE currently equals APR_BUCKET_BUFF_SIZE, so we have to use <=
Add a comment about an assumption we make in our keepalive buffering. Delay the check for "too many items in an iovec" until we actually try to put something in there. This allows that N+1 bucket to be an EOS, FLUSH, FILE, or zero-length bucket without triggering a split. Only if that next bucket has iovec data will a split be made.
Create Files, and thus MMAPs, out of the request pool, not the
connection pool. This solves a small resource leak that had us
not closing files until a connection was closed. In order to do
this, at the end of the core_output_filter, we loop through the
brigade and convert any data we have into a single HEAP bucket
that we know will survive clearing the request_rec.
Submitted by: Ryan Bloom, Justin Erenkrantz <jerenkrantz@ebuilt.com>,
Cliff Woolley
At the hack-athon we decided to change the way that input filters determine how much data is returned to the previous filter. Prior to this change, we used a field in the conn_rec to determine how much to return. After this change, we use an argument to ap_get_brigade. This makes it much more obvious how things work at all levels, so that module authors can easily determine how much data is supposed to be returned to them.
When I initially pulled the BYTERANGE filter into the core, Greg Stein told me I was wrong. I was wrong, and Greg was right. This commit just moves the byterange filter and its related functions out of the core, and puts them back in the HTTP specific module. Submitted by: Greg Stein
Move the error logging of a failed send into the core output filter. This should catch errors in any way we send data.
This adds some simple error logging to send_the_file. There are a lot more cases that we should log :(
change create_request hook to RUN_ALL/return int so handlers can throw errors
Fix a major security problem with double-reverse lookup checking. Previously, a client connecting over IPv4 would not be matched properly when the server had an IPv6 listening socket. PR: 7407 Submitted by: Taketo Kabe <kiabe@sra-tohoku.co.jp> Reviewed by: Jeff Trawick
Add a hook, create_request. This hook allows modules to modify a request while it is being created. This hook is called for all request_rec's, main request, sub request, and internal redirect. When this hook is called, the the r->main, r->prev, r->next pointers have been set, so modules can determine what kind of request this is. Currently, this is only used by the core module, but protocol modules are going to need to have the ability to affect the request while it is being read.
tweak ap_get_remote_host() so that the caller can find out if she got back an IP address mod_access needed to know this, but the old code didn't handle IPv6
Move more code from the http module into the core server. This is core code, basically the default handler, the default input and output filters, and all of the core configuration directives. All of this code is required in order for the server to work, with or without HTTP. The server is closer to working without the HTTP module, although there is still more to do. I tried to fix Windows, but somebody should probably make sure I did it correctly.
This form allows you to request diffs between any two revisions of this file. For each of the two "sides" of the diff, enter a numeric revision.
| apache@apache.org | ViewVC Help |
| Powered by ViewVC 1.1.2 |