Commit 0a3036e3 authored by kocienda's avatar kocienda

Reviewed by Hyatt

	Moved up to HTTP/1.1 in the simple loader, including chunked transer encoding and
	persistent connections. While I was in the neighborhood, I cleaned up a lot of
	code and improved some names.

        * Database.subproj/WebFileDatabase.m: Changed sync idle timeout from 3 seconds to 10 seconds.
	In the "real world" I think that this is a better choice since with even DSL speeds, pages
	often take longer than 3 seconds to load.
        * Misc.subproj/WebNSStringExtras.h:
        * Misc.subproj/WebNSStringExtras.m:
        (-[NSString _web_timeoutFromKeepAliveHeader]): Added this helper.
        * ProtocolHandlers.subproj/WebHTTPProtocolHandler.h: Added WebHTTPTransferEncoding enum and
	transferEncodingFlags ivar to the class.
        * ProtocolHandlers.subproj/WebHTTPProtocolHandler.m:
        (-[WebHTTPProtocolHandler populateResponseWithProtocolMetadata:]): Do a "sanity" check on
	the value of transferEncodingFlags. If the encoding is not "identity" discard content length
	header value.
        (-[WebHTTPProtocolHandler determineTransferEncoding]): Added.
        * ProtocolHandlers.subproj/WebSimpleHTTPProtocolHandler.h: Quite a bit of rearranging and
	additions in order to handle new functionality. Moved the whole method interface into
	the .m file. None of that was public in any way.
        * ProtocolHandlers.subproj/WebSimpleHTTPProtocolHandler.m:
        (-[WebHTTPPersistentConnection initWithFD:expiry:]): Added.
        (-[WebHTTPPersistentConnection isExpired]): Added.
        (WebSimpleHTTPProtocolHandlerInit): Some name changes and additions in order to handle new functionality.
        (_persistentConnectionSweeper): Added.
        (_signalledHandlersCallback): Name change.
        (_socketWriteCallback): Name change.
        (_socketReadCallback): Name change.
        (-[WebSimpleHTTPProtocolHandler initWithResourceLoad:]): Create the HTTP request string here.
        (-[WebSimpleHTTPProtocolHandler beginLoadInBackgroundWithConditions:]): Now checks to see
	if a persistent connection is available for the destination host/port.
        (-[WebSimpleHTTPProtocolHandler endLoad]): Name change to call _finishedWithFileDescriptor.
        (-[WebSimpleHTTPProtocolHandler cleanUpForRetry]): Rearranged in order to be more legible. Some
	additions to handle new functionality.
        (-[WebSimpleHTTPProtocolHandler dealloc]): Adjusted for name changes.
        (-[WebSimpleHTTPProtocolHandler _createHTTPRequest]): Now uses HTTP/1.1 and
	Connection: keep-alive.	This is what the change is all about. :-)
        (-[WebSimpleHTTPProtocolHandler _extractResponseStatusLineFromBytes:length:]):
        (-[WebSimpleHTTPProtocolHandler _processHTTPResultCode]): Name change.
        (-[WebSimpleHTTPProtocolHandler _performSocketRead]): Name change.
        (-[WebSimpleHTTPProtocolHandler _finishedWithFileDescriptor]): Name change. Now handles keeping
	connections alive if they are eligible.
        (isToken): Added to deal with chunked transfer encoding.
        (skipLWS): Ditto.
        (skipToken): Ditto.
        (skipQuotedString): Ditto.
        (parseChunkedHeader): Ditto.
        (-[WebSimpleHTTPProtocolHandler _processResponseData]): Now handles chunked transfer encoding.
        (-[WebSimpleHTTPProtocolHandler _handleLoadCallback]): Now does more checks to see if a load has 	finished. Additional logic needed here since we do not get a "hard close" when a load is
	done since we are trying to keep the socket open.

git-svn-id: 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 746d11b3
......@@ -45,7 +45,7 @@
MAX_UNSIGNED_LENGTH = 20, // long enough to hold the string representation of a 64-bit unsigned number
// interface WebFileDatabaseOp -------------------------------------------------------------
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment