Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

get() stalls when called from HTTP::Easy #107

Closed
wants to merge 1 commit into from

6 participants

@drKreso

I am not sure if this makes any sense at all. I did run the full spec test suite. It did not break any more than usual. IO tests all passed.

This makes HTTP::Easy work as advertised (and consequently Bailador).

@moritz
Owner

I fear this patch takes the wrong approach.

Setting the encoding of the socket is necessary to make sure that multi-byte sequences aren't torn apart. For example in UTF-16LE and BE there can be two-byte sequences starting with 0A, but with your patch the 0A would be wrongly recognized as a newline, and terminate the string returned from .get. Subsequent decoding as UTF-16{LE,BE} would fail. Parrot's readline method supposedly already has code that handles this problem.

Have you found out why the current approach does not work? If it's due to a bug in Parrot, we should report it.

(I might consider applying this patch as a last resort anyway, but I'd rather have a proper fix, if at all possible).

@drKreso

I agree, I thought you might say something like that. I am not sure if it's parrot fault or how to recreate there.

@drKreso

I did further logging - it definitely stops on this line:

   my str $line = $PIO.readline(nqp::unbox_s($!input-line-separator));

Host: localhost:3000
Connection: keep-alive
Cache-Control: max-age=0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.99 Safari/537.22
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
Cookie: remember_user_token=BAhbB1sGaQZJIiIkMmEkMTAkOEFlRHpVbkhlRGMuSEo5TU9nOVNaLgY6BkVU--115f241404a6c3d4bbfdd1a4fed7a1873ea54ae2; remember_korisnik_token=BAhbB1sGaQZJIhlSelY5ODFhenJoOXN5eE5QeGl6WQY6BkVG--b7c4594a3f8eb77d1579789982a20c28fc48e168

Then it tries to readline again - and this is where it stops.

@moritz
Owner

Can you please try the current rakudo code (ie without your patch) with parrot/master? There have been a few fixes to sockets. You can build a rakudo on top of parrot master with

  $ perl Configure.pl --gen-parrot=master && make install

in rakudo's source dir.

@drKreso

I get stuck on bootstraping panda

perl6 bootstrap.pl
==> Bootstrapping Panda
Unable to parse expression in string; couldn't find final \"
in any FAILGOAL at src/stage2/QRegex.nqp:1084
in regex string at /Users/kbojcic/dev/nuke/panda/ext/JSON__Tiny/lib/JSON/Tiny/Grammar.pm:25
in regex pair at /Users/kbojcic/dev/nuke/panda/ext/JSON__Tiny/lib/JSON/Tiny/Grammar.pm:7
in regex pairlist at /Users/kbojcic/dev/nuke/panda/ext/JSON__Tiny/lib/JSON/Tiny/Grammar.pm:6
in regex object at /Users/kbojcic/dev/nuke/panda/ext/JSON__Tiny/lib/JSON/Tiny/Grammar.pm:5
in regex value:sym at /Users/kbojcic/dev/nuke/panda/ext/JSON__Tiny/lib/JSON/Tiny/Grammar.pm:21
in any !protoregex at src/stage2/QRegex.nqp:746
in regex value at /Users/kbojcic/dev/nuke/panda/ext/JSON__Tiny/lib/JSON/Tiny/Grammar.pm:11
in regex arraylist at /Users/kbojcic/dev/nuke/panda/ext/JSON__Tiny/lib/JSON/Tiny/Grammar.pm:9
in regex array at /Users/kbojcic/dev/nuke/panda/ext/JSON__Tiny/lib/JSON/Tiny/Grammar.pm:8
in regex TOP at /Users/kbojcic/dev/nuke/panda/ext/JSON__Tiny/lib/JSON/Tiny/Grammar.pm:4
in method parse at src/gen/CORE.setting:10788
in sub from-json at /Users/kbojcic/dev/nuke/panda/ext/JSON__Tiny/lib/JSON/Tiny.pm:50
in submethod BUILD at /Users/kbojcic/dev/nuke/panda/lib/Panda/Ecosystem.pm:62
in method BUILDALL at src/gen/CORE.setting:759
in method bless at src/gen/CORE.setting:743
in method new at src/gen/CORE.setting:728
in method new at /Users/kbojcic/dev/nuke/panda/lib/Panda.pm:20
in block at bin/panda:108

@FROGGS
Collaborator

drKreso: this got fixed right now, please try again with rakudo HEAD.

@colomon
Collaborator
@drKreso

Ok, panda thing is working.
HTTP::Easy test server - blocks exactly same way

@labster labster added the parrot label
@labster
Collaborator

I'm going to tag this ticket as Parrot specific, because it seems to be related to the readline bugs noted above. And there's not enough information to otherwise reproduce the bug here. Let me know if this affects other VMs.

@lizmat
Collaborator

Since parrot is no longer is a supported VM, I'm closing this pull request.

@lizmat lizmat closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 3 deletions.
  1. +1 −3 src/core/IO/Socket/INET.pm
View
4 src/core/IO/Socket/INET.pm
@@ -92,9 +92,7 @@ my class IO::Socket::INET does IO::Socket {
method get() {
++$!ins;
- my Mu $PIO := nqp::getattr(self, $?CLASS, '$!PIO');
- $PIO.encoding(nqp::unbox_s(PARROT_ENCODING(self.encoding)));
- my str $line = $PIO.readline(nqp::unbox_s($!input-line-separator));
+ my str $line = nqp::getattr(self, $?CLASS, '$!PIO').readline(nqp::unbox_s($!input-line-separator)).encode("binary").decode;
my str $sep = $!input-line-separator;
my int $len = nqp::chars($line);
my int $sep-len = nqp::chars($sep);
Something went wrong with that request. Please try again.