Started working on 'url_to_path' function

master
Aadhavan Srinivasan 2 years ago
parent 418861d53c
commit 5ff532ecd9

@ -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. */
}

Loading…
Cancel
Save