hxcpp

created pr with hxcpp/ssl-short-read.1 on 2026-10-27T21:26:44Z · by d7025af3
added hxcpp/ssl-short-read.2 on 2026-10-27T21:29:42Z · by d7025af3
1: d70d1ca < -: ------- SSL read/write needs to return wouldblock if partial read
-: ------- > 1: dd64130 SSL read/write needs to return wouldblock if partial read
2: af61d88 = 2: d3fe10a Throw exceptions for more error codes
3: 124b85a = 3: 6f33bf1 Retry handshake on would block
4: e8e22fe = 4: 5a504b4 Include whole erorr message in exception
cmds
checkout latest patchset:
ssh pr.pico.sh pull hxcpp:ssl-short-read | git am -3
checkout specific patchset revision:
ssh pr.pico.sh pull hxcpp:ssl-short-read [rev] | git am -3
add changes to patch request:
git format-patch main --stdout | ssh pr.pico.sh hxcpp:ssl-short-read
add comment to patch request:
ssh pr.pico.sh comment hxcpp:ssl-short-read "lgtm!"
+7 -2 Sources/c_borogove/src/hx/libs/ssl/SSL.cpp #
......@@ -109,16 +109,21 @@ void _hx_ssl_close(Dynamic hssl) {
109109
110110 static OSStatus socket_read(SSLConnectionRef conn, void *data, size_t *len) {
111111 int fd = (int)(intptr_t)conn;
112+ size_t requested = *len;
112113 ssize_t ret = recv(fd, data, *len, 0);
113- if (ret > 0) { *len = ret; return noErr; }
114+ if (ret > 0) { *len = ret; return ret < requested ? errSSLWouldBlock : noErr; }
115+ *len = 0;
114116 if (ret == 0) return errSSLClosedGraceful;
115117 if (errno == EAGAIN || errno == EWOULDBLOCK) return errSSLWouldBlock;
116118 return errSecIO;
117119 }
120+
118121 static OSStatus socket_write(SSLConnectionRef conn, const void *data, size_t *len) {
119122 int fd = (int)(intptr_t)conn;
123+ size_t requested = *len;
120124 ssize_t ret = send(fd, data, *len, 0);
121- if (ret > 0) { *len = ret; return noErr; }
125+ if (ret >= 0) { *len = ret; return ret < requested ? errSSLWouldBlock : noErr; }
126+ *len = 0;
122127 if (errno == EAGAIN || errno == EWOULDBLOCK) return errSSLWouldBlock;
123128 return errSecIO;
124129 }
Back to top