]> gitweb.factorcode.org Git - factor.git/commitdiff
Add a new word http-data that is just http-get nip
authorDoug Coleman <doug.coleman@gmail.com>
Fri, 26 Feb 2010 00:05:10 +0000 (18:05 -0600)
committerDoug Coleman <doug.coleman@gmail.com>
Sat, 27 Feb 2010 13:58:35 +0000 (07:58 -0600)
basis/bootstrap/image/download/download.factor
basis/http/client/client.factor
basis/http/http-tests.factor
basis/syndication/syndication.factor
extra/images/http/http.factor
extra/webapps/fjsc/fjsc.factor
extra/yahoo/yahoo.factor

index e2de6219844e439ea8488777a7e77ea80fa04e64..9ab7689eca093c8baf70a5c296642677c451c9c4 100644 (file)
@@ -7,7 +7,7 @@ IN: bootstrap.image.download
 CONSTANT: url URL" http://factorcode.org/images/latest/"
 
 : download-checksums ( -- alist )
-    url "checksums.txt" >url derive-url http-get nip
+    url "checksums.txt" >url derive-url http-data
     string-lines [ " " split1 ] { } map>assoc ;
 
 : need-new-image? ( image -- ? )
index 482a23aeaa644328712528762155b16e210b9202..9e540f111fe8e9bdd817ba6192c06146d2da0660 100644 (file)
@@ -157,6 +157,9 @@ ERROR: download-failed response ;
 : http-get ( url -- response data )
     <get-request> http-request ;
 
+: http-data ( url -- data )
+    http-get nip ;
+
 : with-http-get ( url quot -- response )
     [ <get-request> ] dip with-http-request ; inline
 
index 35d01c10141d7ebbd6157cb02206af74dcc1039e..62936af7ff725eeebc5a7fec47aece72b89d5a59 100644 (file)
@@ -226,14 +226,14 @@ test-db [
 
 [ t ] [
     "vocab:http/test/foo.html" ascii file-contents
-    "http://localhost/nested/foo.html" add-port http-get nip =
+    "http://localhost/nested/foo.html" add-port http-data =
 ] unit-test
 
-[ "http://localhost/redirect-loop" add-port http-get nip ]
+[ "http://localhost/redirect-loop" add-port http-data ]
 [ too-many-redirects? ] must-fail-with
 
 [ "Goodbye" ] [
-    "http://localhost/quit" add-port http-get nip
+    "http://localhost/quit" add-port http-data
 ] unit-test
 
 ! HTTP client redirect bug
@@ -247,7 +247,7 @@ test-db [
 ] unit-test
 
 [ "Goodbye" ] [
-    "http://localhost/redirect" add-port http-get nip
+    "http://localhost/redirect" add-port http-data
 ] unit-test
 
 
@@ -274,12 +274,12 @@ test-db [
 : 404? ( response -- ? ) [ download-failed? ] [ response>> code>> 404 = ] bi and ;
 
 ! This should give a 404 not an infinite redirect loop
-[ "http://localhost/d/blah" add-port http-get nip ] [ 404? ] must-fail-with
+[ "http://localhost/d/blah" add-port http-data ] [ 404? ] must-fail-with
 
 ! This should give a 404 not an infinite redirect loop
-[ "http://localhost/blah/" add-port http-get nip ] [ 404? ] must-fail-with
+[ "http://localhost/blah/" add-port http-data ] [ 404? ] must-fail-with
 
-[ "Goodbye" ] [ "http://localhost/quit" add-port http-get nip ] unit-test
+[ "Goodbye" ] [ "http://localhost/quit" add-port http-data ] unit-test
 
 [ ] [
     <dispatcher>
@@ -293,9 +293,9 @@ test-db [
     test-httpd
 ] unit-test
 
-[ "Hi" ] [ "http://localhost/" add-port http-get nip ] unit-test
+[ "Hi" ] [ "http://localhost/" add-port http-data ] unit-test
 
-[ "Goodbye" ] [ "http://localhost/quit" add-port http-get nip ] unit-test
+[ "Goodbye" ] [ "http://localhost/quit" add-port http-data ] unit-test
 
 USING: html.components html.forms
 xml xml.traversal validators
@@ -353,7 +353,7 @@ SYMBOL: a
 
 [ 4 ] [ a get-global ] unit-test
 
-[ "Goodbye" ] [ "http://localhost/quit" add-port http-get nip ] unit-test
+[ "Goodbye" ] [ "http://localhost/quit" add-port http-data ] unit-test
 
 ! Test cloning
 [ f ] [ <404> dup clone "b" "a" set-header drop "a" header ] unit-test
@@ -371,7 +371,7 @@ SYMBOL: a
 ] unit-test
 
 [ t ] [
-    "http://localhost/" add-port http-get nip
+    "http://localhost/" add-port http-data
     "vocab:http/test/foo.html" ascii file-contents =
 ] unit-test
 
index fe31a49265d425ca2f4d9e7592b0292a329a44c4..edfbebeeabeedafaffe13bbbf8d51d43bde21404 100644 (file)
@@ -115,7 +115,7 @@ M: byte-array parse-feed [ bytes>xml xml>feed ] with-html-entities ;
 
 : download-feed ( url -- feed )
     #! Retrieve an news syndication file, return as a feed tuple.
-    http-get nip parse-feed ;
+    http-data parse-feed ;
 
 ! Atom generation
 
index 620ab6f73b956df5affdb19e5f67db2290219ea9..d3cff18afbea2aa934d8bb839e83b4d872206ed5 100644 (file)
@@ -5,7 +5,7 @@ images.viewer ;
 IN: images.http
 
 : load-http-image ( path -- image )
-    [ http-get nip ] [ image-class ] bi load-image* ;
+    [ http-data ] [ image-class ] bi load-image* ;
 
 : http-image. ( path -- )
     load-http-image image. ;
index 01d6935bee7d1658069e3a82c9c185b3563c0ee3..4dec2580830bc9f3d91d540674af8bb4f0f18bb6 100644 (file)
@@ -35,7 +35,7 @@ TUPLE: fjsc < dispatcher ;
 
 : do-compile-url ( url -- response )
     [ 
-        absolute-url http-get nip 'expression' parse fjsc-compile write "();" write
+        absolute-url http-data 'expression' parse fjsc-compile write "();" write
     ] with-string-writer
     "application/javascript" <content> ;
 
index 5e0c08b430eadb66dacb656d21a8f877ce6f8606..2a8469c32831e9d9e235b329b8195a10394b6e40 100644 (file)
@@ -57,4 +57,4 @@ CONSTANT: factor-id "fRrVAKzV34GDyeRw6bUHDhEWHRedwfOC7e61wwXZLgGF80E67spxdQXuugB
         swap >>query ;
 
 : search-yahoo ( search -- seq )
-    query http-get nip string>xml parse-yahoo ;
+    query http-data string>xml parse-yahoo ;