version 1.7, 1996/01/24 20:12:46
|
version 1.8, 1996/01/31 22:44:42
|
Line 286 PRIVATE int timeout_handler (HTRequest *
|
Line 286 PRIVATE int timeout_handler (HTRequest *
|
return HT_OK; |
return HT_OK; |
} |
} |
|
|
|
/* proxy_handler |
|
** --------------- |
|
** This function is registered to be called before a request is issued |
|
** We look for redirection for proxies and gateways |
|
** returns HT_LOADED We already have this |
|
** HT_ERROR We can't load this |
|
** HT_OK Success |
|
*/ |
|
PRIVATE int proxy_handler (HTRequest * request, int status) |
|
{ |
|
HTParentAnchor *anchor = HTRequest_anchor(request); |
|
char * addr = HTAnchor_address((HTAnchor *) anchor); |
|
char * newaddr = NULL; |
|
if ((newaddr = HTProxy_find(addr))) { |
|
StrAllocCat(newaddr, addr); |
|
HTRequest_setProxying(request, YES); |
|
HTAnchor_setPhysical(anchor, newaddr); |
|
} else if ((newaddr = HTGateway_find(addr))) { |
|
char * path = HTParse(addr,"",PARSE_HOST+PARSE_PATH+PARSE_PUNCTUATION); |
|
/* Chop leading / off to make host into part of path */ |
|
char * gatewayed = HTParse(path+1, newaddr, PARSE_ALL); |
|
HTRequest_setProxying(request, NO); |
|
HTAnchor_setPhysical(anchor, gatewayed); |
|
free(path); |
|
free(gatewayed); |
|
} else |
|
HTRequest_setProxying(request, NO); |
|
FREE(newaddr); |
|
FREE(addr); |
|
return HT_OK; |
|
} |
|
|
/* ------------------------------------------------------------------------- */ |
/* ------------------------------------------------------------------------- */ |
/* HTEXT INTERFACE */ |
/* HTEXT INTERFACE */ |
/* ------------------------------------------------------------------------- */ |
/* ------------------------------------------------------------------------- */ |
Line 557 int main (int argc, char ** argv)
|
Line 589 int main (int argc, char ** argv)
|
HTConversion_add(list, "application/x-www-rules", "*/*", HTRules, |
HTConversion_add(list, "application/x-www-rules", "*/*", HTRules, |
1.0, 0.0, 0.0); |
1.0, 0.0, 0.0); |
HTRequest_setConversion(rr, list, YES); |
HTRequest_setConversion(rr, list, YES); |
|
HTAlert_add(HTConfirm, HT_A_CONFIRM); |
if (HTLoadAnchor((HTAnchor *) ra, rr) != YES) |
if (HTLoadAnchor((HTAnchor *) ra, rr) != YES) |
if (SHOW_MSG) TTYPrint(TDEST, "Can't access rules\n"); |
if (SHOW_MSG) TTYPrint(TDEST, "Can't access rules\n"); |
HTConversion_deleteAll(list); |
HTConversion_deleteAll(list); |
HTRequest_delete(rr); |
HTRequest_delete(rr); |
|
HTAlert_delete(HTConfirm); |
FREE(rules); |
FREE(rules); |
} |
} |
|
|
Line 572 int main (int argc, char ** argv)
|
Line 606 int main (int argc, char ** argv)
|
} |
} |
} |
} |
|
|
/* Set up the output */ |
|
HTRequest_setOutputStream(mr->request, HTFWriter_new(mr->output, YES)); |
|
|
|
/* Log file specifed? */ |
/* Log file specifed? */ |
if (mr->logfile) HTLog_open(mr->logfile, YES, YES); |
if (mr->logfile) HTLog_open(mr->logfile, YES, YES); |
|
|
Line 588 int main (int argc, char ** argv)
|
Line 619 int main (int argc, char ** argv)
|
} |
} |
|
|
/* Register a call back function for the Net Manager */ |
/* Register a call back function for the Net Manager */ |
|
HTNetCall_addBefore(proxy_handler, 0); |
HTNetCall_addAfter(terminate_handler, HT_ALL); |
HTNetCall_addAfter(terminate_handler, HT_ALL); |
|
|
/* Set timeout on sockets */ |
/* Set timeout on sockets */ |