]> gitweb.factorcode.org Git - factor.git/commitdiff
http.client: remove http-get* and its friends, change http-request* and with-http...
authorJohn Benediktsson <mrjbq7@gmail.com>
Thu, 13 Mar 2014 02:29:35 +0000 (19:29 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Thu, 13 Mar 2014 02:39:15 +0000 (19:39 -0700)
22 files changed:
basis/bootstrap/image/download/download.factor
basis/concurrency/semaphores/semaphores-docs.factor
basis/furnace/recaptcha/recaptcha.factor
basis/http/client/client-docs.factor
basis/http/client/client.factor
basis/syndication/syndication.factor
extra/bit/ly/ly.factor
extra/google/charts/charts.factor
extra/google/search/search.factor
extra/google/translate/translate.factor
extra/hacker-news/hacker-news.factor
extra/mason/updates/updates.factor
extra/reddit/reddit.factor
extra/robots/robots.factor
extra/rosetta-code/web-scraping/web-scraping.factor
extra/twitter/prettyprint/prettyprint.factor
extra/webapps/fjsc/fjsc.factor
extra/wikipedia/wikipedia.factor
extra/wolfram-alpha/wolfram-alpha.factor
extra/xkcd/xkcd.factor
extra/yahoo/yahoo.factor
extra/youtube/youtube.factor

index 9d613a5148849b109ba72a2abb3c9bed9d0ed72a..15a0e679c54299f2b02acf47e3a11a456aecf4cd 100644 (file)
@@ -7,7 +7,7 @@ IN: bootstrap.image.download
 CONSTANT: url URL" http://downloads.factorcode.org/images/latest/"
 
 : download-checksums ( -- alist )
-    url "checksums.txt" >url derive-url http-get*
+    url "checksums.txt" >url derive-url http-get nip
     string-lines [ " " split1 ] { } map>assoc ;
 
 : file-checksum ( image -- checksum )
index 4fdecee2736bf13371d0a89d3ab504c44642bbe8..06c951f58651ca6fb1382b7dba6131b3506a4c61 100644 (file)
@@ -53,7 +53,7 @@ fry http.client kernel urls ;
     URL" http://www.oracle.com"\r
 }\r
 2 <semaphore> '[\r
-    _ [ http-get* ] with-semaphore\r
+    _ [ http-get nip ] with-semaphore\r
 ] parallel-map"""\r
 } ;\r
 \r
index 2e9af622d04a671bb97b71354a3b70b23fa6b8c6..3ae20f14bbf9df2779bc4aa473bef4a1c05a5d2e 100644 (file)
@@ -59,7 +59,7 @@ M: recaptcha call-responder*
         { "privatekey" private-key }
         { "remoteip" remote-ip }
     } URL" http://api-verify.recaptcha.net/verify"
-    http-post* parse-recaptcha-response ;
+    http-post nip parse-recaptcha-response ;
 
 : validate-recaptcha-params ( -- )
     {
index bfc63fa3b0c93358d00c8f056ee144203172d3b4..5a622a21abb5aea2a44a2569fd1ca7f7ea616c35 100644 (file)
@@ -55,98 +55,60 @@ HELP: http-get
 { $description "Downloads the contents of a URL." }
 { $errors "Throws an error if the HTTP request fails." } ;
 
-HELP: http-get*
-{ $values { "url" "a " { $link url } " or " { $link string } } { "data" sequence } }
-{ $description "A variant of " { $link http-get } " that checks that the response was successful." }
-{ $errors "Throws an error if the HTTP request fails or is not successful." } ;
-
 HELP: http-post
 { $values { "post-data" object } { "url" "a " { $link url } " or " { $link string } } { "response" response } { "data" sequence } }
 { $description "Submits an HTTP POST request." }
 { $errors "Throws an error if the HTTP request fails." } ;
 
-HELP: http-post*
-{ $values { "post-data" object } { "url" "a " { $link url } " or " { $link string } } { "data" sequence } }
-{ $description "A variant of " { $link http-post } " that checks that the response was successful." }
-{ $errors "Throws an error if the HTTP request fails or is not successful." } ;
-
 HELP: http-put
 { $values { "post-data" object } { "url" "a " { $link url } " or " { $link string } } { "response" response } { "data" sequence } }
 { $description "Submits an HTTP PUT request." }
 { $errors "Throws an error if the HTTP request fails." } ;
 
-HELP: http-put*
-{ $values { "post-data" object } { "url" "a " { $link url } " or " { $link string } } { "data" sequence } }
-{ $description "A variant of " { $link http-put } " that checks that the response was successful." }
-{ $errors "Throws an error if the HTTP request fails or is not successful." } ;
-
 HELP: http-head
 { $values { "url" "a " { $link url } " or " { $link string } } { "response" response } { "data" sequence } }
 { $description "Same as " { $link http-get } " except that the server is not supposed to return a message-body in the response, as per RFC2616. However in practise, most web servers respond to GET and HEAD method calls with identical responses." }
 { $errors "Throws an error if the HTTP request fails." } ;
 
-HELP: http-head*
-{ $values { "url" "a " { $link url } " or " { $link string } } { "data" sequence } }
-{ $description "A variant of " { $link http-head } " that checks that the response was successful." }
-{ $errors "Throws an error if the HTTP request fails or is not successful." } ;
-
 HELP: http-delete
 { $values { "url" "a " { $link url } " or " { $link string } } { "response" response } { "data" sequence } }
 { $description "Requests that the origin server delete the resource identified by the URL." }
 { $errors "Throws an error if the HTTP request fails." } ;
 
-HELP: http-delete*
-{ $values { "url" "a " { $link url } " or " { $link string } } { "data" sequence } }
-{ $description "A variant of " { $link http-delete } " that checks that the response was successful." }
-{ $errors "Throws an error if the HTTP request fails or is not successful." } ;
-
 HELP: http-options
 { $values { "url" "a " { $link url } " or " { $link string } } { "response" response } { "data" sequence } }
 { $description "Submits an HTTP OPTIONS request." }
 { $errors "Throws an error if the HTTP request fails." } ;
 
-HELP: http-options*
-{ $values { "url" "a " { $link url } " or " { $link string } } { "data" sequence } }
-{ $description "A variant of " { $link http-options } " that checks that the response was successful." }
-{ $errors "Throws an error if the HTTP request fails or is not successful." } ;
-
 HELP: http-trace
 { $values { "url" "a " { $link url } " or " { $link string } } { "response" response } { "data" sequence } }
 { $description "Submits an HTTP TRACE request." }
 { $errors "Throws an error if the HTTP request fails." } ;
 
-HELP: http-trace*
-{ $values { "url" "a " { $link url } " or " { $link string } } { "data" sequence } }
-{ $description "A variant of " { $link http-trace } " that checks that the response was successful." }
-{ $errors "Throws an error if the HTTP request fails or is not successful." } ;
-
-HELP: with-http-get
-{ $values { "url" "a " { $link url } " or " { $link string } } { "quot" { $quotation "( chunk -- )" } } { "response" response } }
-{ $description "Downloads the contents of a URL. Chunks of data are passed to the quotation as they are read." }
-{ $errors "Throws an error if the HTTP request fails." } ;
-
-HELP: with-http-get*
-{ $values { "url" "a " { $link url } " or " { $link string } } { "quot" { $quotation "( chunk -- )" } } }
-{ $description "A variant of " { $link with-http-get } " that checks that the response was successful." }
-{ $errors "Throws an error if the HTTP request fails or is not successful." } ;
-
 HELP: http-request
 { $values { "request" request } { "response" response } { "data" sequence } }
-{ $description "Sends an HTTP request to an HTTP server, and reads the response." }
+{ $description "A variant of " { $link http-request* } " that checks that the response was successful." }
 { $errors "Throws an error if the HTTP request fails." } ;
 
 HELP: http-request*
-{ $values { "request" request } { "data" sequence } }
-{ $description "A variant of " { $link http-request } " that checks that the response was successful." }
-{ $errors "Throws an error if the HTTP request fails or is not successful." } ;
+{ $values { "request" request } { "response" response } { "data" sequence } }
+{ $description "Sends an HTTP request to an HTTP server, and reads the response." } ;
 
 HELP: with-http-request
 { $values { "request" request } { "quot" { $quotation "( chunk -- )" } } { "response" response } }
+{ $description "A variant of " { $link with-http-request* } " that checks that the response was successful." } ;
+
+HELP: with-http-request*
+{ $values { "request" request } { "quot" { $quotation "( chunk -- )" } } { "response" response } }
 { $description "Sends an HTTP request to an HTTP server, and reads the response incrementally. Chunks of data are passed to the quotation as they are read. Does not throw an error if the HTTP request fails; to do so, call " { $link check-response } " on the " { $snippet "response" } "." } ;
 
+{ http-request http-request* with-http-request with-http-request* } related-words
+
 ARTICLE: "http.client.get" "GET requests with the HTTP client"
 "Basic usage involves passing a " { $link url } " and getting a " { $link response } " and data back:"
-{ $subsections http-get http-get* }
+{ $subsections
+    http-get
+}
 "Utilities to retrieve a " { $link url } " and save the contents to a file:"
 { $subsections
     download
@@ -158,11 +120,10 @@ ARTICLE: "http.client.get" "GET requests with the HTTP client"
     http-request
     http-request*
 }
-"The " { $link http-get } " and " { $link http-request } " words output sequences. This is undesirable if the response data may be large. Another pair of words take a quotation instead, and pass the quotation chunks of data incrementally:"
+"The " { $link http-request } " and " { $link http-request* } " words output sequences. This is undesirable if the response data may be large. Another pair of words take a quotation instead, and pass the quotation chunks of data incrementally:"
 { $subsections
-    with-http-get
-    with-http-get*
     with-http-request
+    with-http-request*
 } ;
 
 ARTICLE: "http.client.post-data" "HTTP client post data"
@@ -185,21 +146,21 @@ ARTICLE: "http.client.post-data" "HTTP client post data"
 
 ARTICLE: "http.client.post" "POST requests with the HTTP client"
 "Basic usage involves passing post data and a " { $link url } ", and getting a " { $link response } " and data back:"
-{ $subsections http-post http-post* }
+{ $subsections http-post }
 "Advanced usage involves constructing a " { $link request } ", which allows " { $link "http.cookies" } " and " { $link "http.headers" } " to be set:"
 { $subsections <post-request> }
 "Both words take a post data parameter; see " { $link "http.client.post-data" } "." ;
 
 ARTICLE: "http.client.put" "PUT requests with the HTTP client"
 "Basic usage involves passing post data and a " { $link url } ", and getting a " { $link response } " and data back:"
-{ $subsections http-put http-put* }
+{ $subsections http-put }
 "Advanced usage involves constructing a " { $link request } ", which allows " { $link "http.cookies" } " and " { $link "http.headers" } " to be set:"
 { $subsections <put-request> }
 "Both words take a post data parameter; see " { $link "http.client.post-data" } "." ;
 
 ARTICLE: "http.client.head" "HEAD requests with the HTTP client"
 "Basic usage involves passing a " { $link url } " and getting a " { $link response } " and data back:"
-{ $subsections http-head http-head* }
+{ $subsections http-head }
 "Advanced usage involves constructing a " { $link request } ", which allows " { $link "http.cookies" } " and " { $link "http.headers" } " to be set:"
 { $subsections
     <head-request>
@@ -207,7 +168,7 @@ ARTICLE: "http.client.head" "HEAD requests with the HTTP client"
 
 ARTICLE: "http.client.delete" "DELETE requests with the HTTP client"
 "Basic usage involves passing a " { $link url } " and getting a " { $link response } " and data back:"
-{ $subsections http-delete http-delete* }
+{ $subsections http-delete }
 "Advanced usage involves constructing a " { $link request } ", which allows " { $link "http.cookies" } " and " { $link "http.headers" } " to be set:"
 { $subsections
     <delete-request>
@@ -215,7 +176,7 @@ ARTICLE: "http.client.delete" "DELETE requests with the HTTP client"
 
 ARTICLE: "http.client.options" "OPTIONS requests with the HTTP client"
 "Basic usage involves passing a " { $link url } " and getting a " { $link response } " and data back:"
-{ $subsections http-options http-options* }
+{ $subsections http-options }
 "Advanced usage involves constructing a " { $link request } ", which allows " { $link "http.cookies" } " and " { $link "http.headers" } " to be set:"
 { $subsections
     <options-request>
@@ -224,7 +185,7 @@ ARTICLE: "http.client.options" "OPTIONS requests with the HTTP client"
 
 ARTICLE: "http.client.trace" "TRACE requests with the HTTP client"
 "Basic usage involves passing a " { $link url } " and getting a " { $link response } " and data back:"
-{ $subsections http-trace http-trace* }
+{ $subsections http-trace }
 "Advanced usage involves constructing a " { $link request } ", which allows " { $link "http.cookies" } " and " { $link "http.headers" } " to be set:"
 { $subsections
     <trace-request>
index 5d5e121f0ac262d420ffd616bcde6a67b20f037d..c0adf0e94bede9e4d8de8e014e13be4ea30cdfc3 100644 (file)
@@ -1,14 +1,12 @@
 ! Copyright (C) 2005, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: assocs combinators.short-circuit kernel math math.parser
-namespaces make sequences strings splitting calendar
-continuations accessors vectors math.order hashtables
-byte-arrays destructors io io.sockets io.streams.string io.files
-io.timeouts io.pathnames io.encodings io.encodings.string
-io.encodings.ascii io.encodings.utf8 io.encodings.binary
-io.encodings.iana io.crlf io.streams.duplex fry ascii urls
-urls.encoding present locals http http.parsers
-http.client.post-data mime.types ;
+USING: accessors ascii assocs calendar combinators.short-circuit
+destructors fry hashtables http http.client.post-data
+http.parsers io io.crlf io.encodings io.encodings.ascii
+io.encodings.binary io.encodings.iana io.encodings.string
+io.files io.pathnames io.sockets io.timeouts kernel locals math
+math.order math.parser mime.types namespaces present sequences
+splitting urls vocabs.loader ;
 IN: http.client
 
 ERROR: too-many-redirects ;
@@ -163,15 +161,18 @@ ERROR: download-failed response ;
 : check-response-with-body ( response body -- response body )
     [ >>body check-response ] keep ;
 
-: with-http-request ( request quot: ( chunk -- ) -- response )
+: with-http-request* ( request quot: ( chunk -- ) -- response )
     [ (with-http-request) ] with-destructors ; inline
 
-: http-request ( request -- response data )
-    [ [ % ] with-http-request ] B{ } make
-    over content-encoding>> decode check-response-with-body ;
+: with-http-request ( request quot: ( chunk -- ) -- response )
+    with-http-request* check-response ; inline
 
-: http-request* ( request -- data )
-    http-request swap check-response drop ;
+: http-request* ( request -- response data )
+    BV{ } clone [ '[ _ push-all ] with-http-request* ] keep
+    B{ } like over content-encoding>> decode [ >>body ] keep ;
+
+: http-request ( request -- response data )
+    http-request* [ check-response ] dip ;
 
 : <get-request> ( url -- request )
     "GET" <client-request> ;
@@ -179,20 +180,13 @@ ERROR: download-failed response ;
 : http-get ( url -- response data )
     <get-request> http-request ;
 
-: http-get* ( url -- data )
-    http-get swap check-response drop ;
-
-: with-http-get ( url quot: ( chunk -- ) -- response )
-    [ <get-request> ] dip with-http-request ; inline
-
-: with-http-get* ( url quot: ( chunk -- ) -- )
-    with-http-get check-response drop ; inline
-
 : download-name ( url -- name )
     present file-name "?" split1 drop "/" ?tail drop ;
 
 : download-to ( url file -- )
-    binary [ [ write ] with-http-get* ] with-file-writer ;
+    binary [
+        <get-request> [ write ] with-http-request drop
+    ] with-file-writer ;
 
 : download ( url -- )
     dup download-name download-to ;
@@ -204,9 +198,6 @@ ERROR: download-failed response ;
 : http-post ( post-data url -- response data )
     <post-request> http-request ;
 
-: http-post* ( post-data url -- data )
-    http-post swap check-response drop ;
-
 : <put-request> ( post-data url -- request )
     "PUT" <client-request>
         swap >>post-data ;
@@ -214,45 +205,30 @@ ERROR: download-failed response ;
 : http-put ( post-data url -- response data )
     <put-request> http-request ;
 
-: http-put* ( post-data url -- data )
-    http-put swap check-response drop ;
-
 : <delete-request> ( url -- request )
     "DELETE" <client-request> ;
 
 : http-delete ( url -- response data )
     <delete-request> http-request ;
 
-: http-delete* ( url -- data )
-    http-delete swap check-response drop ;
-
 : <head-request> ( url -- request )
     "HEAD" <client-request> ;
 
 : http-head ( url -- response data )
     <head-request> http-request ;
 
-: http-head* ( url -- data )
-    http-head swap check-response drop ;
-
 : <options-request> ( url -- request )
     "OPTIONS" <client-request> ;
 
 : http-options ( url -- response data )
     <options-request> http-request ;
 
-: http-options* ( url -- data )
-    http-options swap check-response drop ;
-
 : <trace-request> ( url -- request )
     "TRACE" <client-request> ;
 
 : http-trace ( url -- response data )
     <trace-request> http-request ;
 
-: http-trace* ( url -- data )
-    http-trace swap check-response drop ;
-
 USE: vocabs.loader
 
 { "http.client" "debugger" } "http.client.debugger" require-when
index 8e9150f69353f67bd6110ea01dc2185b4b26d8d4..407e09aab11dbd68c50ae0b6a10c087ae414b55e 100644 (file)
@@ -108,7 +108,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* parse-feed ;
+    http-get nip parse-feed ;
 
 ! Atom generation
 
index c89c3791bd704791984755bdc87eda951a1968b5..f69eff34b011e2f140b54c89c3461a5468ab1d34 100644 (file)
@@ -23,7 +23,7 @@ ERROR: bad-response json status ;
     ] unless ;
 
 : json-data ( url -- json )
-    http-get* json> check-status "data" of ;
+    http-get nip json> check-status "data" of ;
 
 : get-short-url ( short-url path -- data )
     <bitly-url> swap "shortUrl" set-query-param json-data ;
index 39a615043e9e1699949bc3d6037839df28c0837e..d97a97bceb1ffaf1e620c01dd6abed32feda0016 100644 (file)
@@ -100,6 +100,6 @@ PRIVATE>
 
 : chart. ( chart -- )
     chart>url present dup length 2000 < [ http-image. ] [
-        "?" split1 swap http-post*
+        "?" split1 swap http-post nip
         "png" (image-class) load-image* image.
     ] if ;
index d3d8002f7ab79d074a1154b9bf5b8e8b20212134..4518b114808dcfed03cf016b3b8a0adcc2c37809 100644 (file)
@@ -22,7 +22,7 @@ title content unescapedUrl url titleNoFormatting fileFormat ;
 PRIVATE>
 
 : google-search ( query -- results )
-    search-url http-get* json>
+    search-url http-get nip json>
     { "responseData" "results" } deep-at
     [ \ search-result from-slots ] map ;
 
index 40f810a6400821a2e4889729888f6ed89de0c830..a7a49d52ca853b42a5fd662b0cd9d1816c459c53 100644 (file)
@@ -16,7 +16,7 @@ CONSTANT: maximum-translation-size 5120
     ] { } make ;
 
 : assoc>query-response ( assoc -- response )
-    google-translate-url http-post* ;
+    google-translate-url http-post nip ;
 
 ERROR: response-error response error ;
 
index 3e2e91f186fb486fd8e847eccce9634adfb6ed00..e7faaccf38a2779778b1ed1d0c4f046e49b85a08 100644 (file)
@@ -25,7 +25,7 @@ TUPLE: post title postedBy points id url commentCount postedAgo ;
     ] map ;
 
 : hacker-news-items ( -- seq )
-    "http://api.ihackernews.com/page" http-get*
+    "http://api.ihackernews.com/page" http-get nip
     json> "items" of items> ;
 
 : write-title ( title url -- )
index ca24d98515260e261ee71261d4ea6a5fcf0ddc72..016c1a6d7974da4fa87aa844d0f308e2c5be7271 100644 (file)
@@ -21,7 +21,7 @@ SYMBOLS: latest-sources last-built-sources ;
     [ maybe-download-image drop ] [ file-checksum ] bi ;
 
 : latest-counter ( -- counter )
-    counter-url get-global http-get* string>number ;
+    counter-url get-global http-get nip string>number ;
 
 : update-sources ( -- )
     #! Must be run from builds-dir
index 40cc4ad95a5155ce183ed3db9b6ac29f646a51a1..c6618af1b30ec2d382574efcfbb04b67424ce146 100644 (file)
@@ -44,7 +44,7 @@ public_description subscribers title url ;
 TUPLE: page url data before after ;
 
 : json-page ( url -- page )
-    >url dup http-get* json> "data" of {
+    >url dup http-get nip json> "data" of {
         [ "children" of [ parse-data ] map ]
         [ "before" of [ f ] when-json-null ]
         [ "after" of [ f ] when-json-null ]
@@ -55,7 +55,7 @@ TUPLE: page url data before after ;
 
 : get-user-info ( username -- user )
     "http://api.reddit.com/user/%s/about" sprintf
-    http-get* json> parse-data ;
+    http-get nip json> parse-data ;
 
 : get-url-info ( url -- page )
     "http://api.reddit.com/api/info?url=%s" sprintf json-page ;
index 580e965348148756c8f210df8b54f2e3815850f7..99b375da38fb28d0c0fafe59bfb6f3be9051ca40 100644 (file)
@@ -30,7 +30,7 @@ visit-time request-rate crawl-delay unknowns ;
     >url URL" robots.txt" derive-url ;
 
 : get-robots.txt ( url -- robots.txt )
-    >robots.txt-url http-get* ;
+    >robots.txt-url http-get nip ;
 
 : normalize-robots.txt ( string -- sitemaps seq )
     string-lines
index 66f6f7c91b81986df2e893f529848d2dd1aa4da0..402a960124e28422ceadd9f03249ac68bb4ac10d 100644 (file)
@@ -15,7 +15,7 @@ IN: rosetta-code.web-scraping
 ! and popular such as CPAN for Perl or Boost for C++.
 
 : web-scraping-main ( -- )
-    "http://tycho.usno.navy.mil/cgi-bin/timer.pl" http-get*
+    "http://tycho.usno.navy.mil/cgi-bin/timer.pl" http-get nip
     [ "UTC" swap start [ 9 - ] [ 1 - ] bi ] keep subseq print ;
 
 MAIN: web-scraping-main
index 26f9f89eb742cfb079dd7efccca7877d3834756b..6ba528f9af800776178d624bfbe03237a2f097e9 100644 (file)
@@ -5,7 +5,7 @@ IN: twitter.prettyprint
 
 MEMO: load-http-image ( url -- image/f )
     '[ _
-        [ http-get* ] [ image-class ] bi load-image*
+        [ http-get nip ] [ image-class ] bi load-image*
     ] [ drop f ] recover ;
 
 : user-image ( user -- image/f )
index 6901ea05643c5ea0b3a423e76113d1e95e3892de..52227ade16be4541abf58f3c4df43a4f1045111e 100644 (file)
@@ -34,8 +34,9 @@ TUPLE: fjsc < dispatcher ;
     swap append  ;
 
 : do-compile-url ( url -- response )
-    [ 
-        absolute-url http-get* 'expression' parse fjsc-compile write "();" write
+    [
+        absolute-url http-get nip 'expression' parse
+        fjsc-compile write "();" write
     ] with-string-writer
     "application/javascript" <content> ;
 
index 13127ff1b7091237fd30126cc0b3d9e98f41381e..8bff89b45e61fed9f5be3b9d82449a4720328a9c 100644 (file)
@@ -48,7 +48,7 @@ SYMBOL: language
     [ month-name ] [ day>> ] bi "%s_%s" sprintf wikipedia-url ;
 
 : (historical-events) ( timestamp -- seq )
-    historical-url http-get* string>xml "ul" deep-tags-named ;
+    historical-url http-get nip string>xml "ul" deep-tags-named ;
 
 : items>sequence ( tag -- seq )
     children-tags [ deep-children>string ] map ;
@@ -74,7 +74,7 @@ PRIVATE>
     (historical-events) "Deaths" header. fourth items. ;
 
 : article. ( name -- )
-    wikipedia-url http-get* parse-html
+    wikipedia-url http-get nip parse-html
     "content" find-by-id-between
     [ html-text. ] with-string-writer string-lines
     [ [ blank? ] trim ] map harvest [
index 3766cecfa4a8203bdd62ede45a0b7d2b6729a71d..91a4c3b36b7ea3ea4227869b0b64e4a93d564e49 100644 (file)
@@ -16,7 +16,7 @@ SYMBOL: wolfram-api-id
 : query ( query -- xml )
     url-encode wolfram-api-id get-global
     "http://api.wolframalpha.com/v2/query?input=%s&appid=%s"
-    sprintf http-get* string>xml
+    sprintf http-get nip string>xml
     dup "error" tag-named [
         "msg" tag-named children>string throw
     ] when* ;
index f47be6483ef8ac02ca03875133d0b1d8cdaf8b77..72f8af67f4a3926c2d4a228d26e05dd82f399be4 100644 (file)
@@ -11,19 +11,18 @@ IN: xkcd
 <PRIVATE
 
 : comic-image ( url -- image )
-    http-get*
+    http-get nip
     R" http://imgs\.xkcd\.com/comics/[^\.]+\.(png|jpg)"
     first-match >string load-http-image ;
 
 : comic-image. ( url -- ) comic-image image. ;
 
 : comic-string ( url -- string )
-    http-get* string>xml
+    http-get nip string>xml
     "transcript" "id" deep-tag-with-attr children>string ;
 
 : comic-text. ( url -- )
-    comic-image
-    80 wrap-lines [ print ] each ;
+    comic-image 80 wrap-lines [ print ] each ;
 
 : comic. ( url -- )
     ui-running? [ comic-image. ] [ comic-text. ] if ;
index 9a7ab253907f06b38ffdbc284d64f2774b807b10..7800095330c6fc4a0ea4613862827c6c0b3f73e2 100644 (file)
@@ -57,4 +57,4 @@ CONSTANT: factor-id "fRrVAKzV34GDyeRw6bUHDhEWHRedwfOC7e61wwXZLgGF80E67spxdQXuugB
         swap >>query ;
 
 : yahoo-search ( search -- seq )
-    query http-get* string>xml parse-yahoo ;
+    query http-get nip string>xml parse-yahoo ;
index 900f01e2e6c6ffda33d03b857310d06ce29f6b7d..fde9b05fd6ec3f627cf123a0bc5c06bb0a2483e0 100644 (file)
@@ -50,7 +50,7 @@ CONSTANT: video-info-url URL" http://www.youtube.com/get_video_info"
         "detailpage" "el" set-query-param
         "en_US" "hl" set-query-param
         swap "video_id" set-query-param
-    http-get* query>assoc ;
+    http-get nip query>assoc ;
 
 : video-formats ( video-info -- video-formats )
     "url_encoded_fmt_stream_map" of "," split