Question: How does one operate behind a proxy that requires you to login before connecting to the internet ? (Using a proxy that does not require a loginID/password is no problem)
I recently found some german (sorry lost the name of the author) code that gets the name of documents that are pointed to by hyperlinks in the edit box on a swikipage. This code launches some request to the internet, via my proxy.
CodeFragment: titleForUrl: link | doc content start end | doc := HTTPSocket httpGetDocument: link accept: nil. "accept text/html only" (doc isKindOf: String) ifTrue: [^nil]. "error" doc contentType asLowercase = 'text/html' ifFalse: [^nil]. content := doc content. start := content findString: '<title>' startingAt: 1 caseSensitive: false. start = 0 ifTrue: [^nil]. end := content findString: '</title>' startingAt: start + 7 caseSensitive: false. end = 0 ifTrue: [^nil]. ^content copyFrom: start + 7 to: end - 1.
The first line of code causes my proxy to return a '407 Proxy-Authentication needed' message. How to solve ?
** Maybe we (and not some socket) need to create an instance of PWS (thus a request) instead of sending messages to the HTTPSocket. ** When this request works fine (code 200), we could do the same as in the code above. ** When there is some error (code 407), we should return this to the user, let him/her enter his/her credentials, and retry. ** (But is all this possible?)
Anyone with other/better ideas/solutions ?
Greetings.
Frederik Vandendriessche System Engineer,
eElectronic Business Services,
* frederik.vandendriessche@eds.com * ..32/0 2 711 37 83 L ..32/0 2 711 39 47
squeak-dev@lists.squeakfoundation.org