raku-community-modules / HTTP-Easy

Make HTTP servers (with PSGI support) easily with Raku
Artistic License 2.0
16 stars 19 forks source link

Server stalled #7

Closed drKreso closed 11 years ago

drKreso commented 11 years ago

I am using example form readme in http.pl. It stalls. I am using rakudo 2013.02.01. I think the same problem is manifested in Bailador.

perl6 http.pl [2013-02-28T16:44:41Z] Started HTTP server. [2013-02-28T16:44:42Z] Client connection received. [2013-02-28T16:44:42Z] GET / HTTP/1.1 Host: localhost:8080 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; Inte. l 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

supernovus commented 11 years ago

A bunch of my socket libraries likely need some fairly large modifications since the Parrot IO changes. I'll do some testing shortly to see what is going on, but it's likely using an older API call.

This library is actually one that I've targeted for some larger changes, which will make it more flexible and robust.

drKreso commented 11 years ago

Hi, I poked around a bit.

while $in-headers { my $line = $!connection.get.chomp;

This blocks after reading cookie from header.... Someone mentioned on the IRC it's rakudo issue.

drKreso commented 11 years ago

Ok. I've reverted this commit: https://github.com/rakudo/rakudo/commit/0b5899aefba8facb4feda39716f6be7db1bcc328#src/core/IO/Socket/INET.pm

And then I used in Easy.pm6 at line :93

  $key = $key.encode("binary").decode.uc;

instead of

$key .=uc;

Working like a glow :)

I am unsure of what the real fix would be.

supernovus commented 11 years ago

This is still waiting on a fix of the IO::Socket::INET.get() method which seems to wait indefintely after encountering a blank line. I'm not sure if this bug is in the library itself, or if it is a Parrot bug.