WebSockets.jl icon indicating copy to clipboard operation
WebSockets.jl copied to clipboard

Update to HTTP 1?

Open mind6 opened this issue 2 years ago • 4 comments

There are several popular package dependencies on WebSockets which conflict with using HTTPv1 in the same environment.

https://github.com/JuliaGizmos/WebIO.jl/pull/500

Can we make a new release that makes WebSockets use HTTP1? That might be easier than updating several packages to drop the use of WebSockets.

I tried to look at this but I am having trouble passing tests on Windows as well as WSL/Ubuntu.

On WSL/Ubutnu

Base.show: Error During Test at /home/kirby/.julia/dev/WebSockets/test/runtests.jl:12
  Got exception outside of a @test
  LoadError: TypeError: in typeassert, expected Ptr{Nothing}, got a value of type Ptr{UInt64}
  Stacktrace:
    [1] getproperty
      @ ./stream.jl:60 [inlined]
    [2] _uv_status_tuple
      @ ~/.julia/dev/WebSockets/src/show_ws.jl:73 [inlined]
    [3] top-level scope
      @ ~/.julia/dev/WebSockets/test/show_test.jl:12
    [4] include(fname::String)
      @ Base.MainInclude ./client.jl:476
    [5] macro expansion
      @ ~/.julia/dev/WebSockets/test/runtests.jl:13 [inlined]
    [6] macro expansion
      @ /opt/julia-1.8.2/share/julia/stdlib/v1.8/Test/src/Test.jl:1357 [inlined]
    [7] macro expansion
      @ ~/.julia/dev/WebSockets/test/runtests.jl:13 [inlined]
    [8] macro expansion
      @ /opt/julia-1.8.2/share/julia/stdlib/v1.8/Test/src/Test.jl:1357 [inlined]
    [9] top-level scope
      @ ~/.julia/dev/WebSockets/test/runtests.jl:8
   [10] include(fname::String)
      @ Base.MainInclude ./client.jl:476
   [11] top-level scope
      @ none:6
   [12] eval
      @ ./boot.jl:368 [inlined]
   [13] exec_options(opts::Base.JLOptions)
      @ Base ./client.jl:276
   [14] _start()
      @ Base ./client.jl:522
  in expression starting at /home/kirby/.julia/dev/WebSockets/test/show_test.jl:7
...
Test Summary:                   | Pass  Error  Total     Time
WebSockets                      |  986      6    992  3m42.3s
  Base.show                     |           1      1     1.3s
  WebSocketLogger               |   57            57     3.8s
  Fragment and unit             |  823           823    22.9s
  Handshake                     |   27            27     1.9s
  Client                        |   13            13    41.1s
  Client_listen                 |           1      1     8.7s
  Client_serverWS               |   16      4     20    36.0s
  Abrupt close & error handling |   50            50  1m46.3s

On Windows it freezes after starting the Client_listen test.

mind6 avatar Nov 19 '22 16:11 mind6

Thanks for the ref. to the WebIO discussion. Also ref. #179. I believe a lot of effort has been put into HTTP lately, but there may still be features here that is lacking in HTTP.jl. I don't know.

It seems you are temporarily stranded on a detail. However, @anj00 just submitted PR #182. Are you already working together on this, or could you make suggestions to that PR based on your local changes?

hustf avatar Nov 19 '22 17:11 hustf

I didn't know he's working on it. He's further along than me I hope his PR can work. 😃

mind6 avatar Nov 19 '22 18:11 mind6

I will be travelling for the next few days. It would be really great if you could help out with the PR, see that last comment!

hustf avatar Nov 19 '22 22:11 hustf

Alright. I pass the original tests after updating show_test.jl. Looks like it last worked pre-Julia 1.6

mind6 avatar Nov 20 '22 17:11 mind6

We have now published v1.6.0, since there is some holdup in other packages.

While updating README, I discovered one obstacle: Returning Response(200) is no longer acceptable to HTTP.jl, while other response codes are.

Thanks for the input, and don't hesitate to PR if you have further improvements!

hustf avatar Nov 29 '22 14:11 hustf