fix stuff
git-svn-id: file:///raid/svn-personal/tewi/trunk@64 8739d7e6-ffea-ec47-b151-bdff447c6205
This commit is contained in:
parent
54108c74b9
commit
13eb135280
|
@ -32,6 +32,13 @@ void tw_free_request(struct tw_http_request* req) {
|
|||
}
|
||||
if(req->body != NULL) free(req->body);
|
||||
if(req->version != NULL) free(req->version);
|
||||
|
||||
req->method = NULL;
|
||||
req->path = NULL;
|
||||
req->query = NULL;
|
||||
req->headers = NULL;
|
||||
req->body = NULL;
|
||||
req->version = NULL;
|
||||
}
|
||||
|
||||
int tw_http_parse(SSL* ssl, int sock, struct tw_http_request* req) {
|
||||
|
@ -75,7 +82,10 @@ int tw_http_parse(SSL* ssl, int sock, struct tw_http_request* req) {
|
|||
}
|
||||
#endif
|
||||
int len = tw_read(ssl, sock, buffer, 512);
|
||||
if(len <= 0) break;
|
||||
if(len <= 0){
|
||||
bad = true;
|
||||
break;
|
||||
}
|
||||
int i;
|
||||
for(i = 0; i < len; i++) {
|
||||
char c = buffer[i];
|
||||
|
|
|
@ -428,6 +428,7 @@ void tw_server_pass(int sock, bool ssl, int port, SOCKADDR addr) {
|
|||
char* vhost = cm_strdup(config.hostname);
|
||||
int i;
|
||||
time_t cmtime = 0;
|
||||
if(req.headers != NULL){
|
||||
for(i = 0; req.headers[i] != NULL; i += 2) {
|
||||
if(cm_strcaseequ(req.headers[i], "Host")) {
|
||||
free(vhost);
|
||||
|
@ -445,6 +446,7 @@ void tw_server_pass(int sock, bool ssl, int port, SOCKADDR addr) {
|
|||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
cm_log("Server", "Host is %s", vhost);
|
||||
int port = s == NULL ? 80 : 443;
|
||||
char* host = cm_strdup(vhost);
|
||||
|
|
Loading…
Reference in New Issue
Block a user