v3: - change indentation in socket_set_option(); - don't make validate_buffer() global; - inherit send and receive buffer sizes in request from session (and change tests so they really test that).
I left `websocket_set_send_buffer_size` in place for now. It is not only to print an error message or get an error return in the right place. The test suggests that the buffer size is fetched during WinHttpSendRequest on Windows (that is where it fails if setting invalid size and it doesn't fail later if setting invalid size right after this call). It is not apparent that the buffer size sent after WinHttpSendRequest but before WinHttpCompleteUpgrade have no effect so I would expect some apps to set it at the wrong moment. Ignoring that would make us use a different buffer size if it is valid or fail if it is invalid. I guess that is best to avoid. The alternative to using an extra websocket_set_send_buffer_size variable to initialize a web socket structure right in WinHttpSendRequest, but it looks even uglier to me so far than an extra variable.