Fixed a bug where the program attempted to access a URL's struct members directly

master
Aadhavan Srinivasan 1 year ago
parent 521cdd7941
commit aed4fdb08a

@ -1,4 +1,5 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
#include "url.h" #include "url.h"
#include "request.h" #include "request.h"
@ -25,18 +26,18 @@ char* make_request(Request* req) {
strcat(request_str,req->req_type); strcat(request_str,req->req_type);
strcat(request_str," "); strcat(request_str," ");
strcat(request_str,req->url->filepath); strcat(request_str,get_filepath(req->url));
strcat(request_str," HTTP/1.1"); strcat(request_str," HTTP/1.1");
strcat(request_str,"\r\n"); strcat(request_str,"\r\n");
strcat(request_str,"Host: "); strcat(request_str,"Host: ");
strcat(request_str,req->url->hostname); strcat(request_str,get_hostname(req->url));
strcat(request_str,"\r\n\r\n"); strcat(request_str,"\r\n\r\n");
return request_str;
if (strcmp(get_schema(req->url),"http") == 0) {
if (strcmp(req->url->schema,"http") == 0) {
} else if (strcmp(get_schema(req->url),"https") == 0) {
} else if (strcmp(req->url->schema,"https") == 0) {
} }
} }

Loading…
Cancel
Save