main parsing is complete

This commit is contained in:
SuperNovaa41 2025-01-29 09:32:12 -05:00
parent 9fbe993f1c
commit cc9d367464
2 changed files with 12 additions and 6 deletions

View File

@ -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

View File

@ -4,6 +4,7 @@
#include <sys/socket.h>
#include <netinet/in.h>
#include <poll.h>
#include <errno.h>
#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,6 +70,7 @@ 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) {
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
}