Blockland Forums > Modification Help
Revenge of the TCP object [Solved]
jes00:
So I made this TCP object but it's not going to the url I want or something.
--- Code: ---$ColorSetMaker::Version = "0";
function ColorSetMaker_VersionCheck()
{
if(isFile("./RTBinfo.txt") && (isFile("add-ons/System_ReturnToBlockland/client.cs")))
{
return;
}
if(isObject(ColorSetMaker_Downloader))
ColorSetMaker_Downloader.delete();
new TCPObject(ColorSetMaker_Downloader);
ColorSetMaker_Downloader.connect("dl-web.dropbox.com:80");
}
function ColorSetMaker_Downloader::onConnected(%this)
{
//https://dl-web.dropbox.com/get/ColorSetMaker_Version.txt?w=1fc5f9ab
%req = "/get/ColorSetMaker_Version.txt?w=1fc5f9ab";
//%req = "GET/get/ColorSetMaker_Version.txt?w=1fc5f9ab" SPC "HTTP/1.0\nHost: dl-web.dropbox.com\n\n";
%this.send(%req);
}
function ColorSetMaker_Downloader::onConnectFailed(%this)
{
MessageBoxOK("Attention!", "Unable to connect to the online version information.");
}
function ColorSetMaker_Downloader::onDisconnect(%this)
{
if(!$ColorSetMaker_Connected)
{
MessageBoxOK("Attention!", "Unable to connect to the online version information.");
}
else
{
$ColorSetMaker_Connected = "";
}
}
function ColorSetMaker_Downloader::onLine(%this, %line)
{
echo("\c21:" SPC getSubStr(getWord(%line, 6), 0, 6));
echo("\c22:" SPC getSubStr(getWord(%line, 6), 0, 1));
echo("\c23:" SPC %this);
echo("\c24:" SPC %line);
if(getSubStr(getWord(%line, 6), 0, 6) == $ColorSetMaker::Version)
{
$ColorSetMaker_connected = 1;
ColorSetMaker_Downloader.disconnect();
ColorSetMaker_VersionResult(false);
}
else
{
if(getSubStr(getWord(%line, 6), 0, 6) !$= "1 BETA")
{
$ColorSetMaker_AvailableVersion = "1 BETA";
}
else
{
$ColorSetMaker_AvailableVersion = getSubStr(getWord(%line, 6), 0, 1);
}
ColorSetMaker_Downloader.disconnect();
ColorSetMaker_BersionResult(true);
}
}
function ColorSetMaker_VersionResult(%x)
{
if(%x)
{
MessageBoxOk("Good News!", "Your Color Set Maker mod is up to date.");
}
else
{
MessageBoxOK("Attention!", "There is a more current version of your Color Set Maker mod.\n\nYour Version:" SPC $ColorSetMaker::Version @ "\n\nAvailable: " @ $ColorSetMaker_AvailableVersion);
}
}
--- End code ---
It echos the following in the console:
1:
2:
3: 8366
4:
1:
2:
3: 8366
4: <html>
1:
2:
3: 8366
4: <head><title>Dropbox - 4xx</title>
1:
2:
3: 8366
4: <link href="https://www.dropbox.com/static/css/main.css" rel="stylesheet" type="text/css">
1:
2:
3: 8366
4: <link rel="shortcut icon" href="/static/images/favicon.ico"/>
1:
2:
3: 8366
4: </head>
1:
2:
3: 8366
4: <body style="background-color:#fff">
1:
2:
3: 8366
4: <br/><br/>
1:
2:
3: 8366
4: <div align="center">
1:
2:
3: 8366
4: <table><tr><td width="600px">
1:
2:
3: 8366
4: <center><img id="errorimage" src="/static/images/psychobox.png"/></center>
1:
2:
3: 8366
4: <div id="errorbox">
1: you're
2: y
3: 8366
4: <h1>Error (4xx)</h1>We can't find the page you're looking for. Check out our <a href="https://www.dropbox.com/help">Help Center</a> and <a href="http://forums.dropbox.com">forums</a> for help, or head back to <a href="https://www.dropbox.com/home">home</a>.
1:
2:
3: 8366
4: </div>
1:
2:
3: 8366
4: </td></tr></table>
1:
2:
3: 8366
4: </div>
1:
2:
3: 8366
4:
1:
2:
3: 8366
4: <script type="text/javascript" src="/static/javascript/external/dropbox-mini.js"></script>
1:
2:
3: 8366
4: <script>
Kalphiter:
\r\n for newlines in the HTTP protocol headers
jes00:
--- Quote from: Kalphiter on May 05, 2012, 06:33:11 PM ---\r\n for newlines in the HTTP protocol headers
--- End quote ---
What?
Kalphiter:
Actually that wasn't even the first problem.
%req = "/get/ColorSetMaker_Version.txt?w=1fc5f9ab";
Not a valid request
Slicks555:
as ^ said, that's not a valid request.
http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Request_message