5

I am trying to fetch a file over HTTPS in Io language:

url := URL with("https://api.example.com")
url fetch println

And I get this:

 Error_0x7f97e1509a80:
  location         = "/opt/local/lib/io/addons/Socket/io/URL.io:232"
  message          = "Protocol 'https' unsupported"

I was trying to find something on the net, but, as everybody knows, it's not easy because of the name. I only found this thread http://tech.groups.yahoo.com/group/iolanguage/message/10898 but that's quite old.

How can I get the HTTPS support in Io?

EDIT

I've found that there is a SecureSocket addon, a wrapper over OpenSSL, in Io's source. It wasn't installed when I did sudo port io install on my MacBook with Mountain Lion, though. I tried building it from source, but no luck. It didn't build for me on a Linux machine, either.

EDIT2

I just tried to build Io from source (git clone https://github.com/stevedekorte/io.git) again (using the included script build.sh) and it turned out that cmake did detect OpenSSL:

 -- Found OpenSSL: /usr/lib/libssl.dylib;/usr/lib/libcrypto.dylib  

But then the SecureSocket addon is not built. Its readme file: https://github.com/stevedekorte/io/tree/master/addons/SecureSocket says:

The DTLS1 bindings are not usable unless the patches in this file are applied to OpenSSL 0.9.8e. However, this patch includes a deactivation of the handshake retransmission code in d1_both.c, making it unsuitable for production environments. I take no responsibility, etc, etc. If you want to use it anyway, apply the patches(gathered from various newsgroups and my own experimentation) and uncomment the commented-out block of build.io. For what it's worth, DTLS support in OpenSSL is new as of 0.9.8 and is pretty buggy to begin with. It's a nice idea, but it doesn't seem to be production ready at all yet. These bindings are no exception.

piokuc
  • 25,594
  • 11
  • 72
  • 102
  • 1
    Which part of this has anything to do with `c`? – autistic Apr 25 '13 at 15:32
  • The whole Io interpreter is written in C, including the SSL bindings module, which doesn't build currently. – piokuc Apr 25 '13 at 15:49
  • 1
    A lot of things are written in C. Is it correct to ask how to open a word document here, because Microsoft Word is written in C? No. *"I tried building it from source, but no luck. It didn't build for me on a Linux machine, either."* Be specific, or we won't help you. In fact, we *can't* help you if you won't be specific. What are the errors that occur when you try to build? Did you read the `INSTALL` file, or any readme files that might have come with the source code? Have you posted to a bug tracker? Now armed with these questions, please update your own question... – autistic Apr 25 '13 at 15:58
  • @undefinedbehaviour OK, thank you for the arsenal you have armed me with. I will update the question when I get back home. After I asked the question I subsequently discovered that there are SSL bindings in Io's source code, which don't build cause cmake cannot detect SSL and that forcing cmake to build the bindings results in warnings about calls to some deprecated SSL APIs plus some compilation errors. As I said, will update the question with the detailed list of those error messages soon. – piokuc Apr 25 '13 at 16:18
  • The caution about DTLS1 is not relevant unless you specifically want to use [Datagram TLS](http://en.wikipedia.org/wiki/Datagram_Transport_Layer_Security), which is irrelevant to HTTPS. (edit proposed to remove it.) – poolie Apr 26 '13 at 04:15

2 Answers2

2

If you can't get io to do it your best option would be calling an external tool like wget or curl which can and then loading the file/result locally or returning it via a pipe.

SpliFF
  • 38,186
  • 16
  • 91
  • 120
0

For anybody else interested in another workaround, it should be possible to put stud in front of an Io program which will do the SSL stuff. I have not tested that myself yet.

stud - The Scalable TLS Unwrapping Daemon stud is a network proxy that terminates TLS/SSL connections and forwards the unencrypted traffic to some backend. It's designed to handle 10s of thousands of connections efficiently on multicore machines.

piokuc
  • 25,594
  • 11
  • 72
  • 102