From 49030166f35b2d6b2d1792016723dc3a620fec54 Mon Sep 17 00:00:00 2001 From: Rockingcool Date: Fri, 19 May 2023 11:17:24 -0500 Subject: [PATCH] Added new field for entire URL string --- url.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/url.c b/url.c index e542ba5..c540d83 100644 --- a/url.c +++ b/url.c @@ -7,6 +7,7 @@ struct URL_s { char* hostname; char* port; char* filepath; + char* url_str; }; char* get_schema(URL* url) { @@ -26,11 +27,15 @@ char* get_filepath(URL* url) { } +char* url_to_str(URL* url) { + return url->url_str; +} + URL* new_url(char* url_str) { - char* url_dup = strdup(url_str); URL* url = malloc(sizeof(struct URL_s)); + url->url_str = strdup(url_str); - url->schema = strtok(url_dup,":"); + url->schema = strtok(url->url_str,":"); url->hostname = strtok(NULL,"/");