mirror of
https://github.com/roytam1/basilisk55.git
synced 2026-05-26 15:02:46 +00:00
5959ed8aa3
Bug 1430557. r=longsonr, a=lizzard (d2012d4) Bug 1416529. r=mcmanus, a=ritu (6c616d7) Bug 1324042 - Fix trimmedOffsets arithmetic in GetRenderedText(). r=mats, a=RyanVM (0625e66) Bug 1428947 - Check plane width & stride constraints. r=mattwoodrow, a=ritu (af26fd8) Bug 1334465 - Set mIPCClosed to true before calling SendDeleteSelf in order to avoid race. r=bagder, a=ritu (48000c3) Bug 1334465 - Make HttpChannelParent::mIPCClosed atomic. r=bagder, a=ritu (40f3b6c) Bug 1398021 - Update lz4 to version 1.8.0. r=froydnj, a=RyanVM (9324e57) Bug 1388020. r=nical, a=RyanVM (25eb3e4) Bug 1437087 - Call Disconnect on Unlink of cycle collector. r=masayuki, a=RyanVM (439bf2f) Bug 1437507 - Fix JSObject::setFlags to call ensureShape before checking for dictionary mode. r=jandem, a=RyanVM (fd3a371) Bug 1440926 - Use overflow-checking math when computing Big5 max length. r=emk, a=RyanVM (72ee25b) Bug 1440775 - Make fetch API force-cache and only-if-cached use VALIDATE_NEVER instead of LOAD_FROM_CACHE. r=mayhemer, a=RyanVM (322d7d2) Bug 1425520. r=smaug, a=abillings (112a59e) Bug 1437450 - Disable Ion no-clone optimization for regexps if the graph contains try blocks. r=nbp, a=RyanVM (c78bbff)
Darin Fisher
darin@netscape.com
8/8/2001
HTTP DESIGN NOTES
CLASS BREAKDOWN
nsHttpHandler
- implements nsIProtocolHandler
- manages preferences
- owns the authentication cache
- holds references to frequently used services
nsHttpChannel
- implements nsIHttpChannel
- talks to the cache
- initiates http transactions
- processes http response codes
- intercepts progress notifications
nsHttpConnection
- implements nsIStreamListener & nsIStreamProvider
- talks to the socket transport service
- feeds data to its transaction object
- routes progress notifications
nsHttpConnectionInfo
- identifies a connection
nsHttpTransaction
- implements nsIRequest
- encapsulates a http request and response
- parses incoming data
nsHttpChunkedDecoder
- owned by a transaction
- removes chunked decoding
nsHttpRequestHead
- owns a nsHttpHeaderArray
- knows how to fill a request buffer
nsHttpResponseHead
- owns a nsHttpHeaderArray
- knows how to parse response lines
- performs common header manipulations/calculations
nsHttpHeaderArray
- stores http "<header>:<value>" pairs
nsHttpAuthCache
- stores authentication credentials for http auth domains
nsHttpBasicAuth
- implements nsIHttpAuthenticator
- generates BASIC auth credentials from user:pass
ATOMS
nsHttp:: (header namespace)
eg. nsHttp::Content_Length
TRANSACTION MODEL
InitiateTransaction -> ActivateConnection -> AsyncWrite, AsyncRead
The channel creates transactions, and passes them to the handler via
InitiateTransaction along with a nsHttpConnectionInfo object
identifying the requested connection. The handler either dispatches
the transaction immediately or queues it up to be dispatched later,
depending on whether or not the limit on the number of connections
to the requested server has been reached. Once the transaction can
be run, the handler looks for an idle connection or creates a new
connection, and then (re)activates the connection, assigning it the
new transaction.
Once activated the connection ensures that it has a socket transport,
and then calls AsyncWrite and AsyncRead on the socket transport. This
begins the process of talking to the server. To minimize buffering,
socket transport thread-proxying is completely disabled (using the flags
DONT_PROXY_LISTENER | DONT_PROXY_PROVIDER | DONT_PROXY_OBSERVER with
both AsyncWrite and AsyncRead). This means that the nsHttpConnection's
OnStartRequest, OnDataAvailable, OnDataWritable, and OnStopRequest
methods will execute on the socket transport thread.
The transaction defines (non-virtual) OnDataReadable, OnDataWritable, and
OnStopTransaction methods, which the connection calls in response to
its OnDataAvailable, OnDataWritable, and OnStopRequest methods, respectively.
The transaction owns a nsStreamListenerProxy created by the channel, which
it uses to transfer data from the socket thread over to the client's thread.
To mimize buffering, the transaction implements nsIInputStream, and passes
itself to the stream listener proxy's OnDataAvailable. In this way, we
have effectively wedged the response parsing between the socket and the
thread proxy's buffer. When read, the transaction turns around and reads
from the socket using the buffer passed to it. The transaction scans the
buffer for headers, removes them as they are detected, and copies the headers
into its nsHttpResponseHead object. The rest of the data remains in the
buffer, and is proxied over to the client's thread to be handled first by the
http channel and eventually by the client.
There are several other major design factors, including:
- transaction cancelation
- progress notification
- SSL tunneling
- chunked decoding
- thread safety
- premature EOF detection and transaction restarting
- pipelining (not yet implemented)
CACHING
<EOF>