mIRC Home    About    Download    Register    News    Help

Print Thread
#106212 26/12/04 03:04 PM
Joined: Dec 2004
Posts: 12
D
Depodra Offline OP
Pikka bird
OP Offline
Pikka bird
D
Joined: Dec 2004
Posts: 12
Hi... I'm trying to request that my script reads fileserver.txt on my http server. I try using

sockwrite -n $sockname GET updates/filserver.txt
sockwrite -n $sockname Host: depodra.afraid.org
sockwrite -n $sockname Connection: keep-alive
sockwrite $sockname $crlf

But the $crlf returned is,
Code:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>400 Bad Request</title>
</head><body>
<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not understand.<br /></p>
<address>Apache/2.0.52 (Win32) mod_ssl/2.0.52 OpenSSL/0.9.7d PHP/5.0.2 Server at localhost Port 80</address>

Can anyone help me please?

#106213 26/12/04 09:07 PM
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
Your first line should probably be

sockwrite -n $sockname GET [color:red]/updates/fileserver.txt HTTP/1.0[/color]

This of course assumes that the file http://depodra.afraid.org/updates/fileserver.txt exists.

#106214 26/12/04 11:34 PM
Joined: Dec 2004
Posts: 12
D
Depodra Offline OP
Pikka bird
OP Offline
Pikka bird
D
Joined: Dec 2004
Posts: 12
mmm, i had fixed that b4 and it just returned,
Code:
HTTP/1.1 200 OK
Date: Sun, 26 Dec 2004 23:29:59 GMT
Server: Apache/2.0.52 (Win32) mod_ssl/2.0.52 OpenSSL/0.9.7d PHP/5.0.2
X-Powered-By: PHP/5.0.2
Content-Length: 61
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=ISO-8859-1
-
* /echo: insufficient parameters (line 37, script3.mrc)
-

Before, i had it listing the HTML code of the index.php file of the host instead of the new fileserver.html document... I've updated it and i currently have...

Code:
;FileServ Updater
alias update {
  if ($sock(download).name != download) {
    sockopen download 203.219.139.50 80
    echo -a 10The socket:7 download10 :is now connected.
    set %extention .txt
  }
  else {
    sockclose download
    echo -a 10Closed socket:7 download
  }
}
alias download {
  if (!$1) {
    if (!$sock(download)) { sockopen download 203.219.139.50 80 }
    echo -a Updating
  }
}
on *:SOCKOPEN:download:{
  if ($sockerr > 0) {
    sockclose $sockname
    echo -a Update Error
    if ($sockerr == 3) {                                                     
      if (!$sock($sockname)) { sockopen download depodra.afraid.org 80 }
    }
  }
  else {
    sockwrite -n $sockname GET /updates/fileserver.php HTTP/1.1
    sockwrite -n $sockname Host: 203.219.139.50
    sockwrite -n $sockname Connection: keep-alive
    sockwrite $sockname $crlf
  }
}
on *:SOCKREAD:download:{
  sockread %ver
  tokenize 32 %ver
  echo -a %ver
  if (Version: isin %ver) {
    if ($2 > %fservver) {
      window @Download
      aline @Download 10 Current Version: %fservver
      aline @Download 10 Downloadable Version: $2
      aline @Download 10 Downloading New Version...
      sockclose $sockname
    }
    elseif ($2 == %fservver) {
      echo -a No new download is available...
      echo -a Closing Socket
      sockclose $sockname
    }
  }
  else {
    unset %ver
  }
}


but it still lists:
Code:
The socket: download :is now connected
HTTP/1.1 200 OK
Date: Sun, 26 Dec 2004 23:29:59 GMT
Server: Apache/2.0.52 (Win32) mod_ssl/2.0.52 OpenSSL/0.9.7d PHP/5.0.2
X-Powered-By: PHP/5.0.2
Content-Length: 61
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=ISO-8859-1


by the way, the host is correct (203.219.139.50)

#106215 27/12/04 12:24 AM
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
This is a common problem with mIRC sockets. When you use /sockread %variable, mIRC reads up to the next CRLF. Now, because your text is not followed by a CRLF, mIRC doesn't read it at all.

To solve the problem, fileserver.php needs to output a \r\n (CRLF) after the line, like this:

...
...
echo "<p>Available: 3 http:[/i]//203.219.139.50/updates/general.mrc</p>";
[color:blue]echo "\r\n";
[/color]

#106216 27/12/04 12:52 AM
Joined: Dec 2004
Posts: 12
D
Depodra Offline OP
Pikka bird
OP Offline
Pikka bird
D
Joined: Dec 2004
Posts: 12
whoa, thankyou VERY much smile
now i just gotta figure out how to download the files lol wink


Link Copied to Clipboard