mIRC Home    About    Download    Register    News    Help

Print Thread
Sockets and links with many dots in them #206868 27/11/08 01:29 PM
Joined: Nov 2008
Posts: 6
D
Def1ant Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
D
Joined: Nov 2008
Posts: 6
Hi,

So basicly I'm trying to get a file from my website with mirc by using sockets (sock open, read & write etcetc). While this does work for 'normal' websites (read: google.com etc), this doesn't for my own. I'm guessing this is because i used cheap hosting, which is shared. Due to this, the real domain is just fake, and points towards a directory on a shared domain. Asking a file on my domain won't work, i need to use the indirect path i guess.. however, here are too many dots in the link which caused mirc to get confused :p

In short:
I want to read the file: www.takkra.nl/cb/test.txt
This only goes via http://takkra.nl.server2.starthosting.nl/cb/test.txt
But as you can see there's too many dots in this link.

Is there anyone that knows a workaround for this? Below I've added a simple script to try n get it to work..

Code:
Alias Update {
  if ($sock(update)) { sockclose update }
  sockopen update takkra.nl.server2.starthosting.nl 80
  :end
}

on *:sockopen:update:{
  sockwrite -n update GET /cb/test.txt HTTP/1.0
  sockwrite -n update Host: takkra.nl.server2.starthosting.nl 80
  sockwrite -n update $crlf
}

on *:sockread:update:{
  sockread %update
  if %update { echo -a %update }
}

Last edited by Def1ant; 27/11/08 01:42 PM.
Re: Sockets and links with many dots in them [Re: Def1ant] #206869 27/11/08 02:52 PM
Joined: Oct 2005
Posts: 1,741
G
genius_at_work Offline
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
Most likely is that the server is expecting some other header data from your socket connection. Such as the browser name, content type, etc. You may be able to use a http analyzer to figure out what it is looking for.

-genius_at_work

Re: Sockets and links with many dots in them [Re: Def1ant] #206871 27/11/08 03:10 PM
Joined: Sep 2008
Posts: 62
_
_Memo Offline
Babel fish
Offline
Babel fish
_
Joined: Sep 2008
Posts: 62
cleaned up your code and malformed syntaxes in the HTTP requests, it works now.

Code:
Alias Update {
  if ($sock(update)) sockclose update
  sockopen update www.takkra.nl 80
}

on *:sockopen:update:{
  sockwrite -n update GET /cb/test.txt HTTP/1.1
  sockwrite -n update Host: www.takkra.nl
  sockwrite -n update $crlf
}

on *:sockread:update:{
  var %r
  while (reading) {
    sockread -f %r
    if ($sockerr) {
      echo -a Socket error $sockerr
      break
    }
    echo -a Data: %r
    if (!$sockbr) break 
  }
}



Re: Sockets and links with many dots in them [Re: _Memo] #206872 27/11/08 03:22 PM
Joined: Nov 2008
Posts: 6
D
Def1ant Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
D
Joined: Nov 2008
Posts: 6
Aha, thanks for the help. Was affraid the many dots were the issue, instead it was bad coding. Thank you wink