diff options
author | Moritz Lenz <moritz@faui2k3.org> | 2015-11-22 12:19:10 +0000 |
---|---|---|
committer | Moritz Lenz <moritz@faui2k3.org> | 2015-11-22 12:19:10 +0000 |
commit | 76e441fb40bb006f32b379f7b2cbc7c8cb15ade8 (patch) | |
tree | 7d8d8fd915eb7fe15b1a2b49b446fb5096ba1e91 /tools | |
parent | 5dd02c1ba64955631316fd239683e2de4be970fd (diff) |
Fix HTTP communication in panda-state.p6
Diffstat (limited to 'tools')
-rw-r--r-- | tools/build/panda-state.p6 | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/tools/build/panda-state.p6 b/tools/build/panda-state.p6 index 6ee4a12..0d7dd23 100644 --- a/tools/build/panda-state.p6 +++ b/tools/build/panda-state.p6 @@ -41,16 +41,16 @@ sub fetch-projects-json($to) { else { $s = IO::Socket::INET.new(:host<ecosystem-api.p6c.org>, :port(80)); } - $s.print("GET http://ecosystem-api.p6c.org/projects.json HTTP/1.1\nHost: ecosystem-api.p6c.org\nAccept: */*\nConnection: Close\n\n"); + $s.print("GET http://ecosystem-api.p6c.org/projects.json HTTP/1.1\nHost: ecosystem-api.p6c.org\nAccept: */*\nConnection: Close\n\n"); + # gobble up all header line: + 1 while $s.get; + + # read the body: my ($buf, $g) = ''; - $buf ~= $g while $g = $s.get; + $buf ~= "$g\n" while $g = $s.get; if %*ENV<http_proxy> { $buf.=subst(:g,/'git://'/,'http://'); } - - given open($to, :w) { - .say: $buf.split(/\r?\n\r?\n/, 2)[1]; - .close; - } + spurt($to, $buf); } |