mirror of https://github.com/ipxe/ipxe.git
parse_url() is void.
parent
65dc273d78
commit
044b20385b
|
@ -8,7 +8,6 @@
|
||||||
*
|
*
|
||||||
* [protocol://[host][:port]/]path/to/file
|
* [protocol://[host][:port]/]path/to/file
|
||||||
*
|
*
|
||||||
* We return true for success, 0 for failure (e.g. unknown protocol).
|
|
||||||
* The URL string will be modified by having NULs inserted after
|
* The URL string will be modified by having NULs inserted after
|
||||||
* "protocol", "host" and "port". The original URL can be
|
* "protocol", "host" and "port". The original URL can be
|
||||||
* reconstructed by calling unparse_url.
|
* reconstructed by calling unparse_url.
|
||||||
|
@ -17,6 +16,8 @@
|
||||||
void parse_url ( struct url_info *info, char *url ) {
|
void parse_url ( struct url_info *info, char *url ) {
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
|
DBG ( "URL parsing \"%s\"\n", url );
|
||||||
|
|
||||||
/* Zero the structure */
|
/* Zero the structure */
|
||||||
memset ( info, 0, sizeof ( *info ) );
|
memset ( info, 0, sizeof ( *info ) );
|
||||||
|
|
||||||
|
@ -44,11 +45,15 @@ void parse_url ( struct url_info *info, char *url ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
info->file = p;
|
info->file = p;
|
||||||
|
DBG ( "URL protocol \"%s\" host \"%s\" port \"%s\" "
|
||||||
|
"file \"%s\"\n", info->protocol, info->host,
|
||||||
|
info->port ? info->port : "(NONE)", info->file );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* URL has no explicit protocol; is just a filename */
|
/* URL has no explicit protocol; is just a filename */
|
||||||
info->file = url;
|
info->file = url;
|
||||||
|
DBG ( "URL file \"%s\"\n", info->file );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -63,9 +68,11 @@ char * unparse_url ( struct url_info *info ) {
|
||||||
info->port[-1] = ':';
|
info->port[-1] = ':';
|
||||||
}
|
}
|
||||||
info->host[-3] = ':';
|
info->host[-3] = ':';
|
||||||
|
DBG ( "URL reconstructed \"%s\"\n", info->protocol );
|
||||||
return info->protocol;
|
return info->protocol;
|
||||||
} else {
|
} else {
|
||||||
/* URL had no protocol; was just a filename */
|
/* URL had no protocol; was just a filename */
|
||||||
|
DBG ( "URL reconstructed \"%s\"\n", info->file );
|
||||||
return info->file;
|
return info->file;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue