Last active
September 20, 2016 15:25
-
-
Save skaji/664077e99b80bba90a936cd1a54a0910 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl6 | |
use v6; | |
my $conn = await IO::Socket::Async.connect('127.0.0.1', 5000); | |
my $crlf = "\x0d\x0a"; | |
$conn.print("GET / HTTP/1.1$crlf$crlf"); | |
react { | |
whenever $conn.Supply -> $data { | |
say "--->[$data]<---"; | |
} | |
}; | |
=finish | |
# run http server in backgroud | |
$ plackup --no-default-middleware -e 'sub {[200,[],["ok"]]}' & | |
# With 2016.08, IO::Socket::Async reads the response all at once | |
$ ~/env/rakudobrew/moar-2016.08/install/bin/perl6 test.p6 | |
--->[HTTP/1.0 200 OK | |
Date: Tue, 20 Sep 2016 15:15:26 GMT | |
Server: HTTP::Server::PSGI | |
Content-Length: 2 | |
ok]<--- | |
# With 2016.09, IO::Socket::Async does NOT read the response all at once | |
$ ~/env/rakudobrew/moar-2016.09/install/bin/perl6 test.p6 | |
--->[HTTP/1.0 200 OK | |
Date: Tue, 20 Sep 2016 15:16:20 GMT | |
Server: HTTP::Server::PSGI | |
Content-Length: 2 | |
o]<--- | |
--->[k]<--- | |
# With current HEAD, IO::Socket::Async does NOT read the response all at once | |
$ ~/env/rakudobrew/moar-nom/install/bin/perl6 -v | |
This is Rakudo version 2016.09-19-g8be36b1 built on MoarVM version 2016.09 | |
implementing Perl 6.c. | |
$ ~/env/rakudobrew/moar-nom/install/bin/perl6 test.p6 | |
--->[HTTP/1.0 200 OK | |
Date: Tue, 20 Sep 2016 15:17:29 GMT | |
Server: HTTP::Server::PSGI | |
Content-Length: 2 | |
o]<--- | |
--->[k]<--- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment