cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Strange intermittent problems with libcurl and SQUID

From: Andreas Falco <andreasfalco_at_hotmail.com>
Date: Sat, 29 Nov 2003 11:06:25 -0800

>From: Daniel Stenberg <daniel-curl_at_haxx.se>

Thank you for the replly Daniel!

>Reply-To: curl-library_at_lists.sourceforge.net
>To: curl-library_at_lists.sourceforge.net
>CC: solyom_at_eik.bme.hu
>Subject: Re: Strange intermittent problems with libcurl and SQUID
>Date: Fri, 28 Nov 2003 22:55:14 +0100 (CET)
>
>On Fri, 28 Nov 2003, Andreas Falco wrote:
>
> > I use libcurl.dll with SSL support
>
>What version?
       libcurl.dll - 7.10.3
>
> > When I run SQUID using the maximum debug level I see in the log file
>that
> > the last letter of my password gets corrupted. I could not find an error
>in
> > my code.
>
>Always, no matter what password?

    Independent of username and password combination. And I found now that
not only the last
letter may be corrupted. All passwords tried so far contained only
lowercase lletters of the English alphabet, no spaces, special characters,
not even numbers, so there must have been no URL encoding errors. Someteimes
it works, but most of the time it does not. I have
tried my program ion an other network with the same results.

>Given a fake user+password, can you show us what headers your use of
>libcurl
>makes it send to the proxy (when the proxy thinks there's a missing
>letter)?

I created a new proxy user password combination as an example (and IE works
all the time with these!):

             username:password = hammer:download

Here is the complete debug info my program printed out in verbose debugging
mode for a failed attempt:
----------------------------------------------------------------------------------------------
Proxy name and password: 'hammer:download'
CURL - text:
About to connect() to 169.254.81.100:3128

CURL - text:
Connected to 169.254.81.100 (169.254.81.100) port 3128

CURL - text:
Establish HTTP proxy tunnel to www.opten.hu:443

CURL: sent protocol data:
    0000 43 4F 4E 4E 45 43 54 20 77 77 77 2E 6F 70 74 65 CONNECT.www.opte
    0010 6E 2E 68 75 3A 34 34 33 20 48 54 54 50 2F 31 2E n.hu:443.HTTP/1.
    0020 30 0D 0A 50 72 6F 78 79 2D 61 75 74 68 6F 72 69 0..Proxy-authori
    0030 7A 61 74 69 6F 6E 3A 20 42 61 73 69 63 20 61 47 zation:.Basic.aG
    0040 46 74 62 57 56 79 4F 6D 52 76 64 32 35 73 48 41 FtbWVyOmRvd25sHA
    0050 3D 3D 0D 0A 0D 0A 00 00 00 00 00 00 00 00 00 00 ==..............
CURL: received protocol data:
    0000 48 54 54 50 2F 31 2E 30 20 34 30 37 20 50 72 6F HTTP/1.0.407.Pro
    0010 78 79 20 41 75 74 68 65 6E 74 69 63 61 74 69 6F xy.Authenticatio
    0020 6E 20 52 65 71 75 69 72 65 64 0D 0A 53 65 72 76 n.Required..Serv
CURL: received protocol data:
    0000 53 65 72 76 65 72 3A 20 73 71 75 69 64 2F 32 2E Server:.squid/2.
    0010 35 2E 53 54 41 42 4C 45 31 2D 32 30 30 33 30 31 5.STABLE1-200301
    0020 32 31 0D 0A 4D 69 6D 65 2D 56 65 72 73 69 6F 6E 21..Mime-Version
CURL: received protocol data:
    0000 4D 69 6D 65 2D 56 65 72 73 69 6F 6E 3A 20 31 2E Mime-Version:.1.
    0010 30 0D 0A 44 61 74 65 3A 20 53 61 74 2C 20 32 39 0..Date:.Sat,.29
CURL: received protocol data:
    0000 44 61 74 65 3A 20 53 61 74 2C 20 32 39 20 4E 6F Date:.Sat,.29.No
    0010 76 20 32 30 30 33 20 31 38 3A 32 34 3A 30 31 20 v.2003.18:24:01.
    0020 47 4D 54 0D 0A 43 6F 6E 74 65 6E 74 2D 54 79 70 GMT..Content-Typ
CURL: received protocol data:
    0000 43 6F 6E 74 65 6E 74 2D 54 79 70 65 3A 20 74 65 Content-Type:.te
    0010 78 74 2F 68 74 6D 6C 0D 0A 43 6F 6E 74 65 6E 74 xt/html..Content
CURL: received protocol data:
    0000 43 6F 6E 74 65 6E 74 2D 4C 65 6E 67 74 68 3A 20 Content-Length:.
    0010 31 32 37 32 0D 0A 45 78 70 69 72 65 73 3A 20 53 1272..Expires:.S
CURL: received protocol data:
    0000 45 78 70 69 72 65 73 3A 20 53 61 74 2C 20 32 39 Expires:.Sat,.29
    0010 20 4E 6F 76 20 32 30 30 33 20 31 38 3A 32 34 3A .Nov.2003.18:24:
    0020 30 31 20 47 4D 54 0D 0A 58 2D 53 71 75 69 64 2D 01.GMT..X-Squid-
CURL: received protocol data:
    0000 58 2D 53 71 75 69 64 2D 45 72 72 6F 72 3A 20 45 X-Squid-Error:.E
    0010 52 52 5F 43 41 43 48 45 5F 41 43 43 45 53 53 5F RR_CACHE_ACCESS_
    0020 44 45 4E 49 45 44 20 30 0D 0A 50 72 6F 78 79 2D DENIED.0..Proxy-
CURL: received protocol data:
    0000 50 72 6F 78 79 2D 41 75 74 68 65 6E 74 69 63 61 Proxy-Authentica
    0010 74 65 3A 20 42 61 73 69 63 20 72 65 61 6C 6D 3D te:.Basic.realm=
    0020 22 53 71 75 69 64 20 70 72 6F 78 79 2D 63 61 63 "Squid.proxy-cac
    0030 68 69 6E 67 20 77 65 62 20 73 65 72 76 65 72 22 hing.web.server"
    0040 0D 0A 58 2D 43 61 63 68 65 3A 20 4D 49 53 53 20 ..X-Cache:.MISS.
CURL: received protocol data:
    0000 58 2D 43 61 63 68 65 3A 20 4D 49 53 53 20 66 72 X-Cache:.MISS.fr
    0010 6F 6D 20 64 61 6E 74 65 0D 0A 50 72 6F 78 79 2D om.dante..Proxy-
CURL: received protocol data:
    0000 50 72 6F 78 79 2D 43 6F 6E 6E 65 63 74 69 6F 6E Proxy-Connection
    0010 3A 20 63 6C 6F 73 65 0D 0A 0D 0A 3C 21 44 4F 43 :.close....<!DOC
CURL: received protocol data:
    0000 0D 0A 3C 21 44 4F 43 54 59 50 45 20 48 54 4D 4C ..<!DOCTYPE.HTML
CURL - text:
Proxy requires authorization!

CURL - text:
Closing connection #0
--------------------------------------------------------------------------------------------------
The SQUID error above is sent back after SQUID found the password invalid.
For a successful connection immediately after this failed one:

---------------------------------------------------------------------------------------------------
Proxy name and password: 'hammer:download'
CURL - text:
About to connect() to 169.254.81.100:3128

CURL - text:
Connected to 169.254.81.100 (169.254.81.100) port 3128

CURL - text:
Establish HTTP proxy tunnel to www.opten.hu:443

CURL: sent protocol data:
    0000 43 4F 4E 4E 45 43 54 20 77 77 77 2E 6F 70 74 65 CONNECT.www.opte
    0010 6E 2E 68 75 3A 34 34 33 20 48 54 54 50 2F 31 2E n.hu:443.HTTP/1.
    0020 30 0D 0A 50 72 6F 78 79 2D 61 75 74 68 6F 72 69 0..Proxy-authori
    0030 7A 61 74 69 6F 6E 3A 20 42 61 73 69 63 20 61 47 zation:.Basic.aG
    0040 46 74 62 57 56 79 4F 6D 52 76 64 32 35 73 62 32 FtbWVyOmRvd25sb2
    0050 46 6B 0D 0A 0D 0A 00 00 00 00 00 00 00 00 00 00 Fk..............
CURL: received protocol data:
    0000 48 54 54 50 2F 31 2E 30 20 32 30 30 20 43 6F 6E HTTP/1.0.200.Con
    0010 6E 65 63 74 69 6F 6E 20 65 73 74 61 62 6C 69 73 nection.establis
    0020 68 65 64 0D 0A 0D 0A 00 00 00 00 00 00 00 00 00 hed.............
CURL: received protocol data:
    0000 0D 0A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
CURL - text:
Proxy replied to CONNECT request

CURL - text:
SSL connection using EDH-RSA-DES-CBC3-SHA

CURL - text:
Server certificate:

CURL - text:
         subject: /C=HU/ST=Magyarorszag/L=Budapest/O=Opten Kft/OU=pten -
SA/CN=www.opten.hu/Email=webmaster_at_www.opten.hu

CURL - text:
         start date: 2003-10-10 19:22:27 GMT

CURL - text:
         expire date: 2004-10-09 19:22:27 GMT

CURL - text:
         common name: www.opten.hu (matched)

CURL - text:
         issuer: /C=HU/ST=Magyarorszag/L=Budapest/O=Opten Kft/OU=Opten -
SA/CN=www.opten.hu/Email=webmaster_at_www.opten.hu

CURL -header out:
POST /cgi-bin/lp.cgi HTTP/1.1

Proxy-authorization: Basic aGFtbWVyOmRvd25sb2Fk

Host: www.opten.hu

Pragma: no-cache

Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*

Content-Length: 48

Content-Type: application/x-www-form-urlencoded

CURL: sent protocol data:
    0000 75 73 65 72 3D 69 74 73 6D 65 26 70 77 64 3D 6D user=itsme&pwd=m
    0010 79 6E 61 6D 65 26 66 69 6C 65 3D 65 78 65 75 70 yname&file=exeup
    0020 64 2E 64 61 74 26 64 65 73 74 3D 40 43 46 30 31 d.dat&dest=@CF01
CURL - header in:
HTTP/1.1 200 OK

CURL - header in:
Date: Sat, 29 Nov 2003 18:24:51 GMT

CURL - header in:
Server: Apache-AdvancedExtranetServer/2.0.47 (Mandrake Linux/1.3.91mdk)
mod_ssl/2.0.47 OpenSSL/0.9.7a PHP/4.3.1

CURL - header in:
Content-Length: 27

CURL - header in:
Content-Type: text/html; charset=ISO-8859-1

CURL: received protocol data:
    0000 4E 69 6E 63 73 20 6A 6F 67 6F 73 75 6C 74 73 E1 Nincs.jogosultsß
    0010 67 61 20 62 65 6C E9 70 6E 69 21 00 32 39 20 4E ga.belÚpni!.29.N
CURL - text:
Connection #0 left intact

CURL - text:
Closing connection #0

---------------------------------------------------------------------------------------

The last text in the received protocol data is the reply that the server
www.opten.hu did not let me in
because I faked that username and password. (Of course the username and
password for www.opten.hu differs from my proxy user name and password.)

And this is what I see in the proxy's log (cache.log) for the failed
connection:

2003/11/29 19:08:27| aclCheck: checking password via authenticator
...skipping...
2003/11/29 19:08:27| authenticateStart: 'hammer:downl^\'
2003/11/29 19:08:27| cbdataLock: 0x843ecf0
2003/11/29 19:08:27| cbdataLock: 0x843ef00
2003/11/29 19:08:27| cbdataValid: 0x843ef00
2003/11/29 19:08:27| comm_write: FD 7: sz 16: hndl (nil): data (nil).
2003/11/29 19:08:27| commSetSelect: FD 7 type 2
2003/11/29 19:08:27| commSetSelect: FD 7 type 1
2003/11/29 19:08:27| helperDispatch: Request sent to basicauthenticator #1,
16 b
ytes
2003/11/29 19:08:27| helperSubmit: hammer downl%1c

In this case the last 2 characters were replaced.
I tried different combinations:
For the password 'aaaaaaaa' failed attempts gave 'aaaaa^\' or 'aaaaa%1c'
For 'aaaaa' it was the same: 'aaaaa^\'
For 'aaaa' there were no problems at all. all request was granted.
For 'downloadagain' the cache.log contained 'downloadagain$' maybe this was
too long ?

So its even stranger than I thought.

_________________________________________________________________
Has one of the new viruses infected your computer? Find out with a FREE
online computer virus scan from McAfee. Take the FreeScan now!
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
Received on 2003-11-29