--- Server/server.c 2024/10/17 09:53:39 1.1 +++ Server/server.c 2024/10/27 23:55:30 1.7 @@ -1,4 +1,4 @@ -/* $Id: server.c,v 1.1 2024/10/17 09:53:39 nishi Exp $ */ +/* $Id: server.c,v 1.7 2024/10/27 23:55:30 nishi Exp $ */ #define SOURCE @@ -107,7 +107,7 @@ uint16_t htons(uint16_t n) { return ((n #endif #endif -#if defined(_PSP) || defined(__ps2sdk__) +#if defined(_PSP) || defined(__ps2sdk__) || defined(__bsdi__) #include "strptime.h" #endif @@ -343,15 +343,15 @@ 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]; + fread(buffer, size < 512 ? size : 512, 1, f); + if(tw_write(ssl, sock, buffer, size < 512 ? size : 512) < 0) return; } 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) return; } - incr += 128; - if(size <= 128) break; - size -= 128; + incr += 512; + if(size <= 512) break; + size -= 512; } } @@ -620,7 +620,7 @@ int tw_server_pass(void* ptr) { time_t t; struct tm* btm; strptime(req.headers[i + 1], "%a, %d %b %Y %H:%M:%S GMT", &tm); -#if defined(__MINGW32__) || defined(_PSP) || defined(__PPU__) || defined(__ps2sdk__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__) || defined(__USLC__) || defined(__NeXT__) +#if defined(__MINGW32__) || defined(_PSP) || defined(__PPU__) || defined(__ps2sdk__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__) || defined(__USLC__) || defined(__NeXT__) || defined(__bsdi__) t = 0; btm = localtime(&t); cmtime = mktime(&tm); @@ -640,6 +640,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; @@ -791,6 +793,7 @@ int tw_server_pass(void* ptr) { addstring(&str, "
%h
%h
%h
%s