varspool / Wrench

A simple PHP WebSocket implementation for PHP 7.1
Do What The F*ck You Want To Public License
596 stars 210 forks source link

Catch InvalidArgumentException #56

Closed Alarmfifa closed 10 years ago

Alarmfifa commented 10 years ago

Hello guys! I think it could be related with #15 Steps to reproduce this crash:

printf "GET / HTTP/1.0" | nc localhost 8000

At this moment wrench tries to check header: Method validateRequestHandshake uses getRequestHeaders and if there is no "\r\n" in $response it throws InvalidArgumentException:

       if ($eol === false) {
            throw new InvalidArgumentException('Invalid request line');
        }

The main problem is that nobody catches this exception! =(

There are a lot of methods to solve this problem:

If you have other opinion about this problem, just say =)

Alarmfifa commented 10 years ago

I've reverted this commit and made this pull request. I think, that it is more correctly, because I don't know all ideology in this project and could be wrong.

dominics commented 10 years ago

This looks good to me.

Alarmfifa commented 10 years ago

Thank you, Dominic! =)