tong / hxssl

Haxe→C++/Neko OpenSSL bindings
30 stars 45 forks source link

http:// requests no longer work with hxssl #26

Closed jasononeil closed 10 years ago

jasononeil commented 10 years ago

Hi,

With Ubuntu 12.04, 64 bit:

HTTPS, with lib (works)

-lib hxssl
var h = new haxe.Http("https://google.com/");
h.onData = function(d) trace(d);
h.onError = function(d) trace(d);
h.onStatus = function(d) trace(d);
h.request(false);

HTTP, with lib (fails)

-lib hxssl
var h = new haxe.Http("http://google.com/");
h.onData = function(d) trace(d);
h.onError = function(d) trace(d); // An unknown error has occurred.
h.onStatus = function(d) trace(d);
h.request(false);

HTTP, without lib (works)

var h = new haxe.Http("http://google.com/");
h.onData = function(d) trace(d);
h.onError = function(d) trace(d);
h.onStatus = function(d) trace(d);
h.request(false);

I've tried it both on my development machine and on my VPS (over in Europe somewhere), they have similar OS setups but completely different network/firewall etc, same problem. Any idea where to start debugging, or for a workaround?

I want to make remoting requests from one haxe server to another, which uses haxe.Http. In development I use http, in production I use https.

jasononeil commented 10 years ago

This is compiling to neko, btw.

delahee commented 10 years ago

Argh, used to work here back in the days... you should track the constructor. At the time NC did the final hxssl integration with a #if hxssl so it seems that hxssl cant resolve the http call correctly in your case.

If you can, start debug there.

There are alternatives however, we often use curl or other cmd line to perform exotic network calls, that might do the trick.

Good luck. Le 7 janv. 2014 00:47, "jasononeil" notifications@github.com a écrit :

Hi,

With Ubuntu 12.04, 64 bit:

HTTPS, with lib (works)

-lib hxssl var h = new haxe.Http("https://google.com/"); h.onData = function(d) trace(d); h.onError = function(d) trace(d); h.onStatus = function(d) trace(d); h.request(false);

HTTP, with lib (fails)

-lib hxssl var h = new haxe.Http("http://google.com/"); h.onData = function(d) trace(d); h.onError = function(d) trace(d); // An unknown error has occurred. h.onStatus = function(d) trace(d); h.request(false);

HTTP, without lib (works)

var h = new haxe.Http("http://google.com/"); h.onData = function(d) trace(d); h.onError = function(d) trace(d); h.onStatus = function(d) trace(d); h.request(false);

I've tried it both on my development machine and on my VPS (over in Europe somewhere), they have similar OS setups but completely different network/firewall etc, same problem. Any idea where to start debugging, or for a workaround?

I want to make remoting requests from one haxe server to another, which uses haxe.Http. In development I use http, in production I use https.

— Reply to this email directly or view it on GitHubhttps://github.com/tong/hxssl/issues/26 .

jasononeil commented 10 years ago

Okay good to know...

I was in a rush so I did a very hacky workaround for now (renamed hxssl version to Https.hx and std version to Http80.hx, and then made a new "haxe.Http" which just calls one or the other depending on the address).

Will put it on my todo list to look at later... I am curious if anyone else is experiencing this problem

Jason

On Tue, Jan 7, 2014 at 2:15 PM, David Elahee notifications@github.comwrote:

Argh, used to work here back in the days... you should track the constructor. At the time NC did the final hxssl integration with a #if hxssl so it seems that hxssl cant resolve the http call correctly in your case.

If you can, start debug there.

There are alternatives however, we often use curl or other cmd line to perform exotic network calls, that might do the trick.

Good luck. Le 7 janv. 2014 00:47, "jasononeil" notifications@github.com a écrit :

Hi,

With Ubuntu 12.04, 64 bit:

HTTPS, with lib (works)

-lib hxssl var h = new haxe.Http("https://google.com/"); h.onData = function(d) trace(d); h.onError = function(d) trace(d); h.onStatus = function(d) trace(d); h.request(false);

HTTP, with lib (fails)

-lib hxssl var h = new haxe.Http("http://google.com/"); h.onData = function(d) trace(d); h.onError = function(d) trace(d); // An unknown error has occurred. h.onStatus = function(d) trace(d); h.request(false);

HTTP, without lib (works)

var h = new haxe.Http("http://google.com/"); h.onData = function(d) trace(d); h.onError = function(d) trace(d); h.onStatus = function(d) trace(d); h.request(false);

I've tried it both on my development machine and on my VPS (over in Europe somewhere), they have similar OS setups but completely different network/firewall etc, same problem. Any idea where to start debugging, or for a workaround?

I want to make remoting requests from one haxe server to another, which uses haxe.Http. In development I use http, in production I use https.

— Reply to this email directly or view it on GitHub< https://github.com/tong/hxssl/issues/26> .

— Reply to this email directly or view it on GitHubhttps://github.com/tong/hxssl/issues/26#issuecomment-31715807 .

jasononeil commented 10 years ago

Here is a link to my hacky workaround, in case anyone else is wondering: https://gist.github.com/jasononeil/9378139

RealyUniqueName commented 10 years ago

I'm also experiencing this bug. Jason's solution allows me to workaround this issue, but it's really dirty hack :)

hexonaut commented 10 years ago

Does deleting the hxssl Http class solve the problem?

RealyUniqueName commented 10 years ago

Deleting hxssl Http class gives following error:

/usr/lib/haxe/std/haxe/Http.hx:355: characters 11-32 : Class not found : neko.tls.Socket
ncannasse commented 10 years ago

Given how often HTTPS is needed nowadays, I think it would be necessary to have hxssl be part of the standard hxcpp distrib (ping @gamehaxe), I would add the neko version as well.

ncannasse commented 10 years ago

Pinging @simn as well

ncannasse commented 10 years ago

I actually meant to ping @hughsando :)

hexonaut commented 10 years ago

The Haxe Http class needs to use sys.ssl.Socket instead of neko.tls.Socket to work with cpp. For backwards compatibility maybe an additional cpp conditional could be added. Neko will typedef to correct place.

lexoyo commented 9 years ago

Hello I have this exact same issue as described initially by @jasononeil And this fix seems to have been removed from the Http class Is it me or the problem is back?

lexoyo commented 9 years ago

I am on ubuntu 15.10 with haxe 3.3.0

hexonaut commented 9 years ago

@lexoyo You are referencing my forked repository, not the official Haxe. Make sure you are using the git version of hxssl. The one on haxelib is way out of date.

lexoyo commented 9 years ago

Hi @Blank101 Thank you for your quick answer The git repo has a newer version indeed and it seems to fix my issue, thank you