diff -ur drakma-0.11.1-old/request.lisp drakma-0.11.1-new/request.lisp
--- drakma-0.11.1-old/request.lisp	2007-10-11 10:45:47.000000000 +0200
+++ drakma-0.11.1-new/request.lisp	2007-12-23 04:49:33.000000000 +0100
@@ -29,6 +29,37 @@
 
 (in-package :drakma)
 
+#+sbcl
+(require '#:sb-bsd-sockets)
+#+:sbcl
+(defun sbcl-connect-with-timeout (host port connection-timeout io-timeout &key (element-type 'character))
+  (let* ((sock (make-instance 'sb-bsd-sockets:inet-socket :type :stream :protocol :tcp))
+         (octet-addr
+          (handler-case
+              (sb-bsd-sockets:host-ent-address (sb-bsd-sockets:get-host-by-name host))
+            (sb-bsd-sockets:host-not-found-error (e)
+              (error "Can't resolve ~a: ~a" host e))))
+         (fd (sb-bsd-sockets:socket-file-descriptor sock)))
+    (setf (sb-bsd-sockets:non-blocking-mode sock) t)
+    (handler-case
+        (sb-bsd-sockets:socket-connect sock octet-addr port)
+      (sb-bsd-sockets:socket-error (c)
+        (unless (= (sb-bsd-sockets::socket-error-errno c) sb-posix:einprogress)
+          (error c))))
+    (setf (sb-bsd-sockets:non-blocking-mode sock) nil)
+    (loop
+         (if (sb-sys:wait-until-fd-usable fd :output connection-timeout)
+             (return)
+             (unless (= sb-posix::eintr (sb-alien:get-errno))
+               (sb-bsd-sockets:socket-error "open"))))
+    (sb-bsd-sockets::socket-make-stream
+     sock
+     :input t
+     :output t
+     :timeout io-timeout
+     :buffering :full
+     :element-type element-type)))
+
 (defun determine-body-format (headers external-format-in)
   "The default function used by Drakma to determine how the content
 body is to be read.  See the docstring of *BODY-FORMAT-FUNCTION* for
@@ -193,9 +224,10 @@
                               force-binary
                               want-stream
                               stream
-                              #+:lispworks (connection-timeout 20)
+                              #+(or :lispworks :sbcl) (connection-timeout 20)
                               #+:lispworks (read-timeout 20)
-                              #+:lispworks5.0 (write-timeout 20))
+                              #+:lispworks5.0 (write-timeout 20)
+                              #+:sbcl (io-timeout 20))
   "Sends an HTTP request to a web server and returns its reply.  URI
 is where the request is sent to, and it is either a string denoting a
 uniform resource identifier or a PURI:URI object.  The scheme of URI
@@ -427,7 +459,10 @@
                                                           #+:lispworks5.0 #+:lispworks5.0
                                                           :write-timeout write-timeout
                                                           :errorp t)
-                                    #-:lispworks
+                                    #+:sbcl
+                                    (sbcl-connect-with-timeout host port connection-timeout io-timeout
+                                                               :element-type '(unsigned-byte 8))
+                                    #-(or :lispworks sbcl)
                                     (usocket:socket-stream
                                      (usocket:socket-connect host port
                                                              :element-type 'octet)))))
Only in drakma-0.11.1-new: request.lisp.orig
