cURL / Mailing Lists / curl-library / Single Mail

curl-library

Curl fails to call rewind during digest proxy authentication

From: Spacen Jasset <spacenjasset_at_yahoo.co.uk>
Date: Wed, 12 Dec 2007 17:33:28 +0000

Hello,

We are using curl 7.17.0 and have seemingly discovered a problem:

We try to post 376 bytes to a server, through a squid proxy configured
for digest authentication. We find that curl does not call the ioctl
rewind function (CURLIOCMD_RESTARTREAD) when it re-tries the post with
correct authentication credentials.

This problem may be difficult to reproduce; on some machines it happens
rarely, say 1 in 50, on other machines it will happen constantly. This
has been seen on Linux and OS X platforms.

We can't as yet see where the problem may lie. Please see the log output
below (with comments)

When our rewind function is called, "proto_input_stream::rewind" is seen
in the log output; Similarly "proto_input_stream::read" are calls to our
read function

  16:43:14 url '192.168.100.204/Discovery/HTTPsvc/IISXferWanServer.DLL'
proxy 'test:test_at_vm-fruitbat:3128'

  /* Our data of length 376 */
  16:43:14 proto_input_stream::stream_length - 376
  16:43:14 proto_input_stream::rewind

  16:43:14 CURL: About to connect() to proxy vm-fruitbat port 3128 (#0)
  16:43:14 CURL: Trying 192.168.100.106...
  16:43:14 CURL: connected
  16:43:14 CURL: Connected to vm-fruitbat (192.168.100.106) port 3128 (#0)
  16:43:14 CURL: POST
http://192.168.100.204/Discovery/HTTPsvc/IISXferWanServer.DLL HTTP/1.1
  User-Agent: HttpXferwan 10.3.2 (20071123)
  Host: 192.168.100.204
  Pragma: no-cache
  Accept: */*
  Proxy-Connection: Keep-Alive
  Content-Type: application/octet-stream
  Content-Length: 376
  16:43:14 CURL: HTTP 1.0, assume close after body
  16:43:14 CURL: HTTP/1.0 407 Proxy Authentication Required
  16:43:14 CURL: Server: squid/2.6.STABLE14
  16:43:14 CURL: Date: Wed, 12 Dec 2007 16:27:24 GMT
  16:43:14 CURL: Content-Type: text/html
  16:43:14 CURL: Content-Length: 1450
  16:43:14 CURL: Expires: Wed, 12 Dec 2007 16:27:24 GMT
  16:43:14 CURL: X-Squid-Error: ERR_CACHE_ACCESS_DENIED 0
  16:43:14 CURL: Proxy-Authenticate: Digest realm="DIGEST",
nonce="7AtgR1grWQiRspYH", qop="auth", stale=false
  16:43:14 CURL: X-Cache: MISS from vm-fruitbat.centennial.co.uk
  16:43:14 CURL: X-Cache-Lookup: NONE from
vm-fruitbat.centennial.co.uk:3128
  16:43:14 CURL: Via: 1.0 vm-fruitbat.centennial.co.uk:3128
(squid/2.6.STABLE14)
  16:43:14 CURL: Proxy-Connection: close
  16:43:14 CURL:

  <..html error message...

  /* Our "stream" is read here. Note that there is no rewind called afer
these reads. */
  16:43:14 proto_input_stream::read requested 16384 bytes
  16:43:14 proto_input_stream::read satisfied 376 bytes
  16:43:14 proto_input_stream::read requested 16384 bytes
  16:43:14 proto_input_stream::read satisfied 0 bytes

  16:43:14 CURL: Closing connection #0
  16:43:14 CURL: Issue another request to this URL:
'http://192.168.100.204/Discovery/HTTPsvc/IISXferWanServer.DLL'
  16:43:14 CURL: About to connect() to proxy vm-fruitbat port 3128 (#0)
  16:43:14 CURL: Trying 192.168.100.106...
  16:43:14 CURL: connected
  16:43:15 CURL: Connected to vm-fruitbat (192.168.100.106) port 3128 (#0)
  16:43:15 CURL: Proxy auth using Digest with user 'test'
  16:43:15 CURL: POST
http://192.168.100.204/Discovery/HTTPsvc/IISXferWanServer.DLL HTTP/1.1
  Proxy-Authorization: Digest username="test", realm="DIGEST",
nonce="7AtgR1grWQiRspYH", uri="/Discovery/HTTPsvc/IISXferWanServer.DLL",
cnonce="MTE5NzQ3", nc=00000001, qop="auth",
response="3b848ddfa0b8761bc5a79e03f32a4da9"
  User-Agent: HttpXferwan 10.3.2 (20071123)
  Host: 192.168.100.204
  Pragma: no-cache
  Accept: */*
  Proxy-Connection: Keep-Alive
  Content-Type: application/octet-stream
  Content-Length: 376

  /* Another read. Since no rewind has taken place it cannot be fulfilled */

  16:43:15 proto_input_stream::read requested 16384 bytes
  16:43:15 proto_input_stream::read satisfied 0 bytes
  16:45:16 CURL: Operation too slow. Less than 1 bytes/sec transfered
the last 120 seconds
  16:45:16 CURL: Closing connection #0
  16:45:16 CURL: Timeout was reached
  16:45:16 CURL INFO: Version 'libcurl/7.17.0 06/12/2007 patch level 2
OpenSSL/0.9.7l'
  16:45:16 CURL INFO: CURLINFO_EFFECTIVE_URL
http://192.168.100.204/Discovery/HTTPsvc/IISXferWanServer.DLL
  16:45:16 CURL INFO: CURLINFO_RESPONSE_CODE 407
  16:45:16 CURL INFO: CURLINFO_TOTAL_TIME 121.405
  16:45:16 CURL INFO: CURLINFO_NAMELOOKUP_TIME 0.000218
  16:45:16 CURL INFO: CURLINFO_CONNECT_TIME 0.043462
  16:45:16 CURL INFO: CURLINFO_STARTTRANSFER_TIME 0.140539
  16:45:16 CURL INFO: CURLINFO_REDIRECT_TIME 0.204195
  16:45:16 CURL INFO: CURLINFO_SIZE_UPLOAD 0
  16:45:16 CURL INFO: CURLINFO_SIZE_DOWNLOAD 0
  16:45:16 CURL INFO: CURLINFO_SPEED_DOWNLOAD 0 B/s
  16:45:16 CURL INFO: CURLINFO_SPEED_UPLOAD 0 B/s
  16:45:16 CURL INFO: CURLINFO_CONTENT_TYPE text/html
  16:45:16 CURL INFO: CURLINFO_PROXYAUTH_AVAIL 0x2 (DIGEST)
  16:45:16 CURL INFO: CURLINFO_NUM_CONNECTS 2
  16:45:16 CURL: transaction result status 28 (Timeout was reached)
Received on 2007-12-12