Hovering through authenticated proxy and authenticated http resource

I want to make a post (twitter in this case) using oneliner.

If I do not have a proxy

curl -u user:pass -d status="message" http://twitter.com/statuses/update.xml 

works great.

But when I am behind an authenticated proxy, this is not so.

I tried:

 curl -X proxy:port -U proxyUser:proxyPass -u user:pass -d status="message" http://twitter.com/statuses/update.xml 

So he jumped me with

proxy does not support basic auth

Do you know what I am doing wrong?

early.

+6
rest curl
source share
5 answers

Cababunga's answer is correct, but they do not have another option: --proxy-ntlm . Some proxies will not correctly resolve with --proxy-anyauth , so ideally you want to specify the authentication method used by your proxy server. If you run curl -v -U user:pass -x proxy:port --url http://www.google.com , you should get something in the following lines:

  • About connecting () to the proxy [your proxy] port [your port] (# 0)
  • Attempting [IP] ...
  • connected
  • Connected to the port [your proxy] ([IP]) [your port] (# 0)
  • Install the HTTP proxy tunnel at www.google.com:443
  • Proxy using Basic with user '[user]'
  • CONNECT www.google.com-00-0043 HTTP / 1.1
  • Host: www.google.com-00-0043
  • Proxy Authorization: Basic [gibberish]
  • User-Agent: curl / [ver] ([OS]) libcurl / [ver] OpenSSL / [ver] zlib / [ver]
  • Proxy Connection: Keep-Alive
  • HTTP / 1.1 407 Proxy authentication required
  • Proxy Authentication: NEGOTIATE
  • Proxy Authentication: NTLM

Add a flag for what you see in the Proxy-Authenticate parameter, and you should be good to go. In this example, you would add the --proxy-ntlm .

+14
source

You may be able to specify the username / password in the URL for the authenticated resource to avoid additional complications on the command line.

 http://username: password@twitter.com /statuses/update.xml 

also, the -proxy label is the lowercase letter x, as indicated by cababunga.

 curl -x proxyaddr:port -U proxyUser:proxyPass -u user:pass -d status="message" http://twitter.com/statuses/update.xml 
+4
source

Try adding --proxy-digest or --proxy-anyauth . And I think, to connect to the proxy, you should use the lowercase -x (not -x ).

+2
source

I managed to accomplish this with Miki's answer here:

This is the command I received at the end to access the BitBucket repository:

 curl -u userBitbucket:PwdBitBucket -U userProxy:pwdProxy -x address_proxy:port:proxy --proxy-ntlm http://host:port/projects/project/repos/repo/browse/file 
0
source

You can try using SOCKS v5 instead of v4:

 $ curl --proxy socks5://proxyUser: proxyPass@proxy :port ... 
0
source

All Articles