mirror of
https://github.com/sigmasternchen/Serwer
synced 2025-03-15 07:08:54 +00:00
some clean up
This commit is contained in:
parent
fcfc8d69e9
commit
055e6c3607
2 changed files with 7 additions and 7 deletions
|
@ -66,12 +66,10 @@ int ws_run_linear(webserver_t* server) {
|
|||
|
||||
// line end
|
||||
if (buffersize == 1) {
|
||||
// TODO 400
|
||||
ws_simple_status(connfd, 400);
|
||||
break;
|
||||
}
|
||||
if (buffer[buffersize - 2] != '\r') {
|
||||
// TODO 400
|
||||
ws_simple_status(connfd, 400);
|
||||
break;
|
||||
}
|
||||
|
@ -81,7 +79,6 @@ int ws_run_linear(webserver_t* server) {
|
|||
ws_log(server, LOG_TESTING, "got last header line");
|
||||
|
||||
if (headerlines < 1) {
|
||||
// TODO 400
|
||||
ws_simple_status(connfd, 400);
|
||||
break;
|
||||
}
|
||||
|
@ -95,9 +92,8 @@ int ws_run_linear(webserver_t* server) {
|
|||
handler_t* handler = ws_handler_find(server, path, host);
|
||||
|
||||
if (handler == NULL) {
|
||||
// TODO 404
|
||||
ws_log(server, LOG_DEBUG, "handler not found");
|
||||
ws_simple_status(connfd, 404);
|
||||
ws_simple_status(connfd, 404); // TODO add content
|
||||
break;
|
||||
}
|
||||
ws_log(server, LOG_TESTING, "found");
|
||||
|
@ -170,8 +166,7 @@ int ws_run_linear(webserver_t* server) {
|
|||
ws_log(server, LOG_TESTING, "parsing first line");
|
||||
int e;
|
||||
if ((e = ws_request_parse(header + headersize, &path, &method)) < 0) {
|
||||
ws_log(server, LOG_DEBUG, "parsing error: %i", e);
|
||||
// TODO 400
|
||||
ws_log(server, LOG_DEBUG, "parsing error: %i", e);
|
||||
ws_simple_status(connfd, 400);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -182,6 +182,9 @@ bool ws_host_match(const char* host, const char* match) {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO server:80 and server:80* do not match.
|
||||
|
||||
// if not whole match string matches, return false
|
||||
if (m != lenm)
|
||||
return false;
|
||||
|
@ -239,6 +242,8 @@ bool ws_path_match(const char* path, const char* match) {
|
|||
}
|
||||
}
|
||||
|
||||
// TODO /hello and /hello* do not match.
|
||||
|
||||
// if not whole match string used, return false
|
||||
if (m != lenm)
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue