On 04/20/04(09:58) "Dan Higgins" <dan@danamis..> wrote in <_A2597@delegate-en.ML_> |If I have one port open, can I use Delegate to accept connections on that |port, then look at the incoming stream, and forward on to different ports |based on the stream data? | |More specifically, I need to listen on port 8888. Then IF a http request is |made on that port, relay it to port 80. If the incoming stream is NOT http, |then relay to some other default port. On 04/21/04(03:15) "Dan Higgins" <dan@danamis..> wrote in <_A2599@delegate-en.ML_> |-P8888 |-vv |# Default server type if coming into :8888 |# :8900 will be relay for HTTP |# :8901 will be relay for whatever is not HTTP |SERVER=delegate |FORWARD=tcprelay://localhost:8900-_-http:*:* |FORWARD=tcprelay://localhost:8901-_-*:*:* |--------END-------- ... |At first I was putting everything into one file, but it seems you can't mix |"delegate" and other types of servers. It could be reasonable that, reading the Manual.htm, you thought that FORWARD can be used for such routing based on protocol. But actually the protocol on the client-side is fixed with SERVER parameter, and the protocol to be used for routing is the server-side protocol. For example, when the client-side protocol is HTTP by SERVER=http, then the routing can be switched with "GET protocol://server" or so. When the client-side protocol is "delegate", the special protocol used only inter-DeleGate communication, the server-side protocol is specified as "SERVER protocol://server" command. Thus there is no way to do routing based on client-side protocol using built-in features of DeleGate, but you can do it by an "external filter". The enclosed program "pswitch" reads incoming stream and if it is not in HTTP, then output "CONNECT host:port<CR><LF>" before the real input. Attaching this program as a external filter to HTTP-DeleGate like follows, non-HTTP request is forwarded to "localhost 8889" where it should be cared. % delegated -P8888 -v SERVER=http REMITTABLE=ssltunnel FFROMCL="-p,pswitch localhost 8889" Cheers, Yutaka -- D G Yutaka Sato <pfqcabdyi-mykgh4444btw.ml@delegate.org> http://delegate.org/y.sato/ ( - ) National Institute of Advanced Industrial Science and Technology _< >_ 1-1-4 Umezono, Tsukuba, Ibaraki, 305-8568 Japan Do the more with the less -- B. Fuller /*------ pswitch.c ---------------------------------------------------*/ #include <stdio.h> main(ac,av) char *av[]; { char com[64],con[64]; int rcc; if( ac < 3 ){ fprintf(stderr,"Usage: %s host port\n",av[0]); exit(-1); } if( (rcc = read(0,com,4)) < 0 ) exit(-1); com[rcc] = 0; if( strcasecmp(com,"GET ") == 0 || strcasecmp(com,"HEAD") == 0 || strcasecmp(com,"POST") == 0 ){ }else{ sprintf(con,"CONNECT %s:%s\r\n",av[1],av[2]); write(1,con,strlen(con)); } write(1,com,rcc); exit(0); } /*--------------------------------------------------------------------*/