hxcpp
created pr with
hxcpp/ssl-short-read.1
added hxcpp/ssl-short-read.2
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 -3checkout specific patchset revision:
ssh pr.pico.sh pull hxcpp:ssl-short-read [rev] | git am -3add changes to patch request:
git format-patch main --stdout | ssh pr.pico.sh hxcpp:ssl-short-readadd comment to patch request:
ssh pr.pico.sh comment hxcpp:ssl-short-read "lgtm!"
Patchset
hxcpp/ssl-short-read.2
→ SSL read/write needs to return wouldblock if partial read
Stephen Paul Weber
Throw exceptions for more error codes
2026-10-27T21:17:55ZStephen Paul Weber
Retry handshake on would block
2026-10-27T21:18:19ZStephen Paul Weber
Include whole erorr message in exception
2026-10-27T21:18:51ZStephen Paul Weber
2026-10-27T21:19:11Z
SSL read/write needs to return wouldblock if partial read
Stephen Paul Weber
2026-10-27T21:17:55ZSemantic diff summary
0 added,
0 modified,
0 signature changed,
0 removed
across 0 analyzed files
(1 file skipped: unsupported file type)
+7
-2
Sources/c_borogove/src/hx/libs/ssl/SSL.cpp
#
| ... | ... | @@ -109,16 +109,21 @@ void _hx_ssl_close(Dynamic hssl) { | |
| 109 | 109 | ||
| 110 | 110 | static OSStatus socket_read(SSLConnectionRef conn, void *data, size_t *len) { | |
| 111 | 111 | int fd = (int)(intptr_t)conn; | |
| 112 | + | size_t requested = *len; | |
| 112 | 113 | 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; | |
| 114 | 116 | if (ret == 0) return errSSLClosedGraceful; | |
| 115 | 117 | if (errno == EAGAIN || errno == EWOULDBLOCK) return errSSLWouldBlock; | |
| 116 | 118 | return errSecIO; | |
| 117 | 119 | } | |
| 120 | + | ||
| 118 | 121 | static OSStatus socket_write(SSLConnectionRef conn, const void *data, size_t *len) { | |
| 119 | 122 | int fd = (int)(intptr_t)conn; | |
| 123 | + | size_t requested = *len; | |
| 120 | 124 | 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; | |
| 122 | 127 | if (errno == EAGAIN || errno == EWOULDBLOCK) return errSSLWouldBlock; | |
| 123 | 128 | return errSecIO; | |
| 124 | 129 | } |