if(fp_log && ilf!=ILF_Sarg)
fprintf(fp_log, "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n",dia,hora,user,ip,url,tam,code,elap,smartfilter);
-
totregsg++;
if(download_flag && strstr(code,"DENIED") == 0) {
int url_len;
int ourl_size=0;
int ourltt_size=0;
+ int same_url;
struct getwordstruct gwarea;
struct longlinestruct line;
if(UserAgentLog[0] != '\0' && email[0] == '\0') useragent();
sprintf(wdirname,"%s/sarg-general",dirname);
- if((fp_gen=MY_FOPEN(wdirname,"a"))==NULL){
+ if((fp_gen=MY_FOPEN(wdirname,"w"))==NULL){
fprintf(stderr, "SARG: (report) %s: %s\n",text[45],wdirname);
exit(1);
}
strcpy(oldacchora,acchora);
rtotal++;
}
+ same_url=(strcmp(oldurl,accurl) == 0);
if(site[0] != '\0') {
if(strcmp(oldaccuser,accuser) != 0){
oucache=0;
}
} else {
- if(strcmp(oldurl,accurl) != 0 || strcmp(oldaccuser,accuser) != 0){
+ if(!same_url || strcmp(oldaccuser,accuser) != 0){
if(strstr(oldacccode,"DENIED") != 0)
strcpy(oldmsg,text[46]);
else
strcpy(oldacccode,acccode);
strcpy(oldaccip,accip);
- url_len=strlen(accurl);
- if (url_len>=ourl_size) {
- ourl_size=url_len+1;
- oldurl=realloc(oldurl,ourl_size);
- if (!oldurl) {
- debuga(_("Not enough memory to store the url"));
- exit(1);
+ if (!same_url) {
+ url_len=strlen(accurl);
+ if (url_len>=ourl_size) {
+ ourl_size=url_len+1;
+ oldurl=realloc(oldurl,ourl_size);
+ if (!oldurl) {
+ debuga(_("Not enough memory to store the url"));
+ exit(1);
+ }
}
+ strcpy(oldurl,accurl);
}
- strcpy(oldurl,accurl);
strcpy(oldaccdia,accdia);
strcpy(oldacchora,acchora);
}
- bzero(user,sizeof(user));
fclose(fp_in);
- unlink(tmp3);
longline_free(&line);
if (oldurltt) free(oldurltt);
+ unlink(tmp3);
+ bzero(user,sizeof(user));
}
closedir(dirp);
{
fprintf(fp_gen,"%s\t%lld\t%lld\t%s\t%s\t%s\t%s\t%lld\t%lld\t%lld\n",user,nacc,nbytes,url,ip,hora,dia,nelap,incache,oucache);
return;
-
}
static void grava_SmartFilter(const char *dirname, const char *user, const char *ip, const char *data, const char *hora, const char *url, const char *smart)