I need to tunnel a website from the internet to another local network (no I cant run NAT and so forth). But the problem with a tunnel is that it will send the wrong HOST option. So since the middle computer is running mirc I thought I would contruct a sort of a tunnel script for mirc.

It needs to accept connections on a port and when an connection i received open another connection to the website, then it should just tell the other one what the other one said. So for instance, the socklisten conneciton says "GET /", it should then send "GET /" to the website connection... Here is how my script looks like.


on 1:sockread:expressen:{
if ($sockerr > 0) goto end
:nextread
sockread %temphttp
if ($sockbr == 0) goto end
if (%temphttp == $null) %temphttp = -
sockwrite -n amino2 %temphttp
goto nextread
:end
}
alias httpredirect {
sockopen expressen xhtml.expressen.se 80
socklisten amino 90
}
on 1:socklisten:amino: {
sockaccept amino2
}
on 1:sockread:amino2:{
if ($sockerr > 0) goto end
:nextread
sockread %temphttp2
if ($sockbr == 0) goto end
if (%temphttp2 == $null) %temphttp2 = -
if (172.155.155.10:90 isin %temphttp2) { sockwrite -n expressen Host: xhtml.expressen.se }
else sockwrite -n expressen %temphttp2
goto nextread
:end
}

Now, when I do a /httpredirect and then try to access http://172.155.155.10:90 I get various errors. I have changed something to mess up the script completly, since now I get a lot of /sockwrite: line too long (line 7, script2.mrc) and /sockwrite: 'amino2' queue would exceed 16384 bytes (line 7, script2.mrc).. Yesterday it would send the first page (index.htm) but it would add some weird charectors here and there (I dont mind this since they dont have tags they wont be displayed anyway) but after it was received the web browser would still be expecting more, so I am thinking that it is expecting a terminate command or simular?

What do I need to do to get this to worK?