A Lightweight and fully asynchronous WebSocket client library based on libev

Overview

libuwsc(中文)

license PRs Welcome Issue Welcome Release Version Build Status

A Lightweight and fully asynchronous WebSocket client library based on libev for Embedded Linux. And provide Lua-binding.

Why should I choose libev?

libev tries to follow the UNIX toolbox philosophy of doing one thing only, as good as possible.

Features

  • Lightweight - 35KB(Using glibc,stripped)
  • Fully asynchronous - Use libev as its event backend
  • Support ssl - OpenSSL, mbedtls and CyaSSl(wolfssl)
  • Code structure is concise and understandable, also suitable for learning
  • Lua-binding

Dependencies

Install dependent packages

sudo apt install libev-dev libssl-dev

Build and install

git clone --recursive https://github.com/zhaojh329/libuwsc.git
cd libuwsc
mkdir build && cd build
cmake ..
make && sudo make install

Install on OpenWrt

opkg update
opkg list | grep libuwsc
opkg install libuwsc-nossl

If the install command fails, you can compile it yourself.

Contributing

If you would like to help making libuwsc better, see the CONTRIBUTING.md file.

Comments
  • [bug] Issue with UWSC_OP_TEXT scrambling data

    [bug] Issue with UWSC_OP_TEXT scrambling data

    Description

    When using libuwsc I noticed that the JSON strings I was getting back were often scrambled and this caused the parser to fail. So I wrote a program to reproduce this problem in a way that was clear. The program establishes a connection with the websocket server provided by https://www.websocket.org/echo.html (wss://echo.websocket.org). This server sends a text reply whenever it receives a message containing the text of the message. My program will send a message with a predefined sample text every three seconds. This can be used to test if libuwsc is mutating the data that is being received.

    Output of program
    Short-mode output

    Using the latest upstream (https://github.com/zhaojh329/libuwsc/commit/8bad3e17064cc6812db21407f4a3112c44c29905), the output of short mode is like this most of the time:

    =====================================================
    Sent: "This is a sample string." # This is what is sent to the WS url
    OK: content==test: "This is a sample string." # This is what is received in response, it should be the same
    =====================================================
    Sent: "This is a sample string."
    OK: content==test: "This is a sample string."
    =====================================================
    Sent: "This is a sample string."
    OK: content==test: "This is a sample string."
    =====================================================
    Sent: "This is a sample string."
    OK: content==test: "This is a sample string."
    =====================================================
    

    This indicates that libuwsc is doing its job. However, sometimes this will happen:

    Sent: "This is a sample string."
    ERR: content!=test: "This is a sample string.□libuwsc"
    =====================================================
    

    The string "libuwsc" is appended to the returned result. This is the most common error. If left running for long enough, this can occur:

    Sent: "This is a sample string."
    ERR: content!=test: "This is a sample string.otocol Handshake"
    =====================================================
    Sent: "This is a sample string."
    ERR: content!=test: "This is a sample string.ndshake"
    =====================================================
    Sent: "This is a sample string."
    ERR: content!=test: "This is a sample string.de"
    =====================================================
    Sent: "This is a sample string."
    ERR: content!=test: "This is a sample string. 00:26:47 GMT"
    =====================================================
    Sent: "This is a sample string."
    ERR: content!=test: "This is a sample string.□libuwsc"
    =====================================================
    Sent: "This is a sample string."
    ERR: content!=test: "This is a sample string.k2c="
    =====================================================
    Sent: "This is a sample string."
    ERR: content!=test: "This is a sample string.way"
    =====================================================
    

    I'm not sure where these appended strings are coming from. Maybe additional data in the received payload? Immediately after this:

    Sent: "This is a sample string."
    ERR: content!=test: "This is a sample string.
    □libuwsc□↑This is a sample string.□↑This is a sample string.□↑This is a sample string.□libuwsc□↑This is a sample string.□↑This is a sample string.□↑This is a sample string.□libuwsc□↑This is a sample string.□↑This is a sample string.□↑This is a sample string.□↑This is a sample string.□libuwsc□↑This is a sample string.□↑This is a sample string.□↑This is a sample string.□↑This is a sample string.□libuwsc□↑This is a sample string.□↑This is a sample string.□↑This is a sample string.□libuwsc□↑This is a sample string.□↑This is a sample string.□↑This is a sample string.□libuwsc□↑This is a sample string.□↑This is a sample string.□↑This is a sample string.□↑This is a sample string.□libuwsc□↑This is a sample string.□↑This is a sample string.□↑This is a sample string.□↑This is a sample string.□libuwsc□↑This is a sample string.□↑This is a sample string.□↑This is a sample string.□libuwsc□↑This is a sample string.□↑This is a sample string.□↑This is a sample string.□↑This is a sample string.□libuwsc□↑This is a sample string.□↑This is a sample string.□↑This is a sample string.□libuwsc□↑This is a sample string.□↑This is a sample string.□↑This is a sample string.□↑This is a sample string.□libuwsc□↑This is a sample string.□↑This is a sample string.□↑This is a sample string.□↑This is a sample string.□libuwsc□↑This is a sample string.□↑This is a sample string.□↑This is a sample string.□libuwsc□↑This is a sample string.□↑This is a sample string.□↑This is a sample string.□↑This is a sample string.□libuwsc□↑This is a sample string.□↑This is a sample string.□↑This is a sample string.□libuwsc□↑This is a sample string.□↑This is a sample string.□↑This is a sample string.□↑This is a sample string.□libuwsc□↑This is a sample string.□↑This is a sample string.□↑This is a sample string.□libuwsc□↑This is a sample string.□↑This is a sample string.□↑This is a sample string.□↑This is a sample string.□libuwsc□↑This is a sample string.□↑This is a sample string.□↑This is a sample string.□libuwsc□↑This is a sample string.□↑This is a sample string.□↑This is a sample string.□↑This is a sample string.□libuwsc□↑This is a sample string.□↑This is a sample string.□↑This is a sample string.□libuwsc□↑This is a sample string.□↑This is a sample string.□↑This is a sample string.□↑This is a sample string.□libuwsc□↑This is a sample string.□↑This is a sample string.□↑This is a sample string.□libuwsc□↑This is a sample string.□↑This is a sample string.□↑This is a sample string.□↑This is a sample string.□libuwsc□↑This is a sample string.□↑This is a sample string.□↑This is a sample string.□libuwsc□↑This is a sample string.□↑This is a sample string.□↑This is a sample string.□↑This is a sample string.□libuwsc□↑This is a sample string.□↑This is a sample string.□↑This is a sample string.□libuwsc□↑This is a sample string.□↑This is a sample string.□↑This is a sample string.□↑This is a sample string.□libuwsc□↑This is a sample string.□↑This is a sample string.□↑This is a sample string.□libuwsc□↑This is a sample string.□↑This is a sample string.□↑This is a sample string.□↑This is a sample string.□libuwsc□↑This is a sample string.□↑This is a sample string.□↑This is a sample string.□↑This is a sample string.□libuwsc□↑This is a sample string.□↑This is a sample string.□↑This is a sample string.□libuwsc□↑This is a sample string.□↑This is a sample string.□↑This is a sample string.□↑This is a sample string.□libuwsc□↑This is a sample string.□↑This is a sample string.□↑This is a sample string.□libuwsc□↑This is a sample string.□↑This is a sample string.□↑This is a sample string.□libuwsc□↑This is a sample string.□↑This is a sample string.□↑This is a sample string.□↑This is a sample string.□libuwsc□↑This is a sample string.□↑This is a sample string.□↑This is a sample string.□libuwsc□↑This is a sample string.□↑This is a sample string.□↑This is a sample string.□↑This i"
    =====================================================
    

    Long-mode output

    My test has two modes because it is much easier to reproduce with a larger amount of text. Proper functioning looks like:

    Sent: "10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
    "
    OK: content==test: "10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
    "
    =====================================================
    

    In a brief amount of iterations:

    Sent: "10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
    "
    ERR: content!=test: "10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
    □libuwsc4 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
    □~10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
    □~10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
    □libuwsc□~10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
    □~10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
    □~10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
    □libuwsc□~10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
    □~10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
    □~10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
    □~10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
    □libuwsc□~10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
    □~10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
    □~10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
    □~10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 9"
    =====================================================
    

    Given this we can see that for whatever reason the text is being duplicated, often separated with garbage characters and the string "libuwsc". A repetition always starts with the beginning of the string but is sometimes truncated at the end.

    To reproduce

    Clone curz46/libuwsc-test and follow the instructions in the README.md. Run the program using ./bin/test and select a mode. Leave the program running until error is observed.

    Questions

    • How could this be occurring?
    • Which parts of the source are related to the receiving and passing of text to onmessage?
    • Which parts of the source could be responsible?

    Thanks, Dylan

    bug 
    opened by curz46 4
  • Build failed on Macos

    Build failed on Macos

    Is this lib compatible with MacOS, iOS or Android? I try to build it on MacOS but it fails. Also, is it threat safe?

    with '-Wno-misleading-indentation'

    error: unknown warning option '-Wno-misleading-indentation'; did you mean '-Wno-binding-in-condition'? [-Werror,-Wunknown-warning-option]
    

    with -Wno-binding-in-condition

    uwsc.c:66:12: error: implicit declaration of function 'htobe16' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        code = htobe16(code & 0xFFFF);
               ^
    uwsc.c:117:29: error: implicit declaration of function 'be16toh' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
            frame->payloadlen = be16toh(buffer_pull_u16(rb));
                                ^
    uwsc.c:122:15: error: implicit declaration of function 'be64toh' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
            len = be64toh(buffer_pull_u64(rb));
                  ^
    uwsc.c:122:15: note: did you mean 'be16toh'?
    uwsc.c:117:29: note: 'be16toh' declared here
            frame->payloadlen = be16toh(buffer_pull_u16(rb));
                                ^
    uwsc.c:421:28: error: implicit declaration of function 'htobe16' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
            buffer_put_u16(wb, htobe16(len));
                               ^
    uwsc.c:424:28: error: implicit declaration of function 'htobe64' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
            buffer_put_u64(wb, htobe64(len));
                               ^
    uwsc.c:462:28: error: implicit declaration of function 'htobe16' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
            buffer_put_u16(wb, htobe16(len));
                               ^
    uwsc.c:465:28: error: implicit declaration of function 'htobe64' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
            buffer_put_u64(wb, htobe64(len));
                               ^
    uwsc.c:575:36: error: use of undeclared identifier 'SOCK_NONBLOCK'
        sock = tcp_connect(host, port, SOCK_NONBLOCK | SOCK_CLOEXEC, &inprogress, &eai);
                                       ^
    uwsc.c:575:52: error: use of undeclared identifier 'SOCK_CLOEXEC'
        sock = tcp_connect(host, port, SOCK_NONBLOCK | SOCK_CLOEXEC, &inprogress, &eai);
                                                       ^
    
    
    opened by selimanac 3
  • running example.c gives error

    running example.c gives error

    I did all these steps in order as in README.md successfully.

    sudo apt install libev-dev libssl-dev

    git clone --recursive https://github.com/zhaojh329/libuwsc.git
    cd libuwsc
    mkdir build && cd build
    cmake ..
    make && sudo make install
    

    I'm not able to complile example.c with gcc example.c

    it gives this error

    ../example/example.c:30:10: fatal error: uwsc.h: No such file or directory #include "uwsc.h"

    opened by manibharathytu 2
  • uwsc_new 2nd argument from char*

    uwsc_new 2nd argument from char*

    warning: assignment to 'void (*)(struct uwsc_client *, void *, size_t,  _Bool)' {aka 'void (*)(struct uwsc_client *, void *, unsigned int,  _Bool)'} from incompatible pointer type 'void (*)(struct uwsc_client *, char *, size_t,  _Bool)' {aka 'void (*)(struct uwsc_client *, char *, unsigned int,  _Bool)'} [-Wincompatible-pointer-types]
      cl->onmessage = uwsc_onmessage;
                    ^
    

    Do you have any idea how to fix that, I'm getting the address from argv.

    opened by andrewhodel 2
  • Libuwsc and rtty only support aarch64?

    Libuwsc and rtty only support aarch64?

    RT, I just tested building in ubuntu-18.04-amd64-docker env and found an error:

    Scanning dependencies of target uwsc
    [  5%] Building C object src/CMakeFiles/uwsc.dir/uwsc.c.o
    [ 11%] Building C object src/CMakeFiles/uwsc.dir/log.c.o
    [ 16%] Building C object src/CMakeFiles/uwsc.dir/utils.c.o
    [ 22%] Building C object src/CMakeFiles/uwsc.dir/buffer.c.o
    [ 27%] Building C object src/CMakeFiles/uwsc.dir/sha1.c.o
    [ 33%] Building C object src/CMakeFiles/uwsc.dir/base64.c.o
    [ 38%] Building C object src/CMakeFiles/uwsc.dir/ssl.c.o
    make[2]: *** No rule to make target '/usr/lib/aarch64-linux-gnu/libev.so', needed by 'src/libuwsc.so.3.2.2'.  Stop.
    CMakeFiles/Makefile2:87: recipe for target 'src/CMakeFiles/uwsc.dir/all' failed
    make[1]: *** [src/CMakeFiles/uwsc.dir/all] Error 2
    Makefile:129: recipe for target 'all' failed
    make: *** [all] Error 2
    

    This is my dockerfile, those COPY are the source code I downloaded from the release. 'install-rtty-6.sh' is the official script to build rtty you provided. I just modifed it to use the local source code.

    FROM amd64/ubuntu:18.04
    USER root
    
    # change to Asia/Shanghai
    ENV TZ=Asia/Shanghai
    
    COPY rtty/libuwsc-3.2.2/ /root/libuwsc-3.2.2/
    COPY rtty/install-rtty-6.sh /root/
    COPY rtty/rtty-6.6.1/ /root/rtty-6.6.1/
    COPY rtty/supervisor-linux-amd64 /root/
    
    RUN sed -i s@/archive.ubuntu.com/@/mirrors.aliyun.com/@g /etc/apt/sources.list \
        && apt-get clean \
        && apt-get update -y \
        && apt-get install -y apt-utils libev-dev \
        && chmod 777 /root/install-rtty-6.sh \
        && cd /root \
        && /bin/sh install-rtty-6.sh \
        && chmod 777 /root/supervisor-linux-amd64
    
    CMD ["/root/supervisor-linux-amd64"]
    
    opened by iedwin 2
  • cl->send() with long messages

    cl->send() with long messages

    I have no problem with cl->send() on messages with only a few thousand characters.

    If I try to send a message with 40,000 characters, I get this:

    *** Error in `./cclient': malloc(): memory corruption: 0x000055f07a5cc240 ***
    ======= Backtrace: =========
    /lib/x86_64-linux-gnu/libc.so.6(+0x70bfb)[0x7f8f73628bfb]
    /lib/x86_64-linux-gnu/libc.so.6(+0x76fc6)[0x7f8f7362efc6]
    /lib/x86_64-linux-gnu/libc.so.6(+0x79089)[0x7f8f73631089]
    /lib/x86_64-linux-gnu/libc.so.6(__libc_malloc+0x54)[0x7f8f73632f64]
    /lib/x86_64-linux-gnu/libc.so.6(+0x6755d)[0x7f8f7361f55d]
    /usr/local/lib/libuwsc.so.3.3.2(get_nonce+0x1c)[0x7f8f7395a9b0]
    /usr/local/lib/libuwsc.so.3.3.2(+0x3014)[0x7f8f7395a014]
    ./cclient(+0x341a)[0x55f07920141a]
    /usr/local/lib/libuwsc.so.3.3.2(+0x2d9a)[0x7f8f73959d9a]
    /usr/lib/x86_64-linux-gnu/libev.so.4(ev_invoke_pending+0x53)[0x7f8f73b63413]
    /usr/lib/x86_64-linux-gnu/libev.so.4(ev_run+0x966)[0x7f8f73b66a06]
    ./cclient(+0x3847)[0x55f079201847]
    /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf1)[0x7f8f735d82e1]
    ./cclient(+0x1a0a)[0x55f0791ffa0a]
    ======= Memory map: ========
    55f0791fe000-55f079203000 r-xp 00000000 ca:01 1187736                    /home/admin/collect-v2/clients/cclient/cclient
    55f079402000-55f079403000 r--p 00004000 ca:01 1187736                    /home/admin/collect-v2/clients/cclient/cclient
    55f079403000-55f079404000 rw-p 00005000 ca:01 1187736                    /home/admin/collect-v2/clients/cclient/cclient
    55f07a59b000-55f07a620000 rw-p 00000000 00:00 0                          [heap]
    7f8f6c000000-7f8f6c021000 rw-p 00000000 00:00 0 
    7f8f6c021000-7f8f70000000 ---p 00000000 00:00 0 
    7f8f7219a000-7f8f721b0000 r-xp 00000000 ca:01 263298                     /lib/x86_64-linux-gnu/libgcc_s.so.1
    7f8f721b0000-7f8f723af000 ---p 00016000 ca:01 263298                     /lib/x86_64-linux-gnu/libgcc_s.so.1
    7f8f723af000-7f8f723b0000 r--p 00015000 ca:01 263298                     /lib/x86_64-linux-gnu/libgcc_s.so.1
    7f8f723b0000-7f8f723b1000 rw-p 00016000 ca:01 263298                     /lib/x86_64-linux-gnu/libgcc_s.so.1
    7f8f723b1000-7f8f723c5000 r-xp 00000000 ca:01 263363                     /lib/x86_64-linux-gnu/libresolv-2.24.so
    7f8f723c5000-7f8f725c4000 ---p 00014000 ca:01 263363                     /lib/x86_64-linux-gnu/libresolv-2.24.so
    7f8f725c4000-7f8f725c5000 r--p 00013000 ca:01 263363                     /lib/x86_64-linux-gnu/libresolv-2.24.so
    7f8f725c5000-7f8f725c6000 rw-p 00014000 ca:01 263363                     /lib/x86_64-linux-gnu/libresolv-2.24.so
    7f8f725c6000-7f8f725c8000 rw-p 00000000 00:00 0 
    7f8f725c8000-7f8f725cd000 r-xp 00000000 ca:01 263356                     /lib/x86_64-linux-gnu/libnss_dns-2.24.so
    7f8f725cd000-7f8f727cc000 ---p 00005000 ca:01 263356                     /lib/x86_64-linux-gnu/libnss_dns-2.24.so
    7f8f727cc000-7f8f727cd000 r--p 00004000 ca:01 263356                     /lib/x86_64-linux-gnu/libnss_dns-2.24.so
    7f8f727cd000-7f8f727ce000 rw-p 00005000 ca:01 263356                     /lib/x86_64-linux-gnu/libnss_dns-2.24.so
    7f8f727ce000-7f8f727d8000 r-xp 00000000 ca:01 263357                     /lib/x86_64-linux-gnu/libnss_files-2.24.so
    7f8f727d8000-7f8f729d8000 ---p 0000a000 ca:01 263357                     /lib/x86_64-linux-gnu/libnss_files-2.24.so
    7f8f729d8000-7f8f729d9000 r--p 0000a000 ca:01 263357                     /lib/x86_64-linux-gnu/libnss_files-2.24.so
    7f8f729d9000-7f8f729da000 rw-p 0000b000 ca:01 263357                     /lib/x86_64-linux-gnu/libnss_files-2.24.so
    7f8f729da000-7f8f729e0000 rw-p 00000000 00:00 0 
    7f8f729e0000-7f8f72c18000 r-xp 00000000 ca:01 265703                     /usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.2
    7f8f72c18000-7f8f72e18000 ---p 00238000 ca:01 265703                     /usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.2
    7f8f72e18000-7f8f72e34000 r--p 00238000 ca:01 265703                     /usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.2
    7f8f72e34000-7f8f72e43000 rw-p 00254000 ca:01 265703                     /usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.2
    7f8f72e43000-7f8f72e47000 rw-p 00000000 00:00 0 
    7f8f72e47000-7f8f72ea7000 r-xp 00000000 ca:01 265705                     /usr/lib/x86_64-linux-gnu/libssl.so.1.0.2
    7f8f72ea7000-7f8f730a6000 ---p 00060000 ca:01 265705                     /usr/lib/x86_64-linux-gnu/libssl.so.1.0.2
    7f8f730a6000-7f8f730aa000 r--p 0005f000 ca:01 265705                     /usr/lib/x86_64-linux-gnu/libssl.so.1.0.2
    7f8f730aa000-7f8f730b0000 rw-p 00063000 ca:01 265705                     /usr/lib/x86_64-linux-gnu/libssl.so.1.0.2
    7f8f730b0000-7f8f730b3000 r-xp 00000000 ca:01 263350                     /lib/x86_64-linux-gnu/libdl-2.24.so
    7f8f730b3000-7f8f732b2000 ---p 00003000 ca:01 263350                     /lib/x86_64-linux-gnu/libdl-2.24.so
    7f8f732b2000-7f8f732b3000 r--p 00002000 ca:01 263350                     /lib/x86_64-linux-gnu/libdl-2.24.so
    7f8f732b3000-7f8f732b4000 rw-p 00003000 ca:01 263350                     /lib/x86_64-linux-gnu/libdl-2.24.so
    7f8f732b4000-7f8f733b7000 r-xp 00000000 ca:01 263351                     /lib/x86_64-linux-gnu/libm-2.24.so
    7f8f733b7000-7f8f735b6000 ---p 00103000 ca:01 263351                     /lib/x86_64-linux-gnu/libm-2.24.so
    7f8f735b6000-7f8f735b7000 r--p 00102000 ca:01 263351                     /lib/x86_64-linux-gnu/libm-2.24.so
    7f8f735b7000-7f8f735b8000 rw-p 00103000 ca:01 263351                     /lib/x86_64-linux-gnu/libm-2.24.so
    7f8f735b8000-7f8f7374d000 r-xp 00000000 ca:01 263347                     /lib/x86_64-linux-gnu/libc-2.24.so
    7f8f7374d000-7f8f7394d000 ---p 00195000 ca:01 263347                     /lib/x86_64-linux-gnu/libc-2.24.so
    7f8f7394d000-7f8f73951000 r--p 00195000 ca:01 263347                     /lib/x86_64-linux-gnu/libc-2.24.so
    7f8f73951000-7f8f73953000 rw-p 00199000 ca:01 263347                     /lib/x86_64-linux-gnu/libc-2.24.so
    7f8f73953000-7f8f73957000 rw-p 00000000 00:00 0 
    7f8f73957000-7f8f7395e000 r-xp 00000000 ca:01 300479                     /usr/local/lib/libuwsc.so.3.3.2
    7f8f7395e000-7f8f73b5d000 ---p 00007000 ca:01 300479                     /usr/local/lib/libuwsc.so.3.3.2
    7f8f73b5d000-7f8f73b5e000 r--p 00006000 ca:01 300479                     /usr/local/lib/libuwsc.so.3.3.2
    7f8f73b5e000-7f8f73b5f000 rw-p 00007000 ca:01 300479                     /usr/local/lib/libuwsc.so.3.3.2
    7f8f73b5f000-7f8f73b6c000 r-xp 00000000 ca:01 299998                     /usr/lib/x86_64-linux-gnu/libev.so.4.0.0
    7f8f73b6c000-7f8f73d6b000 ---p 0000d000 ca:01 299998                     /usr/lib/x86_64-linux-gnu/libev.so.4.0.0
    7f8f73d6b000-7f8f73d6c000 r--p 0000c000 ca:01 299998                     /usr/lib/x86_64-linux-gnu/libev.so.4.0.0
    7f8f73d6c000-7f8f73d6d000 rw-p 0000d000 ca:01 299998                     /usr/lib/x86_64-linux-gnu/libev.so.4.0.0
    7f8f73d6d000-7f8f73d77000 r-xp 00000000 ca:01 265438                     /lib/x86_64-linux-gnu/libjson-c.so.3.0.1
    7f8f73d77000-7f8f73f76000 ---p 0000a000 ca:01 265438                     /lib/x86_64-linux-gnu/libjson-c.so.3.0.1
    7f8f73f76000-7f8f73f77000 r--p 00009000 ca:01 265438                     /lib/x86_64-linux-gnu/libjson-c.so.3.0.1
    7f8f73f77000-7f8f73f78000 rw-p 0000a000 ca:01 265438                     /lib/x86_64-linux-gnu/libjson-c.so.3.0.1
    7f8f73f78000-7f8f73f9b000 r-xp 00000000 ca:01 263343                     /lib/x86_64-linux-gnu/ld-2.24.so
    7f8f7418c000-7f8f74192000 rw-p 00000000 00:00 0 
    7f8f7419a000-7f8f7419b000 rw-p 00000000 00:00 0 
    7f8f7419b000-7f8f7419c000 r--p 00023000 ca:01 263343                     /lib/x86_64-linux-gnu/ld-2.24.so
    7f8f7419c000-7f8f7419d000 rw-p 00024000 ca:01 263343                     /lib/x86_64-linux-gnu/ld-2.24.so
    7f8f7419d000-7f8f7419e000 rw-p 00000000 00:00 0 
    7ffe458d9000-7ffe458fa000 rw-p 00000000 00:00 0                          [stack]
    7ffe45924000-7ffe45926000 r--p 00000000 00:00 0                          [vvar]
    7ffe45926000-7ffe45928000 r-xp 00000000 00:00 0                          [vdso]
    ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
    Aborted
    
    opened by andrewhodel 2
  • Specified protocol was not requested by the client.

    Specified protocol was not requested by the client.

    Hello,

    I am trying to connect to a nodejs websocket server using libuwsc and I get the error "Specified protocol was not requested by the client." when doing request.accept('echo-protocol', request.origin). I understand this to be the protocol set and can not see this in the libuwsc library, am I missing something here?

    Many thanks, J

    opened by JonathanWoodward 2
  • Cleanup and feature

    Cleanup and feature

    Hello,

    Please consider these changes: first commit just removes unused stuff; second commit just adds a member to struct uwsc_client for storing a custom user data (which is important to make elegant C++ wrapper, for example).

    opened by dmitigr 1
  • Need to build libuwsc example.c incorporating libev and libuwsc in single monolithic binary

    Need to build libuwsc example.c incorporating libev and libuwsc in single monolithic binary

    I need to build example (from example.c) in partially static configuration, without libev.so and without libuwsc.so, which will not be available on a target system (that is, I will copy binary "example" to target system, but the target system will not have installed libev or libuwsc.)

    Host (where I will build) is Ubuntu 18.04, 64-bit. Target (where I will execute) is Ubuntu 18.04, 64-bit, but has no shared libraries for libev and libuwsc.

    I tested libuwsc initially as cloned from github - it works well (I tested example to communicate OK with existing websocket echo server.)

    On host (where I will build), I tried changing cmake command from cmake .. to this:

    cmake .. -DBUILD_STATIC_LIBS=ON -DBUILD_SHARED_LIBS=OFF

    The result build process is now:

    $ make
    [ 11%] Building C object src/CMakeFiles/uwsc_s.dir/uwsc.c.o
    [ 22%] Building C object src/CMakeFiles/uwsc_s.dir/log.c.o
    [ 33%] Building C object src/CMakeFiles/uwsc_s.dir/utils.c.o
    [ 44%] Building C object src/CMakeFiles/uwsc_s.dir/buffer/buffer.c.o
    [ 55%] Building C object src/CMakeFiles/uwsc_s.dir/sha1.c.o
    [ 66%] Building C object src/CMakeFiles/uwsc_s.dir/ssl.c.o
    [ 77%] Linking C static library libuwsc.a
    [ 77%] Built target uwsc_s
    Scanning dependencies of target example
    [ 88%] Building C object example/CMakeFiles/example.dir/example.c.o
    [100%] Linking C executable example
    [100%] Built target example
    
    

    Now, example (binary) grows from 13408 to 42616 bytes, but when I move example binary to target system (target does not have libev or libuwsc intalled), executing ./example results:

    ./example: error while loading shared libraries: libev.so.4: cannot open shared object file: No such file or directory

    The source system (where I am building) has libev.a (static) and libev.so (shared), but resulting binary example still is referencing libev.so, so it cannot start.

    I am not expert on cmake, I think my problem is with with cmake.

    Thank you for any help!

    opened by wb0gaz 1
  • void pointer for char pointer in example.c

    void pointer for char pointer in example.c

    https://github.com/zhaojh329/libuwsc/blob/master/example/example.c#L67

    static void uwsc_onmessage(struct uwsc_client *cl,
    	void *data, size_t len, bool binary)
    {
    

    Why is data a void pointer not a char pointer?

    opened by andrewhodel 1
  • Memory leak with SSL enabled, openssl

    Memory leak with SSL enabled, openssl

    I download the example.

    admin@dev:~/collect-v2/clients/cclient$ wget https://raw.githubusercontent.com/zhaojh329/libuwsc/master/example/example.c
    --2020-01-08 14:39:29--  https://raw.githubusercontent.com/zhaojh329/libuwsc/master/example/example.c
    Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.52.133
    Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.52.133|:443... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 4317 (4.2K) [text/plain]
    Saving to: ‘example.c’
    
    example.c                                            100%[=====================================================================================================================>]   4.22K  --.-KB/s    in 0.002s  
    
    2020-01-08 14:39:29 (2.69 MB/s) - ‘example.c’ saved [4317/4317]
    

    I compile it.

    admin@dev:~/collect-v2/clients/cclient$ gcc -I/usr/local/include/uwsc -I/usr/include/json-c -I/usr/local/include -L/usr/local/lib -L/usr/local/lib/uwsc -lpthread -ljson-c -lev -luwsc -o example example.c 
    

    I run the program and valgrind using -u ws://localhost/ws

    You can see there are no memory leaks reported by valgrind.

    admin@dev:~/collect-v2/clients/cclient$ valgrind --leak-check=full ./example -u ws://localhost/ws
    ==3970== Memcheck, a memory error detector
    ==3970== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
    ==3970== Using Valgrind-3.12.0.SVN and LibVEX; rerun with -h for copyright info
    ==3970== Command: ./example -u ws://localhost/ws
    ==3970== 
    2020/01/08 14:40:35 (example.c:141) Libuwsc: 3.3.2
    2020/01/08 14:40:36 (example.c:147) Start connect...
    2020/01/08 14:40:36 (example.c:91) onerror:2: Invalid header
    ==3970== 
    ==3970== HEAP SUMMARY:
    ==3970==     in use at exit: 1,016 bytes in 6 blocks
    ==3970==   total heap usage: 66 allocs, 60 frees, 43,855 bytes allocated
    ==3970== 
    ==3970== LEAK SUMMARY:
    ==3970==    definitely lost: 0 bytes in 0 blocks
    ==3970==    indirectly lost: 0 bytes in 0 blocks
    ==3970==      possibly lost: 0 bytes in 0 blocks
    ==3970==    still reachable: 1,016 bytes in 6 blocks
    ==3970==         suppressed: 0 bytes in 0 blocks
    ==3970== Reachable blocks (those to which a pointer was found) are not shown.
    ==3970== To see them, rerun with: --leak-check=full --show-leak-kinds=all
    ==3970== 
    ==3970== For counts of detected and suppressed errors, rerun with: -v
    ==3970== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
    

    I run the program using an SSL URL and valgrind using -u wss://localhost/ws

    You can see the program has a memory leak from libuwsc! Can you fix this please?

    admin@dev:~/collect-v2/clients/cclient$ valgrind --leak-check=full ./example -u wss://localhost/ws
    ==3971== Memcheck, a memory error detector
    ==3971== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
    ==3971== Using Valgrind-3.12.0.SVN and LibVEX; rerun with -h for copyright info
    ==3971== Command: ./example -u wss://localhost/ws
    ==3971== 
    2020/01/08 14:40:40 (example.c:141) Libuwsc: 3.3.2
    2020/01/08 14:40:40 (example.c:147) Start connect...
    2020/01/08 14:40:41 (ssl.c:141) (null)
    2020/01/08 14:40:41 (example.c:91) onerror:7: ssl handshake failed
    ==3971== 
    ==3971== HEAP SUMMARY:
    ==3971==     in use at exit: 162,494 bytes in 2,922 blocks
    ==3971==   total heap usage: 4,628 allocs, 1,706 frees, 370,000 bytes allocated
    ==3971== 
    ==3971== 73,990 (824 direct, 73,166 indirect) bytes in 1 blocks are definitely lost in loss record 296 of 296
    ==3971==    at 0x4C2BBAF: malloc (vg_replace_malloc.c:299)
    ==3971==    by 0x61FDC87: CRYPTO_malloc (in /usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.2)
    ==3971==    by 0x5F5E2EF: SSL_new (in /usr/lib/x86_64-linux-gnu/libssl.so.1.0.2)
    ==3971==    by 0x5473783: uwsc_ssl_init (in /usr/local/lib/libuwsc.so.3.3.2)
    ==3971==    by 0x54715FC: uwsc_init (in /usr/local/lib/libuwsc.so.3.3.2)
    ==3971==    by 0x54716A3: uwsc_new (in /usr/local/lib/libuwsc.so.3.3.2)
    ==3971==    by 0x109173: main (in /home/admin/collect-v2/clients/cclient/example)
    ==3971== 
    ==3971== LEAK SUMMARY:
    ==3971==    definitely lost: 824 bytes in 1 blocks
    ==3971==    indirectly lost: 73,166 bytes in 37 blocks
    ==3971==      possibly lost: 0 bytes in 0 blocks
    ==3971==    still reachable: 88,504 bytes in 2,884 blocks
    ==3971==         suppressed: 0 bytes in 0 blocks
    ==3971== Reachable blocks (those to which a pointer was found) are not shown.
    ==3971== To see them, rerun with: --leak-check=full --show-leak-kinds=all
    ==3971== 
    ==3971== For counts of detected and suppressed errors, rerun with: -v
    ==3971== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
    
    opened by andrewhodel 1
  • How do you install libev on windows 10?

    How do you install libev on windows 10?

    I downloaded the libev files.

    Doesn't explain how it's used or installed.

    and cmake for libuwsc throws errors for not able to find libev...

    how to make cmake compile libuwsc with libev?

    Thanks.

    opened by rajhlinux 1
  • examples require SSL

    examples require SSL

    -musl/bin/ld: src/libuwsc.so.3.3.5: undefined reference to `mbedtls_ssl_config_free'
    /home/mangix/devstuff/openwrt/staging_dir/toolchain-powerpc_464fp_gcc-11.2.0_musl/lib/gcc/powerpc-openwrt-linux-musl/11.2.0/../../../../powerpc-openwrt-linux-musl/bin/ld: src/libuwsc.so.3.3.5: undefined reference to `mbedtls_ctr_drbg_init'
    /home/mangix/devstuff/openwrt/staging_dir/toolchain-powerpc_464fp_gcc-11.2.0_musl/lib/gcc/powerpc-openwrt-linux-musl/11.2.0/../../../../powerpc-openwrt-linux-musl/bin/ld: src/libuwsc.so.3.3.5: undefined reference to `mbedtls_ssl_read'
    /home/mangix/devstuff/openwrt/staging_dir/toolchain-powerpc_464fp_gcc-11.2.0_musl/lib/gcc/powerpc-openwrt-linux-musl/11.2.0/../../../../powerpc-openwrt-linux-musl/bin/ld: src/libuwsc.so.3.3.5: undefined reference to `mbedtls_ssl_setup'
    /home/mangix/devstuff/openwrt/staging_dir/toolchain-powerpc_464fp_gcc-11.2.0_musl/lib/gcc/powerpc-openwrt-linux-musl/11.2.0/../../../../powerpc-openwrt-linux-musl/bin/ld: src/libuwsc.so.3.3.5: undefined reference to `mbedtls_ctr_drbg_random'
    /home/mangix/devstuff/openwrt/staging_dir/toolchain-powerpc_464fp_gcc-11.2.0_musl/lib/gcc/powerpc-openwrt-linux-musl/11.2.0/../../../../powerpc-openwrt-linux-musl/bin/ld: src/libuwsc.so.3.3.5: undefined reference to `mbedtls_ssl_free'
    /home/mangix/devstuff/openwrt/staging_dir/toolchain-powerpc_464fp_gcc-11.2.0_musl/lib/gcc/powerpc-openwrt-linux-musl/11.2.0/../../../../powerpc-openwrt-linux-musl/bin/ld: src/libuwsc.so.3.3.5: undefined reference to `mbedtls_ssl_config_init'
    /home/mangix/devstuff/openwrt/staging_dir/toolchain-powerpc_464fp_gcc-11.2.0_musl/lib/gcc/powerpc-openwrt-linux-musl/11.2.0/../../../../powerpc-openwrt-linux-musl/bin/ld: src/libuwsc.so.3.3.5: undefined reference to `mbedtls_ssl_conf_ca_chain'
    /home/mangix/devstuff/openwrt/staging_dir/toolchain-powerpc_464fp_gcc-11.2.0_musl/lib/gcc/powerpc-openwrt-linux-musl/11.2.0/../../../../powerpc-openwrt-linux-musl/bin/ld: src/libuwsc.so.3.3.5: undefined reference to `mbedtls_ssl_init'
    /home/mangix/devstuff/openwrt/staging_dir/toolchain-powerpc_464fp_gcc-11.2.0_musl/lib/gcc/powerpc-openwrt-linux-musl/11.2.0/../../../../powerpc-openwrt-linux-musl/bin/ld: src/libuwsc.so.3.3.5: undefined reference to `mbedtls_ssl_set_bio'
    /home/mangix/devstuff/openwrt/staging_dir/toolchain-powerpc_464fp_gcc-11.2.0_musl/lib/gcc/powerpc-openwrt-linux-musl/11.2.0/../../../../powerpc-openwrt-linux-musl/bin/ld: src/libuwsc.so.3.3.5: undefined reference to `mbedtls_ctr_drbg_seed'
    /home/mangix/devstuff/openwrt/staging_dir/toolchain-powerpc_464fp_gcc-11.2.0_musl/lib/gcc/powerpc-openwrt-linux-musl/11.2.0/../../../../powerpc-openwrt-linux-musl/bin/ld: src/libuwsc.so.3.3.5: undefined reference to `mbedtls_ssl_write'
    /home/mangix/devstuff/openwrt/staging_dir/toolchain-powerpc_464fp_gcc-11.2.0_musl/lib/gcc/powerpc-openwrt-linux-musl/11.2.0/../../../../powerpc-openwrt-linux-musl/bin/ld: src/libuwsc.so.3.3.5: undefined reference to `mbedtls_net_recv'
    /home/mangix/devstuff/openwrt/staging_dir/toolchain-powerpc_464fp_gcc-11.2.0_musl/lib/gcc/powerpc-openwrt-linux-musl/11.2.0/../../../../powerpc-openwrt-linux-musl/bin/ld: src/libuwsc.so.3.3.5: undefined reference to `mbedtls_entropy_init'
    /home/mangix/devstuff/openwrt/staging_dir/toolchain-powerpc_464fp_gcc-11.2.0_musl/lib/gcc/powerpc-openwrt-linux-musl/11.2.0/../../../../powerpc-openwrt-linux-musl/bin/ld: src/libuwsc.so.3.3.5: undefined reference to `mbedtls_ssl_conf_rng'
    /home/mangix/devstuff/openwrt/staging_dir/toolchain-powerpc_464fp_gcc-11.2.0_musl/lib/gcc/powerpc-openwrt-linux-musl/11.2.0/../../../../powerpc-openwrt-linux-musl/bin/ld: src/libuwsc.so.3.3.5: undefined reference to `mbedtls_net_init'
    /home/mangix/devstuff/openwrt/staging_dir/toolchain-powerpc_464fp_gcc-11.2.0_musl/lib/gcc/powerpc-openwrt-linux-musl/11.2.0/../../../../powerpc-openwrt-linux-musl/bin/ld: src/libuwsc.so.3.3.5: undefined reference to `mbedtls_x509_crt_init'
    /home/mangix/devstuff/openwrt/staging_dir/toolchain-powerpc_464fp_gcc-11.2.0_musl/lib/gcc/powerpc-openwrt-linux-musl/11.2.0/../../../../powerpc-openwrt-linux-musl/bin/ld: src/libuwsc.so.3.3.5: undefined reference to `mbedtls_ssl_conf_authmode'
    /home/mangix/devstuff/openwrt/staging_dir/toolchain-powerpc_464fp_gcc-11.2.0_musl/lib/gcc/powerpc-openwrt-linux-musl/11.2.0/../../../../powerpc-openwrt-linux-musl/bin/ld: src/libuwsc.so.3.3.5: undefined reference to `mbedtls_ssl_handshake'
    /home/mangix/devstuff/openwrt/staging_dir/toolchain-powerpc_464fp_gcc-11.2.0_musl/lib/gcc/powerpc-openwrt-linux-musl/11.2.0/../../../../powerpc-openwrt-linux-musl/bin/ld: src/libuwsc.so.3.3.5: undefined reference to `mbedtls_ssl_set_hostname'
    /home/mangix/devstuff/openwrt/staging_dir/toolchain-powerpc_464fp_gcc-11.2.0_musl/lib/gcc/powerpc-openwrt-linux-musl/11.2.0/../../../../powerpc-openwrt-linux-musl/bin/ld: src/libuwsc.so.3.3.5: undefined reference to `mbedtls_net_send'
    /home/mangix/devstuff/openwrt/staging_dir/toolchain-powerpc_464fp_gcc-11.2.0_musl/lib/gcc/powerpc-openwrt-linux-musl/11.2.0/../../../../powerpc-openwrt-linux-musl/bin/ld: src/libuwsc.so.3.3.5: undefined reference to `mbedtls_ssl_config_defaults'
    /home/mangix/devstuff/openwrt/staging_dir/toolchain-powerpc_464fp_gcc-11.2.0_musl/lib/gcc/powerpc-openwrt-linux-musl/11.2.0/../../../../powerpc-openwrt-linux-musl/bin/ld: src/libuwsc.so.3.3.5: undefined reference to `mbedtls_entropy_func'
    collect2: error: ld returned 1 exit status
    
    opened by neheb 0
  •  sha1_transform() causes buffer overflow

    sha1_transform() causes buffer overflow

    Hello. sha1_transform() in the sha1.c declares a block[1] of union type, which is union char64long16 { uint8_t c[64]; uint32_t l[16]; };

    and access until block->l[79] by R0 MACRO. It makes a buffer overflow. would you fix this problem?

    opened by clearday4 0
  • Library installation by vcpkg

    Library installation by vcpkg

    Do you intend to make the library available to be installed via vcpkg? It would be much easier and more practical and besides it would be available for installation for both Linux and Windows

    opened by luizfernandonb 4
Releases(v3.3.5)
Owner
Jianhui Zhao
linux inside
Jianhui Zhao
Ultra fast and low latency asynchronous socket server & client C++ library with support TCP, SSL, UDP, HTTP, HTTPS, WebSocket protocols and 10K connections problem solution

CppServer Ultra fast and low latency asynchronous socket server & client C++ library with support TCP, SSL, UDP, HTTP, HTTPS, WebSocket protocols and

Ivan Shynkarenka 958 Jan 3, 2023
Cross-platform, efficient, customizable, and robust asynchronous HTTP/WebSocket server C++14 library with the right balance between performance and ease of use

What Is RESTinio? RESTinio is a header-only C++14 library that gives you an embedded HTTP/Websocket server. It is based on standalone version of ASIO

Stiffstream 924 Jan 6, 2023
websocket and http client and server library, coming with ws, a command line swiss army knife utility

Hello world IXWebSocket is a C++ library for WebSocket client and server development. It has minimal dependencies (no boost), is very simple to use an

Machine Zone, Inc. 369 Jan 5, 2023
C++ websocket client/server library

WebSocket++ (0.8.2) WebSocket++ is a header only C++ library that implements RFC6455 The WebSocket Protocol. It allows integrating WebSocket client an

Peter Thorson 6k Jan 8, 2023
The C++ REST SDK is a Microsoft project for cloud-based client-server communication in native code using a modern asynchronous C++ API design. This project aims to help C++ developers connect to and interact with services.

Welcome! The C++ REST SDK is a Microsoft project for cloud-based client-server communication in native code using a modern asynchronous C++ API design

Microsoft 7.2k Dec 30, 2022
A C++ async HTTP client library to use in asynchronous applications while communicating with REST services.

libashttp An asynchronous HTTP library using Boost.ASIO as the backend. This project is licensed under: Usage Here is a example usage which is taken f

Tolga Hoşgör 53 Dec 17, 2022
Mongoose Embedded Web Server Library - a multi-protocol embedded networking library with TCP/UDP, HTTP, WebSocket, MQTT built-in protocols, async DNS resolver, and non-blocking API.

Mongoose - Embedded Web Server / Embedded Networking Library Mongoose is a networking library for C/C++. It implements event-driven non-blocking APIs

Cesanta Software 9k Jan 1, 2023
Small and fast cross-platform networking library, with support for messaging, IPv6, HTTP, SSL and WebSocket.

frnetlib Frnetlib, is a cross-platform, small and fast networking library written in C++. There are no library dependencies (unless you want to use SS

Fred Nicolson 23 Nov 25, 2022
An easy to use and powerful open source websocket library written in C.

libwebsock Easy to use C library for websockets This library allows for quick and easy development of applications that use the websocket protocol, wi

Jonathan Hall 47 Nov 13, 2022
BingBing 60 Dec 15, 2022
Asynchronous TCP Library for STM32H7-based Portenta_H7 using mbed_portenta core.

Asynchronous TCP Library for STM32H7-based Portenta_H7 using mbed_portenta core. This library is the base for future and more advanced Async libraries, such as AsyncWebServer, AsyncHTTPRequest, AsyncHTTPSRequest

Khoi Hoang 3 Dec 29, 2022
This is a small library that allows to stream a Dear ImGui scene to multiple WebSocket clients at once

imgui-ws Dear ImGui over WebSockets This is a small library that allows to stream a Dear ImGui scene to multiple WebSocket clients at once. This is ac

Georgi Gerganov 327 Dec 30, 2022
Triton Python and C++ client libraries and example, and client examples for go, java and scala.

Triton Client Libraries and Examples To simplify communication with Triton, the Triton project provides several client libraries and examples of how t

Triton Inference Server 228 Jan 5, 2023
HTTP and WebSocket built on Boost.Asio in C++11

HTTP and WebSocket built on Boost.Asio in C++11 Branch Linux/OSX Windows Coverage Documentation Matrix master develop Contents Introduction Appearance

Boost.org 3.6k Jan 4, 2023
Custom WebSocket implementation in C for educational and recreational purposes.

C WebSockets WARNING! The library is in an active development state and is not even alpha yet. Use it at your own risk. Nothing is documented, anythin

Tsoding 17 May 25, 2022
Pushpin is a reverse proxy server written in C++ that makes it easy to implement WebSocket, HTTP streaming, and HTTP long-polling services.

Pushpin is a reverse proxy server written in C++ that makes it easy to implement WebSocket, HTTP streaming, and HTTP long-polling services. The project is unique among realtime push solutions in that it is designed to address the needs of API creators. Pushpin is transparent to clients and integrates easily into an API stack.

Fanout 3.2k Jan 2, 2023
WSServer is a fast, configurable, and extendable WebSocket Server for UNIX systems written in C (C11).

WSServer a C WebSocket Server WSServer is a fast, configurable, and extendable WebSocket Server for UNIX systems written in C (C11). As of version 2.0

Morten Houmøller Nygaard 170 Dec 8, 2022
Simple embeddable C++11 async tcp,http and websocket serving.

net11 Simple embeddable C++11 async tcp,http and websocket serving. What is it? An easily embeddable C++11 networking library designed to make buildin

Jonas Lund 9 Mar 28, 2020
cuehttp is a modern c++ middleware framework for http(http/https)/websocket(ws/wss).

cuehttp 简介 cuehttp是一个使用Modern C++(C++17)编写的跨平台、高性能、易用的HTTP/WebSocket框架。基于中间件模式可以方便、高效、优雅的增加功能。cuehttp基于boost.asio开发,使用picohttpparser进行HTTP协议解析。内部依赖了nl

xcyl 29 Dec 17, 2022