--- Server/server.c 2024/10/20 20:23:51 1.4 +++ Server/server.c 2024/11/03 06:16:48 1.10 @@ -1,4 +1,4 @@ -/* $Id: server.c,v 1.4 2024/10/20 20:23:51 nishi Exp $ */ +/* $Id: server.c,v 1.10 2024/11/03 06:16:48 nishi Exp $ */ #define SOURCE @@ -343,15 +343,16 @@ void _tw_process_page(SSL* ssl, int sock incr = 0; while(1) { if(f != NULL) { - char buffer[128]; - fread(buffer, size < 128 ? size : 128, 1, f); - tw_write(ssl, sock, buffer, size < 128 ? size : 128); + char buffer[512]; + int st; + fread(buffer, size < 512 ? size : 512, 1, f); + if((st = tw_write(ssl, sock, buffer, size < 512 ? size : 512)) <= 0) break; } else { - tw_write(ssl, sock, (unsigned char*)doc + incr, size < 128 ? size : 128); + if(tw_write(ssl, sock, (unsigned char*)doc + incr, size < 512 ? size : 512) <= 0) break; } - incr += 128; - if(size <= 128) break; - size -= 128; + incr += 512; + if(size <= 512) break; + size -= 512; } } @@ -640,6 +641,8 @@ int tw_server_pass(void* ptr) { host[i] = 0; port = atoi(host + i + 1); break; + }else if(vhost[i] == '['){ + for(; vhost[i] != 0 && vhost[i] != ']'; i++); } } name = host; @@ -1020,7 +1023,7 @@ void tw_server_loop(void) { struct timeval tv; #endif #if defined(__MINGW32__) || defined(__HAIKU__) || defined(_MSC_VER) || defined(__BORLANDC__) || (defined(__WATCOMC__) && !defined(__NETWARE__) && !defined(__DOS__)) - struct thread_entry threads[2048]; + struct thread_entry threads[128]; for(i = 0; i < sizeof(threads) / sizeof(threads[0]); i++) { threads[i].used = false; }