Btw,
I tried connecting to the stream using plain old java.net.HttpUrlConnection
> val connection = new java.net.URL("...").openConnection()
// set headers
connection.getInputStream
connection.getResponseCode
this way it just works and I get status code 200. So it seems something
goes wrong in akka http.
Jeroen
On Wednesday, July 15, 2015 at 5:01:32 PM UTC+2, Jeroen Rosenberg wrote:
>
> Thnx Johannes for the swift reply :)
>
> I'm using JDK 7. I strongly suspect the host I connect to (stream.gnip.com)
> to be a virtual host (as they also provide other endpoints such as
> api.gnip.com). I just tried with 1.0 and it gives me the same result.
>
> Jeroen
>
> On Wednesday, July 15, 2015 at 4:47:10 PM UTC+2, Johannes Rudolph wrote:
>>
>> Hi Jeroen,
>>
>> is this a virtual host you are connecting against? This may hint towards
>> the client not sending the TLS SNI extension correctly which could be a bug
>> in akka-http or due to an old JDK version on your client. Which JDK version
>> do you use?
>>
>> https://en.wikipedia.org/wiki/Server_Name_Indication says that you would
>> need at least JDK 7 to make SNI work (only relevant if the host you connect
>> against is an HTTPS virtual host).
>>
>> Also, you could try the just released 1.0 version (though I cannot think
>> of a reason why that should fix it).
>>
>> Johannes
>>
>> On Wednesday, July 15, 2015 at 4:13:14 PM UTC+2, Jeroen Rosenberg wrote:
>>>
>>> I'm trying to connect to a third party streaming API over HTTPS using
>>> "akka-stream-experimental" % "1.0-RC4" and "akka-http-experimental" %
>>> "1.0-RC4"
>>>
>>> My code looks like this
>>>
>>> class GnipStreamHttpClient(host: String, account: String, processor:
>>>>> ActorRef) extends Actor with ActorLogging {
>>>>
>>>> this: Authorization =>
>>>>
>>>>
>>>>> private val system = context.system
>>>>
>>>> private val endpoint = Uri(s"https://$host/somepath")
>>>>
>>>> private implicit val executionContext = system.dispatcher
>>>>
>>>> private implicit val flowMaterializer: Materializer =
>>>>> ActorMaterializer(ActorMaterializerSettings(system))
>>>>
>>>>
>>>>> val client = Http(system).outgoingConnectionTls(host, port, settings
>>>>> = ClientConnectionSettings(system))
>>>>
>>>>
>>>>> override def receive: Receive = {
>>>>
>>>> case response: HttpResponse if response.status.intValue / 100 == 2
>>>>> =>
>>>>
>>>> response.entity.dataBytes.map(processor ! _).runWith(Sink.ignore)
>>>>
>>>> case response: HttpResponse =>
>>>>
>>>> log.info(s"Got unsuccessful response $response")
>>>>
>>>> case _ =>
>>>>
>>>> val req = HttpRequest(GET,
>>>>> endpoint).withHeaders(`Accept-Encoding`(gzip), Connection("Keep-Alive"))
>>>>> ~>
>>>>> authorize
>>>>
>>>> log.info(s"Making request: $req")
>>>>
>>>> Source.single(req)
>>>>
>>>> .via(client)
>>>>
>>>> .runWith(Sink.head)
>>>>
>>>> .pipeTo(self)
>>>>
>>>> }
>>>>
>>>> }
>>>>
>>>>
>>> As a result I'm getting an Http 404 response. This doesn't make much
>>> sense to me as when I copy the full url to curl it just works
>>>
>>>> curl --compressed -v -uuser:pass https://my.streaming.api.com/somepath
>>>>
>>>
>>> Also when I connect to a mock implementation of this streaming API using
>>> Http protocol, my code works fine (using outgoingConnection instead of
>>> outgoingConnectionTls).
>>>
>>> What do I do wrong when making Https request? As far as I understand
>>> changing to outgoingConnectionTls should be enough for most cases.
>>>
>>> Any help is be appreciated!
>>>
>>
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ:
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.