From: C.DeRykus on
On Feb 23, 1:51 pm, cerr <ron.egg...(a)gmail.com> wrote:
> On Feb 23, 9:25 am, Ben Morrow <b...(a)morrow.me.uk> wrote:
>
>
>
> > Quoth cerr <ron.egg...(a)gmail.com>:
>
> > > On Feb 22, 5:01 pm, Ben Morrow <b...(a)morrow.me.uk> wrote:
>
> > > > No, that's not right. I'm going to guess you used
>
> > > >     warn "headers: $res->headers->as_string";
>
> > > > or something equivalent; that won't work since method calls aren't
> > > > interpolated. Try
>
> > > >     warn "headers: " . $res->headers->as_string;
>
> > > Oh Yeah, that looks different:
> > > headers: Connection:
> > > close
> > > Date: Wed, 04 Jan 2006 21:19:34
> > > GMT
> > > Server:
> > > Apache
> > > Content-Type: text/html; charset=ISO-8859-1
> > > Client-Date: Tue, 23 Feb 2010 16:26:55 GMT
> > > Client-Peer: 192.168.167.166:443
> > > Client-Response-Num: 1
> > > Client-SSL-Cert-Issuer: /C=US/ST=California/L=Sunnyvale/O=Tropos
> > > Networks/OU=Manufacturing/CN=Tropos Router/
> > > emailAddress=supp...(a)tropos.com
> > > Client-SSL-Cert-Subject: /C=US/ST=California/L=Sunnyvale/O=Tropos
> > > Networks/OU=Manufacturing/CN=Tropos Router/
> > > emailAddress=supp...(a)tropos.com
> > > Client-SSL-Cipher: EDH-RSA-DES-CBC3-SHA
> > > Client-SSL-Warning: Peer certificate not verified
> > > Client-Transfer-Encoding: chunked
> > > Link: <mailto:peter.sugiarto%40troposnetworks.com>; rev="made"
> > > Title: Configuration Utility: INDOOR ROUTER
> > > res->message: 200->code
>
> > > But this doesn't really tell me anything either, does it?
>
> > It says the the server is *not* returning the configuration file at all,
> > but it sending back the same HTML form you started with.
>
> > I'm going to take a wild guess and suggest that maybe the server
> > requires you to accept cookies properly. Try using WWW::Mechanize (with
> > a properly-configured cookie store) to run through the whole
> > login/download process.
>
> > > > What sort of 'filename' are you expecting?
>
> > > Well I expected to see the filename that the browser would be
> > > downloanding, that would be 'tropos.cfg'.
>
> > OK. If you install the LiveHTTPHeaders FF extension, you should see that
> > when you perform a successful download the server sends a
> > Content-Disposition header. HTTP::Response->filename will pick this up,
> > if it's there.
>
> Ah, hold on, with this extension I figured out that the correct post
> string is:'export_profile=Current+Profile&save=Export' and with that i
> see binary data coming back in $res->content - now i just wrote this
> in a binary file and it seems to work.
>

off-topic but IMO the server should have returned a 400 'Bad Request'
if there's a missing query parameter. Even though covering a wide
range of possible error conditions, there's a clear signal that
the server encountered a problem.

--
Charles DeRykus