char leks[5], sep[2], res[MAXLEN];
char hour[15];
char source[128], list[128];
- char url[MAX_URL_LEN];
+ char full_url[MAX_URL_LEN];
+ const char *url;
char user[MAX_USER_LEN];
char ip[45];
long long int lmon, lday, lyear;
int mon, day, year;
int idata=0;
int i;
- char *str;
bool id_is_ip;
struct getwordstruct gwarea;
struct getwordstruct gwarea1;
list[0]='\0';
ip[0]='\0';
user[0]='\0';
- url[0]='\0';
+ full_url[0]='\0';
while(strcmp(leks,"end") != 0) {
if (getword(leks,sizeof(leks),&gwarea1,'#')<0) {
debuga(_("Invalid \"redirector_log_format\" option in your sarg.conf (missing # at end of tag)\n"));
}
strcpy(user,res);
} else if(strcmp(leks,"url") == 0) {
- if (strlen(res)>=sizeof(url)) {
+ if (strlen(res)>=sizeof(full_url)) {
debuga(_("URL too long in redirector log file %s\n"),wentp);
exit(EXIT_FAILURE);
}
- strcpy(url,res);
+ strcpy(full_url,res);
}
}
}
debuga(_("Invalid redirected list in file %s\n"),wentp);
exit(EXIT_FAILURE);
}
- if (getword_skip(MAXLEN,&gwarea,' ')<0 || getword_limit(url,sizeof(url),&gwarea,' ')<0) {
+ if (getword_skip(MAXLEN,&gwarea,' ')<0 || getword_limit(full_url,sizeof(full_url),&gwarea,' ')<0) {
debuga(_("Invalid URL in file %s\n"),wentp);
exit(EXIT_FAILURE);
}
debuga(_("Invalid user in file %s\n"),wentp);
exit(EXIT_FAILURE);
}
- /*
- The URL may be "http://url:port/data" if the method is GET or simply "url:port/" if the method is CONNECT.
- The following code removes the protocol:// if it is detected and always truncates the URL after the domain name.
- It will fail if the URL doesn't start with the protocol and contains two consecutive / in the path (i.e.
- the URL is not normalized).
- */
- str=strchr(url,'/');
- if (str) {
- if (str[1]=='/') {
- str+=2;
- for (i=0 ; *str && *str!='/' ; i++) url[i]=*str++;
- url[i]='\0';
- } else {
- *str='\0';
- }
- }
}
+ url=process_url(full_url,false);
//sprintf(warea,"%04d%02d%02d",year,mon,day);