Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: HTTP spy ?

From: tomc:darkwing:uoregon at: 9-May-2002 0:27

For debugging cgi and building bots I have an "echo-server" running. it just sits on a port and echos back what it is sent (or at least the first 10k or less of what it is sent) to use it, I go the the page the cgi form is on I change the browsers proxy to point at the (running) echo-server and hit the forms submit button. echo-server returns a simple html page with _exactly_ what the browser sent. Its not fancy but it has been very useful to me. to try the one I'm running you can set your browsers proxy to port 3776 feel free to use it occasionaly for unimportant data (if it starts getting hammered I'll have to pull it) if you are interested in running it yourself or need to run it alot please modify the following to suit your needs (watch the linewraps) % cat bin/echoserv #! /private/bin/rebol -sqw REBOL [ Title: "ECHO SERVER" Date: [13-Jan-2002 19-July-1999] Author: ["Tom Conlin" "Sterling Newton"] Purpose: {to echo back what your browser sends. which may be slightly different than what the webserver says it hears. helps to debug forms, cgis and to build bots I am also capturing a copy in a log but you may not care or have a place to store it so just comment those lines out } usage: { typicaly you go the the page of interest in your browser then point the browsers http proxy at the machine and port this script is running on then push the pages submit button and see what the browser intended to say to the server. (to go back to surfing, stop pointing your browsers proxy here) } note: {based on a script called bogus-proxy.r Sterling helped me with} ] header: {HTTP/1.0 200 OK Content-Type: text/html <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <html><pre> } tailer: {</pre></html>} ; this func is only used to timestamp the log file with net style dates http-date: func[/local weekdays months gmt][ gmt: now - now/zone rejoin [pick system/locale/days gmt/weekday ", " gmt/day " " pick system/locale/months gmt/month " " gmt/year " " gmt/time GMT^/ ] ] serv: open/lines tcp://:3776 ;EC0 in hex but use what you want size: 10240 ; ... or whatever you want forever [ stream: make string! size wait conn: pick serv 1 read-io conn stream size insert/only conn rejoin[header stream tailer] close conn ; comment out the next lines if you do not need a log write/append %/tmp/echoserv.log rejoin[ newline "# " conn/host tab http-date stream newline ] ] close serv ; not that we are apt to get here ------------------------------------------------------------------------------ On Wed, 8 May 2002, pat665 wrote: