aboutsummaryrefslogtreecommitdiff
path: root/docs/conf
diff options
context:
space:
mode:
authoradamw <adam@warski.org>2017-10-12 19:23:09 +0200
committeradamw <adam@warski.org>2017-10-12 19:23:09 +0200
commit7bf4d02da823c21b27cf20ba0b764b511ac69432 (patch)
tree04b9ab557c4af82b9970af386e6f4f9e4292e472 /docs/conf
parent7885188a982c193e26f8ca6bc9aea8f6a642b32d (diff)
downloadsttp-7bf4d02da823c21b27cf20ba0b764b511ac69432.tar.gz
sttp-7bf4d02da823c21b27cf20ba0b764b511ac69432.tar.bz2
sttp-7bf4d02da823c21b27cf20ba0b764b511ac69432.zip
More docs
Diffstat (limited to 'docs/conf')
-rw-r--r--docs/conf/proxy.rst15
-rw-r--r--docs/conf/ssl.rst14
-rw-r--r--docs/conf/timeouts.rst23
3 files changed, 52 insertions, 0 deletions
diff --git a/docs/conf/proxy.rst b/docs/conf/proxy.rst
new file mode 100644
index 0000000..85b140a
--- /dev/null
+++ b/docs/conf/proxy.rst
@@ -0,0 +1,15 @@
+Proxy support
+=============
+
+A proxy can be specified when creating a backend::
+
+ import com.softwaremill.sttp._
+
+ implicit val backend = HttpURLConnectionBackend(
+ options = SttpBackendOptions.httpProxy("some.host", 8080))
+
+ sttp
+ .get(uri"...")
+ .send() // uses the proxy
+
+
diff --git a/docs/conf/ssl.rst b/docs/conf/ssl.rst
new file mode 100644
index 0000000..8b58e25
--- /dev/null
+++ b/docs/conf/ssl.rst
@@ -0,0 +1,14 @@
+SSL
+===
+
+SSL handling can be customized (or disabled) when creating a backend and is
+backend-specific.
+
+Depending on the underlying backend's client, you can customize SSL settings
+as follows:
+
+* ``HttpUrlConnectionBackend``: when creating the backend, specify the ``customizeConnection: HttpURLConnection => Unit`` parameter, and set the hostname verifier & SSL socket factory as required
+* akka-http: when creating the backend, specify the ``customHttpsContext: Option[HttpsConnectionContext]`` parameter. See `akka-http docs <http://doc.akka.io/docs/akka-http/current/scala/http/server-side/server-https-support.html>`_
+* async-http-client: create a custom client and use the ``setSSLContext`` method
+* OkHttp: create a custom client modifying the SSL settings as described `on the wiki <https://github.com/square/okhttp/wiki/HTTPS>`_
+
diff --git a/docs/conf/timeouts.rst b/docs/conf/timeouts.rst
new file mode 100644
index 0000000..72b2f4a
--- /dev/null
+++ b/docs/conf/timeouts.rst
@@ -0,0 +1,23 @@
+Timeouts
+========
+
+Sttp supports read and connection timeouts:
+
+* Connection timeout - can be set globally (30 seconds by default)
+* Read timeout - can be set per request (1 minute by default)
+
+How to use::
+
+ import com.softwaremill.sttp._
+ import scala.concurrent.duration._
+
+ // all backends provide a constructor that allows users to specify backend options
+ implicit val backend = HttpURLConnectionBackend(
+ options = SttpBackendOptions.connectionTimeout(1.minute))
+
+ sttp
+ .get(uri"...")
+ .readTimeout(5.minutes) // or Duration.Inf to turn read timeout off
+ .send()
+
+