curl / Mailing Lists / curl-users / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: curl cannot authenticate with router using basic http authentication

From: Bruno Dantas via curl-users <curl-users_at_cool.haxx.se>
Date: Thu, 11 Jul 2019 11:04:09 -0400

Right on, Dan! Yes, the combination of adding '-b /dev/null' plus adding the URL a second time did the trick. I had noticed that wget was only succeeding on the second try, but had no idea cookies had something to do with it.

Following your advice, this is the final (successful) command:

$ curl -b /dev/null http://admin:password@192.168.100.1/RouterStat
us.htm http://admin:password@192.168.100.1/RouterStatus.htm

Thank you very much!
-Bruno

On Thu, Jul 11, 2019, at 10:05 AM, Dan Fandrich via curl-users wrote:
> On Thu, Jul 11, 2019 at 03:45:02PM +0200, Aleksandar Lazic via curl-users wrote:
> > Am 11.07.2019 um 13:23 schrieb Bruno Dantas via curl-users:
> > > I have a script that runs in my router every so often to reboot my modem.
> > >
> > > The script works with wget, but I would like to implement it with curl
> > > because this script is the only reason I have wget installed.
> > >
> > > The trouble is that while wget can authenticate with the modem, curl
> > > cannot. Here is the output of the relevant commands:
>
> You don't show the headers sent by wget. Try comparing those with the
> equivalent ones sent by curl and see where the difference lies. I note that
> wget seems to do two round trips whereas curl does only one. wget enables
> cookies by default, so the problem could be a missing cookie rather than bad
> Basic auth. Try giving curl the option -b /dev/null to enable cookie handling,
> and try adding --anyauth or the URL a second time on the command-line to force
> a second round-trip so the server gets the set cookie.
> -----------------------------------------------------------
> Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
> Etiquette: https://curl.haxx.se/mail/etiquette.html
>
-----------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2019-07-11