mIRC Homepage
Posted By: Spitfire3292 Sockread Bug - 09/04/07 01:54 AM
When I socket to http://runehead.com/feeds/lowtech/searchuser.php?user=Zezima

Replace Zezima with any user in Runescape if you would like (That's besides the point)

The source code displays this

Quote:
@@start
The Forgotten Legion|http://www.theforgottenlegion.co.nr
Slayers of Chaos|http://z6.invisionfree.com/The_Slayers_of_Chaos/
Anzacs MB Pking Team|http://z6.invisionfree.com/Anzacs/index.php?act=idx
World 3|http://runescape.com
Links|
The Holy Kingdom|http://www.NoneATM.com
gloryofpures|http://z4.invisionfree.com/gloryofpures
@@end


But the interesting thing about when I echo the sockread using a variable. I get this.

Quote:
HTTP/1.1 200 OK
Date: Mon, 09 Apr 2007 01:47:29 GMT
Server: Apache/2.2.3 (Unix)
X-Powered-By: PHP/5.2.0
Content-Length: 338
Connection: close
Content-Type: text/html
@@start
The Forgotten Legion|http://www.theforgottenlegion.co.nr
Slayers of Chaos|http://z6.invisionfree.com/The_Slayers_of_Chaos/
Anzacs MB Pking Team|http://z6.invisionfree.com/Anzacs/index.php?act=idx
World 3|http://runescape.com
Links|
The Holy Kingdom|http://www.NoneATM.com
gloryofpures|http://z4.invisionfree.com/gloryofpures


Notice how there isn't an @@end. This isn't the case when I use bvars. When I use bvars I get this.

Quote:
HTTP/1.1 200 OK
Date: Mon, 09 Apr 2007 01:49:21 GMT
Server: Apache/2.2.3 (Unix)
X-Powered-By: PHP/5.2.0
Content-Length: 338
Connection: close
Content-Type: text/html

@@start
The Forgotten Legion|http://www.theforgottenlegion.co.nr
Slayers of Chaos|http://z6.invisionfree.com/The_Slayers_of_Chaos/
Anzacs MB Pking Team|http://z6.invisionfree.com/Anzacs/index.php?act=idx
World 3|http://runescape.com
Links|
The Holy Kingdom|http://www.NoneATM.com
gloryofpures|http://z4.invisionfree.com/gloryofpures
@@end


Notice how @@end is now there. My friend had a similar problem with another website which I do not know the name of right now and said bvars fixed it, and sure enough it did. I know this is a problem with mIRC because 1) It works with bvars and 2) HTTP Sniffer picks it up.

My friend said this might be the reason of the bug:
Quote:
<Marius> mIRC cuts out the last line, it's because it closes the socket too soon, thinking the document is empty because the document data is read as part of the document, thus making it fail to read the last line
<Marius> this is the case when reading ANY website or ducoment through mIRC sockets.


Thanks for taking the time to read this.

-Andrew N. (Spitfire3292)
Posted By: starbucks_mafia Re: Sockread Bug - 09/04/07 03:17 AM
I'll bet $1000 this isn't a bug but is instead due to that website's output not ending with a $crlf and your socket code not using /sockread -f to force the last line to be read.

See this post for a practical example of what you need to be doing to get the whole webpage.
Posted By: Spitfire3292 Re: Sockread Bug - 09/04/07 03:28 AM
Hehe thanks. I forgot about the -f trigger smile Wonderful Jaytea reminded me of it after I bugged the living hell out of him with highlights and memo's for a solution to this problem. Thanks star and Jaytea :P

As far as I'm concerned, Case Closed:
© mIRC Discussion Forums