I've been working on how to hit a webpage in arc using the underlying scheme tcp-connect function. This code -- Racket, not Arc -- will hit google, get its source, and print it on standard out:
I've been having trouble getting it all to work in arc by hacking ac.scm with some 'xdefs. I can get 'tcp-connect to read just fine, but 'eof-object doesn't seem to ever return true. I'm going to try this weekend, and I'll see what I can find. Here's the working 'xdef for tcp-connect:
A while ago I tried to get www.google.com using Anarki's web.arc (https://github.com/nex3/arc/blob/master/lib/web.arc). It appended a spurious "?&" to the end of the URL, but once I hacked in a fix to keep that from happening, it worked just fine. (Well, I think I encountered one more issue occasionally: If there's absolutely no response, even headers, 'parse-server-headers blocks forever.)
To read the response body, web.arc just says (tostring (whilet line (readline in) (prn line))). Apparently it there's EOF detection somewhere in this process....
Sorry I'm not providing working code, or even a reliable memory. XD I suppose I'll try things out again tonight and commit any fixes back to Anarki.
Oh, web.arc already worked with Google. Since the last time I tried this, I think Google must have updated to accept http://www.google.com/?&; as a legitimate home page URL.