Re: I cannot log on !
Date: Fri, 14 Dec 2007 23:04:09 +0100 (CET)
On Fri, 14 Dec 2007, Jean Marie COUPRIE wrote:
>> 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 confusing
>> 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.
If the browser gets two responses, it is because it made two requests. To me
it sounds exactly like a redirect that the browser followed but libcurl
didn't. Either you didn't tell libcurl to do that or the redirect was made in
> There are 2 methods to use an application on a server :
They're the same method in my view. A client sends HTTP messages to the
server, and it gets and acts on the responses it gets. The client can be a
browser or curl or other http-tools.
> The user assumes that the contents of files in 1) and 2) are similar. This
> may be completely wrong : in the present example of log on 2) gives 70 octets
> and 1) gives 20 ko. ..
Sure the server can differentiate the responses based on what browser/client
that (the server believes) communicates with it, but with tools such as
libcurl you can impersonate browsers pretty accurately and thus fool the
servers to return the exact same response to libcurl as it does to your
Your quoted big diff is probably due to the redirect problem from above.
> I wish that the man page warn against this false assumption and emphasize
> this difference of behavior.
First, those differences are not because of curl vs browsers, they're actually
more of the exception than the rule and then we have documented how to script
things with HTTP already:
Where and how exactly do you suggest we'd mention this in the man page?
>> (and libcurl stuff is better taken to the curl-library mailing list...)
> What is your advice ? Copy this in a post to curl-library mailing list ?
I suggest you simply do your next follow-up on this subject on that list
instead of this.
> I have found in the RexxCurl manual "CURLSETOPT(handle, option,option
> value[,more option values,...])
> This function is called to define all the parameters and data required to
> carry out the particular request."
Oh, a bit unusual to have one function that can set many at once, but that
doesn't change much in regard to this behavior.
> So I have assumed that the parameters were valid only for the present
> (particular) request and that they disappeared before the next request...
They're valid for the present handle, the handle it sets the options for. And
they're valid in that handle until you change them.
> And I have written a routine that reenters each time the common options. It
> seem that it is not needed but does not cause problem. Easy-curl text is not
In what regard? The curl_easy_setopt() function says very early:
Options set with this function call are valid for all forthcoming transfers
performed using this handle. The options are not in any way reset between
transfers, so if you want subsequent transfers with different options, you
must change them between the transfers.
In what way is this not clear? If you think it is, how would you instead
suggest we phrase that paragraph?
> Where can I find a list of default options ? It is not obvious in the
> easy-curl list of man pages...
Basically, all options should mention what the default for that particular
switch is. There's no default options, as all options are just options and you
can alter none, one, 148 or somewhere in between. It depends on what you want.
Oh, there's one single option that is mandatory and that's CURLOPT_URL to tell
libcurl what to operate on.
-- Commercial curl and libcurl Technical Support: http://haxx.se/curl.htmlReceived on 2007-12-14