On Dec 14, 2007 3:43 PM, Jean Marie COUPRIE <abies20_at_neuf.fr> wrote:
> > Date: Thu, 13 Dec 2007 21:40:52 +0100 (CET)
> > From: Daniel Stenberg <daniel_at_haxx.se>
> > On Thu, 13 Dec 2007, Jean Marie COUPRIE wrote:
> >> Please add in the Man page of Curl (in big characters) a warning saying
> >> if the application send several messages to answer 1 Curl request, Curl
> >> (and give to the user) only the first one that may be very different
> >> what a browser see.
> > I don't see how that makes any sense. curl fetches the response from the
> > server. A single request gets a single response. I think you're
> > matters, but I can't exactly figure out how.
> > Can you please elaborate?
> Apparently "A single request gets a single response." is false if the
> server use a welcome message : After successful log on, the server send
> a message screen that say approximatively " Welcome userid, you have
> been connected, you will be redirected in a few seconds. If you are not,
> click here" then it send the first application screen. Curl reports only
> the welcome message, the user of a browser sees both.
The "multiple responses" are usually single pages. The first page saying
"welcome, you will be redirected" probably contains one of these:
1) <meta http-equiv="refresh" content="5; URL=xxxxx"
3) a self-submitting form. i.e. there's a form full of hidden variables
in the body, which gets submitted due to:
a) the body tag looks something like "<body
4) some other method of making the browser leap off in another direction.
So, while the user is looking at the welcome page, the browser is counting
down from some number. When it hits zero, the browser then does the
*second* page fetch.
Trust me, this really is how it works, though the above list of redirect
methods is not exhaustive. There's one application in particular that I
have to work with which does 4 redirects between logging in and getting to
the target page, and none of the redirects are handled the same way.
You need to examine the first page you get back and see how it manages the
"redirect magic", then emulate that in your script.
Received on 2007-12-14