joshua655 / v8cgi

Automatically exported from code.google.com/p/v8cgi
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

http client throws "Error: The operation completed successfully" #116

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. run a script that uses the http module to request https://www.google.com/
2. ( example at: https://dl.dropbox.com/u/341900/http-sample.js )
3. notice the error (thrown by the line that opens the socket)

What is the expected output? What do you see instead?
I'd expect to see some html output to the console

What version of the product are you using? On what operating system?
tried with latest version 0.9.3 on Windows XP 32-bit

Please provide any additional information below.
This seems to only be with some sites. Particularly Google sites, with or 
without SSL. For an example without SSL, try http://code.google.com/p/v8cgi/ 
which will result in the same error.

Original issue reported on code.google.com by simon.st...@gmail.com on 11 Jun 2012 at 2:45

GoogleCodeExporter commented 9 years ago
Probably caused by IPv6.

1) Does your windows box support IPv6 ?

2) What is the result of "Socket.getAddrInfo('www.google.com', 
Socket.PF_INET6)" ?

3) Does the HTTP client work, if you force IPv4? You can try that by adding 
"throw 1;" at the end of the line 305 in lib/http.js

Original comment by ondrej.zara on 11 Jun 2012 at 5:36

GoogleCodeExporter commented 9 years ago
My Windows box doesn't support IPv6. As far as I know, Windows did not
support this until Vista, and I am on XP.

The result of `Socket.getAddrInfo('www.google.com', Socket.PF_INET6)` is an
empty string, with no exception thrown. Adding `throw 1` after line 305
didn't help, it still throws the same error..

Let me know if you'd like me to try this on Windows 7 or Mac OS.

Original comment by simon.st...@gmail.com on 11 Jun 2012 at 12:29

GoogleCodeExporter commented 9 years ago
I managed to reproduce the bug (WinXP), so there is no need to try on Win7.

(Note: it is possible to add IPv6 support to XP; just install it as a new 
protocol in Network Connections)

The question is, what should be the correct behavior of getAddrInfo. Target 
hostname (www.google.com) HAS a valid AAAA (IPv6) record, so getAddrInfo should 
probably not fail. On the other hand, Windows is unable to successfully resolve 
this record, rendering the getAddrInfo call useless.

What is your opinion?

Original comment by ondrej.zara on 11 Jun 2012 at 12:45

GoogleCodeExporter commented 9 years ago
The current behaviour of returning an empty string my be fine. In that case
we would just need to adjust the logic in http.js to account for this case.
I'll have a play with it and see what I come up with. I assume we need to
keep the try/catch for cases where it might throw (not sure what this would
be).

Original comment by simon.st...@gmail.com on 11 Jun 2012 at 7:00

GoogleCodeExporter commented 9 years ago
Yes, the try-catch must remain there. getAddrInfo throws when the DNS record 
was not found; when the DNS server is not available; when any other kind of 
network problems occurs...

Original comment by ondrej.zara on 11 Jun 2012 at 8:57

GoogleCodeExporter commented 9 years ago

Original comment by ondrej.zara on 16 Jul 2012 at 8:27

GoogleCodeExporter commented 9 years ago
http://code.google.com/p/teajs/issues/detail?id=5

Original comment by ondrej.zara on 20 Jul 2012 at 7:49

GoogleCodeExporter commented 9 years ago
Fixed in http://code.google.com/p/teajs/issues/detail?id=5.

v8cgi is now known as TeaJS, please update your bookmarks accordingly :-)

Original comment by ondrej.zara on 30 Jul 2012 at 7:49