From 5ff532ecd9d63e03a0ea3878e32b078695863fea Mon Sep 17 00:00:00 2001 From: Rockingcool Date: Thu, 9 Mar 2023 08:08:38 -0600 Subject: [PATCH] Started working on 'url_to_path' function --- url_manipulation.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/url_manipulation.c b/url_manipulation.c index 28a517b..76186e7 100644 --- a/url_manipulation.c +++ b/url_manipulation.c @@ -16,9 +16,8 @@ char* url_to_proto(char* url) { char* url_to_hostname(char* url) { /* This function relies on a hack-y assumption: that, given a string - that represents a URL (e.g. https://www.example.com), the host portion - of the address is the length of the address minus (length of protocol + 3 ("://"). - In this case that would be 23 - [5 (h,t,t,p,s) + 3 = 8]. */ + that represents a URL (e.g. https://www.example.com/index.html), the length of the host portion + of the address is the distance between the second slash (:/'/') and the third ('/'index.html). */ size_t length = strlen(url); char* protocol = url_to_proto(url); @@ -35,3 +34,8 @@ char* url_to_hostname(char* url) { } +char* url_to_path(char* url) { + /* Assumption: The path starts from the third slash to the end of the string. */ + + +}