--- Server/server.c 2024/10/27 23:53:55 1.6 +++ Server/server.c 2024/10/28 00:12:13 1.9 @@ -1,4 +1,4 @@ -/* $Id: server.c,v 1.6 2024/10/27 23:53:55 nishi Exp $ */ +/* $Id: server.c,v 1.9 2024/10/28 00:12:13 nishi Exp $ */ #define SOURCE @@ -344,10 +344,11 @@ void _tw_process_page(SSL* ssl, int sock while(1) { if(f != NULL) { char buffer[512]; + int st; fread(buffer, size < 512 ? size : 512, 1, f); - tw_write(ssl, sock, buffer, size < 512 ? size : 512); + if((st = tw_write(ssl, sock, buffer, size < 512 ? size : 512)) <= 0) break; } else { - tw_write(ssl, sock, (unsigned char*)doc + incr, size < 512 ? size : 512); + if(tw_write(ssl, sock, (unsigned char*)doc + incr, size < 512 ? size : 512) <= 0) break; } incr += 512; if(size <= 512) break;