crashdemons Posted March 16, 2009 Share Posted March 16, 2009 (edited) Okay well, I've had Raw HTTP programs working before, but apparently I messed something up more recently.This program was supposed to connect to www.example.com and download the index page there. (path /)However, it connected as it was supposed to and reported that it sent all of the data, but no response data is received from the server.After some debugging with a locally-hosted HTTP server, I determined that the problem was not HTTP-related.I noticed that the script connects to the server but does not send any data to the server.When the server sends a 408 Request Timeout response, the script also does not receive it.I have been staring at this until my eyes hurt. I have had other Raw HTTP scripts that work fine.If possible, would like to know what obvious thing I missed.I will be, undoubtedly, embarrassed to have missed something, but at least I will know all of the rules once again.Things I have tried:Tweaking the TCPTimeoutAdding delays between Connect & Sendetc.expandcollapse popupLocal $domain='www.example.com' Local $sdata='GET / HTTP/1.1' & @CRLF & _ 'Host: '& $domain & @CRLF & _ 'Connection: close' & @CRLF Opt("TCPTimeout",100) TCPStartup() ConsoleWrite('TCPStartup Err='&@error&@CRLF) Local $ip=TCPNameToIP($domain) Local $sc=TCPConnect($ip,80) ConsoleWrite($sc&' - TCPConnect: '&$ip&':80'&@CRLF) Local $sn=TCPSend($sc,$sdata); TCPSend($sc,StringToBinary($sdata)); didn't work either. ConsoleWrite('-----------SENT:'&@CRLF&$sdata&@CRLF&'-----------'&@CRLF) ConsoleWrite($sc&' - TCPSend: '&$sn&'/'&StringLen($sdata)&' Err='&@error&@CRLF) Local $recv='' Local $timerA=TimerInit() Local $rc,$len While 1 $rc=TCPRecv($sc,1000,1) If @error Then ConsoleWrite($sc&' - TCPRecv Err='&@error&@CRLF) ExitLoop; stop on error EndIf $rc=BinaryToString($rc); since we chose to recv as a Binary type $len=StringLen($rc) If $len>0 Then ConsoleWrite($sc&' - TCPRecv Len='&$len&@CRLF) $recv&=$rc EndIf If TimerDiff($timerA)>15000 Then ConsoleWrite($sc&' - TCPRecv, RESPONSE TIMEOUT!'&@CRLF) ExitLoop; exit on our max timeout EndIf Sleep(250) WEnd ConsoleWrite('-----------RECV:'&@CRLF&$recv&@CRLF&'-----------'&@CRLF) TCPCloseSocket($sc) ConsoleWrite($sc&' - TCPCloseSocket Err='&@error&@CRLF) TCPShutdown() ConsoleWrite($sc&' - TCPShutdown Err='&@error&@CRLF) ExitMy Console Output:>"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\Documents and Settings\Admin\Desktop\New AutoIt v3 Script.au3" /autoit3dir "C:\Program Files\AutoIt3\SciTE\.." /UserParams +>12:33:20 Starting AutoIt3Wrapper v.1.9.2 >Running:(3.2.12.1):C:\Program Files\AutoIt3\SciTE\..\autoit3.exe "C:\Documents and Settings\Admin\Desktop\New AutoIt v3 Script.au3" TCPStartup Err=0 1804 - TCPConnect: 208.77.188.166:80 -----------SENT: GET / HTTP/1.1 Host: www.example.com Connection: close ----------- 1804 - TCPSend: 58/58 Err=0 1804 - TCPRecv, RESPONSE TIMEOUT! -----------RECV: ----------- 1804 - TCPCloseSocket Err=0 1804 - TCPShutdown Err=0 +>12:33:36 AutoIT3.exe ended.rc:0 +>12:33:37 AutoIt3Wrapper Finished >Exit code: 0 Time: 18.036Edit: removed a meaningless comment from script Edited March 17, 2009 by crashdemons My Projects - WindowDarken (Darken except the active window) Yahsmosis Chat Client (Discontinued) StarShooter Game (Red alert! All hands to battlestations!) YMSG Protocol Support (Discontinued) Circular Keyboard and OSK example. (aka Iris KB) Target Screensaver Drive Toolbar Thingy Rollup Pro (Minimize-to-Titlebar & More!) 2D Launcher physics example Ascii Screenshot AutoIt3 Quine Example ("Is a Quine" is a Quine.) USB Lock (Another system keydrive - with a toast.) Link to comment Share on other sites More sharing options...
crashdemons Posted March 17, 2009 Author Share Posted March 17, 2009 Not to bump the thread, but... Any Guesses? My Projects - WindowDarken (Darken except the active window) Yahsmosis Chat Client (Discontinued) StarShooter Game (Red alert! All hands to battlestations!) YMSG Protocol Support (Discontinued) Circular Keyboard and OSK example. (aka Iris KB) Target Screensaver Drive Toolbar Thingy Rollup Pro (Minimize-to-Titlebar & More!) 2D Launcher physics example Ascii Screenshot AutoIt3 Quine Example ("Is a Quine" is a Quine.) USB Lock (Another system keydrive - with a toast.) Link to comment Share on other sites More sharing options...
jvanegmond Posted March 17, 2009 Share Posted March 17, 2009 Simple problem. HTTP standards say every packet should end with two LF characters. You end it with one char, so it is not parsed by the server and will create a time out. Here is changed code: Local $domain='www.example.com' Local $sdata='GET / HTTP/1.1' & @CRLF & _ 'Host: '& $domain & @CRLF & _ 'Connection: close' & @CRLF & @CRLF Rest is the same. github.com/jvanegmond Link to comment Share on other sites More sharing options...
crashdemons Posted March 17, 2009 Author Share Posted March 17, 2009 (edited) Simple problem. HTTP standards say every packet should end with two LF characters. You end it with one char, so it is not parsed by the server and will create a time out.Here is changed code:Local $domain='www.example.com'Local $sdata='GET / HTTP/1.1' & @CRLF & _ 'Host: '& $domain & @CRLF & _ 'Connection: close' & @CRLF & @CRLFRest is the same.That works- My ISP must be filtering invalid HTTP requests because I had a server (not even an HTTP Server, just a receiver) program listening for any data remotely and it just wouldn't get anything.Thanks. Edited March 17, 2009 by crashdemons My Projects - WindowDarken (Darken except the active window) Yahsmosis Chat Client (Discontinued) StarShooter Game (Red alert! All hands to battlestations!) YMSG Protocol Support (Discontinued) Circular Keyboard and OSK example. (aka Iris KB) Target Screensaver Drive Toolbar Thingy Rollup Pro (Minimize-to-Titlebar & More!) 2D Launcher physics example Ascii Screenshot AutoIt3 Quine Example ("Is a Quine" is a Quine.) USB Lock (Another system keydrive - with a toast.) Link to comment Share on other sites More sharing options...
jvanegmond Posted March 17, 2009 Share Posted March 17, 2009 Could be because of other issues, such as a router blocking incoming packets because it doesn't know where to send it to. Try doing a HTTP request on your own IP from the outside and see what happens. I'll help out if you send me a PM. github.com/jvanegmond Link to comment Share on other sites More sharing options...
crashdemons Posted March 17, 2009 Author Share Posted March 17, 2009 Can't be a router because I'm on dial-a-slug. My Projects - WindowDarken (Darken except the active window) Yahsmosis Chat Client (Discontinued) StarShooter Game (Red alert! All hands to battlestations!) YMSG Protocol Support (Discontinued) Circular Keyboard and OSK example. (aka Iris KB) Target Screensaver Drive Toolbar Thingy Rollup Pro (Minimize-to-Titlebar & More!) 2D Launcher physics example Ascii Screenshot AutoIt3 Quine Example ("Is a Quine" is a Quine.) USB Lock (Another system keydrive - with a toast.) Link to comment Share on other sites More sharing options...
Marlo Posted March 17, 2009 Share Posted March 17, 2009 Some ISP's block you from listening on port 80 to prevent you from running web servers, makes sense if your on dial-up Click here for the best AutoIt help possible.Currently Working on: Autoit RAT Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now