Author Topic: Revenge of the TCP object [Solved]  (Read 3310 times)

Please split it over a few lines, and don't put a space after \r\n.

I also said it should end in \r\n\r\n

Please split it over a few lines, and don't put a space after \r\n.

I also said it should end in \r\n\r\n
Like this:
Code: [Select]
%req = "GET /u/74047590/ColorSetMaker_Version.txt HTTP/1.1\r\n
Host: dl.dropbox.com\r\n
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20100101 Firefox/12.0\r\n Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n Accept-Language: en-us,en;q=0.5\r\n
Connection: keep-alive\r\n
If-None-Match: 23n\r\n\r\n";
It does end in \r\n\r\n

No, doing that will force a bunch of \n into the string, or whatever depending on your OS.

Two ways you can do it
%req = "xyz...";
%req = %req @"xyz...";
%req = %req @"xyz...";

or

%req1 = "xyz...";
%req2 = "xyz...";
%req3 = "xyz...";
%req = %req1 @ %req2 @ %req3;

No, doing that will force a bunch of \n into the string, or whatever depending on your OS.

Two ways you can do it
%req = "xyz...";
%req = %req @"xyz...";
%req = %req @"xyz...";

or

%req1 = "xyz...";
%req2 = "xyz...";
%req3 = "xyz...";
%req = %req1 @ %req2 @ %req3;
Code: [Select]
%req1 = "GET /u/74047590/ColorSetMaker_Version.txt HTTP/1.1\r\n";

%req2 = "Host: dl.dropbox.com\r\n";

%req3 = "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20100101 Firefox/12.0\r\n Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n";

%req4 = "Accept-Language: en-us,en;q=0.5\r\n";

%req5 = "Connection: keep-alive\r\n";

%req6 = "If-None-Match: 23n\r\n\r\n";

%req = %req1 @ %req2 @ %req3 @ %req4 @ %req5 @ %req6;


%this.send(%req);

What? now it gets this result:
1:
2:
3: 8369
4: HTTP/1.1 304 NOT MODIFIED
1:
2:
3: 8369
4: Server: nginx/1.0.14
1: GMT
2: G
3: 8369
4: Date: Tue, 08 May 2012 17:47:09 GMT
1:
2:
3: 8369
4: Content-Type: text/plain; charset=ascii
1:
2:
3: 8369
4: Connection: keep-alive
1:
2:
3: 8369
4: etag: 23n
1:
2:
3: 8369
4: pragma: no-cache
1:
2:
3: 8369
4: cache-control: no-cache
1:
2:
3: 8369
4:

Take out the If-None-Match line

Take out the If-None-Match line
Now it can't connect to anything.

The "Accept" field disappeared again.

The "Accept" field disappeared again.
What do you mean?

I fiddled around (alot), and I found that this worked perfectly when I used it:
%Req = "GET " @ %File @ " HTTP/1.1\r\nHost: " @ %Server @ "\r\n\n";
Try this.


missing an \r
It worked perfectly on all the websites I tried, and works on both mac and PC.

Try this.
missing an \r
They both return the same result:
1:
2:
3: 8369
4: HTTP/1.1 200 OK
1:
2:
3: 8369
4: Server: nginx/1.0.14
1: GMT
2: G
3: 8369
4: Date: Thu, 10 May 2012 11:23:37 GMT
1:
2:
3: 8369
4: Content-Type: text/plain; charset=ascii
1:
2:
3: 8369
4: Connection: keep-alive
1:
2:
3: 8369
4: content-length: 22
1:
2:
3: 8369
4: x-robots-tag: noindex,nofollow
1:
2:
3: 8369
4: accept-ranges: bytes
1:
2:
3: 8369
4: etag: 23n
1:
2:
3: 8369
4: pragma: public
1:
2:
3: 8369
4: cache-control: max-age=0
1:
2:
3: 8369
4:


Code: (With Kalphiter's \r) [Select]
%file = "/u/74047590/ColorSetMaker_Version.txt";

%server = "dl.dropbox.com";

%req = "GET " @ %File @ " HTTP/1.1\r\nHost: " @ %Server @ "\r\n\r\n";

Not sure why people are still trying to "fix" the request structure - the fact that it's displaying a content-length header of 22 and not actually displaying content indicates you've forgeted up your code. Remove the disconnect() calls in your script and see what happens.

« Last Edit: May 10, 2012, 09:30:56 AM by Ephialtes »

Not sure why people are still trying to "fix" the request structure - the fact that it's displaying a content-length header of 22 and not actually displaying content indicates you've forgeted up your code. Remove the disconnect() calls in your script and see what happens.
No result, your wisdom is appreciated.