diff --git a/request.c b/request.c index ff75a57..b51f0c8 100644 --- a/request.c +++ b/request.c @@ -1,16 +1,42 @@ -#include "stdlib.h" +#include #include "url.h" #include "request.h" +#define MAX_BUFFER_SIZE 50000 + struct Request_s { URL* url; char* req_type; }; -Request* new_Request(char* url_str,char* req_type_str) { +Request* new_request(char* url_str,char* req_type_str) { Request* req = malloc(sizeof(struct Request_s)); req->url = new_url(url_str); req->req_type = req_type_str; } +URL* get_url(Request* req) { + return req->url; +} + +char* make_request(Request* req) { + char* request_str = malloc(sizeof(char) * MAX_BUFFER_SIZE); + + strcat(request_str,req->req_type); + strcat(request_str," "); + strcat(request_str,req->url->filepath); + strcat(request_str," HTTP/1.1"); + strcat(request_str,"\r\n"); + strcat(request_str,"Host: "); + strcat(request_str,req->url->hostname); + strcat(request_str,"\r\n\r\n"); + + + + if (strcmp(req->url->schema,"http") == 0) { + + } else if (strcmp(req->url->schema,"https") == 0) { + + } +}