Closed vnluc closed 4 years ago
I've just experienced the same. Windows 10 with rakudo 2018-10.
The reason for this is that the error message is matched for the "Connection reset by peer" condition, and Windows actually says "An established connection was aborted" in the condition we were testing for.
I guess this would fix it:
diff --git a/lib/HTTP/UserAgent.pm6 b/lib/HTTP/UserAgent.pm6
index c0762f9..dda4ac8 100644
--- a/lib/HTTP/UserAgent.pm6
+++ b/lib/HTTP/UserAgent.pm6
@@ -274,7 +274,7 @@ method get-response(HTTP::Request $request, Connection $conn, Bool :$bin) return
when X::HTTP::NoResponse {
X::HTTP::Internal.new(rc => 500, reason => "server returned no data").throw;
}
- when /'Connection reset by peer'/ {
+ when /'Connection reset by peer' || 'An established connection was aborted'/ {
X::HTTP::Internal.new(rc => 500, reason => "Connection reset by peer").throw;
}
}
But as I can't test on Windows I'm somewhat loathe to just stick it in without it being tested first.
well... not on german windows installations :-(
# Failed test 'right exception type (HTTP::UserAgent::Exception::X::HTTP::Internal)'
# at C:\rakudo\share\perl6\precomp\27817378A664BB5C15126CB10AFCD197C0389145\C7\C712FE6969F786C9380D643DF17E85D06868219E line 1
# Expected: HTTP::UserAgent::Exception::X::HTTP::Internal
# Got: X::AdHoc
# Exception message: Could not receive data from socket: Eine bestehende Verbindung wurde softwaregesteuert
durch den Hostcomputer abgebrochen.
or is this something related but different?
Well it would appear that it is just passing the text from the OS verbatim, and Windows has internationalised error messages for this. I assume also that the Could not receive data from socket
is common to a number of potential error conditions, so it's going to be tricky to match.
I guess the proper fix would be for Perl 6 to throw properly typed exceptions in IO::Socket::INET so we wouldn't have to worry about matching the error text.
This is still failing on Windows. Rakudo 2019.07.1
Any idea why it is failing? Is it something specific to Windows that is not working? Shall we skip this test if we are on Windows?
The reason that it fails is that IO::Socket::INET throws an AdHoc exception for the 'connection reset by peer' case with the text of the OS error as the message, the code that is being tested matches the 'connection reset by peer' to detect this particular error. For most Unix like operating systems this is fine as the message is fairly consistently what is expected, however on Windows the message is different and localised to the locale set in the OS so the exception doesn't match.
I'd go with marking the test as TODO on Windows to be honest. The real fix would be to make IO::Socket::INET throw more specific exceptions which can be tested explicitly.
This is fixed on windows
I think this can be closed, no?
We'll close when we get three or four :+1: on the above comment :-)
@jonathanstowe does my vote count? ;)
Of course :-)
I am using version 2018.05
When I try install command, this is the output of error.
zef install HTTP::UserAgent