Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

...
  • 7 commits
  • 8 files changed
  • 0 commit comments
  • 2 contributors
2  README.markdown
View
@@ -11,7 +11,7 @@ Declare dependency:
(defproject your-project "1.0.0-SNAPSHOT"
:description "Your project description"
:dependencies [[org.clojure/clojure "1.3.0"]
- [http.async.client "0.4.2"]])
+ [http.async.client "0.4.3"]])
```
Require:
4 changelog.org
View
@@ -3,6 +3,10 @@
#+EMAIL: hubert@happyhacking.nl
#+SETUPFILE: setup.org
+* Release 0.4.3
+** Issue [[https://github.com/neotyk/http.async.client/pull/30][#30]] by [[https://github.com/canassa][Cesar Canassa]]
+ Fixes issue with single cookie in response.
+** Upgrade AHC to 1.7.1
* Release 0.4.2
** Issue [[https://github.com/neotyk/http.async.client/pull/29][#29]] by [[https://github.com/diamondap][A. Diamond]]
Added support for client certificates.
23 docs.org
View
@@ -11,7 +11,7 @@
(defproject your-project "1.0.0-SNAPSHOT"
:description "Your project description"
:dependencies [[org.clojure/clojure "1.3.0"]
- [http.async.client "0.4.2"]])
+ [http.async.client "0.4.3"]])
#+END_SRC
Make sure that your project depends on at least 1.3.0 Clojure as
*http.async.client* will not run in earlier versions.
@@ -692,7 +692,7 @@
Basic method is default, so you don't have to specify it:
#+BEGIN_SRC clojure
- (with-open [client (client/create-client {:auth {:user u :password p}})]
+ (with-open [client (client/create-client :auth {:user u :password p})]
(let [resp (client/GET client url)]
;; Check if response is not 401 or so and process response
))
@@ -718,6 +718,25 @@
;; process response
))
#+END_SRC
+*** SSL Certificates
+ Since v0.4.2 it is possible to use SSL certificates with client.
+
+ For client to use SSL you need to provide it with *ssl-context*.
+ #+BEGIN_SRC clojure
+ (require [http.async.client.cert :as cert])
+ (let [ctx (cert/ssl-context :keystore-file ks-file
+ :keystore-password password
+ :certificate-file cert-file
+ :certificate-alias other-cert-alias)]
+ (with-open [client (client/create-client :ssl-context ctx)]
+ (let [resp (client/GET client url)]
+ ;; process response
+ )))
+ #+END_SRC
+
+ For more documentation please consult docstring of
+ [[http://neotyk.github.com/http.async.client/doc/http.async.client.cert.html#var-ssl-context][*http.async.client.cert/ssl-context*]] and tests.
+
*** Closing *http.async.client*
Whenever you've created *http.async.client* via
[[http://neotyk.github.com/http.async.client/doc/http.async.client.html#var-create-client][*http.async.client/create-client*]] you will need to close it.
2  index.org
View
@@ -12,7 +12,7 @@
(defproject your-project "1.0.0-SNAPSHOT"
:description "Your project description"
:dependencies [[org.clojure/clojure "1.3.0"]
- [http.async.client "0.4.2"]])
+ [http.async.client "0.4.3"]])
#+END_SRC
Require:
6 project.clj
View
@@ -1,4 +1,4 @@
-(defproject http.async.client "0.4.2"
+(defproject http.async.client "0.4.3"
:name "http.async.client"
:description "Asynchronous HTTP Client for Clojure"
:url "http://neotyk.github.com/http.async.client/"
@@ -6,7 +6,7 @@
:java-source-path "src/jvm"
:javac-options {:deprecation "true"}
:dependencies [[org.clojure/clojure "1.3.0"]
- [com.ning/async-http-client "1.7.0"]]
+ [com.ning/async-http-client "1.7.1"]]
:dev-dependencies [[codox "0.4.0"]
[org.eclipse.jetty/jetty-server "7.1.4.v20100610"]
[org.eclipse.jetty/jetty-security "7.1.4.v20100610"]
@@ -17,4 +17,4 @@
;; :repositories {"snapshots" "http://oss.sonatype.org/content/repositories/snapshots/"}
:autodoc {:web-src-dir "http://github.com/neotyk/http.async.client/blob/"
:web-home "http://neotyk.github.com/http.async.client/autodoc/"
- :copyright "Copyright 2011 Hubert Iwaniuk"})
+ :copyright "Copyright 2012 Hubert Iwaniuk"})
3  src/clj/http/async/client/headers.clj
View
@@ -64,7 +64,8 @@
"Creates cookies from headers."
[headers]
(if (contains? headers :set-cookie)
- (for [cookie-string (:set-cookie headers)]
+ (for [cookie-string (let [set-cookie (:set-cookie headers)]
+ (if (string? set-cookie) (vector set-cookie) set-cookie))]
(let [name-token (atom true)]
(into {}
(for [#^String cookie (.split cookie-string ";")]
2  src/clj/http/async/client/request.clj
View
@@ -32,7 +32,7 @@
ByteArrayInputStream
ByteArrayOutputStream)))
-(def ^:dynamic *user-agent* "http.async.client/0.4.2-dev")
+(def ^:dynamic *user-agent* "http.async.client/0.4.3")
(def ^:dynamic *CLIENT* nil)
12 test/http/async/client/test.clj
View
@@ -136,7 +136,7 @@
constraint (Constraint.)
mapping (ConstraintMapping.)
security (ConstraintSecurityHandler.)]
-
+
(.addBean srv loginSrv)
(doto constraint
(.setName Constraint/__BASIC_AUTH)
@@ -481,6 +481,16 @@
(is (thrown-with-msg? RuntimeException #"Too many connections 1" (GET client url)))
(is (not (failed? (await r1)))))))
+
+(deftest single-set-cookie
+ (let [resp (GET *client* "http://localhost:8123/cookie")
+ cookie (first (cookies resp))
+ header (headers resp)]
+ (is (string? (:set-cookie header)))
+ (is (= (:name cookie) "foo"))
+ (is (= (:value cookie) "bar"))))
+
+
(deftest await-string
(let [resp (GET *client* "http://localhost:8123/stream")
body (string (await resp))]

No commit comments for this range

Something went wrong with that request. Please try again.