I have the following non-working code:
object Main extends App { import dispatch._ def test(address: String) = { Await.result(Http.default(url(address).GET OK as.String), Duration.Inf) } // This works fine val s1 = test("http://download.finance.yahoo.com/d/quotes.csv?s=MSFT&f=sohgbav") println(s1) // This throws Exception 1 val s2 = test("http://www.alphavantage.co/query?function=TIME_SERIES_DAILY_ADJUSTED&symbol=MSFT&apikey=demo&datatype=csv") println(s2) // This throws Exception 2 val s3 = test("https://www.alphavantage.co/query?function=TIME_SERIES_DAILY_ADJUSTED&symbol=MSFT&apikey=demo&datatype=csv") println(s3) }
I would like to know why "s1" works fine, while the exceptions "s2" and "s3" exclude. The exception is:
Exception 1:
[error] ! access URL [error] java.util.concurrent.ExecutionException: dispatch.StatusCode: Unexpected response status: 301 (NettyResponseFuture.java:172) [error] org.asynchttpclient.netty.NettyResponseFuture.get(NettyResponseFuture.java:172) [error] dispatch.HttpExecutor.$anonfun$apply$3(execution.scala:123)
Exception 2:
[error] ! access URL [error] java.util.concurrent.ExecutionException: java.net.ConnectException: General SSLEngine problem (NettyResponseFuture.java:172) [error] org.asynchttpclient.netty.NettyResponseFuture.get(NettyResponseFuture.java:172) [error] dispatch.HttpExecutor.$anonfun$apply$3(execution.scala:123)
In addition, all three URLs work properly when I access them through the Safari web browser. Why does the first URL work fine through submit, but the last two don't work?
Bruno source share