cURL / Mailing Lists / curl-library / Single Mail

curl-library

Proxy authentication NTLM

From: Sasikala Raju <sasikalaraju_at_commvault.com>
Date: Thu, 23 Jun 2016 05:55:32 +0000

Hello,

We are trying to connect to the server via HTTP proxy which expects authentication type as NTLM. Curl trace also confirms that proxy authentication type is NTLM.
By default our application not sets any proxy authentication type (so default should be Basic ) . And using below API to set the proxy details.

CURLOPT_PROXYTYPE as HTTP
CURLOPT_PROXY as proxyserver:port
CURLOPT_PROXYUSERPWD as proxyuser:password

As expected we are not able to successfully connect via proxy and curl trace is as below. (407 error)
To fix this I believe we need to set CURLOPT_PROXYAUTH as CURLAUTH_ANY.
If proxy does not require authentication(if proxy does not require user name and password) we should not set CURLOPT_PROXYUSERPWD.

Is this is the correct way to accomplish?

Curl trace:

== cURL Info: About to connect() to proxy myproxy.mycompany.com port 80 (#0)
== cURL Info: Trying xx.xx.xx.xx...
== cURL Info: connected
== cURL Info: Connected to myproxy.mycompany.com (xx.xx.xx.xx) port 80 (#0)
== cURL Info: Establish HTTP proxy tunnel to xx.xx.com:443
== cURL Info: Proxy auth using Basic with user ''
== cURL Info: Server auth using Basic with user ''
=> Send header, 134 bytes (0x86)
0000: CONNECT xx.xx.com:443 HTTP/1.1
0028: Host: xx.xx.com:443
0045: Proxy-Authorization:XXXXXXXXXX
0066: Proxy-Connection: Keep-Alive
0084:
<= Recv header, 44 bytes (0x2c)
0000: HTTP/1.1 407 Proxy Authentication Required
<= Recv header, 19 bytes (0x13)
0000: Mime-Version: 1.0
<= Recv header, 37 bytes (0x25)
0000: Date: Tue, 31 May 2016 14:22:48 GMT
<= Recv header, 65 bytes (0x41)
0000: Via: 1.1xx.xx.xx:80 (Cisco-WSA/8.0.6-119)
<= Recv header, 25 bytes (0x19)
0000: Content-Type: text/html
<= Recv header, 26 bytes (0x1a)
0000: Proxy-Authenticate: NTLM
<= Recv header, 19 bytes (0x13)
0000: Connection: close
<= Recv header, 25 bytes (0x19)
0000: Proxy-Connection: close
<= Recv header, 22 bytes (0x16)
0000: Content-Length: 3535
<= Recv header, 2 bytes (0x2)
0000:
== cURL Info: Ignore 3535 bytes of response-body
== cURL Info: Received HTTP code 407 from proxy after CONNECT

Thanks,
Sasi-

***************************Legal Disclaimer***************************
"This communication may contain confidential and privileged material for the
sole use of the intended recipient. Any unauthorized review, use or distribution
by others is strictly prohibited. If you have received the message by mistake,
please advise the sender by reply email and delete the message. Thank you."
**********************************************************************

-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2016-06-23