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: Dan Fandrich via curl-users <>
Date: Thu, 11 Jul 2019 16:04:13 +0200

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.
Received on 2019-07-11