Added new field for entire URL string
This commit is contained in:
13
url.c
13
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) {
|
||||
}
|
||||
|
||||
|
||||
URL* new_url(char* url_str) {
|
||||
char* url_dup = strdup(url_str);
|
||||
URL* url = malloc(sizeof(struct URL_s));
|
||||
char* url_to_str(URL* url) {
|
||||
return url->url_str;
|
||||
}
|
||||
|
||||
url->schema = strtok(url_dup,":");
|
||||
URL* new_url(char* url_str) {
|
||||
URL* url = malloc(sizeof(struct URL_s));
|
||||
url->url_str = strdup(url_str);
|
||||
|
||||
url->schema = strtok(url->url_str,":");
|
||||
|
||||
url->hostname = strtok(NULL,"/");
|
||||
|
||||
|
Reference in New Issue
Block a user