process.c
changeset 33 ba41bfbe87a2
parent 32 6dc2d52e4b13
equal deleted inserted replaced
32:6dc2d52e4b13 33:ba41bfbe87a2
   130 		finish_parsed( rule );
   130 		finish_parsed( rule );
   131 		finish_parsed( request );
   131 		finish_parsed( request );
   132 		return;
   132 		return;
   133 	}
   133 	}
   134 
   134 
   135 	if ( request && request->chid ) printf( "%s", request->chid );
   135 	if ( request && request->chid ) printf( "%s ", request->chid );
   136 	printf( "\n" );
   136 	printf( "ERR\n" );
   137 	fflush( stdout );
   137 	fflush( stdout );
   138 
   138 
   139 	finish_parsed( rule );
   139 	finish_parsed( rule );
   140 	finish_parsed( request );
   140 	finish_parsed( request );
   141 	return;
   141 	return;
   150 rewrite( parsed *request, parsed *rule )
   150 rewrite( parsed *request, parsed *rule )
   151 {
   151 {
   152 	if ( rule == NULL || v.debugmode >= 5 ) return;
   152 	if ( rule == NULL || v.debugmode >= 5 ) return;
   153 
   153 
   154 	if ( request->chid ) printf( "%s", request->chid );
   154 	if ( request->chid ) printf( "%s", request->chid );
   155 	if ( rule->redir ) printf( "%s:", rule->redir );
   155 	printf( "OK " );
       
   156 
       
   157 	/* Redirect */
       
   158 	if ( rule->redir ) {
       
   159 		printf( "status=%s url=", rule->redir );
       
   160 	}
       
   161 
       
   162 	/* Rewrite */
       
   163 	else {
       
   164 		printf( "rewrite-url=" );
       
   165 	}
       
   166 
   156 	printf( "%s%s", (rule->scheme ? rule->scheme : request->scheme), rule->host );
   167 	printf( "%s%s", (rule->scheme ? rule->scheme : request->scheme), rule->host );
   157 	if ( rule->port ) printf( ":%s", rule->port );
   168 	if ( rule->port ) printf( ":%s", rule->port );
   158 	printf( "%s", rule->path ? rule->path : request->path );
   169 	printf( "%s", rule->path ? rule->path : request->path );
   159 
   170 
   160 	printf("\n");
   171 	printf("\n");