Hi,all,
 
I added the following code in the mod_proxy.c of Apache1.3.12:

static int proxy_handler(request_rec *r)
{
   ...
 for (direct_connect = ii = 0; ii < conf->dirconn->nelts &&!direct_connect;ii++) {
    direct_connect = list[ii].matcher(&list[ii], r);
}
#if DEBUGGING
ap_log_rerror(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, r,
     (direct_connect) ? "NoProxy for %s" : "UseProxy for %s", r->uri);
#endif
    }


/*###########################################################*/
/* A user will be limited to access sites if he has no money */
if(check_user_no_money(r)==1){
hp=ap_pgethostbyname(r->pool,r->hostname);
if(hp){
int index=-1;

ipaddress=inet_ntoa(*(struct in_addr *) hp->h_addr_list[0]);

index=IP_StrInRangeTable(GlobalTable, ipaddress);
   
if( index >=0 ){
/* Founded! it is a free-charge IP. Nothing to do!*/
}
else{ /* Not founded and error! redirect!*/
char *newuri;
if(No_Money_Uri) newuri=ap_escape_uri(r->pool,No_Money_Uri);
else{
const char *ServerName = NULL;
ServerName=ap_get_server_name(r);
                    newuri=ap_pstrcat(r->pool,"http://",ServerName,"/",NULL);
newuri=ap_escape_uri(r->pool,newuri);
 }
ap_internal_redirect(newuri,r);
return OK;
}
}  
}
/*###############################################################*/


/* firstly, try a proxy, unless a NoProxy directive is active */

    if (!direct_connect)
for (i = 0; i < proxies->nelts; i++) {
    p = strchr(ents[i].scheme, ':'); /* is it a partial URL? */
    if (strcmp(ents[i].scheme, "*") == 0 ||
(p == NULL && strcasecmp(scheme, ents[i].scheme) == 0) ||

   ...
}

  When Apache execute the function of ap_internal_redirect(newuri,r),
the error_log file will add two record, for example:
  [Thu May 11 23:02:14 2000] [notice] child pid 7303 exit signal Segmentation
fault (11)
[Thu May 11 23:24:35 2000] [notice] caught SIGTERM, shutting down

  But, if I din't compile mod_ssl into Apache core, there is no error,
and ap_internal_redirect function will run normally.
  Help me,please. Thank you.

Best regards,
Ironbugs

Reply via email to