[squeak-dev] SSLSocket and basic http auth (api.del.icio.us or mail.google.com or ...)

Pierre-Edouard PORTIER pierre-edouard.portier at insa-lyon.fr
Fri Feb 20 12:57:35 UTC 2009


Hi!
I try to connect to SSL + Basic HTTP Auth sites, for example :
https://mail.google.com or https://api.del.icio.us
When I try :

| conn |
conn := SSLSocket newConnectionAddress: (NetNameResolver addressForName: '
mail.google.com') port: 443

I obtain a socket with state: SSLConnectionClosed.
With sites that do not require HTTP Basic authentication :

| conn |
conn := SSLSocket newConnectionAddress: (NetNameResolver addressForName: '
www.usaa.com') port: 443

I obtain a SSLSocket with state: SSLConnectionConnected.
But don't we need an open socket in order to send the request with the
authentication data in the header ?

In fact, inside the HttpsSocket>>httpsGetDocumentFromUrl: url args: args
accept: mimeType request: requestString we find:

sock := HttpsSocket new.
        sock connectTo: serverAddr port: connectToPort.
        (sock waitForConnectionUntil: (Time millisecondClockValue + (10000)
truncated)) ifTrue: [
            sock sendCommand: 'GET ', page, ' HTTP/1.0', String crlf,
                (mimeType ifNotNil: ['ACCEPT: ', mimeType, String crlf]
ifNil: ['']),
                'ACCEPT: text/html', String crlf,    "Always accept plain
text"
                requestString,    "extra user request. Authorization"
                'Host: ', serverName, ':', port printString, String crlf.
etc.etc.
with the possibility to put the authentication header inside the
requestString.

Has someone any idea how to solve this problem?

Thank you.

pep
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20090220/6ed2c3a4/attachment.htm


More information about the Squeak-dev mailing list