main parsing is complete
This commit is contained in:
parent
9fbe993f1c
commit
cc9d367464
@ -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
|
||||
|
@ -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,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
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user