1

I'm trying to download from a local http server (ip cam).

Via browser it works fine with http://user:pass@192.168.1.5/cgi-bin/snapshot.cgi. I get the image successful.

But then using curl with the command

curl -v -L --digest --negotiate --anyauth --user user:pass "http://192.168.1.5/cgi-bin/snapshot.cgi"

I get this:

*   Trying 192.168.1.5:80...
* TCP_NODELAY set
* Connected to 192.168.1.5 (192.168.1.5) port 80 (#0)
> GET /cgi-bin/snapshot.cgi HTTP/1.1
> Host: 192.168.1.5
> User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:62.0) Gecko/20100101 Firefox/62.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 401 Unauthorized
< Connection: close
< Content-Length: 0
< WWW-Authenticate: Digest realm="Login to XU1I0705675M1", qop="auth", nonce="d9f03251-2779-4c13-8ad5-98105c9e6c5f", opaque=""
<
* Excess found: excess = 2 url = /cgi-bin/snapshot.cgi (zero-length body)
* Closing connection 0
* Issue another request to this URL: 'http://192.168.1.5/cgi-bin/snapshot.cgi'
* Hostname 192.168.1.5 was found in DNS cache
*   Trying 192.168.1.5:80...
* TCP_NODELAY set
* Connected to 192.168.1.5 (192.168.1.5) port 80 (#1)
* Server auth using Digest with user 'admin'
> GET /cgi-bin/snapshot.cgi HTTP/1.1
> Host: 192.168.1.5
> Authorization: Digest username="admin",realm="Login to XU1I0705675M1",nonce="d9f03251-2779-4c13-8ad5-98105c9e6c5f",uri="/cgi-bin/snapshot.cgi",cnonce="8802bd2d1b65ff9477ba713e40547c32",nc=00000001,response="cbd9b8472c864caee51b75f3f53a13d7",qop="auth"
> User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:62.0) Gecko/20100101 Firefox/62.0
> Accept: */*
>
* Received HTTP/0.9 when not allowed

* Closing connection 1
curl: (1) Received HTTP/0.9 when not allowed

How do I get curl to get authorized in this case?

Edit: +version:

curl --version
curl 7.70.0 (x86_64-pc-win32) libcurl/7.70.0 OpenSSL/1.1.1g (Schannel) zlib/1.2.11 brotli/1.0.7 WinIDN libssh2/1.9.0 nghttp2/1.40.0
Release-Date: 2020-04-29
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps mqtt pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: AsynchDNS HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile MultiSSL NTLM SPNEGO SSL SSPI TLS-SRP UnixSockets brotli libz
Azevedo
  • 2,059
  • 6
  • 34
  • 52
  • 1
    does [this answer](https://stackoverflow.com/a/59086309/13338210) help? –  May 17 '20 at 16:37
  • @Madhurjya, I've just updated it and it is compiled with the `nghttp2` version: `curl 7.70.0 (x86_64-pc-win32) libcurl/7.70.0 OpenSSL/1.1.1g (Schannel) zlib/1.2.11 brotli/1.0.7 WinIDN libssh2/1.9.0 nghttp2/1.40.0`. Still the same error. – Azevedo May 17 '20 at 17:04
  • The "multiuse..." message is not an error; it's a red-herring explained at [this answer](https://stackoverflow.com/a/74917358/7859025) – Jaredo Mills Dec 26 '22 at 05:02

1 Answers1

2

You may have to force curl to accept the (unexpected) downgrade with --http0.9.

By the way, from looking at e.g. https://github.com/cloudflare/quiche/issues/248, this might be because the server doesn't completely adhere to the protocol and trips up curl, if I read this issue correctly.

Volker Stolz
  • 7,274
  • 1
  • 32
  • 50