cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Handling multiple redirects to various CGI scripts

From: Ralph Mitchell <ralphmitchell_at_gmail.com>
Date: Sat, 22 Jan 2005 00:11:55 -0600

And another thing to look out for - right now I'm trying to deal with
a server that hands out a self-submitting form... There's a
javascript function called "autosubmit" that calls
document.whatever.submit(), and in the html body it has a form named
"whatever" that contains a couple of hidden input fields. The icing
on that particular cake is the "onLoad=autosubmit();" in the body tag,
so that as soon as the page loads, it executes the function that
submits the form. It does that at least 3 times, and somewhere along
the line I'm missing something, so I don't get to the same place as a
browser...

I'm not normally vindictive, but I hope there's a specially nasty
place reserved in the afterlife for the genius that came up with
*that* particular piece of stupidity... I can see maybe doing the
autosubmit once, but 3 (or more) times?? And that's *after* it
redirects to a 3rd party to handle the login, which then sends me back
to the original server where the autosubmit pages lurk...

Ralph Mitchell

On Fri, 21 Jan 2005 22:08:35 -0600, Ralph Mitchell
<ralphmitchell_at_gmail.com> wrote:
> Second that. You need to check out the page that you get and look for:
>
> o META REFRESH tags that tell a browser to go elsewhere
>
> o javascript that does "location.href=[some new url]"
>
> I had a problem once with a page that assembled a new url in
> javascript based on form entry values, then "magically" transported
> the browser to that page using "location.href=xxxx". In comparison,
> meta refresh tags are child's play... :)
>
> Ralph Mitchell
>
>
> On Fri, 21 Jan 2005 16:46:27 -0500, HART, CHRISTOPHER T
> <christopher.t.hart_at_bankofamerica.com> wrote:
> > It might be that those subsequent redirects are handled through client-side scripting. The -L option only follows redirects that are issued as an HTTP 302 header redirect. If it is a client-side script, usually you can just write your script so that it makes the first request (using the -b and -c options to capture and provide any cookies you pick along the way), then make the subsequent requests using the same cookie file. (cURL won't handle or interpret VB/Java/ECMA-script; it's up to you to implement that manually.)
> >
> > Chris Hart
> >
> > -----Original Message-----
> > From: curl-users-bounces_at_cool.haxx.se
> > [mailto:curl-users-bounces_at_cool.haxx.se]On Behalf Of E. Mark Floyd II
> > Sent: Friday, January 21, 2005 4:30 PM
> > To: curl-users_at_cool.haxx.se
> > Subject: Handling multiple redirects to various CGI scripts
> >
> > I wanted to know how to handle a multiple redirect using Curl, if it is
> > possible (the documentation vaguely says it's possible). Here is the
> > scenario we're trying to solve:
> >
> > "Use curl to script a login. The login is comprised of three parts.
> > The initial curl call to login.cgi, which needs to be followed by
> > subsequent cgi scripts which need to all happen in order to complete the
> > login."
> >
> > I am currently using the -L option to handle unlimited number of
> > redirects, but it always stops after login.cgi, the redirect at the 2nd
> > step doesn't happen.
> >
> > Can someone please help shed some light on implementing this in Curl.
> >
> > Regards,
> >
> > Mark
> >
> > --
> > To be conscious that you are ignorant is a great step to knowledge.
> > Benjamin Disraeli (1804 - 1881), Sybil, 1845
> >
> >
>
Received on 2005-01-22