cURL / Mailing Lists / curl-library / Single Mail

curl-library

POST call via proxy with authentication

From: Matteo Rocco <vanrock.web_at_gmail.com>
Date: Wed, 10 Jan 2007 12:02:47 +0100

I'm carrying out some tests using libcurl to send a post request to a php
script
via proxy with authentication. The response of the request is a single byte
(a number 0, -1, -2 -3 )

libcurl is compiled statically and i test for 3 kind of proxies.

I have this result :-(

with libcurl 7.16.0
1) ISA BASIC --> OK DEBUG, 'FAIL' RELEASE (return all the headers
with the response)
2) SQUID BASIC --> OK DEUB, 'FAIL' RELEASE (return all the
headers with the response)
3) ISA NTLM --> OK

with libcurl CVS HEAD
1) ISA BASIC --> OK
2) SQUID BASIC --> OK
3) ISA NTLM --> FAIL

I have seen some change in transfer.c, is there a bug?

Thank you very much in advance for your help

I remain at your disposal for further information

Matteo

.. logs that might be useful

1) libcurl 7.16 - ISA BASIC
----------------------------------------------
- first call Curl_readwrite
HTTP/1.1 407 Proxy Authentication Required ( The ISA Server requires
authorization to fulfill the request. Access to the Web Proxy service is
denied. )
Via:1.1 ISABASIC
Proxy-Authenticate: Basic realm="isabasic."
Pragma: no-cache
Cache-Control: no-cache
Content-Type: text/html
Content-Length: 2360

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
etc..

- second call Curl_readwrite
HTTP/1.1 200 OK
Via: 1.1 ISABASIC
Connection: close
Proxy-Connection: close
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Date: Wed, 10 Jan 2007 10:02:44 GMT
Content-Type: text/html
Server: Apache/1.3.34 (Unix) PHP/4.4.0 mod_ssl/2.8.25 OpenSSL/0.9.8a
X-Powered-By: PHP/4.4.0
Set-Cookie: PHPSESSID=b22223578a359220fcb8ca912c59d6f3; path=/
Cache-Control: no-store, no-cache, must-revalidate, post-check=0,
pre-check=0
Pragma: no-cache

0
----------------------------------------------
DEBUG OK

RELEASE failed because he returned document (return value 0) along with all
http headers
----------------------------------------------

2) libcurl 7.16 - SQUID BASIC
----------------------------------------------
- first call Curl_readwrite
HTTP/1.0 407 Proxy Authentication Required
Server: squid/2.5.STABLE6
Mime-Version: 1.0
Date: Wed, 10 Jan 2007 10:25:15 GMT
Content-Type: text/html
Content-Length: 1396
Expires: Wed, 10 Jan 2007 10:25:15 GMT
X-Squid-Error: ERR_CACHE_ACCESS_DENIED 0
Proxy-Authenticate: Basic realm="Squid proxy-caching web server"
X-Cache: MISS from MY_PROXY_SERVER
Proxy-Connection: keep-alive

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "
http://www.w3.org/TR/html4/loose.dtd">
etc ...

- second call Curl_readwrite
HTTP/1.0 200 OK
Date: Wed, 10 Jan 2007 10:07:25 GMT
Server: Apache/1.3.34 (Unix) PHP/4.4.0 mod_ssl/2.8.25 OpenSSL/0.9.8a
X-Powered-By: PHP/4.4.0
Set-Cookie: PHPSESSID=ae98c87e12da2334fd72c627c343a82a; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0,
pre-check=0
Pragma: no-cache
Content-Type: text/html
X-Cache: MISS from MY_PROXY_SERVER
Proxy-Connection: close

0
----------------------------------------------
DEBUG OK

RELEASE failed because he returned document (return value 0) along with all
http headers
----------------------------------------------

3) libcurl 7.16 - ISA NTLM
----------------------------------------------
- first call Curl_readwrite
HTTP/1.1 407 Proxy Authentication Required ( The ISA Server requires
authorization to fulfill the request. Access to the Web Proxy service is
denied. )
Via:1.1 ISANTLM
Proxy-Authenticate: NTLM
Proxy-Authenticate: Kerberos
Proxy-Authenticate: Negotiate
Pragma: no-cache
Cache-Control: no-cache
Content-Type: text/html
Content-Length: 2359

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
etc ..

- second call Curl_readwrite
HTTP/1.1 407 Proxy Authentication Required ( Access is denied. )
Via:1.1 ISANTLM
Proxy-Authenticate: NTLM
TlRMTVNTUAACAAAABQAFADgAAAAGgokCldO0/0/Vg0EAAAAAAAAAADYANgA9AAAABQLODgAAAA9JQ09OQQIACgBJAEMATwBOAEEAAQAOAEkAUwBBAE4AVABMAE0AAwAOAGkAcwBhAG4AdABsAG0AAAAAAA==
Pragma: no-cache
Cache-Control: no-cache
Content-Type: text/html
Content-Length: 0

- third call Curl_readwrite
HTTP/1.1 200 OK
Via: 1.1 ISANTLM
Connection: close
Proxy-Connection: close
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Date: Wed, 10 Jan 2007 10:15:46 GMT
Content-Type: text/html
Server: Apache/1.3.34 (Unix) PHP/4.4.0 mod_ssl/2.8.25 OpenSSL/0.9.8a
X-Powered-By: PHP/4.4.0
Set-Cookie: PHPSESSID=486f42374cff684e00a6dd374b4f0fdb; path=/
Cache-Control: no-store, no-cache, must-revalidate, post-check=0,
pre-check=0
Pragma: no-cache

0
----------------------------------------------

4) libcurl CVS HEAD - ISA BASIC
----------------------------------------------
- first call Curl_readwrite
HTTP/1.1 407 Proxy Authentication Required ( The ISA Server requires
authorization to fulfill the request. Access to the Web Proxy service is
denied. )
Via:1.1 ISABASIC
Proxy-Authenticate: Basic realm="isabasic."
Pragma: no-cache
Cache-Control: no-cache
Content-Type: text/html
Content-Length: 2359

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
etc ...

- second call Curl_readwrite
HTTP/1.1 200 OK
Via: 1.1 ISABASIC
Connection: close
Proxy-Connection: close
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Date: Wed, 10 Jan 2007 08:44:53 GMT
Content-Type: text/html
Server: Apache/1.3.34 (Unix) PHP/4.4.0 mod_ssl/2.8.25 OpenSSL/0.9.8a
X-Powered-By: PHP/4.4.0
Set-Cookie: PHPSESSID=086e63e0cf5ae3849675a377a16de6e1; path=/
Cache-Control: no-store, no-cache, must-revalidate, post-check=0,
pre-check=0
Pragma: no-cache

0
----------------------------------------------

5) libcurl CVS HEAD - SQUID BASIC
----------------------------------------------
- first call Curl_readwrite
HTTP/1.0 407 Proxy Authentication Required
Server: squid/2.5.STABLE6
Mime-Version: 1.0
Date: Wed, 10 Jan 2007 09:05:32 GMT
Content-Type: text/html
Content-Length: 1396
Expires: Wed, 10 Jan 2007 09:05:32 GMT
X-Squid-Error: ERR_CACHE_ACCESS_DENIED 0
Proxy-Authenticate: Basic realm="Squid proxy-caching web server"
X-Cache: MISS from MY_PROXY_SERVER
Proxy-Connection: keep-alive

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "
http://www.w3.org/TR/html4/loose.dtd">
etc ...

- second call Curl_readwrite
HTTP/1.0 200 OK
Date: Wed, 10 Jan 2007 08:47:55 GMT
Server: Apache/1.3.34 (Unix) PHP/4.4.0 mod_ssl/2.8.25 OpenSSL/0.9.8a
X-Powered-By: PHP/4.4.0
Set-Cookie: PHPSESSID=d4971d322d8a366ffbb5b64773df6b98; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0,
pre-check=0
Pragma: no-cache
Content-Type: text/html
X-Cache: MISS from MY_PROXY_SERVER
Proxy-Connection: close

0
----------------------------------------------

5) libcurl CVS HEAD - ISA NTLM
----------------------------------------------
- first call Curl_readwrite
HTTP/1.1 407 Proxy Authentication Required ( The ISA Server requires
authorization to fulfill the request. Access to the Web Proxy service is
denied. )
Via:1.1 ISANTLM
Proxy-Authenticate: NTLM
Proxy-Authenticate: Kerberos
Proxy-Authenticate: Negotiate
Pragma: no-cache
Cache-Control: no-cache
Content-Type: text/html
Content-Length: 2359

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
etc ...

- second call Curl_readwrite
    enter in a loop of Curl_readwrite
----------------------------------------------

it doesn't enter if() block (expression below equals false)
    if((k->keepon & KEEP_READ) &&
       ((select_res & CSELECT_IN) || conn->bits.stream_was_rewound)) {

variables have following values:
    k->keepon = 2
    select_res = 0;
    conn->bits.stream_was_rewound 0 ''
----------------------------------------------
Received on 2007-01-10