// url.c
void read_hostalias(const char *Filename);
void free_hostalias(void);
-const char *process_url(char *url);
+const char *process_url(char *url,bool full_url);
void url_hostname(const char *url,char *hostname,int hostsize);
// usage.c
} else
download_flag=false;
- url=process_url(full_url);
+ url=process_url(full_url,LongUrl);
if (!url || url[0] == '\0') continue;
if(addr[0] != '\0'){
free((void *)alias->Alias);
free(alias);
}
+ FirstAlias=NULL;
}
/*!
Get the part of the URL necessary to generate the report.
\param url The URL as extracted from the report.
+\param full_url \c True to keep the whole URL. If \c false,
+the URL is truncated to only keep the host name and port number.
*/
-const char *process_url(char *url)
+const char *process_url(char *url,bool full_url)
{
char *str;
const char *start;
// remove any scheme:// at the beginning of the URL (see rfc2396 section 3.1)
for (str=url ; *str && (isalnum(*str) || *str=='+' || *str=='-' || *str=='.') ; str++);
- if (*str==':' && str[1]=='/') {
- url=str+1;
+ if (*str==':' && str[1]=='/' && str[2]=='/') {
+ url=str+3;
while (*url=='/') url++;
}
start=url;
- if (!LongUrl) {
+ if (!full_url) {
for (str=url ; *str && *str!='/' ; str++);
if (*str=='/') *str='\0';
if (FirstAlias)