@@ -65,6 +65,7 @@ static const struct option options[] = {{"port", required_argument, NULL, 'p'},
6565#if LWS_LIBRARY_VERSION_NUMBER >= 4000000
6666 {"ping-interval" , required_argument , NULL , 'P' },
6767#endif
68+ {"srv-buf-size" , required_argument , NULL , 'f' },
6869 {"ipv6" , no_argument , NULL , '6' },
6970 {"ssl" , no_argument , NULL , 'S' },
7071 {"ssl-cert" , required_argument , NULL , 'C' },
@@ -83,7 +84,7 @@ static const struct option options[] = {{"port", required_argument, NULL, 'p'},
8384 {"version" , no_argument , NULL , 'v' },
8485 {"help" , no_argument , NULL , 'h' },
8586 {NULL , 0 , 0 , 0 }};
86- static const char * opt_string = "p:i:U:c:H:u:g:s:w:I:b:P:6aSC:K:A:Wt:T:Om:oqBd:vh" ;
87+ static const char * opt_string = "p:i:U:c:H:u:g:s:w:I:b:P:f: 6aSC:K:A:Wt:T:Om:oqBd:vh" ;
8788
8889static void print_help () {
8990 // clang-format off
@@ -116,6 +117,7 @@ static void print_help() {
116117#if LWS_LIBRARY_VERSION_NUMBER >= 4000000
117118 " -P, --ping-interval Websocket ping interval(sec) (default: 5)\n"
118119#endif
120+ " -f, --srv-buf-size Maximum chunk of file (in bytes) that can be sent at once, a larger value may improve throughput (default: 4096)\n"
119121#ifdef LWS_WITH_IPV6
120122 " -6, --ipv6 Enable IPv6 support\n"
121123#endif
@@ -463,6 +465,14 @@ int main(int argc, char **argv) {
463465 retry .secs_since_valid_hangup = interval + 7 ;
464466 } break ;
465467#endif
468+ case 'f' : {
469+ int serv_buf_size = parse_int ("srv-buf-size" , optarg );
470+ if (serv_buf_size < 0 ) {
471+ fprintf (stderr , "ttyd: invalid srv-buf-size: %s\n" , optarg );
472+ return -1 ;
473+ }
474+ info .pt_serv_buf_size = serv_buf_size ;
475+ } break ;
466476 case '6' :
467477 info .options &= ~(LWS_SERVER_OPTION_DISABLE_IPV6 );
468478 break ;
@@ -553,9 +563,9 @@ int main(int argc, char **argv) {
553563 if (ssl ) {
554564 info .ssl_cert_filepath = cert_path ;
555565 info .ssl_private_key_filepath = key_path ;
556- #ifndef LWS_WITH_MBEDTLS
566+ #ifndef LWS_WITH_MBEDTLS
557567 info .ssl_options_set = SSL_OP_NO_TLSv1 | SSL_OP_NO_TLSv1_1 ;
558- #endif
568+ #endif
559569 if (strlen (ca_path ) > 0 ) {
560570 info .ssl_ca_filepath = ca_path ;
561571 info .options |= LWS_SERVER_OPTION_REQUIRE_VALID_OPENSSL_CLIENT_CERT ;
0 commit comments