The generated header only "looked like" Base64, but if the other side
actually tried to decode it as such, it could fail. This change fixes
that to always generate a valid Base64 value.
The Base64 code is copied from
https://gist.github.com/tomykaira/f0fd86b6c73063283afe550bc5d77594.
* Update IXSocket.h
Avoid "conflicting declaration 'typedef SSIZE_T ssize_t'"
* Update IXUdpSocket.h
* Update IXNetSystem.cpp
ENOSPC and EAFNOSUPPORT are not defined for clang on windows
This change adds onChunkCallback to the request. If defined it will be
called repeatedly with the incoming data. This allows to process data on
the go or write it to disk instead of accumulating the data in memory.
* Introduction of IXWebSocketSendData that makes it possible to not only send std::string but also std::vector<char/uint8_t> and char* without copying them to a std::string first.
Add a sendUtf8Text() method that doesn't check for invalid UTF-8 characters. The caller must guarantee that the string only contains valid UTF-8 characters.
* Updated usage.md: sendUtf8Text() and IXWebSocketSendData
* mbedls system certs
* missing curly brace ...
* windows uwp for appveyor
* try again uwp
* update version and changelog
* revert odd change in test/IXSocketTest.cpp
Co-authored-by: Benjamin Sergeant <bsergeant@mz.com>
* Fix#323: Missing SelectInterrupt implementation for Windows
Using WSAEventSelect, WSAWaitForMultipleEvents and WSAEnumNetworkEvents to emulate poll() with an interrupt-event.
* Cleanup
* Fixed incomplete comment.
* Switched ifdefs to support other Unixes with pipe file descriptors
* Fixed: SelectInterrupt fallback code for getFd()==-1 && getEvent()==nullptr converted a PollResultType::Timeout into a ReadyForRead causing the HttpClient to fail because it uses a hard-coded "SelectInterrupt" instance that doesn't implement getFd() and getEvent().
* Fixed gcc compile errors
* - HttpClient now uses the SelectInterruptFactory
- Fixed wrong ix::poll result when using Windows WSA functions
* We must deselect the networkevents from the socket event. Otherwise the socket will report states that aren't there.
See https://en.cppreference.com/w/cpp/header/cerrno for additional details. Some of used constants are defined in this header.
Inclusion is necessary to avoid these errors:
```
/home/user/IXWebSocket/ixwebsocket/IXNetSystem.cpp:189:30: error: use of undeclared identifier 'EAFNOSUPPORT'
default: errno = EAFNOSUPPORT; return 0;
^
/home/user/IXWebSocket/ixwebsocket/IXNetSystem.cpp:191:17: error: use of undeclared identifier 'ENOSPC'
errno = ENOSPC;
^
/home/user/IXWebSocket/ixwebsocket/IXNetSystem.cpp:175:25: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long long') to 'int' [-Wshorten-64-to-32]
j = strspn(buf + i, ":0");
~ ^~~~~~~~~~~~~~~~~~~~~
/home/user/IXWebSocket/ixwebsocket/IXNetSystem.cpp:234:21: error: use of undeclared identifier 'EAFNOSUPPORT'
errno = EAFNOSUPPORT;
^
2 warnings and 3 errors generated.
```
* mbedls system certs
* missing curly brace ...
* windows uwp for appveyor
* try again uwp
* bump version
* keep using local cacert.pem in unittest
* appveyor back to normal
* remove appveyor file
Co-authored-by: Benjamin Sergeant <bsergeant@mz.com>
* Correctly convert remote port bytecode to uint16 port number.
Copied the network_to_host_short function from the ASIO library to convert the remote port byte code to a uint16 number.
* Switched from uint16_t to unsigned short to work in Windows
* Updated missed uint16_t to unsigned short
* Fix unsafe calls and safeguard WebSocketMessage from being called w/
temporaries
* Use unnamed namespace to express internal linkage
* Avoid returning references that are mutex protected
Motivation for this MR
The antipattern of returning references to mutex protected members was
removed. Since a caller can hold the reference it would make all class
level locking meaningless.
Instead values are returned. The IXWebSocketPerMessageDeflateOptions
class was shrunk by 7 bytes (1 padding + 2*3) after changing the int
members to the used uint8_t; side effects of that were handled.
An inefficient "string -> int" was replaced by standard library. As
seen here http://coliru.stacked-crooked.com/a/46b5990bafb9c626 this
gives an order of magnitude better performance.
* noexcept string to integer conversion
* Fix unsafe calls and safeguard WebSocketMessage from being called w/
temporaries
* Use unnamed namespace to express internal linkage
* Avoid returning references that are mutex protected
Motivation for this MR
The antipattern of returning references to mutex protected members was
removed. Since a caller can hold the reference it would make all class
level locking meaningless.
Instead values are returned. The IXWebSocketPerMessageDeflateOptions
class was shrunk by 7 bytes (1 padding + 2*3) after changing the int
members to the used uint8_t; side effects of that were handled.
An inefficient "string -> int" was replaced by standard library. As
seen here http://coliru.stacked-crooked.com/a/46b5990bafb9c626 this
gives an order of magnitude better performance.