This is one approach (and I note that Eric has done something similar for JHS - see the wget verb in ~addons/ide/jhs/core.ijs). However as Raul points out, being able to handle all the various wrinkles (proxy authentication, SSL, IPv6 ...) would require a lot of additional work. Seems to me we are better off interfacing to existing tools that are freely available and someone else is actively developing.
If we want a J interface that is "closer to the metal" than spawning wget.exe or curl.exe, then we could interface directly to the C functions in libcurl. > From: David Mitchell > Sent: Friday, 13 August 2010 05:34 > > On 8/12/2010 11:14, Raul Miller wrote: > > On Thu, Aug 12, 2010 at 10:54 AM, David > Mitchell<[email protected]> wrote: > >> How about this (quick and dirty and needs bullet proofing): > > > > I wonder why we do not have a bullet proofed version already. > > > > That said, you are using HTTP 0.9 which is officially an obsolete > > standard. HTTP/1.0 is more complex and HTTP/1.1 is even > > more complex (all in the name of efficiencies are not relevant > > here, but which matter for normal web browsing). And dealing > > with all the little quirks (that sometimes show up in real use) > > takes time and energy (and code). > > > > Or this (feel free to expand on this fragment): > > require 'socket media/platimg viewmat' > coinsert 'jsocket' > > getPent=: 3 : 0 > rosettac=. sdcheck sdgethostbyname 'rosettacode.org' NB. find host > skr=. 0 pick sdcheck sdsocket '' > sdcheck sdconnect skr;rosettac,<80 NB. connect to port 80 > sdcheck ('GET http://rosettacode.org/mw/images/c/c6/Pentagon.png > HTTP/1.0',CR,LF,'Host: rosettacode.org',CR,LF,CR,LF) sdsend skr,0 > qqq=.;sdcheck sdrecv skr,10000,0 > qqq=.(4+0{,I.(CR,LF,CR,LF) E. qqq)}.qqq > sdcheck sdclose skr > qqq > ) > > foo=:getPent'' > > bitmap=:getimg foo > > viewmat bitmap > > -- > David Mitchell > > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
