odnoklassniki / one-nio

Unconventional I/O library for Java
Apache License 2.0
655 stars 97 forks source link

Minor HttpClient improvement. Mutable bufferSize. #46

Closed asurovenko closed 3 years ago

asurovenko commented 5 years ago

Hi! Please tell us more about BUFFER_SIZE=8000 meaning. What if response bigger than 8000 bytes? If I'm sure that almost all my responses have less than 6000 bytes, does it mean that I should set BUFFER_SIZE=6000?

apangin commented 5 years ago

It's just a buffer size, like in BufferedInputStream. No matter how large a response is, HttpClient should work correctly with a smaller or a larger buffer. The only requirement is that the buffer is large enough to hold at least one line of response header.

It's OK to make the buffer size configurable. You can even add a corresponding ConnectionString parameter (that's exactly what ConnectionString was designed for).

asurovenko commented 5 years ago

I don't understand the point about ConnectionString. You mean make the setter for ConnectionString? For what? I can't imagine case in that we must reuse client.

apangin commented 5 years ago

ConnectionString is used to set up SocketPool and HttpClient parameters. Since you are adding a tunable parameter to HttpClient, it might be a good idea to configure it via ConnectionString as well.

apangin commented 3 years ago

Closing PR due to inactivity. bufferSize is made configurable via ConnectionString parameter.