Skip to content
This repository has been archived by the owner on Sep 20, 2021. It is now read-only.

Set header buffer size #73

Open
Pierozi opened this issue Aug 12, 2016 · 9 comments
Open

Set header buffer size #73

Pierozi opened this issue Aug 12, 2016 · 9 comments

Comments

@Pierozi
Copy link
Member

Pierozi commented Aug 12, 2016

Refer to issue #72

Today the library will take arbitrary first 2048 bytes of stream and send them to Http library.
Until we design better interface on Hoa\Http we can still make the buffer size configurable.

Did we implement this parameter with Hoa\Zformat and array as argument of constructor ?

@Hywan
Copy link
Member

Hywan commented Aug 15, 2016

I guess this is better to increase it to 4092. If it fixes the issue in #72, then this is good enough, and then we will address this issue in Hoa\Http. This is the cleaner solution. Thoughts?

@Pierozi
Copy link
Member Author

Pierozi commented Aug 15, 2016

I don't know, @hhxsv5 use cookie encrypted, that depend of the encryption use.
2048 seems to me already big, even with huge Authorization token.
Can we have consequences if we increase the value ? apart from memory footprint on variable.

@hhxsv5
Copy link

hhxsv5 commented Aug 16, 2016

I think it's better to read stream until we get header "sec-websocket-key" or eof.

other websocket projects:
https://github.com/Textalk/websocket-php/blob/master/lib/Server.php#L76
https://github.com/vakata/websocket/blob/master/src/Base.php#L96

@Pierozi
Copy link
Member Author

Pierozi commented Sep 14, 2016

Hi @hhxsv5, the question was not how parse the header, but have enough data.
In your example, they dump the entries content of stream into local variable $request.

In our case, it is Hoa\Http responsible to parse header.
But library do not accept yet stream as argument.

It is not acceptable for us to dump entire stream content, because it's a stream... we only want here extract header part.

There as two option :

  1. Increase value to 4096 or 8192 for sure to cover your long key.
  2. Wait until we refactor Hoa\Http with PSR-7

@mmowbray
Copy link

Can we increase it to the maximum TCP frame size? 4096 is way too low for my needs. Thanks!

@Hywan
Copy link
Member

Hywan commented Mar 24, 2017

I think we should really revamp the Hoa\Http library. However, a temporary non-breaking patch would be to increase it to 4096.

@Pierozi Could you just increase the size to 4096 in #74, without the addition of new methods. Thanks!

@Pierozi
Copy link
Member Author

Pierozi commented Mar 31, 2017

@Hywan Ok I will do that, I also think it's for the best at this time.

@zsp00
Copy link

zsp00 commented Mar 18, 2019

what ??? Not fixed yet... wasted hours looking for problems

@hhxsv5
Copy link

hhxsv5 commented Mar 18, 2019

@zhusipu Finally, I built the WebSocket server with Swoole.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

5 participants