hoaproject / Http

The Hoa\Http library.
https://hoa-project.net/
10 stars 9 forks source link

Undefined offset: 1 when parse garbage HTTP header #29

Open vmanyushin opened 6 years ago

vmanyushin commented 6 years ago

When HTTP header is not valid, this line https://github.com/hoaproject/Http/blob/6d3e114b48a63cf6b9532f9e9607cebade6314ef/Http.php#L139 produce Undefined offset: 1

Can you add something like this

if(stripos($header, ':')) {
    list($name, $value)                = explode(':', $header, 2);
    $this->_headers[strtolower($name)] = trim($value);
}
--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/52968018-undefined-offset-1-when-parse-garbage-http-header?utm_campaign=plugin&utm_content=tracker%2F2455535&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F2455535&utm_medium=issues&utm_source=github).
Hywan commented 6 years ago

Thanks for the reporting!

Are you in the mood of creating a PR? If no, maybe some @hoaproject/hoackers can take this one :-)?