Author Topic: TCPObjects being handicapped (Me being handicapped)  (Read 956 times)

For some reason whenever I use an ampersand with an HttpObject.get it converts it to %26 in the request thus making the web server not recognize it. Is there another method to do this without this conversion?
« Last Edit: February 25, 2014, 10:37:19 PM by Scriode »

HTTPObject instances always URL-encode characters.

Is there another method to do this without this conversion?

Use a TCPObject.

Use a TCPObject.
So how would I read a page like http? I couldn't manage to find a solution.
Never mind I figured it out.

Actually I ran into another problem... So when I send the thing and echo the lines it gives me this.

Then I try to remove that it gives a bunch of spaces from the \r\n and I can't get rid of them.

« Last Edit: February 25, 2014, 12:22:30 AM by Scriode »

The content does not begin until after two new lines/carriage returns.

The content does not begin until after two new lines/carriage returns.
Then why am I getting all the junk that I do not need?

Here is what I'm doing if that helps
Code: [Select]
function ParseTCPFromExpress(%lines) { //Should be parsing the webpage text
for(%i = 0; %i < strlen(%lines); %i++) {
if(getsubstr(%lines,%i,1) $= "^")
return getsubstr(%lines, %i+1, strlen(%lines)-%i-1); //Returns the rest without the "^"
}
}

function ServerCmdPingTCP(%client) {
TestTCP();
}
function TestTCP() {
%obj = new TCPObject(ServerPing) {};
%obj.connect("localhost:3000/ping");
}
function ServerPing::onConnected(%this) {
echo("Connected");
%this.send("GET /Ping HTTP/1.0\r\nHost:localhost\r\n\r\n");
}
function ServerPing::onConnectFailed(%this) {
echo("Failed");
%this.schedule(10,delete);
}
function ServerPing::onLine(%this, %lines) {
announce(ParseTCPFromExpress(%lines));
}
« Last Edit: February 25, 2014, 09:28:56 PM by Scriode »

Just wait until the first blank line, then start parsing. This will cut out all the headers.

When I used
Code: [Select]
announce("Bla" @ ParseTCPFromExpress(%lines)); This is what I got...

I have no idea why it's doing this.

Just wait until the first blank line, then start parsing. This will cut out all the headers.
Also same thing happens.

I am a dumb stuff. Nevermind. The problem was I was doing it ::onLine so it kept repeating itself for every line. Ignore everything now. It's fixed.
« Last Edit: February 25, 2014, 10:48:18 PM by Scriode »