]> gitweb.factorcode.org Git - factor.git/commitdiff
http.client: default to http:// if not specified.
authorJohn Benediktsson <mrjbq7@gmail.com>
Mon, 15 Jul 2013 16:30:22 +0000 (09:30 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Mon, 15 Jul 2013 16:30:22 +0000 (09:30 -0700)
basis/http/client/client.factor

index 7f99c62984b645df9148e95bde50db7be4bf3530..0f9cbc448cecc33f0a7e70c340c0f3b356106f0b 100644 (file)
@@ -140,10 +140,15 @@ SYMBOL: redirects
         [ do-redirect ] [ nip ] if
     ] with-variable ; inline recursive
 
+: request-url ( url -- url' )
+    dup >url dup protocol>> [ nip ] [
+        drop "http://" prepend >url
+    ] if ensure-port ;
+
 : <client-request> ( url method -- request )
     <request>
         swap >>method
-        swap >url ensure-port >>url ; inline
+        swap request-url >>url ; inline
 
 PRIVATE>