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* hostname;
|
||||||
char* port;
|
char* port;
|
||||||
char* filepath;
|
char* filepath;
|
||||||
|
char* url_str;
|
||||||
};
|
};
|
||||||
|
|
||||||
char* get_schema(URL* url) {
|
char* get_schema(URL* url) {
|
||||||
@@ -26,11 +27,15 @@ char* get_filepath(URL* url) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
URL* new_url(char* url_str) {
|
char* url_to_str(URL* url) {
|
||||||
char* url_dup = strdup(url_str);
|
return url->url_str;
|
||||||
URL* url = malloc(sizeof(struct URL_s));
|
}
|
||||||
|
|
||||||
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,"/");
|
url->hostname = strtok(NULL,"/");
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user