Hi Hans, On 24/6/20 6:33 pm, Hans Leidekker wrote:
+ if ((ret = receive_bytes( netconn, (char *)&socket->status, sizeof(socket->status), &count ))) goto done; + if (count != sizeof(socket->status)) + { + ret = ERROR_WINHTTP_INVALID_SERVER_RESPONSE; + goto done; + } + socket->status = RtlUshortByteSwap( socket->status ); + ret = receive_bytes( netconn, socket->reason, sizeof(socket->reason), &socket->reason_len ); +
The status and reason message are optional for the close packet and is causing an error on my test application. The packet length will show if it has a code. https://tools.ietf.org/html/rfc6455#section-5.5.1 If there is a body, the first two bytes of the body MUST be a 2-byte unsigned integer (in network byte order) representing a status code with value /code/ defined in Section 7.4. Following the 2-byte integer, the body MAY contain UTF-8-encoded data with value /reason/ating a reason for closure, followed by UTF-8-encoded data" Regards Alistair.