On 10/12/22 04:48, Hans Leidekker (@hans) wrote:
Hans Leidekker (@hans) commented about dlls/winhttp/request.c:
int bytes_sent; DWORD ret, len;
- if (request->flags & REQUEST_FLAG_WEBSOCKET_UPGRADE
&& request->websocket_set_send_buffer_size < MIN_WEBSOCKET_SEND_BUFFER_SIZE)
- {
WARN( "Invalid send buffer size %u.\n", request->websocket_set_send_buffer_size );
ret = ERROR_NOT_ENOUGH_MEMORY;
goto end;
- }
This isn't pretty. If websocket_set_send_buffer_size exists only to return this error and your app doesn't depend on this then I'd rather leave this out.
The problem I was trying to solve this way is the case when the invalid (too short) socket length is set after WinHttpSendRequest(). On Windows this setting doesn't affect anything (except for the value read back), it looks like Windows fetches the buffer length (or creates a websocket buffer internally?) somewhere during SendRequest. I don't have anything depending on this specific behaviour, I can probably just check that value later again in WebSocketCompleteUpgrade() and fail at that moment, print fixme and remove that test with setting invalid length between SendRequest and CompleteUpgrade which will be failing.