Changeset 16 in Main
- Timestamp:
- Sep 14, 2024, 12:09:52 AM (2 months ago)
- Location:
- trunk
- Files:
-
- 2 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Common/cm_string.h
r5 r16 7 7 8 8 char* cm_strcat(const char* a, const char* b); 9 char* cm_strcat3(const char* a, const char* b, const char* c); 9 10 char* cm_strdup(const char* str); 10 11 char* cm_trimstart(const char* str); -
trunk/Common/string.c
r6 r16 11 11 memcpy(str + strlen(a), b, strlen(b)); 12 12 str[strlen(a) + strlen(b)] = 0; 13 return str; 14 } 15 16 char* cm_strcat3(const char* a, const char* b, const char* c) { 17 char* tmp = cm_strcat(a, b); 18 char* str = cm_strcat(tmp, c); 19 free(tmp); 13 20 return str; 14 21 } -
trunk/Server/Makefile
r14 r16 6 6 .SUFFIXES: .c .o 7 7 8 OBJS = version.o main.o config.o server.o ssl.o 8 OBJS = version.o main.o config.o server.o ssl.o http.o 9 9 10 10 all: tewi$(EXEC) -
trunk/Server/config.c
r13 r16 1 1 /* $Id$ */ 2 3 #define SOURCE 2 4 3 5 #include "tw_config.h" -
trunk/Server/main.c
r9 r16 1 1 /* $Id$ */ 2 3 #define SOURCE 2 4 3 5 #include <stdio.h> 4 6 #include <stdbool.h> 5 7 #include <string.h> 8 #include <signal.h> 6 9 7 10 #include <openssl/opensslv.h> … … 50 53 } 51 54 cm_log("Daemon", "Ready"); 55 #ifndef __MINGW32__ 56 signal(SIGCHLD, SIG_IGN); 57 #endif 52 58 tw_server_loop(); 53 59 } -
trunk/Server/server.c
r15 r16 1 1 /* $Id$ */ 2 3 #define SOURCE 2 4 3 5 #include "tw_server.h" … … 5 7 #include "tw_ssl.h" 6 8 #include "tw_config.h" 9 #include "tw_http.h" 7 10 8 11 #include <unistd.h> … … 111 114 } 112 115 return 0; 116 } 117 118 size_t tw_read(SSL* ssl, int s, void* data, size_t len) { 119 if(ssl == NULL) { 120 return recv(s, data, len, 0); 121 } else { 122 return SSL_read(ssl, data, len); 123 } 124 } 125 126 size_t tw_write(SSL* ssl, int s, void* data, size_t len) { 127 if(ssl == NULL) { 128 return send(s, data, len, 0); 129 } else { 130 return SSL_write(ssl, data, len); 131 } 113 132 } 114 133 … … 140 159 sslworks = true; 141 160 } 161 struct tw_http_request req; 162 int ret = tw_http_parse(s, sock, &req); 142 163 cleanup: 143 if(sslworks) {164 if(sslworks) { 144 165 SSL_shutdown(s); 145 166 } -
trunk/Server/ssl.c
r12 r16 1 1 /* $Id$ */ 2 3 #define SOURCE 2 4 3 5 #include "tw_ssl.h" -
trunk/Server/tw_server.h
r9 r16 4 4 #define __TW_SERVER_H__ 5 5 6 #include <openssl/ssl.h> 7 6 8 int tw_server_init(void); 7 9 void tw_server_loop(void); 10 size_t tw_read(SSL* ssl, int s, void* data, size_t len); 11 size_t tw_write(SSL* ssl, int s, void* data, size_t len); 8 12 9 13 #endif -
trunk/Server/version.c
r3 r16 1 1 /* $Id$ */ 2 3 #define SOURCE 2 4 3 5 #include "tw_version.h"
Note:
See TracChangeset
for help on using the changeset viewer.