Giter Club home page Giter Club logo

fs2-http's People

Contributors

adamchlupacek avatar d6y avatar fomkin avatar mraulim avatar n4to4 avatar pchlupacek avatar raffiki avatar s5bug avatar szoio avatar zuzanqa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fs2-http's Issues

`bodyAsString` is waiting connection closing

Hi guys!

I've tried to use client as it shown in README and find out that bodyAsString is waiting connection closing (end of stream). My server doesn't close connection by itself, it waiting closing by client. I've write some code to show what I mean.

val request = HttpRequest.get[Task](Uri.https("fomkin.org", "/hello-world.txt"))
val startTime = System.currentTimeMillis
client.request(request).flatMap { resp =>
  val task = resp.body.runFold(ByteBuffer.allocate(resp.bodySize.get.toInt)) {
    case (buffer, byte) =>
      val t = System.currentTimeMillis - startTime
      println(s"${t}ms: ${byte.toChar}")
      buffer.put(byte)
      buffer
  }
  Stream.eval(task)
}.runLog.map { xs =>
  val t = System.currentTimeMillis - startTime
  println(s"${t}ms: --")
  println(xs.map(x => new String(x.array())))
}

It prints something like

1033ms: H
1033ms: e
1033ms: l
1033ms: l
1033ms: o
1033ms:  
1033ms: W
1033ms: o
1033ms: r
1033ms: l
1033ms: d
6624ms: --
Hello World

Last two line prints only when I reboot nginx.

Runtime error with fs2 v2.0.0

I'd need to use fs2-http with fs2 v2.0.0, but I'm getting the following runtime error:

Exception in thread "specs2.user-14" java.lang.NoSuchMethodError: fs2.io.tcp.package$.client$default$2()Z
	at spinoco.fs2.http.websocket.WebSocket$.$anonfun$client$1(WebSocket.scala:98)
	at spinoco.fs2.http.websocket.WebSocket$.$anonfun$client$1$adapted(WebSocket.scala:97)
	at fs2.Stream$.$anonfun$flatMap$1(Stream.scala:1091)
	at fs2.internal.FreeC$$anon$1.cont(FreeC.scala:31)
	at fs2.internal.FreeC$ViewL$$anon$9$$anon$10.cont(FreeC.scala:239)
	at fs2.internal.FreeC$ViewL$.mk(FreeC.scala:228)
	at fs2.internal.FreeC$ViewL$.apply(FreeC.scala:220)
	at fs2.internal.FreeC.viewL(FreeC.scala:77)
	at fs2.internal.Algebra$.fs2$internal$Algebra$$go$1(Algebra.scala:228)
	at fs2.internal.Algebra$$anon$2.$anonfun$out$1(Algebra.scala:279)
	at fs2.internal.Algebra$.$anonfun$compileLoop$1(Algebra.scala:247)
	at cats.effect.internals.IORunLoop$.cats$effect$internals$IORunLoop$$loop(IORunLoop.scala:139)
	at cats.effect.internals.IORunLoop$RestartCallback.signal(IORunLoop.scala:355)
	at cats.effect.internals.IORunLoop$RestartCallback.run(IORunLoop.scala:366)
	at cats.effect.internals.Trampoline.cats$effect$internals$Trampoline$$immediateLoop(Trampoline.scala:70)
	at cats.effect.internals.Trampoline.startLoop(Trampoline.scala:36)
	at cats.effect.internals.TrampolineEC$JVMTrampoline.super$startLoop(TrampolineEC.scala:93)
	at cats.effect.internals.TrampolineEC$JVMTrampoline.$anonfun$startLoop$1(TrampolineEC.scala:93)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
...

this is with v0.4.1.

Websocket trying to read 2GB of a 728 bit string

Failed to decode value: cannot acquire 16526844176 bits from a vector that contains 728 bits, content: ByteVector(95 bytes, 0x7b2274223a6e756c6c2c2273223a6e756c6c2c226f70223a31302c2264223a7b226865617274626561745f696e74657276616c223a34313235302c225f7472616365223a5b22676174657761792d7072642d6d61696e2d6b673677225d7d7d)
	at spinoco.fs2.http.websocket.WebSocket$impl$.decode$1(WebSocket.scala:323)

I'm using websockets here and here.

A test on your end can be done like so:

object Main extends IOApp {

  override def run(args: List[String]): IO[ExitCode] = {
    implicit val ag = AsynchronousChannelGroup.withThreadPool(Executors.newCachedThreadPool())
    Stream
      .eval(Queue.unbounded[IO, Event])
      .flatMap(queue => {
        Client[IO]("TOKEN_HERE") { in =>
          in.flatMap(e => {
            println(s"Received: $e")
            Stream.empty
          })
        }.login(queue, Sharding.Single())
      })
      .compile
      .drain
      .as(ExitCode.Success)
  }

}

Replacing TOKEN_HERE with a Bot token you get from the Discord Developer Console.

failing decoder tests

in master and series 0.2 (which I hoped to bump to the M8 release of fs2)

! ChunkedEncoding.encode-decode: Falsified after 3 passed tests.
! util.decodes.base64: Falsified after 3 passed tests.

fiddling around a bit with the tests, to give me vectors of code units to have something printable:

[info] > Labels of failing property:
[info] Expected Vector(Right(Vector(62875, 60936, 24080))) but got Vector(Right(Vector(63, 63, 63)))

Note that code unit 63 encodes ?, and 62875 and 60936 are in the private use area.

SSL Handshake Issues

The createSSLEngine call fails to handshake properly for a lot of smaller websites. Bug Location

This can be fixed by adding a reference to the host and port that is being secured. sslContext.createSSLEngine(host, port)

Outdated Websocket README

In websockets, mergeDrainL has become concurrently such that a mergeDrainL b is b concurrently a.

WebSocket: Server keeps sending pings after closing

After receiving close message from a client, server keeps sending ping messages and eventually fails after three unconfirmed attempts. According to RFC it should gracefully close the connection immediately after the close message.

JSON content type not being turned into a String

Could not get a string body: Media Type must be text, but is DefaultMediaType(application,json,true,true,WrappedArray(json))
	at org.discordscala.core.util.RequestUtil$.$anonfun$stringBodyFromResponse$2(RequestUtil.scala:64)
	at cats.syntax.EitherOps$.leftMap$extension(either.scala:144)
	at org.discordscala.core.util.RequestUtil$.$anonfun$stringBodyFromResponse$1(RequestUtil.scala:64)

RequestUtil.scala:64

Add comparison chart to documentation

Hey guys,

I found out about your set of libraries because I recently switched to doobie. Could you create comparison chart that compares fs2-http and akka-http (both client and server side) ? I'm long time user of spray (now akka-http) but I'm always interested if any new frameworks/libraries come up.

Uri to String representation

I could be looking in the wrong place, but I expected to find a stringify Op for Uri.

I assume you must do this somewhere, because you'll construct the string somewhere.

HttpClient very slow if response has content length

If you change spinoco.fs2.http.internal.HttpClientApp to hit http://httpbin.org/html (content length 3741) it will constantly take 60 seconds to complete. Hitting http://httpbin.org/get (content length ~159) returns in the time you would expect. Chunked responses are unaffected.

WebSocket client doesn't handle SSL errors properly

Hi,

It looks, that WebSocket client is unable to handle SSL errors, when initial connection has been established. For example, when we connect to non-ssl host with wss:// protocol, client should raise error, but it doesn't (I think, similar problem exists for other ssl errors, like untrusted certifcate).

How to reproduce:
edit line:

WebSocketRequest.ws("echo.websocket.org", "/", QueryParameter.single("encoding", "text"))

with:
WebSocketRequest.wss("echo.websocket.org", 80, "/", QueryParameter.single("encoding", "text")) (use wss method instead of ws and explicitly set port to 80)

and run the test. I would expect, that client will raise error, but actual client will hang forever.

correct implicits?

following the example at https://github.com/Spinoco/fs2-http#http-client and using the 8 lines of imports I am getting

could not find implicit value for parameter AG: java.nio.channels.AsynchronousChannelGroup
[error]     http.client[Task]().flatMap { client =>

are you sure this is the full list of imports?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.