Subversion Repositories Tewi

Rev

Rev 392 | Rev 394 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 392 Rev 393
Line 1... Line 1...
1
/* $Id: server.c 392 2024-10-20 20:52:41Z nishi $ */
1
/* $Id: server.c 393 2024-10-27 23:53:30Z nishi $ */
2
 
2
 
3
#define SOURCE
3
#define SOURCE
4
 
4
 
5
#include "../config.h"
5
#include "../config.h"
6
 
6
 
Line 341... Line 341...
341
	tw_write(ssl, sock, "\r\n", 2);
341
	tw_write(ssl, sock, "\r\n", 2);
342
	if(doc == NULL && f == NULL) return;
342
	if(doc == NULL && f == NULL) return;
343
	incr = 0;
343
	incr = 0;
344
	while(1) {
344
	while(1) {
345
		if(f != NULL) {
345
		if(f != NULL) {
346
			char buffer[128];
346
			char buffer[512];
347
			fread(buffer, size < 128 ? size : 128, 1, f);
347
			fread(buffer, size < 512 ? size : 512, 1, f);
348
			tw_write(ssl, sock, buffer, size < 128 ? size : 128);
348
			tw_write(ssl, sock, buffer, size < 512 ? size : 512);
349
		} else {
349
		} else {
350
			tw_write(ssl, sock, (unsigned char*)doc + incr, size < 128 ? size : 128);
350
			tw_write(ssl, sock, (unsigned char*)doc + incr, size < 512 ? size : 512);
351
		}
351
		}
352
		incr += 128;
352
		incr += 512;
353
		if(size <= 128) break;
353
		if(size <= 512) break;
354
		size -= 128;
354
		size -= 512;
355
	}
355
	}
356
}
356
}
357
 
357
 
358
void tw_process_page(SSL* ssl, int sock, const char* status, const char* type, FILE* f, const unsigned char* doc, size_t size, time_t mtime, time_t cmtime) { _tw_process_page(ssl, sock, status, type, f, doc, size, NULL, mtime, cmtime); }
358
void tw_process_page(SSL* ssl, int sock, const char* status, const char* type, FILE* f, const unsigned char* doc, size_t size, time_t mtime, time_t cmtime) { _tw_process_page(ssl, sock, status, type, f, doc, size, NULL, mtime, cmtime); }
359
 
359