Henrik Nordstrom-5 wrote:
>
> Probably your redirectors are broken. What redirector are you using?
>
> Regards
> Henrik
>
>
I think so,because the redirector is just writing ,and all this working in
test mode only.
Here is the source code of "main" function.
int main(int argc, char **argv)
{
log_debug("Starting");
if(argc < 2)
{ strncpy(config,def_config,255);
log_debug("Wrong usage of program!The second argument must be config
file absolute path");
snprintf(TMP_MSG,LINE_MAXLEN,
"Using default config name '%s'",config);
log_debug(TMP_MSG);
}else if (argc == 2){
if(!(cnf_file = fopen(argv[1],"r")))
{
strncpy(config,def_config,255);
snprintf(TMP_MSG,LINE_MAXLEN,
"The specified path not found!Using default config name '%s'",config);
log_debug(TMP_MSG);
}else{
strncpy(config,argv[1],255);
}
}
//
if(config_read())
{
log_debug("Read config error!");
emergMode = 2;
}//label
log_debug("Config reading done.");
checkEmergMode();
//
log_debug("Ready to serve requests");
//
// my_debug();
set_sig_handler();
for(;;)
{
//
now = time(NULL);
//
time_t diff_time = difftime(now,last_configure);
if(((int) diff_time == reconfigure) || (((int)diff_time %
reconfigure) == 0 && (int)diff_time != 0))
{
reConfigure();
checkEmergMode();
sleep(1);
}//time
if (chdir(root_dir) != 0) {
snprintf(TMP_MSG,Q_LINE_MAXLEN, "Can not change working directory to %s",
root_dir);
log_debug(TMP_MSG);
exit(EXIT_FAILURE);
}
if (setvbuf(stdout, NULL, _IOLBF, 0) != 0) {
snprintf(TMP_MSG,Q_LINE_MAXLEN, "Cannot configure stdout buffer");
log_debug(TMP_MSG);
exit(EXIT_FAILURE);
}
//
if(fgets(p_string, LINE_MAXLEN, stdin) != NULL){
manageOutput(p_string);//bug with this function,need check
}
//
usleep(1000);
//
}//while
exit(EXIT_SUCCESS);
}
void manageOutput(char *stream){
char *sym;
sym = strtok(stream," ");
snprintf(rEntry.url,255,"%s",sym);
sym = strtok(NULL,"");
snprintf(rEntry.src_address,255,"%s",sym);
sym = strtok(NULL,"");
snprintf(rEntry.ident,255,"%s",sym);
sym = strtok(NULL,"");
snprintf(rEntry.user,UNAME_MAXLEN,"%s",sym);
sym = strtok(NULL,"");
snprintf(rEntry.method,32,"%s",sym);
if(isBlocked(rEntry.user) == 1){
snprintf(rEntry.url,LINE_MAXLEN,"%s%s",reurl_blocked,rEntry.user);
}else if(isOverdrafted(rEntry.user) != 0) {
snprintf(rEntry.url,LINE_MAXLEN,"%s%s",reurl_overdrafted,rEntry.user);
}//else redirect_all = 2;
//
if(redirect_all == 0){
fprintf(stdout, "%s %s %s %s %s",
rEntry.url,
rEntry.src_address,
rEntry.ident,
rEntry.user,
rEntry.method
);
}else fprintf(stdout,"%s","");
fflush(stdout);
}
I think all the problems are in the "manageOutput" function.
-- View this message in context: http://www.nabble.com/after-squid-shut-down-redirector-still-working-tf4488899.html#a12811785 Sent from the Squid - Users mailing list archive at Nabble.com.Received on Fri Sep 21 2007 - 01:11:54 MDT
This archive was generated by hypermail pre-2.1.9 : Mon Oct 01 2007 - 12:00:02 MDT