Skip to content
This repository has been archived by the owner on Sep 4, 2019. It is now read-only.

HTTPS SSL TLS Using websockets doesnt work #87

Closed
dioptre opened this issue Feb 21, 2016 · 1 comment
Closed

HTTPS SSL TLS Using websockets doesnt work #87

dioptre opened this issue Feb 21, 2016 · 1 comment

Comments

@dioptre
Copy link

dioptre commented Feb 21, 2016

Line 381 in Websocket.jl:

sock = WebSocket(client.id, client.sock)

Receives a MbedTLS SSLContext in the client.sock value as per HttpServer.jl:
JuliaWeb/WebSockets.jl#51

  sess = MbedTLS.SSLContext()
        MbedTLS.setup!(sess, ssl_config)
        # set_priority_string!(sess)
        # set_credentials!(sess, cert_store)
        client = accept(server.http.sock)
        try
            MbedTLS.set_bio!(sess, client)
            MbedTLS.handshake(sess)
            # associate_stream(sess, client)
            # handshake!(sess)
        catch e
            println("Error establishing SSL connection: ", e)
            close(client)
            continue
        end
        client = Client(id_pool += 1, sess)
        client.parser = ClientParser(message_handler(server, client, websockets_enabled))
        @async process_client(server, client, websockets_enabled)`

As I'm not sure which project is better to help massage the socket into, I'm looking for help on this one. Please let me know what to do! What else might be needed to make websockets on TLS work? Thanks

PS Here's more interesting debug info:

HttpServer.Client{MbedTLS.SSLContext}(14,MbedTLS.SSLContext(Ptr{Void} @0x0000000003245910,MbedTLS.SSLConfig(Ptr{Void} @0x0000000002dff880,MbedTLS.CtrDrbg(Ptr{Void} @0x0000000002ca2f00,Nullable(MbedTLS.Entropy(Ptr{Void} @0x0000000002e54c90,Any[]))),#undef,(anonymous function),cert. version : 3
serial number : DB:7E:D8:55:3E:F1:AB:AC
issuer name : C=US, ST=CA, L=San Francisco, O=BXI, CN=bxi.io, emailAddress=dioptre@gmail.com
subject name : C=US, ST=CA, L=San Francisco, O=BXI, CN=bxi.io, emailAddress=dioptre@gmail.com
issued on : 2016-02-21 07:47:43
expires on : 2017-02-20 07:47:43
signed using : RSA with SHA-256
RSA key size : 2048 bits
basic constraints : CA=true
,MbedTLS.PKContext(Ptr{Void} @0x0000000002cf1160)),true,TCPSocket(open, 0 bytes waiting)),HttpServer.ClientParser(HttpParser,HttpParser.ParserSettings(Ptr{Void} @0x00007fcb39e9ffc0,Ptr{Void} @0x00007fcb39ea35d0,Ptr{Void} @0x00007fcb39ea3810,Ptr{Void} @0x00007fcb39ea3850,Ptr{Void} @0x00007fcb39ea3a80,Ptr{Void} @0x00007fcb39ea4c80,Ptr{Void} @0x00007fcb39ea50a0,Ptr{Void} @0x00007fcb39ea5210)))WARNING: both Patchwork and Base export "Text"; uses of it in module Main must be qualified
ERROR (unhandled task failure): MethodError: convert has no method matching convert(::Type{TCPSocket}, ::MbedTLS.SSLContext)
This may have arisen from a call to the constructor TCPSocket(...),
since type constructors fall back to convert methods.
Closest candidates are:
TCPSocket(::Any)
call{T}(::Type{T}, ::Any)
convert{T}(::Type{T}, ::T)
...
in call at /home/a/.julia/v0.4/WebSockets/src/WebSockets.jl:57
in handle at /home/a/.julia/v0.4/WebSockets/src/WebSockets.jl:387
in on_message_complete at /home/a/.julia/v0.4/HttpServer/src/HttpServer.jl:393
in on_message_complete at /home/a/.julia/v0.4/HttpServer/src/RequestParser.jl:104

PPS This is what I tried (using client.sock.bio):
dioptre/WebSockets.jl@3bb92d7

...and new error

handling websocket connection:
write: broken pipe (EPIPE)
in yieldto at ./task.jl:71
in wait at ./task.jl:371
in stream_wait at ./stream.jl:60
in uv_write at stream.jl:944
in flush at stream.jl:979
in locked_write at /home/a/.julia/v0.4/WebSockets/src/WebSockets.jl:154
in write at /home/a/.julia/v0.4/WebSockets/src/WebSockets.jl:168
in start_updates at /home/a/projects/bxi/server/www.jl:213
in anonymous at /home/a/projects/bxi/server/www.jl:274
in anonymous at /home/a/.julia/v0.4/Mux/src/Mux.jl:15
in anonymous at /home/a/.julia/v0.4/Mux/src/Mux.jl:8
in splitquery at /home/a/.julia/v0.4/Mux/src/basics.jl:28
in anonymous at /home/a/.julia/v0.4/Mux/src/Mux.jl:8
in wcatch at /home/a/.julia/v0.4/Mux/src/websockets_integration.jl:12
in anonymous at /home/a/.julia/v0.4/Mux/src/Mux.jl:8
in todict at /home/a/.julia/v0.4/Mux/src/basics.jl:21
in anonymous at /home/a/.julia/v0.4/Mux/src/Mux.jl:12 (repeats 2 times)
in anonymous at /home/a/.julia/v0.4/Mux/src/Mux.jl:8
in anonymous at /home/a/.julia/v0.4/Mux/src/server.jl:38
in handle at /home/a/.julia/v0.4/WebSockets/src/WebSockets.jl:394
in on_message_complete at /home/a/.julia/v0.4/HttpServer/src/HttpServer.jl:393
in on_message_complete at /home/a/.julia/v0.4/HttpServer/src/RequestParser.jl:104ERROR (unhandled task failure): write: broken pipe (EPIPE)
in yieldto at ./task.jl:71
in wait at ./task.jl:371
in stream_wait at ./stream.jl:60
in uv_write at stream.jl:944
in flush at stream.jl:979
in locked_write at /home/a/.julia/v0.4/WebSockets/src/WebSockets.jl:154
in close at /home/a/.julia/v0.4/WebSockets/src/WebSockets.jl:197
in handle at /home/a/.julia/v0.4/WebSockets/src/WebSockets.jl:395
in on_message_complete at /home/a/.julia/v0.4/HttpServer/src/HttpServer.jl:393
in on_message_complete at /home/a/.julia/v0.4/HttpServer/src/RequestParser.jl:1

@dioptre
Copy link
Author

dioptre commented Feb 27, 2016

Bump

@aviks aviks closed this as completed Sep 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants