You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Failed to paste more than 2035 characters with libwebsockets >= 4.4.0 #1532
Screenshots
If applicable, add screenshots to help explain your problem.
Environment:
OS: Windows, Linux
Browser: Chrome, Firefox
Additional context
It seems to be related to this commit: warmcat/libwebsockets@6a2542d
If I undo the commit or just build with a version (4.3.10 for example) without the commit, I can once again paste very-long text like in 1.7.7.
changed the title [-]Failed to paste more than 2035 characters with libwebsockets > 4.4.0[/-][+]Failed to paste more than 2035 characters with libwebsockets >= 4.4.0[/+]on Apr 25, 2026
lws_set_extension_option only sets the soft cap, the actual limit is bound by protocol->rx_buffer_size or pt_serv_buf_size (when protocol->rx_buffer_size is 0).
Kind of confusing that extension option rx_buf_size is the exponent of 2, while protocol->rx_buffer_size and pt_serv_buf_size is in bytes.
The only problem is that I am not sure if it's ok to hardcode the number.
Activity
[-]Failed to paste more than 2035 characters with libwebsockets > 4.4.0[/-][+]Failed to paste more than 2035 characters with libwebsockets >= 4.4.0[/+]PvH-SPC commentedon May 11, 2026
Hi wondering what the plan is for this fix?
erusc commentedon May 12, 2026
I think I found the fix without hacking libwebsockets.
The theoretical limit of rx buffer is 2^31 = 2147483648 (unsigned int, 2 GiB), according to https://github.com/warmcat/libwebsockets/blob/6a2542d/lib/roles/ws/ext/extension-permessage-deflate.c#L53-L66 and https://github.com/warmcat/libwebsockets/blob/6a2542d/lib/roles/ws/ext/extension-permessage-deflate.c#L232-L235.
lws_set_extension_optiononly sets the soft cap, the actual limit is bound byprotocol->rx_buffer_sizeorpt_serv_buf_size(when protocol->rx_buffer_size is 0).Kind of confusing that extension option
rx_buf_sizeis the exponent of 2, while protocol->rx_buffer_size and pt_serv_buf_size is in bytes.The only problem is that I am not sure if it's ok to hardcode the number.
PvH-SPC commentedon May 14, 2026
Can we get this cut into a release? Not sure what changed but anything is better than the very small paste window we have now.
erusc commentedon May 15, 2026
For now you can just use 1.7.7 or build with libwebsockets 4.3.10.
BUILD_TARGET=$(arch) LIBWEBSOCKETS_VERSION=4.3.10 ./scripts/cross-build.shSet BUILD_TARGET if you need a different architecture.
ttyd/scripts/cross-build.sh
Lines 201 to 219 in 647d55a
v4.3.10 was tagged 2 months ago, so I assume it's not outdated yet.
p.s.
There seem to be another issue about TLS with libwebsockets 4.4 and 4.5, so it might be better to stick with 4.3.x for the time being.