Add a client backend for HttpURLConnection #1882
Conversation
object HttpURLConnectionClient { | ||
|
||
/** Construct a new Client */ | ||
def apply[F[_]](implicit F: Effect[F]): Client[F] = |
rossabaker
May 28, 2018
Author
Member
We probably want a configuration here for timeouts?
We probably want a configuration here for timeouts?
f3906bc
to
b63346b
import scala.concurrent.ExecutionContext | ||
|
||
package object internal { | ||
def blocking[F[_], A](fa: F[A], blockingExecutionContext: ExecutionContext)(implicit F: Async[F], ec: ExecutionContext): F[A] = |
rossabaker
Jun 17, 2018
Author
Member
This looks a lot like @ChristopherDavenport's linebacker 0.1 and the not ideal combinator in @SystemFw's gist.
Better can be done with bracket. Better still can be done with rank-N types. But maybe this is the best we can do now?
This looks a lot like @ChristopherDavenport's linebacker 0.1 and the not ideal combinator in @SystemFw's gist.
Better can be done with bracket. Better still can be done with rank-N types. But maybe this is the best we can do now?
val hostnameVerifier: Option[HostnameVerifier], | ||
val sslSocketFactory: Option[SSLSocketFactory], | ||
val blockingExecutionContext: ExecutionContext, | ||
)(implicit ec: ExecutionContext) { |
rossabaker
Jun 17, 2018
Author
Member
This is a good example of what I have in mind for the client and server configurations. This can be evolved by adding more values. Generating the with
methods is tedious, but I think compatibility wins here.
This is a good example of what I have in mind for the client and server configurations. This can be evolved by adding more values. Generating the with
methods is tedious, but I think compatibility wins here.
rossabaker
Jun 17, 2018
Author
Member
Maybe having types named BlahClient
create a plain old Client
is confusing. We could all this a JavaNetClientBuilder
or JavaNetClientConfig
, but I like the shape.
Maybe having types named BlahClient
create a plain old Client
is confusing. We could all this a JavaNetClientBuilder
or JavaNetClientConfig
, but I like the shape.
Quite useful in the REPL, yeah. |
It's still not great. The body I/O blocks. |
@@ -0,0 +1,39 @@ | |||
http4s | |||
Copyright 2013-2018 http4s.org | |||
Licensed under Apache License 2.0 (see LICENSE) |
rossabaker
Jun 18, 2018
Author
Member
We're technically supposed to include the license of all the projects we copied from. I took the liberty of doing so while adding yet another project to copy and paste from.
A former employer's lawyer once told me we need to have the copyright boilerplate on all our source files. I told him not while we were maintaining multiple branches. But maybe now is a good time. But that's a discussion for another ticket.
We're technically supposed to include the license of all the projects we copied from. I took the liberty of doing so while adding yet another project to copy and paste from.
A former employer's lawyer once told me we need to have the copyright boilerplate on all our source files. I told him not while we were maintaining multiple branches. But maybe now is a good time. But that's a discussion for another ticket.
fa0 <- F.fromEither(att) | ||
} yield fa0 | ||
|
||
/** Like fs2.io.readInputStream, but does a double shift with [[blocking]]. */ |
rossabaker
Jun 18, 2018
Author
Member
I think everything from here below disappears in fs2-1.0, because it does a double shift. This is basically all a backport to fs2-0.10.
I think everything from here below disappears in fs2-1.0, because it does a double shift. This is basically all a backport to fs2-0.10.
Licensed under Apache License 2.0 (see LICENSE) | ||
|
||
This software contains portions of code derived from finagle | ||
https://github.com/twitter/finagle |
rossabaker
Jun 18, 2018
Author
Member
The version we copied from has no copyright. 😕
The version we copied from has no copyright.
Bump. I dismissed @SystemFw's earlier approval due to substantial changes. |
We can't really get around this blocking somewhere, so I think packing it away like this is a good solution. |
It's a bit of a shame since the main use for this is probably the repl, where you normally just import |
Yeah, it made it slightly more awkward to use in the REPL, but it'll be a bit more consistent with our other java.io builders. You know, we could have a |
It's not production grade. It blocks. But it comes with no extra dependencies, doesn't need to be shut down, and is nice for a REPL session.