diff --git a/src/http.c b/src/http.c index 2d11750..9239acf 100644 --- a/src/http.c +++ b/src/http.c @@ -100,6 +100,15 @@ void parse_http_request(char** buffer, http_request* request) parse_request_line(&line, request); + /** + * TODO: start accepting the headers + * + * for now im going to ignore them since they're not suuuper important for simple + * operation + * + * whats important is that we have the 2 things we need to get started, the method and the URI + */ + /** // parse the remaining lines diff --git a/src/tcp.c b/src/tcp.c index 28b09ec..205dc68 100644 --- a/src/tcp.c +++ b/src/tcp.c @@ -4,6 +4,7 @@ #include #include #include +#include #include "include/tcp.h" #include "include/http.h" @@ -41,16 +42,11 @@ void setup_socket(server_conn_t* conn) } } -// this is a blocking call void recv_message(char** buffer, int socket) { ulong current_size, bytes_recv; int status; - /** - * TODO: look into poll()? recv is receiving : "Resource temporarily unavaiable" - */ - current_size = bytes_recv = 0; status = 0; @@ -74,7 +70,8 @@ void recv_message(char** buffer, int socket) // lets recv BUFFER_INC_LEN amount of bytes status = recv(socket, *buffer + bytes_recv, BUFFER_INC_LEN, MSG_DONTWAIT); if (status < 0) { - perror("recv"); + if (errno != EAGAIN && errno != EWOULDBLOCK) // these signify that that were just no data to read, dw about this + perror("recv"); break; // don't want to crash on a recv failure, lets just break }