From 76e441fb40bb006f32b379f7b2cbc7c8cb15ade8 Mon Sep 17 00:00:00 2001 From: Moritz Lenz Date: Sun, 22 Nov 2015 12:19:10 +0000 Subject: Fix HTTP communication in panda-state.p6 --- tools/build/panda-state.p6 | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'tools/build') 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, :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 { $buf.=subst(:g,/'git://'/,'http://'); } - - given open($to, :w) { - .say: $buf.split(/\r?\n\r?\n/, 2)[1]; - .close; - } + spurt($to, $buf); } -- cgit v1.1