Parent Directory
|
Revision Log
| Links to HEAD: | (view) (annotate) |
| Sticky Revision: |
no declarations after statements.
cleanup brigade before reusing it
core, mod_deflate, mod_sed: Reduce memory usage by reusing bucket brigades in several places
core: Treat timeout reading request as 408 error, not 400. Log 408 errors in access log as was done in Apache 1.3.x. PR: 39785 Submitted by: Nobutaka Mantani, Stefan Fritsch Reviewed and added to by: Dan Poirier
Bring back OS/2 support. Reverses r758929 with a little bit of conflict resolution.
remove OS/2 platform support
the CRLF following 100 Continue needs to be sent as ASCII on EBCDIC boxes.
Disabled DefaultType directive and removed ap_default_type() from core. We now exclude Content-Type from responses for which a media type has not been configured via mime.types, AddType, ForceType, or some other mechanism. MMN major bump to NZ time. PR: 13986
simplifications per niq's review comments
EBCDIC fix for ap_send_interim_response()
Import the core parts of the DTrace patch. This is a modified and updated version of what was submited by Theo before: <http://mail-archives.apache.org/mod_mbox/httpd-dev/200805.mbox/%3C6AFBCFE8-4CCA-4A02-8A43-F9170689695D@omniti.com%3E> Note, this does not hook it up into the build system at this time, because the original patch was a little too creative there. Submitted By: Theo Schlossnagle <jesus omniti.com>
* Don't send 100-Continue when there was no Expect: 100-continue in the request headers.
core, mod_proxy: If a kept_body is present, it becomes safe for subrequests to support message bodies. Make sure that safety checks within the core and within the proxy are not triggered when kept_body is present. This makes it possible to embed proxied POST requests within mod_include.
Remove all references to CORE_PRIVATE.
* Do not set filter context brigade to NULL (and thus need to recreate it each time) but empty it (via APR_BRIGADE_PREPEND) and reuse it. Submitted by: Stefan Fritsch <sf sfritsch.de> Reviewed by: rpluem
Alternate fix... profiling indicates that the string termination is completely unneeded and superflous. In which case, the original allocation size is sufficient since nothing external worries about a NULL nor looks for it.
Prevent 1-byte overflow on 8192 boundary (see PR 43310)
Add option not to send&clear response headers in ap_send_interim_response. We'll need this option to fix PR#43711, and ap_send_interim_response is fortunately too new an API to have made it into anything stable.
Introduce ap_send_interim_response function and API, for interim (HTTP 1xx) responses sent by an application or backend.
update license header text
* server/core.c (default_handler): Use apr_brigade_insert_file() to append the file to the brigade. * server/protocol.c (ap_send_fd), modules/proxy/mod_proxy_http.c (spool_reqbody_cl), modules/cache/mod_mem_cache.c (recall_body), modules/cache/mod_disk_cache.c (recall_body), modules/mappers/mod_negotiation.c (handle_map_file), modules/generators/mod_asis.c (asis_handler), modules/dav/fs/repos.c [DEBUG_GET_HANDLER] (dav_fs_deliver), modules/arch/win32/mod_isapi.c (ServerSupportFunction): Likewise.
* Adjust comment as per niq's proposal in r395166 and as already adjusted by colm in the backport to 2.0.x (r395197).
Update the copyright year in all .c, .h and .xml files
* Initialize last_char as otherwise a random value will be compared against APR_ASCII_LF at the end of the loop if bb only contains an EOS bucket. PR: 39282 Submitted by: Davi Arnaut <davi haxent.com.br> Reviewed by: rpluem
* Rollback r393037 as this was vetoed by wrowe. Details see http://mail-archives.apache.org/mod_mbox/httpd-dev/200604.mbox/%3c443ABE65.1060603@rowe-clan.net%3e
* Prevent r->parsed_uri.path from being NULL as this can cause segmentation faults e.g. in mod_cache. Set it to "/" in this case. PR: 39259 Submitted by: Davi Arnaut <davi haxent.com.br> Reviewed by: rpluem
Revert the refactoring of the request read code
* Improve fix for PR38123. This fixes PR38123 and PR37790 (whose fix has been already backported) by inserting the HTTP_IN filter uncondionally before we call ap_send_error_response or ap_die. This ensures that ap_discard_request_body called by ap_die and by ap_send_error_response works correctly on status codes that do not cause the connection to be dropped and in situations where the connection should be kept alive.
* Fix PR38123 by adding the HTTP_IN filter also in the case of an invalid expect header.
An unambigous cast, if limit is <0 it's unlimited.
Refactoring of ap_read_request() to store partial request state in the request rec. The point of this is to allow asynchronous MPMs do do nonblocking reads of requests. (Backported from the async-read-dev branch)
* server/protocol.c (ap_old_write_filter): Use NULL for the NULL pointer not 0.
Fix for Bug 37790 (hangs on error return from post_read_request)
No functional Change: Removing trailing whitespace. This also means that "blank" lines consisting of just spaces or tabs are now really blank lines
keep the proxied Content-Length header for a HEAD response. PR 18757
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.
Pay close attention to core_create_req() ... and note that not one other member of the r->vars is initialized herein. Move this initialization elsewhere. (If this is the 'default' - it really aught to be the zero value, for that matter).
* server/protocol.c (ap_read_request): Remove the Content-Length header if any Transfer-Encoding header is present, regardless of value. Reviewed by: Paul Querna, Jeff Trawick
if Transfer-Encoding is not "identity" ignore Content-Length. otherwise ajp-proxy hangs when Transfer-Encoding is "chunked".
If a request contains both a T-E and C-L, remove the C-L, stopping some HTTP Request Smuggling attacks exploited when using HTTPD as a forward or reverse proxy.
* server/protocol.c (read_request_line): Revert addition of error message which triggers every time dummy_connection() is used to wake up a child.
Support the suppress-error-charset setting, as with Apache 1.3.x. With Apache 1.3.x, it is a bit simpler as the request does not go through ap_make_content_type(). Modules can set custom error responses but not be able to set the charset, so they have to code the charset in the html. Thus, it is useful to preserve 1.3.x behavior exactly. PR: 26467
use a more general but slightly slower test for a body.
clone_headers_no_body: remove all entity headers in addition to the Transfer-Encoding header when creating a GET subrequest
don't propagate input headers describing a body to a subrequest. this can cause a back end server to hang in a read for a body which no longer exists.
Update copyright year to 2005 and standardize on current copyright owner line.
limit_req_fieldsize is signed, correct a signedness error using a cast since it's not possible to have a negative limit.
FINALLY Correct ap_http_method()! It is NOT a method, it's a SCHEME! Bumped mmn, and ap module cookie, for this function rename. It's not a deprecation, as ap_http_method would be a lovely function name sometime in the future: to determine what the function name implies.
Revert patch r104923. This patch doesn't actually fix bug 18757 and breaks TLS upgrade functionality. Also, removing the content length for HEAD requests is being handled in ap_http_header_filter().
general property cleanup
Fix for memory consumption DoS, CVE CAN-2004-0942: * server/protocol.c (ap_rgetline_core): Don't trim trailing whitespace from the buffer here. (ap_get_mime_headers_core): Trim trailing whitespace here, after reading a complete field including continuation lines. Also simplify code to remove whitespace between field-name and colon. Reviewed by: Andr�� Malo, Bill Stoddard
Use a more descriptive error message, and make it an INFO insteead of NOTICE.
PR: 31875 Fix URI parsing bug in case of a leading double-slash
This will put some messages in the error log when some people try a lame DoS by just opening a socket, and never sending any data. Ivan suggested such a change about a month ago, to match the 1.3 behavoir. Today I helped OSU's Admins figure out that someone was trying this 'attack' against their mirror server. The server status just showed hundreds of Apache Children stuck in Reading. This will at least hint to the admins where the problem is by telling them about it in the error log. Inspired by: Rici Lake, Ivan Ristic <ivanr webkreator.com>
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
* server/protocol.c (ap_rgetline_core): Never NUL terminate at (*s)[-1] for caller-supplied *s. Submitted by: Rici Lake <ricilake speedy.com.pe>
* server/protocol.c (ap_rgetline_core): Fix off-by-one.
Fix for Bug 18757 (sending bogus content-length of zero in no-body requests)
Fix signedness emit.
CAN-2004-0493 - memory exhaustion denial of service Reviewed by: jerenkrantz
ap_rgetline_core: insure that the output string is null terminated when exiting with APR_ENOSPC Submitted by: Tsurutani Naoki <turutani scphys.kyoto-u.ac.jp>
ap_set_sub_req_protocol and ap_finalize_sub_req_protocol are now exported on Win32 as well PR: 28523 Submitted by: Edward Rudd <eddie omegaware.com>
*) Remove compile-time length limit on request strings. Length is
now enforced solely with the LimitRequestLine config directive.
[Paul J. Reder]
fix name of The Apache Software Foundation
fix copyright dates according to the first check in
apply Apache License, Version 2.0
* server/protocol.c (ap_rgetline_core): Fix folding if header is continued over more than two lines. PR: 19405 (affects proxy only)
* server/protocol.c (ap_rgetline_core): Re-indent function after being skewed by CAN-2003-0132 fix: no functional change.
update license to 2004.
get rid of _FOREACH
Set the scoreboard state to indicate logging prior to running logging hooks so that server-status will show 'L' for hung loggers instead of 'W'.
tag the pools created for requests and subrequests
zap an incorrect comment that remained from 1.3 days Submitted by: Aryeh Katz Reviewed by: Jeff Trawick
minor style changes
Update comment after removal of tmp_headers in r1.132.
Update the header token parsing code to allow LWS between the token word
and the ':' seperator. [PR 16520]
[submitted: Kris Verbeeck <kris.verbeeck@advalvas.be> and
Nicel KM <mnicel@yahoo.com>]
[Reviewed: <coad@measurement-factory.com> and
Paul J. Reder]
Eliminate creation of a temporary table in ap_get_mime_headers_core() Submitted by: Joe Schaefer <joe+gmane@sunstarsys.com> Reviewed by: Brian Pane
fix some discrepancies between format strings and arguments, resolving some warnings on 64-bit systems
Simplify and shorten the code path for scanning request headers Reviewed by: Greg Ames, Bill Rowe
ap_rgetline_core: set the number of bytes read & copied into the caller's buffer when returning APR_ENOSPC. This prevents seg faults in ap_get_mime_headers_core in an error path which handles headers that are too long. Submitted by: Jeff Trawick
ap_get_mime_headers_core: allocate space for the trailing null when there are folded headers. PR 18170 [Peter Mayne <PeterMayne@SPAM_SUX.ap.spherion.com>]
finished that boring job: update license to 2003. Happy New Year! ;-))
ap_get_mime_headers: combine some error paths to remove a conditional branch from the mainline path. It might be worthwhile to move all the getline error handling into a separate function and be a little more i-cache friendly.
ap_get_mime_headers: whoops - need to insure that we use a configured field size limit if there is one
ap_get_mime_headers: tighten up the null termination of header line which is too long. getline can return a smaller length that what it actually read in that case. The check for len > limit_fieldsize isn't needed, but we do need to insure that getline actually allocated a buffer (and set len) in the case where the first socket input buffer is already bigger than the limit.
prevent a potential seg fault in ap_escape_html if a header field is too long.
Move the check of the Expect request header field after the hook for ap_post_read_request, since that is the only opportunity for modules to handle Expect extensions. Obtained from: apache-1.3
bucket length parameter is apr_size_t, which isn't always signed, so be careful when comparing with the special value -1 Submitted by: Allan Edwards <ake@us.ibm.com> Reviewed by: Jeff Trawick
when the connection drops, c->aborted is set but generally ap_pass_brigade returns APR_SUCCESS content-length needs to be alert to c->aborted so that it doesn't keep trying to pass brigades down (otherwise, you get errors writing to the network over and over and over and ...)
Ensure that output already available is flushed to the network when the content-length filter realizes that no new output will be available for a while. This helps some streaming CGIs as well as some other dynamically-generated content.
Minor simplification... The can_send_content_length variable is redundant with ctx->data_sent.
The protocol version (eg: HTTP/1.1) in the request line parsing is now case insensitive. Before, 'http/1.1' would silently be forced to HTTP/1.0 PR: Obtained from: Submitted by: Reviewed by:
Changed the content-length filter to allow streaming delivery of content to clients With this new code, the C-L filter will compute a content-length if there's an EOS in the first brigade passed to it. For normal static file requests, the response header will still include a C-L. If there's no EOS in the first brigade passed to the C-L filter, the filter will give up on setting the C-L header, in favor of passing the data on to the next filter in a timely manner.
fix weird things that happen with canned error messages due to using two different request_recs after an ErrorDocument internal redirect failure. examples: wrong Content-Type, garbled output from ebcdic servers due to double charset translation
add notes about a portability problem -- formatting apr_time_t in hex
fix folding when the continuation charater is a blank Reported by: one of Jeff T's regression test cases
silence an unhelpful gcc warning
Eliminated the use of AP_MODE_SPECULATIVE brigade reads to check for request header continuation lines. Instead, ap_get_mime_headers_core() now sets aside each line of input until it sees the next line. If the next line starts with a tab, it is appended to the previous one; otherwise, the previous line is added to the request headers table. This reduces the number of temporary buckets that must be created and destroyed to read in a request.
Re-use the same temp brigade to read all lines of a request header, to avoid the overhead of brigade creation and deletion. (This produced a 5% reduction in the total CPU usage of a minimalist httpd configuration: <JHEPKCEMGPKFFDHHDDKDMELFEKAA.bill@wstoddard.com>)
Fix C-L filter non-blocking-mode brokenness. It was failing to ever read from pipe/socket buckets again if it got APR_EAGAIN from them due to its use of APR_BRIGADE_FOREACH. Submitted by: the gang on IRC
Optimization for ap_rgetline_core(): When "folding" mode is enabled, clear and re-use the temporary brigade rather than destroying it and creating a new one
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
ap_finalize_sub_req_protocol() shouldn't send an EOS bucket if one was already sent. mod_ext_filter performs some one-time processing when it sees EOS. When it saw EOS more than once and a subsequent attempt to close a file failed, it issued the log message described in PR 9644. PR: 9644
Call ap_discard_request_body from ap_finalize_request. Remove the call from all other modules that do not use it to determine the response for the request.
stop using APLOG_NOERRNO in calls to ap_log_?error()
Start with a larger buffer size in ap_rgetline_core() to avoid having to grow the buffer so often
Optimization: modified the power-of-two allocator in ap_rgetline_core() so that it converges on the new buffer size in a single iteration.
Fixed missing null-termination of ap_make_content_type() patterns list
Optimization: Replaced apr_strcat() with apr_strcatv() in ap_make_content_type()
Performance fix: replaced the strcasecmp calls in ap_make_content_type() with apr_strmatch()
cleanup old-school backward uses of APR_BRIGADE_CONCAT to use APR_BRIGADE_PREPEND instead, plus optimize away a bunch of repetitive brigade destructions/creations by hanging onto ctx->saved even after we empty it out.
Simplify this little chunk of code since r is set to f->r earlier.
Adds support for reading trailers on input by exporting get_mime_headers to ap_get_mime_headers and calling it in the appropriate place in ap_http_filter. showstoppers--;
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.
Seems like this is the end of the compiler emits on Win32, once again.
Update our copyright for this year.
Style Police comming through...
ap_rgetline_core: fix a bug with folding observed while testing ebcdic. Garbage characters sometimes appeared after a legitimate folded header. We weren't allocating an extra byte for the trailing null, or copying it, when called from get_mime_headers (folding is in use, and ap_rgetline is responsible for allocating memory). No need to worry about a trailing LF - it's already been nuked. I checked the partial line code to see if it had a similar bug. It looked like it did, and that the code which trims the back end of the line would run multiple times and whack innocent bytes. However, gdb showed that this section of code appears to be dead due to input filter chain changes. also, removed an assignment to a dead variable.
ap_rgetline: fix folding and partial line handling on ebcdic boxes. The normal case worked OK, but due to the recursion and multiple exit points, input bytes could go thru charset translation multiple times or not at all. Suggested by: Justin Erenkrantz
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
This fixes most of the header bug that was committed last night. The server is seg faulting on pipelined requests currently, but I want to get people back to a running server.
Fix the mod_dir/mod_negotiation bug, where redirects and sub requests were not getting the correct filters. This is done by creating a location in the request rec that holds protocol level filters. Protocol level filters survive for one request, from the time the request is received from the user to the time the response is sent. r->output_filters now stores the request level filters, which are only valid for the lifetime of one request_rec. This patch works, but it is not complete. The second half of the problem is that add_any_filter doesn't check where it puts the filters that it adds, so it is possible for filters to be put on this wrong list, and for filters to be lost completely during request processing. That half of the fix will be coming in the next day or so. Submitted by: Will Rowe, Justin Erenkrantz, Ryan Bloom
ownership of the brigade is passed in the ap_pass_brigade call so make sure that it doesn't get left lying around. This tickled a bug with mod_deflate and resulted in a bucket being compressed more than once.
Just toss these debug messages since so many people use httpd with LogLevel 'debug' and complain if they see anything that says "error" in it. This case isn't even interesting unless you are hard-core.
update CHANGES for an input side seg fault fix. also, get rid of a mainframe term that somehow leaked into a comment which might confuse people.
ensure that ap_rgetline allocates storage for the request line each time it is called. This fixes a number of segfaults on daedalus where the first line is empty (i.e. \r\n followed by a bunch of garbage)
We totally disregard the fact that notice is level 5 and always print that. Yuck. Make these error message DEBUG level then.
don't try to place a header field in error-notes if ap_rgetline() returned something like APR_EOF, since len is not set in this case and we can go off the end of storage make sure we set r->status to something when we bail out due to an error; otherwise, the request goes forward with meaningless headers
Tone down the logging levels for these two messages from ERROR to NOTICE. It's something to note, but it isn't an error worthy of logging by default. (Also always log any status values in read_request_line() - incl. timeouts.)
If the MIME-continuation line returns nothing, then we should return not segfault. (A minor change to Jeff's patch is that we ignore the EBCDIC code path.) Submitted by: Jeff Trawick Reviewed by: Justin Erenkrantz
make it compile on win32
Simplify the exit paths of ap_rgetline by creating a second brigade for use when we do AP_MODE_SPECULATIVE. This allows us to delete the brigades earlier. (In practice, it really doesn't matter if we delete the brigade or not since it will be destroyed when it's pool is destroyed, but we'll try to be nice.)
optimized away one more filter name lookup during request processing
Fixed a read from a deleted brigade in the new version of ap_rgetline()... In the "folding" case, there was an ap_get_brigade() call after the brigade had been destroyed. I noticed this while debugging a memory leak that showed up while testing the httpd with ab.
ap_rgetline(): completely ignore an empty bucket... previously the logic
generally worked but with a memory debug build it could
crash since some memory debuggers don't like an alloc of
zero bytes
Eliminate needless variable that wasn't initialized anyway.
Add another status code to ignore in the error_log. (I'm really tempted to ditch this log line altogether.)
Turn the log verbosity WAY down by not logging TIMEUP and EOF errors in read_request_line as these are very common place with HTTP keepalive timeouts.
Somehow, I lost this condition when I changed to account for ap_rgetline.
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
Rewrite ap_rgetline to remove the need to have an "internal" brigade stored in the core_module structure by using the AP_MODE_SPECULATIVE filter mode to determine if MIME-continuation should occur. Notes: - ap_rgetline has a new prototype. - ap_rgetline returns APR_ENOSPC when we are out of buffer space. All direct callers of ap_rgetline are now adjusted to handle this new API. ap_getline will mimic the old API for now. Reviewed by: Ryan Morgan
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)
A modification to reduce the memory usage of the server: Reduced the initial size of the r->headers_in and r->subprocess_env tables...this saves us 600 bytes per request, which (based on tests I just ran) helps keep r->pool from overflowing its initial 8KB allocation and having to alloc another 8KB block.
Making sure that the global variables have been initialized to avoid linker problems at least on NetWare Submitted by: Pavel Novy
Fixed a bug in ap_rgetline() When an input line required more than one read, each subsequent block of data was copied on top of the previous one. So if a request line got split into multiple packets, the data would be corrupted. The new code uses a power-of-two allocator to expand the buffer and properly append the next block of data at the end of the previous one.
Skip the setting of Last-Modified in the response header on requests or subrequests for which no response header will be generated (a performance improvement for mod_include)
Address a signedness warning. No cleaner solutions here.
Fixed check for buffer overrun in ap_rgetline()
get rid of an unused variable
[No code changes here, just adding the cvs comment that I messed up in the previous commit] Added a version of ap_getline() that allocs a buffer from the request's pool, rather than copying into a caller-supplied buffer. (This lets us eliminate one copy operation on the request headers.)
include/http_protocol.h
Optimization: changed some apr_pstrndup calls to apr_pstrmemdup
Yea, sure a message is always good. Note we can't log the exception. Submitted by John Sterling <sterling@covalent.net>
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.
Prevent segv in ap_note_basic_auth_failure() when no AuthName is configured PR: Obtained from: Submitted by: John Sterling <sterling@covalent.net> Reviewed by: dougm
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.
ap_getline() is useful to modules outside of the core.. change declaration from AP_CORE_DECLARE to AP_DECLARE so it can be used used outside the core PR: Obtained from: Submitted by: Reviewed by:
change ap_getline to return the size of the buffer when there's no apparent end to an input line. This is more like the 1.3 behavior which should help the callers recognize this condition.
don't lose the return code from ap_fwrite() when called from buffer_output()
I believe it is a kosher for a filter to return EOS, but return APR_SUCCESS via ap_get_brigade. So, we should treat this as end-of-input.
Remove the lameo create_req hack and delay the addition of the HTTP_IN filter until after we have read the headers. This eliminates the status hack that was in http_protocol.c and makes it all around better. server/protocol.c now directly adds HTTP_IN filter - should we create a specific hook for this? (Could we do this as a post_read_request hook?) I'm not terribly sure, but let's move it down to the lowest possible place in ap_read_request. We can change this detail later as we see fit.
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)
Switch back to SIGUSR1 for graceful restarts on all platforms that support it. This defines a symbol called AP_SIG_GRACEFUL in ap_config_auto.h which will have the appropriate signal value. All direct references to SIGWINCH have been replaced with AP_SIG_GRACEFUL. On Linux 2.0, use SIGWINCH instead since SIGUSR1 is used by glibc 2.0's user-space threading library to control threads. All later versions of Linux/glibc don't have this problem. (Not to mention the security holes in older Linux versions which make it unsuitable for use as a web server.) If your platform doesn't have SIGUSR1, use the appropriate mojo in configure to define what your graceful restart signal should be. In theory, a configure switch could be added to allow the admin to specify the appropriate signal that should be used. This is left as an exercise to the reader for now. The docs need to be updated. Since the signal is now configurable, just saying SIGUSR1 for graceful restart isn't completely true. Also, the apachectl functionality needs to be moved into httpd - this is what Win32 does and it makes us consistent across platforms. Roy issued a veto against use of SIGWINCH by default, so this should resolve that veto.
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.
Fix breakage from Brian Pane's util_filter switch to hash tables. There were some places that were expecting what you put into frec would be what frec->name would be. Not true anymore. There are enough other places that were already doing the strcasecmp that it makes more sense to just make it all strcasecmp across the board rather than changing the UPPERCASE to lowercase. (None of these with the exception of old_filter look to be in the critical path anyway...)
Make test for EAGAIN portable in content length filter. This fixes some failures in CGIs on OS/2.
adjust to apr_uri_ rename
We can't use a static buffer for this patch, because that wouldn't be thread safe. Submitted by: Greg Marr <gregm@alum.wpi.edu>
Fix ap_rvprintf to support more than 4K of data. Submitted by: Cody Sherr <csherr@covalent.net>
Back out a patch that wasn't ready for inclusion. Thanks to OtherBill for pointing out that this was committed when it shouldn't have been.
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>
Coexist within the XHTML changes to http_protocol.c
More obsessive changes to meet HTML 3.2, HTML 4.01 Transitional and XHTML 1.0 Transitional
Reduce CPU consumption in conv_10 function, used to format "%d" by apr_*printf
This includes two changes to APR:
* new functions apr_itoa, apr_ltoa, and apr_off_t_toa
that provide itoa-type functionality based on pools
* Inline code in inet_ntop4 to replace sprintf for converting
binary IP addresses into dotted-decimal format
and two changes to Apache:
* use the apr_itoa functions in setting the content length,
in place of apr_psprintf
* use the apr_itoa functions to replace frequent uses of
'sprintf("%d",...)' in mod_log_config.
Submitted by: Brian Pane
Reviewed by: Dean Gaudet, Greg Ames
A couple of optimizations to the content_length filter.
Grrr.. Cliff warned me about this. APR should return APR_SUCCESS with zero bytes read rather than APR_EOF. Will work on APR later...
Reimplement content length filter to fix problem where all output from CGI scripts was being buffered in the brigade before any of it was written to the network. cl filter now honors flush and implements a buffer threshold.
Do non-blocking reads from pipes in the content-length filter.
*) 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.]
Back out the change to allocate files out of the main request pool, and implement pool-based setaside for FILE and MMAP buckets.
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.
use apr-util's apr_date_parse_http() instead of the to-be-removed ap_parseHTTPdate() (proxy needs to make similar changes) build changes forthcoming... Submitted by: Justin Erenkrantz
Move the addition of default AP_HTTP_HTTP_HEADER filters to the insert_filter phase so that other filters are not bypassed by default. PR: Obtained from: Submitted by: Reviewed by:
back out filter change that is preventing headers to be sent PR: Obtained from: Submitted by: john sterling Reviewed by: dougm
Moved util_uri to apr-util/uri/apr_uri, which means adding the apr_ prefix to all of the uri functions (yuck), changing some includes, and using APR error codes instead of HTTP-specific error codes. Other notes to test this patch: - You need to delete the util_uri.h file - exports picks up on this. - I'd like to remove the apr_uri.h from httpd.h, but that might increase the complexity of this patch even further. Once this patch is accepted (in some form), then I can focus on removing apr_uri.h from httpd.h entirely. I need baby steps (heh) right now. - I imagine that this might break a bunch of stuff in Win32 or other OS builds with foreign dependency files. Any help here is appreciated. This is a start... -- justin Submitted by: Justin Erenkrantz Reviewed by: Roy Fielding
Move the addition of default AP_HTTP_HTTP_HEADER filters to the insert_filter phase so that other filters are not bypassed by default. PR: Obtained from: Reviewed by:
fix the type of a parameter to ap_get_brigade()
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.
Removed the keptalive boolean from conn_rec because it is now only used by a single routine and can be replaced by a local variable. Submitted by: Greg Stein, Ryan Bloom, Roy Fielding
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.
Revert the change that moved keepalives out of conn_rec. That variable controls the number of requests per connection, regardless of the protocol used by the request.
Don't overwrite r->the_request. This was causing us to never get the request in the access_log
Move the keepalives field out of the conn_rec and into an HTTP specific connection record. This also moves some HTTP specific back out of the core and into the HTTP module.
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 ap_set_last_modified to the core. This is a potentially controversial change, because this is kind of HTTP specific. However many protocols should be able to take advantage of this kind of information. I expect that headers will need one more layer of indirection for multi-protocol work, but this is a small step in the right direction.
back out the logging of read errors in getline. daedalus was logging boatloads of "(54)Connection reset by peer: ap_get_brigade() failed" errors.
Empty out the brigade shared by ap_getline()/ap_get_client_block() on error exit from ap_getline(). Some other code got upset because the wrong data was in the brigade.
Handle ap_discard_request_body() being called more than once. Add a debug assertion to verify that c->remain is zero when a new request starts. ap_http_filter() does the wrong thing otherwise.
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.
This is a fix that went into v1.3 quite a while back, but not into v2.0. It sorts out the problem when a password protected reverse proxy URL sends a Proxy-Authenticate to a browser instead of a WWW-Authenticate. This patch covers the changes to the httpd-2.0 tree. Submitted by: Graham Leggett Reviewed by: Chuck Murcko
Avoid using sscanf to determine the HTTP protocol number in the common case because sscanf is a performance hog. From Mike Abbot's Accelerating Apache patch number 6. Submitted by: Mike Abbot <mja@trudge.engr.sgi.com> Reviewed by: Bill Stoddard
Fix content-length computation. We ONLY compute a content-length if We are not in a 1.1 request and we cannot chunk, and this is a keepalive or we already have all the data.
Make the old_write filter use the ap_f* functions for buffering the data. This has been tested with a couple of directory listings, but it could probably use a bit more testing before being declared stable.
Another missing AP_DECLARE mismatch
Begin to move functions from the http module to the core. The goal is to have only functions that are HTTP specific in the http directory.
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 |