diff options
Diffstat (limited to 'docs/conf')
-rw-r--r-- | docs/conf/proxy.rst | 15 | ||||
-rw-r--r-- | docs/conf/ssl.rst | 14 | ||||
-rw-r--r-- | docs/conf/timeouts.rst | 23 |
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() + + |