Re: HTTP ping pong
- From: Daniel Pitts <newsgroup.spamfilter@xxxxxxxxxxxxxxxxxxx>
- Date: Tue, 05 May 2009 10:09:30 -0700
Roedy Green wrote:
Over time I have been learning how browsers and servers talk to eachKind of. Generally what happens is the web-browser will fetch external data (images, JS, CSS) a few at a time. Also, HTTP supports reusing a connection, so it may be that your browser opens at most three connections, and reuses them for all the page content.
other.
It seems to work like this:
Your browsers sets a GET or POST.
The server responds with web page.
In the web page are a number of images.
the browser then simultaneously sends some more get requests. I think
each one gets its own socket. data seems to flow back simultaneously
(interleaved packets).
Either way, it is up to the "User Agent" to respect the Location header
Sometimes there is a redirect. I think it is normally up to the
browser to request the next leg and wait for the response. Other
times the server can handle the redirect itself and send something
with a note in the header where the new home is.
You probably will benefit from reading the HTTP RFC's. I'm working offline, or I'd fine the exact number/link for you. Google knows.
There are two flavours of redirect, temporary and permanent. Temporary
ones are used for load balancing, redirecting to a backup server etc.
Permanent ones the server wants to you note, and use the new URL
instead. Temporary redirects will likely soon point nowhere.
One answer: Javascript.
There are a couple of things I have not yet figured out.
1. If I login for example sometimes I see a page on the browser, then
that page is replaced by another page a few seconds like. I did not
touch the keyboard. What happened?
Another answer: The web-browser may decide to continue rendering the old content until the new content is loaded.
I believe there are ways to do this. I've heard the term "continuation" in this regard, but I haven't looked into it myself.
2. Does the sever ever send more than one response to the same
request?
The request is hidden in a regular page. Javascript is often involved.
3. How do popups work. How can a server send you something you did not
request?
The HTTP protocol covers this. In chunked mode, it will tell you that there are more chunks. In non-chunked mode, it will tell you the content-length. Each of those are headers.
4. At the Java HTTP level, does do you know when you have hit the end
of the data? an EOF exception or something else?
If you want to deep-dive, the HTTP RFC is a great resource, and also look at commons-httpclient for a fully Java HTTP client solution.
As you might guess, I am feeling an urge to write a little essay
called HTTP ping pong.
--
Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>
.
- References:
- HTTP ping pong
- From: Roedy Green
- HTTP ping pong
- Prev by Date: Re: java.util.Date() returns the time one hour slow during DTS change
- Next by Date: Re: JSP Related
- Previous by thread: Re: HTTP ping pong
- Next by thread: JSP Related
- Index(es):
Relevant Pages
|