6

How can I make an HTTPS request from Squeak or Pharo? HTTPClient and friends seem to lack any facilities for SSL.

Benjamin Pollack
  • 27,594
  • 16
  • 81
  • 105

6 Answers6

6

You can use SqueakSSL easily through WebClient like so:

WebClient httpGet: 'https://www.google.com/search?q=squeak'.

There may be a problem with certificates, in which case you will have to catch and ignore the errors (see here).

Also, keep your eye on the Zinc http framework, which will be Pharo's new default soon. It doesn't seem to have ssl yet, but it's being rapidly developed.

Sean DeNigris
  • 6,306
  • 1
  • 31
  • 37
5

Zodiac as mentioned above will enable you to make HTTPS requests from Zinc.

Enable it like this (recipe from the Pharo forum):

First download the SqueakSSL plugin and put it in your Pharo directory, and then load the necessary packages:

"Load Zinc HTTP Components"
Gofer it 
  squeaksource: 'ZincHTTPComponents'; 
  package: 'Zinc-HTTP'; 
  package: 'Zinc-Tests'; 
  package: 'Zinc-Patch-HTTPSocket'; 
  load. 

"Load Zodiac including extras"
Gofer it 
  squeaksource: 'Zodiac'; 
  package: 'Zodiac-Core'; 
  package: 'Zodiac-Tests'; 
  load. 

"Load extra Zinc support for Zodiac"
Gofer it 
  squeaksource: 'ZincHTTPComponents'; 
  package: 'Zinc-Zodiac'; 
  load. 

"Switch to the Zn Zodiac socket factory" 
ZnNetworkingUtils default: ZnZodiacNetworkingUtils new. 

And you should be able to make requests against HTTPS resources.

martineg
  • 1,269
  • 13
  • 14
1

There was a bit of discussion on the mailing list. In short:

SqueakSSL is supposed to do the job, but may need some fixing. It can be invoked through WebClient, as Sean Denigris noted:

WebClient httpGet: 'https://www.google.com/search?q=squeak'.

And, from the mailing list:

If you know whom you want to connect to, then you can use stunnel.

nes1983
  • 15,209
  • 4
  • 44
  • 64
  • Mmm interesting... wonder if stunnel supports wildcards... I think not. I think I need the native SSL connection from Pharo for when the SSL client connection is to a gateway with subdomains. Like when points to some account named in the subdomain of the url. Have to try that WebClient to https – Sebastian Sastre Sep 27 '11 at 11:50
0

In recent Pharo images the support is much better since Zinc and Zodiac are integrated. Just evaluate

ZnEasy get: 'https://www.google.com'

for example.

A detailed docu can be found here:

http://www.pharo-project.org/news?dialog=documentation-for-zinc-http

For HTTPS client, Secure POP client, Secure SMTP client read

http://zdc.stfx.eu/zodiac-paper.html

Torsten
  • 61
  • 1
0

In a production environment we just use Lighttpd (or Apache) to translate from http to https

Stephan Eggermont
  • 15,847
  • 1
  • 38
  • 65
  • 1
    I'm not looking to *serve* HTTPS; in that case, I'd absolutely just stick an SSL terminator in front. I'm looking to *consume* it in a client application. – Benjamin Pollack Dec 19 '10 at 14:38
  • Have in mind that you should be able to do https -> http too. See here [link](http://serverfault.com/questions/227057/revers-proxy-http-https) – Sebastian Sastre Sep 27 '11 at 11:41
0

You might want to use stunnel.

Why?

To outsource completely the CPU intensive encryption/decryption tasks to a native library and free the VM of that stress at all.

In the other hand, you might want to keep an eye on Zodiac that started by this initiative

Sebastian Sastre
  • 2,034
  • 20
  • 21