mirror of
https://github.com/roytam1/mozilla45esr.git
synced 2026-05-26 15:39:48 +00:00
6eca2ddf0a
- #493: image max-width M823483 M1247929 (1e8048f6f) - closes #493: fix height for flexbox case M1030952 M1180107 (3d108a56a) (with fix for msvc) - closes #484: wallpaper unrenderable icons getting into Cocoa menus (35862d42c) - revert UA fx60 change, add as new agent, add IE11 (3698c7959) - #469: a few more hosts for adblock (a2c8faf0b) - #491: M1443891 M1444231 M1443092 M1448774 M1452416 (9661a95c2) - #491: update certs and pins (8aaf95173) - #491: backout M1452416 for bustage, we'll think of another way to implement this (f6c7b6f4a) - fix for x86 by Ken/MacPorts (cadf0e4e0) - #497: improve DOM KeyboardEvent support (5eacbf2ea) - #483: okay, let's try tuning Purple again now that 485 is fixed (aabc8bc25) - #469: more adblock entries (29b022d4d) - #399: tune up HTTP cache M1248003 M1248389 (f5d414283) - #491: new fix for M1452416 (3f1408e19) - #491: M1393367 M1452202 (c4a05454d) - #491: update certs and pins (3642b952f) - #491: M1452075 (cb09bc27d) - #469: and a couple more (efceaf1c0) - #491: M1449548 (adapted for 45) (05c79ddd2) - #491: update certs and pins (again) (619952aa4) - #499: same-site cookie support (64dc7e7f8)
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>