From ee9af71154f0671e2da7d981ee5db373641dddb8 Mon Sep 17 00:00:00 2001 From: Istvan Ban Date: Mon, 14 Jun 2021 22:09:02 +0200 Subject: [PATCH] change http://http-kit.org to http://http-kit.github.io --- _posts/2013-02-05-http-kit-clean-small.md | 7 ++++--- client.html | 16 ++++++++-------- index.html | 2 +- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/_posts/2013-02-05-http-kit-clean-small.md b/_posts/2013-02-05-http-kit-clean-small.md index d67d4ff..b5a8c02 100644 --- a/_posts/2013-02-05-http-kit-clean-small.md +++ b/_posts/2013-02-05-http-kit-clean-small.md @@ -6,9 +6,9 @@ status: publish title: http-kit is clean and small, less is exponentially more --- -* [HTTP server](http://http-kit.org/server.html): event-driven, ring adapter, websocket extension, asynchronous extension -* [HTTP Client](http://http-kit.org/client.html): event-driven, asynchronous with promise, synchronous with @promise, keep-alive -* [Timer facility](http://http-kit.org/timer.html) +* [HTTP server](http://http-kit.github.io/server.html): event-driven, ring adapter, websocket extension, asynchronous extension +* [HTTP Client](http://http-kit.github.io/client.html): event-driven, asynchronous with promise, synchronous with @promise, keep-alive +* [Timer facility](http://http-kit.github.io/timer.html) All the above + high concurrency + high performance + nice API + written from scrach = ~3K lines of code. @@ -35,3 +35,4 @@ Less is exponentially more *cloc runned time: Tue Feb 5 23:23:58 CST 2013, on master branch, from src directory* *Edit: 2013/3/29 with release 2.0.0, the codebase is slightly larger: 2970 lines of Java, 266 lines of Clojure* +*Edit: 2021/6/14: fix URLs* diff --git a/client.html b/client.html index aa79c3a..f04f034 100644 --- a/client.html +++ b/client.html @@ -57,7 +57,7 @@

Combined, concurrent requests, handle results

Send request concurrently, with half the waiting time

{% highlight clojure %} -(let [resp1 (http/get "http://http-kit.org/") +(let [resp1 (http/get "http://http-kit.github.io/") resp2 (http/get "http://clojure.org/")] (println "Response 1's status: " (:status @resp1)) ; wait as necessary (println "Response 2's status: " (:status @resp2))) @@ -82,11 +82,11 @@

Persistent connection

That can be configured by the keepalive option:

{% highlight clojure %} ; keepalive for 30s -@(http/get "http://http-kit.org" {:keepalive 30000}) +@(http/get "http://http-kit.github.io" {:keepalive 30000}) ; will reuse the previous TCP connection -@(http/get "http://http-kit.org" {:keepalive 30000}) +@(http/get "http://http-kit.github.io" {:keepalive 30000}) ; disable keepalive for this request -@(http/get "http://http-kit.org" {:keepalive -1}) +@(http/get "http://http-kit.github.io" {:keepalive -1}) {% endhighlight %}

Pass state to asynchronous callback

@@ -100,7 +100,7 @@

Pass state to asynchronous callback

;;; save state for callback, useful for async request (let [opts {:start-time (System/currentTimeMillis)}] - (http/get "http://http-kit.org" opts callback)) + (http/get "http://http-kit.github.io" opts callback)) {% endhighlight %}

Output coercion

@@ -157,7 +157,7 @@

Nested params

Various options

{% highlight clojure %} -(http/request {:url "http://http-kit.org/" +(http/request {:url "http://http-kit.github.io/" :method :get ; :post :put :head or other :user-agent "User-Agent string" :oauth-token "your-token" @@ -194,8 +194,8 @@

Faking Responses in Tests

{% highlight clojure %} -(with-fake-http ["http://http-kit.org/" "a fake response"] - (http/get {:url "http://http-kit.org/"})) ; promise wrapping the faked response +(with-fake-http ["http://http-kit.github.io/" "a fake response"] + (http/get {:url "http://http-kit.github.io/"})) ; promise wrapping the faked response {% endhighlight %} diff --git a/index.html b/index.html index 72831eb..b529cc9 100644 --- a/index.html +++ b/index.html @@ -41,7 +41,7 @@

HTTP Server documentation

HTTP Client documentation

{% highlight clojure %} ;; start concurrent requests, get promise, half the waiting time -(let [response1 (http-kit/get "http://http-kit.org/") +(let [response1 (http-kit/get "http://http-kit.github.io/") response2 (http-kit/get "http://clojure.org/")] ;; Handle responses one-by-one, blocking as necessary ;; Other keys :headers :body :error :opts