<div dir="ltr">Max,<div><br></div><div>DEADLINE is the way to go, I think. It seems, though, that there is a regression in the socket error handling that causes it to act funny:</div><div><br></div><div>(drakma:http-request "<a href="http://10.0.0.1/">http://10.0.0.1/</a>" :deadline (+ (get-internal-real-time) internal-time-units-per-second))<br></div><div><br></div><div>This signals a USOCKET:TIMEOUT-ERROR in the Slime repl, but on the bare repl, it raises an error related to some failing numeric comparison (supposedly in the printer for the timeout condition, but I am not sure. Error and stack trace below.</div><div><br></div><div>If you establish a handler for USOCKET:TIMEOUT-ERROR, you should be good to go.</div><div><br></div><div>-Hans</div><div><br></div><div>> Error: The value NIL is not of the expected type REAL.<br></div><div><div> (21818D60) : 0 (>-2 NIL 0) 2293</div><div> (21818D90) : 1 (<=-2 NIL 0) 29</div><div> (21818DB0) : 2 (FUNCALL #'#<#<CCL::STANDARD-KERNEL-METHOD PRINT-OBJECT (STANDARD-OBJECT T)>> #<USOCKET:TIMEOUT-ERROR #x302002202C8D> #<STRING-OUTPUT-STREAM #x302002202A1D>) 69</div><div> (21818DD0) : 3 (%CALL-NEXT-METHOD (NIL #<CCL::STANDARD-KERNEL-METHOD PRINT-OBJECT #> . 70267366)) 997</div><div> (21818E50) : 4 (%CALL-NEXT-METHOD (NIL #<CCL::STANDARD-KERNEL-METHOD PRINT-OBJECT #> . 70267366)) 997</div><div> (21818ED0) : 5 (%%STANDARD-COMBINED-METHOD-DCODE (#<CCL::STANDARD-KERNEL-METHOD PRINT-OBJECT :AROUND #> #<CCL::STANDARD-KERNEL-METHOD PRINT-OBJECT #> #<CCL::STANDARD-KERNEL-METHOD PRINT-OBJECT #>) 70267366) 669</div><div> (21818F48) : 6 (FUNCALL #'#<#<CCL::STANDARD-KERNEL-METHOD CCL::REPORT-CONDITION (CONDITION T)>> #<USOCKET:TIMEOUT-ERROR #x302002202C8D> #<STRING-OUTPUT-STREAM #x302002202A1D>) 237</div><div> (21818F88) : 7 (%BREAK-MESSAGE "Error" #<USOCKET:TIMEOUT-ERROR #x302002202C8D> 70267452 #\>) 1101</div><div> (21819150) : 8 (BREAK-LOOP-HANDLE-ERROR #<USOCKET:TIMEOUT-ERROR #x302002202C8D> 70267452) 701</div><div> (218191B8) : 9 (%ERROR #<USOCKET:TIMEOUT-ERROR #x302002202C8D> (:SOCKET NIL) 70267452) 333</div><div> (218191E0) : 10 (RAISE-ERROR-FROM-ID :CONNECTION-TIMED-OUT NIL #<SOCKET-CREATION-ERROR #x302002202CED>) 149</div><div> (21819210) : 11 (SIGNAL #<SOCKET-CREATION-ERROR #x302002202CED>) 981</div><div> (21819268) : 12 (%ERROR #<SOCKET-CREATION-ERROR #x302002202CED> NIL 70267474) 117</div><div> (21819290) : 13 (SOCKET-ERROR NIL "connect" 60 NIL :CONNECT-ADDRESS #<IP4-SOCKET-ADDRESS <a href="http://10.0.0.1:80">10.0.0.1:80</a>>) 1053</div><div> (21819300) : 14 (%SOCKET-CONNECT 4 #<IP4-SOCKET-ADDRESS <a href="http://10.0.0.1:80">10.0.0.1:80</a>> 1000) 317</div><div> (21819348) : 15 (MAKE-TCP-SOCKET :REMOTE-HOST "10.0.0.1" :REMOTE-PORT 80 :LOCAL-HOST NIL :LOCAL-PORT NIL :FORMAT :BINARY :EXTERNAL-FORMAT :UNIX :DEADLINE 60509603 :NODELAY T :CONNECT-TIMEOUT 20) 1357</div><div> (21819440) : 16 (MAKE-SOCKET :REMOTE-HOST "10.0.0.1" :REMOTE-PORT 80 :LOCAL-HOST NIL :LOCAL-PORT NIL :FORMAT :BINARY :EXTERNAL-FORMAT :UNIX :DEADLINE 60509603 :NODELAY T :CONNECT-TIMEOUT 20) 989</div><div> (21819638) : 17 (SOCKET-CONNECT "10.0.0.1" 80 :PROTOCOL :STREAM :ELEMENT-TYPE FLEXI-STREAMS:OCTET :TIMEOUT 20 :DEADLINE 60509603 :NODELAY T :LOCAL-HOST NIL :LOCAL-PORT NIL) 477</div><div> (21819708) : 18 (HTTP-REQUEST #<URI <a href="http://10.0.0.1/">http://10.0.0.1/</a>> :DEADLINE 60509603) 4261</div><div> (21819A38) : 19 (CALL-CHECK-REGS DRAKMA:HTTP-REQUEST "<a href="http://10.0.0.1/">http://10.0.0.1/</a>" :DEADLINE 60509603) 221</div><div> (21819A70) : 20 (TOPLEVEL-EVAL (DRAKMA:HTTP-REQUEST "<a href="http://10.0.0.1/">http://10.0.0.1/</a>" :DEADLINE (+ # INTERNAL-TIME-UNITS-PER-SECOND)) NIL) 693</div><div> (21819B00) : 21 (READ-LOOP :INPUT-STREAM #<SYNONYM-STREAM to *TERMINAL-IO* #x30200041458D> :OUTPUT-STREAM #<SYNONYM-STREAM to *TERMINAL-IO* #x30200041442D> :BREAK-LEVEL 0 :PROMPT-FUNCTION #<Compiled-function (:INTERNAL CCL::READ-LOOP) (Non-Global) #x30000053056F>) 2269</div><div> (21819D58) : 22 (RUN-READ-LOOP :BREAK-LEVEL 0) 157</div><div> (21819D80) : 23 (TOPLEVEL-LOOP) 101</div><div> (21819DA8) : 24 (FUNCALL #'#<(:INTERNAL (TOPLEVEL-FUNCTION (CCL::LISP-DEVELOPMENT-SYSTEM T)))>) 101</div><div> (21819DC8) : 25 (FUNCALL #'#<(:INTERNAL CCL::MAKE-MCL-LISTENER-PROCESS)>) 661</div><div> (21819E60) : 26 (RUN-PROCESS-INITIAL-FORM #<TTY-LISTENER listener(1) [Active] #x30200041346D> (#<COMPILED-LEXICAL-CLOSURE # #x302000412F9F>)) 669</div><div> (21819EF0) : 27 (FUNCALL #'#<(:INTERNAL (CCL::%PROCESS-PRESET-INTERNAL (PROCESS)))> #<TTY-LISTENER listener(1) [Active] #x30200041346D> (#<COMPILED-LEXICAL-CLOSURE # #x302000412F9F>)) 573</div><div> (21819F98) : 28 (FUNCALL #'#<(:INTERNAL CCL::THREAD-MAKE-STARTUP-FUNCTION)>) 277</div></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-01-19 14:11 GMT+01:00 Max Rottenkolber <span dir="ltr"><<a href="mailto:max@mr.gy" target="_blank">max@mr.gy</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Sun, 04 Jan 2015 18:33:34 -0800, Ron Garret wrote:<br>
<br>
> No more need to load drakma to get simple urls! Woohoo!<br>
<br>
</span>I guess the reason to use drakma is to not introduce non-portability.<br>
Also SNARF-URL is not documented (and as far as I can tell CCL-1.9<br>
doesn't have it)?<br>
<br>
Without wanting to needlessly hijack this thread, there is a specific<br>
HTTP-REQUEST functionality that I am missing in drakma: Reliable timeouts.<br>
<br>
Drakma has CONNECTION-TIMEOUT, READ-TIMEOUT, WRITE-TIMEOUT and DEADLINE.<br>
<br>
DEADLINE seems to be a Clozure only parameter and accepts "internal time<br>
units". I couldn't get it to work so far .<br>
<br>
(READ-TIMEOUT and WRITE-TIMEOUT are LispWorks only, CONNECTION-TIMEOUT is<br>
rather unreliable.)<br>
<br>
It's not a big issue (in the end you just attach a watchdog to your<br>
request-thread), but this part of Drakma really annoys me, if not only<br>
for the complete non-portability of the API by itself.<br>
<br>
Then I just noticed CCL's (also undocumented) WITH-INPUT/OUTPUT-TIMEOUT.<br>
<br>
Comments? :)<br>
<div class="HOEnZb"><div class="h5"><br>
_______________________________________________<br>
Openmcl-devel mailing list<br>
<a href="mailto:Openmcl-devel@clozure.com">Openmcl-devel@clozure.com</a><br>
<a href="https://lists.clozure.com/mailman/listinfo/openmcl-devel" target="_blank">https://lists.clozure.com/mailman/listinfo/openmcl-devel</a><br>
</div></div></blockquote></div><br></div>