]> gitweb.factorcode.org Git - factor.git/commitdiff
Merge branch 'experimental' into couchdb
authorAlex Chapman <chapman.alex@gmail.com>
Wed, 17 Sep 2008 10:02:34 +0000 (20:02 +1000)
committerAlex Chapman <chapman.alex@gmail.com>
Wed, 17 Sep 2008 10:02:34 +0000 (20:02 +1000)
1  2 
basis/http/client/client.factor

index 46bee405d16e2e9570b0cfcaa2276d59c3d05a6a,5e22f5144d15e6879416a369631e2bf72770f7c9..d684d5af9212eae2e9143f38ba7755a28584f697
@@@ -1,6 -1,6 +1,6 @@@
  ! Copyright (C) 2005, 2008 Slava Pestov.
  ! See http://factorcode.org/license.txt for BSD license.
- USING: accessors assocs kernel math math.parser namespaces
+ USING: accessors assocs kernel math math.parser namespaces make
  sequences io io.sockets io.streams.string io.files io.timeouts
  strings splitting calendar continuations accessors vectors
  math.order hashtables byte-arrays prettyprint
@@@ -95,7 -95,7 +95,7 @@@ DEFER: (http-request
  SYMBOL: redirects
  
  : redirect-url ( request url -- request )
-     '[ , >url derive-url ensure-port ] change-url ;
+     '[ _ >url derive-url ensure-port ] change-url ;
  
  : do-redirect ( response data -- response data )
      over code>> 300 399 between? [
@@@ -141,7 -141,7 +141,7 @@@ PRIVATE
          do-redirect
      ] with-variable ;
  
 -: success? ( code -- ? ) 200 = ;
 +: success? ( code -- ? ) 200 299 between? ;
  
  ERROR: download-failed response body ;
  
@@@ -169,7 -169,7 +169,7 @@@ M: download-failed error
  : download-to ( url file -- )
      #! Downloads the contents of a URL to a file.
      swap http-get
-     [ content-charset>> ] [ '[ , write ] ] bi*
+     [ content-charset>> ] [ '[ _ write ] ] bi*
      with-file-writer ;
  
  : download ( url -- )
  
  : http-post ( post-data url -- response data )
      <post-request> http-request ;
 +
 +: <put-request> ( data url -- request )
 +    <post-request> "PUT" >>method ;
 +
 +: http-put ( data url -- response data )
 +    <put-request> http-request ;