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.

Overview

Mongoose - Embedded Web Server / Embedded Networking Library

License: GPLv2 Build Status Code Coverage Fuzzing Status

Mongoose is a networking library for C/C++. It implements event-driven non-blocking APIs for TCP, UDP, HTTP, WebSocket, MQTT. It has been designed for connecting devices and bringing them online. On the market since 2004, used by vast number of open source and commercial products - it even runs on the International Space Station! Mongoose makes embedded network programming fast, robust, and easy.

Connectivity is vital for software and embedded devices, but there are many pitfalls to consider when embedding a web server. This white paper breaks down on the top 9 things to avoid when embedding a web server.

Looking for a pre-compiled Mongoose web server Windows or Mac binary?

Looking for a complete IoT solution? Check out

  • VCON - Arduino compatible MCU modules with built-in firmware OTA updates
  • Mongoose OS - open source embedded operating system for low-power connected microcontrollers. Secure, designed for commercial Internet of Things products

Support

Features

  • Cross-platform: works on Linux/UNIX, MacOS, Windows, Android, FreeRTOS, etc
  • Supported embedded architectures: ESP32, ESP8266, TI, NRF52, STM32, PIC32, NXP, and more
  • Builtin protocols: plain TCP/UDP, HTTP, MQTT, Websocket
  • SSL/TLS support: mbedTLS, OpenSSL or custom (via API)
  • Asynchronous DNS resolver
  • Tiny static and run-time footprint
  • Source code is both ISO C and ISO C++ compliant
  • Very easy to integrate: just copy mongoose.c and mongoose.h files to your build tree

Licensing

Mongoose is released under Commercial and GNU GPL v.2 open source licenses.

Commercial Projects: Contact us for commercial license.

Dashboard Example

Mongoose is often used to implement device dashboards and real-time data exchange over Websocket. Here is a dashboard example that illustrates the functionality:

Developing a new product? Contact us today to discuss how Mongoose can help.

Contributions

Contributions are welcome! Please follow the guidelines below:

  • Sign Cesanta CLA and send GitHub pull request
  • When making pull requests, please make sure that it has only one commit, and imlements/fixes only one piece of functionality
Comments
  • Allow controlling behavior when MG_MAX_RECV_SIZE is reached

    Allow controlling behavior when MG_MAX_RECV_SIZE is reached

    When MG_MAX_RECV_SIZE is reached we may want to stop reading rather than throwing an error as a full buffer may just mean we need to wait for the consumer to clear the buffer on a future poll iteration.

    Each poll iteration will call MG_EV_POLL which can consume from the buffer to allow reading to continue, we should not assume that the buffer will always be consumed below the recv max after each poll iteration as the consumer may need to apply backpressure to the recv buffer if the consumer is not able to clear the recv buffer faster than read_conn fills it.

    Introduce a MG_EV_BUFFER_FULL event which allows the user to choose what to do when the buffer is reached, with the existing erroring behavior remaining the default.

    opened by jameshilliard 35
  • HTTPS client with Mongoose+Krypton in ARM results in Bus Error

    HTTPS client with Mongoose+Krypton in ARM results in Bus Error

    Hello!

    First have to tell HTTP client implemented with Mongoose runs fine in my ARM9. Problems occur when turned into HTTPS using Krypton. (However Application with HTTPS runs ok in Linux PC)

    What is done for HTTPS: -URLs changed from http:// to https:// -added Krypton files -built with flags -DMG_ENABLE_SSL=1 & -DMG_DISABLE_PFS=1

    Here is some mg debug log:

    https_error

    Please help.

    Cheerio WilsonLP

    opened by WilsonLP 31
  • Add top level Makefile and targets for DLL

    Add top level Makefile and targets for DLL

    I see that mongoose 5.2 removed the Makefile. I believe that the idea that everyone should download sources and compile as embedded.

    Although in some situation it would be great to distribute it as a shared library. Some distros (like Linux Arch) are in strong favor of this way. It would be great if mongoose could be distributed as a shared library.

    So it would be nice to have Makefile that:

    • compiles *.so *.a with some predefined set of compile flag (enable all features by default is probably the best idea)
    • installs compiled binary files + header files
    • has 'check' targtet
    • *.pc file with compilation flags that are in sync with shared libraries
    opened by anatol 29
  • Multithreaded worker example

    Multithreaded worker example

    docs/Options.md mentions about num_threads, but the struct static_config_options doesn't have this option. I also see that there is a non static function mg_start_thread, but it is not used anywhere in the examples. Is it possible to have an example explaining the use of mongoose using multiple worker threads?

    opened by carun 24
  • mongoose segfaulted with num_threads 1 & global_auth_file option

    mongoose segfaulted with num_threads 1 & global_auth_file option

    When i set num_threads 1 and run my cgi application, mongoose segfaulted after page content is shown.

    The debug output:

    *** 1362423056.0xb76666c0.mg_start.5284: [num_threads] -> [1] *** 1362423056.0xb76666c0.mg_start.5284: [access_log_file] -> [stdout] *** 1362423056.0xb76666c0.mg_start.5284: [error_log_file] -> [stderr] *** 1362423056.0xb76666c0.mg_start.5284: [listening_ports] -> [443s] *** 1362423056.0xb76666c0.mg_start.5284: [ssl_certificate] -> [/etc/mongoose/server.crt] *** 1362423056.0xb76666c0.mg_start.5284: [document_root] -> [/var/www] *** 1362423056.0xb76666c0.mg_start.5284: [global_auth_file] -> [/var/www/.htpasswd] *** 1362423056.0xb76666c0.mg_start.5284: [authentication_domain] -> [z-box] *** 1362423056.0xb76666c0.mg_start.5294: Setting default: [cgi_pattern] -> [.cgi$|.pl$|**.php$] *** 1362423056.0xb76666c0.mg_start.5294: Setting default: [ssi_pattern] -> [**.shtml$|*_.shtm$] *_* 1362423056.0xb76666c0.mg_start.5294: Setting default: [enable_directory_listing] -> [yes] *** 1362423056.0xb76666c0.mg_start.5294: Setting default: [index_files] -> [index.html,index.htm,index.cgi,index.shtml,index.php,index.lp] *** 1362423056.0xb76666c0.mg_start.5294: Setting default: [enable_keep_alive] -> [no] *** 1362423056.0xb76666c0.mg_start.5294: Setting default: [request_timeout_ms] -> [30000] Mongoose web server v. 3.8 started on port(s) 443s with web root [/var/www] *** 1362423056.0xb6b50b70.consume_socket.4999: going idle *** 1362423065.0xb7350b70.accept_new_connection.5125: Accepted socket 4 *** 1362423065.0xb7350b70.produce_socket.5092: queued socket 4 *** 1362423065.0xb6b50b70.consume_socket.5011: grabbed socket 4, going busy *** 1362423065.0xb7350b70.accept_new_connection.5125: Accepted socket 5 *** 1362423065.0xb7350b70.produce_socket.5092: queued socket 5 *** 1362423070.0xb6b50b70.send_http_error.946: [Error 500: Server Error Client closed connection] *** 1362423070.0xb6b50b70.consume_socket.4999: going idle *** 1362423070.0xb6b50b70.consume_socket.5011: grabbed socket 5, going busy *** 1362423070.0xb6b50b70.handle_request.4356: /cgi-bin/main.cgi *** 1362423070.0xb6b50b70.consume_socket.4999: going idle *** 1362423070.0xb7350b70.accept_new_connection.5125: Accepted socket 4 *** 1362423070.0xb7350b70.produce_socket.5092: queued socket 4 *** 1362423070.0xb6b50b70.consume_socket.5011: grabbed socket 4, going busy *** 1362423070.0xb7350b70.accept_new_connection.5125: Accepted socket 5 *** 1362423070.0xb7350b70.produce_socket.5092: queued socket 5 *** 1362423070.0xb7350b70.accept_new_connection.5125: Accepted socket 6 *** 1362423070.0xb7350b70.produce_socket.5092: queued socket 6 *** 1362423070.0xb7350b70.accept_new_connection.5125: Accepted socket 7 *** 1362423070.0xb7350b70.produce_socket.5092: queued socket 7 *** 1362423070.0xb7350b70.accept_new_connection.5125: Accepted socket 8 *** 1362423070.0xb7350b70.produce_socket.5092: queued socket 8 *** 1362423070.0xb7350b70.accept_new_connection.5125: Accepted socket 9 *** 1362423070.0xb7350b70.produce_socket.5092: queued socket 9 *** 1362423070.0xb6b50b70.handle_request.4356: /css/main.css *** 1362423070.0xb7350b70.accept_new_connection.5125: Accepted socket 4 *** 1362423070.0xb7350b70.produce_socket.5092: queued socket 4 *** 1362423070.0xb6b50b70.consume_socket.4999: going idle *** 1362423070.0xb6b50b70.consume_socket.5011: grabbed socket 5, going busy *** 1362423070.0xb6b50b70.handle_request.4356: /js/main.tabs.js *** 1362423070.0xb6b50b70.consume_socket.4999: going idle *** 1362423070.0xb6b50b70.consume_socket.5011: grabbed socket 6, going busy *** 1362423070.0xb7350b70.accept_new_connection.5125: Accepted socket 5 *** 1362423070.0xb7350b70.produce_socket.5092: queued socket 5 *** 1362423070.0xb6b50b70.handle_request.4356: /js/jquery.js *** 1362423070.0xb7350b70.accept_new_connection.5125: Accepted socket 6 *** 1362423070.0xb7350b70.produce_socket.5092: queued socket 6 *** 1362423070.0xb6b50b70.consume_socket.4999: going idle *** 1362423070.0xb6b50b70.consume_socket.5011: grabbed socket 7, going busy *** 1362423070.0xb6b50b70.handle_request.4356: /ip_base.js *** 1362423070.0xb6b50b70.send_http_error.946: [Error 404: Not Found File not found] *** 1362423070.0xb6b50b70.consume_socket.4999: going idle *** 1362423070.0xb6b50b70.consume_socket.5011: grabbed socket 8, going busy *** 1362423076.0xb6b50b70.send_http_error.946: [Error 500: Server Error Client closed connection]

    I have coredump, but i don't know how to attach it here.

    opened by lego12239 23
  • Sometimes static files are truncated when using SSL because SSL_Write returns -1 (SSL_ERROR_WANT_WRITE)

    Sometimes static files are truncated when using SSL because SSL_Write returns -1 (SSL_ERROR_WANT_WRITE)

    Only occurs sometimes and only after a bunch of SSL_Writes have succeed. Basically everying is ok (a bunch of SSL_Writes 8192 bytes success) but then suddenly SSL_Write returns -1 (after calling SSL_get_error in the error I see SSL_ERROR_WANT_WRITE). I have a 5 sec poll period on the select. Can reproduce once every 10 requests (ctrl+f5 refresh) on Chrome/IE and on different files (js/css) of ~300KBs. Using self-signed certificated you provided and no proxies (browser and server are on same machine). Is it just me ? Could it be related to non-blocking sockets introduced in v5 ?

    Googling for it I get the idea I need to call SSL_Write again (w/ same arguments) because negotiation wasnt finished. From Man pages: "The operation did not complete; the same TLS/SSL I/O function should be called again later. If, by then, the underlying BIO has data available for reading (if the result code is SSL_ERROR_WANT_READ) or allows writing data (SSL_ERROR_WANT_WRITE), then some TLS/SSL protocol progress will take place, i.e. at least part of an TLS/SSL record will be read or written. The retry may again lead to a SSL_ERROR_WANT_READ or SSL_ERROR_WANT_WRITE condition. There is no fixed upper limit for the number of iterations that may be necessary until progress becomes visible at application protocol level."

    opened by rjcoelho 22
  • Fix for erroneous MG_EV_HTTP_CHUNK

    Fix for erroneous MG_EV_HTTP_CHUNK

    Do not send MG_EV_HTTP_CHUNK if chunk len would be zero and response is not yet fully received.

    This can occur in circumstances where the first socket read contains only the header (no data). In this case, the calculated chunk length is zero.

    opened by david-collett 20
  • [Windows] 'unit_test.exe' failure

    [Windows] 'unit_test.exe' failure

    The unit_test.exe program always fails for me. Running as set V=5 & unit_test.exe I get this output:

    -> [9876543210,7]
    ...
    3cab2d23 3 sock.c:301:write_conn        4 0x2b8 29:0 29 err 0
    3cab2d33 4 sock.c:608:mg_mgr_poll       1 -- tchrc
    3cab2d43 4 sock.c:608:mg_mgr_poll       5 r- tchrc
    3cab2d52 3 sock.c:291:read_conn         5 0x2b4 0:0 29 err 0
    3cab2d62 4 http.c:660:uri_to_path2      5 /foo/version.h -> ./src/version.h 3
    3cab2d81 4 sock.c:608:mg_mgr_poll       4 -- tchrc
    3cab2d91 4 sock.c:608:mg_mgr_poll       1 -- tchrc
    3cab2da0 4 sock.c:608:mg_mgr_poll       5 -w tchrc
    3cab2db0 3 sock.c:301:write_conn        5 0x2b4 129:0 129 err 0
    3cab2dcf 4 sock.c:608:mg_mgr_poll       4 -- tchrc
    3cab2def 4 sock.c:608:mg_mgr_poll       1 -- tchrc
    3cab2dfe 4 sock.c:608:mg_mgr_poll       5 -- tchrc
    3cab2dfe 4 sock.c:608:mg_mgr_poll       4 r- tchrc
    3cab2dfe 3 sock.c:291:read_conn         4 0x2b8 0:0 129 err 0
    3cab2dfe 3 net.c:163:mg_close_conn      4 closed
    3cab2e0e 4 sock.c:608:mg_mgr_poll       1 -- tchrc
    3cab2e0e 4 sock.c:608:mg_mgr_poll       5 r- tchrc
    3cab2e0e 3 sock.c:291:read_conn         5 0x2b4 0:0 -1 err 0
    3cab2e0e 3 net.c:163:mg_close_conn      5 closed
    3cab2e0e 4 sock.c:608:mg_mgr_poll       1 -- tchrc
    FAILURE test/unit_test.c:2270: cmpbody(buf, expected) == 0
    

    Seems the cause is DOS line-ending of src/version.h. If I first do a dos2unix src\version.h, it passes. Can the unit_test be suited for this case? Or are we expected to have git always convert files to Unix line-endings? core.autocrlf=false or something?

    The 2nd problem is on the file test/data/київ.txt which also has a DOS file-ending. But my dos2unix program is unable to convert it.
    A change to core.autocrlf=false and git pull after a check-out does not modify such files. Ref. https://github.com/atom/github/issues/1830

    What to do with these things?

    opened by gvanem 20
  • Crash on mg_tls_init

    Crash on mg_tls_init

    • My goal is: running a bot
    • My actions were: api server for the bot accepts a connection with mbedtls for the crypto
    • My expectation was: no crash
    • The result I saw: a crash
    • My question is: why crash and how fix?

    Environment

    • mongoose version: latest commit as of 04/07/2021 (dd-mm-yyyy)
    • custom changes?: n
      • If yes, provide the diff below, and the releavant commit:
    • build environment:
      • OS: debian linux
      • Compiler/IDE: gcc/g++
    • relevant example (see https://github.com/cesanta/mongoose/tree/master/examples) is: ?
    • relevant documentation topic (see https://cesanta.com/docs/) is: ?

    MBEDTLS VERSION:

    root@tricebot:~/bin# apt list | grep mbedtls
    
    WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
    
    libmbedtls-dev/stable,now 2.16.0-1 amd64 [installed]
    libmbedtls-doc/stable 2.16.0-1 all
    libmbedtls12/stable,now 2.16.0-1 amd64 [installed,automatic]
    root@tricebot:~/bin# 
    

    (Source code if that helps: https://github.com/djpiper28/CockatriceTournamentBot) Bind address: https://127.0.0.1:8000, SSL Certificates generated by certbot and don't expire for about a month. Request sent:

    authtoken=[REDACTED]
    gamename=test-deck-hashes/Match3
    password=[REDACTED]
    playerCount=1
    spectatorsAllowed=0
    spectatorsNeedPassword=0
    spectatorsCanChat=0
    spectatorsCanSeeHands=0
    onlyRegistered=0
    playerDeckVerification=1
    playerName=*
    deckHash=ie03v62v
    
    

    COREDUMP:

    Core was generated by `./botExec'.
    Program terminated with signal SIGABRT, Aborted.
    #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
    50      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
    [Current thread is 1 (Thread 0x7fb614bd9700 (LWP 16315))]
    (gdb) bt full
    #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
            set = {__val = {0, 94430847706812, 11, 94430847706812, 140420008742048, 94430847706817, 0, 0, 0, 0, 0, 0, 140420008741552, 140420008741576, 140420008742083, 140420008741552}}
            pid = <optimized out>
            tid = <optimized out>
            ret = <optimized out>
    #1  0x00007fb615628535 in __GI_abort () at abort.c:79
            save_stage = 1
            act = {__sigaction_handler = {sa_handler = 0x0, sa_sigaction = 0x0}, sa_mask = {__val = {0 <repeats 11 times>, 17179869184, 140419795065520, 0, 140420008740912, 140420008741168}}, sa_flags = 347965488, sa_restorer = 0x1000}
            sigs = {__val = {32, 0 <repeats 15 times>}}
    #2  0x00007fb61567f508 in __libc_message (action=action@entry=do_abort, fmt=fmt@entry=0x7fb61578a28d "%s\n") at ../sysdeps/posix/libc_fatal.c:181
            ap = {{gp_offset = 24, fp_offset = 0, overflow_arg_area = 0x7fb614bd8940, reg_save_area = 0x7fb614bd88d0}}
            fd = 2
            list = <optimized out>
            nlist = <optimized out>
            cp = <optimized out>
            written = <optimized out>
    #3  0x00007fb615685c1a in malloc_printerr (str=str@entry=0x7fb615788376 "corrupted size vs. prev_size") at malloc.c:5341
    No locals.
    #4  0x00007fb615685e74 in malloc_consolidate (av=av@entry=0x7fb608000020) at malloc.c:4488
            fb = <optimized out>
            maxfb = 0x7fb608000078
            p = <optimized out>
            nextp = 0x0
            unsorted_bin = 0x7fb608000080
            first_unsorted = <optimized out>
            nextchunk = <optimized out>
            size = <optimized out>
            nextsize = <optimized out>
            prevsize = <optimized out>
            nextinuse = <optimized out>
            bck = <optimized out>
            fwd = <optimized out>
    #5  0x00007fb615688a58 in _int_malloc (av=av@entry=0x7fb608000020, bytes=bytes@entry=1960) at malloc.c:3695
            nb = 1968
            idx = 78
            bin = <optimized out>
            victim = <optimized out>
            size = <optimized out>
            victim_index = <optimized out>
            remainder = <optimized out>
            remainder_size = <optimized out>
            block = <optimized out>
            bit = <optimized out>
            map = <optimized out>
            fwd = <optimized out>
            bck = <optimized out>
            tcache_unsorted_count = <optimized out>
            tcache_nb = <optimized out>
            tc_idx = <optimized out>
            return_cached = <optimized out>
            __PRETTY_FUNCTION__ = "_int_malloc"
    #6  0x00007fb61568b1a2 in __libc_calloc (n=<optimized out>, elem_size=<optimized out>) at malloc.c:3428
            av = <optimized out>
            oldtop = 0x7fb608016240
    --Type <RET> for more, q to quit, c to continue without paging--c
            p = <optimized out>
            bytes = 1960
            sz = 1960
            csz = <optimized out>
            oldtopsize = 44480
            mem = <optimized out>
            clearsize = <optimized out>
            nclears = <optimized out>
            d = <optimized out>
            hook = <optimized out>
            __PRETTY_FUNCTION__ = "__libc_calloc"
    #7  0x000055e26520394d in mg_tls_init (c=0x7fb608011ab0, opts=0x7ffc8070c950) at src/tls.c:68
            tls = 0x55e265204236 <mg_url_is_ssl(char const*)+64>
            rc = 0
            ca = 0x0
            cert = 0x7fb614bd8df7 ""
            certkey = 0x55e2653c0770 "https://127.0.0.1:8000"
            __func__ = "mg_tls_init"
    #8  0x000055e265117817 in eventHandler (c=0x7fb608011ab0, event=4, ev_data=0x0, fn_data=0x7ffc8070c920) at /root/Tricebot/CockatriceTournamentBot/src/api_server.c:677
            s = 0x7fb608003cf0
            api = 0x7ffc8070c920
    #9  0x000055e2651f9a1b in mg_call (c=0x7fb608011ab0, ev=4, ev_data=0x0) at src/event.c:13
    No locals.
    #10 0x000055e2652025b3 in accept_conn (mgr=0x7fb614bd8e90, lsn=0x7fb608000b20) at src/sock.c:486
            buf = "127.0.0.1:55672\000a\340 e\342U\000\000\000\000\000\000\000\000\000\000a\340 e\342U\000"
            c = 0x7fb608011ab0
            usa = {sa = {sa_family = 2, sa_data = "\331x\177\000\000\001\000\000\000\000\000\000\000"}, sin = {sin_family = 2, sin_port = 30937, sin_addr = {s_addr = 16777343}, sin_zero = "\000\000\000\000\000\000\000"}, sin6 = {sin6_family = 2, sin6_port = 30937, sin6_flowinfo = 16777343, sin6_addr = {__in6_u = {__u6_addr8 = "\000\000\000\000\000\000\000\000\060\216\275\024\266\177\000", __u6_addr16 = {0, 0, 0, 0, 36400, 5309, 32694, 0}, __u6_addr32 = {0, 0, 347967024, 32694}}}, sin6_scope_id = 347967064}}
            sa_len = 16
            fd = 6
            __func__ = "accept_conn"
    #11 0x000055e265202f00 in mg_mgr_poll (mgr=0x7fb614bd8e90, ms=100) at src/sock.c:675
            c = 0x7fb608000b20
            tmp = 0x0
            now = 1625423402179
            __func__ = "mg_mgr_poll"
    #12 0x000055e2651185ed in pollingThread (apiIn=0x7ffc8070c920) at /root/Tricebot/CockatriceTournamentBot/src/api_server.c:1064
            mgr = {conns = 0x7fb608011ab0, dns4 = {url = 0x55e265222711 "udp://8.8.8.8:53", c = 0x0}, dns6 = {url = 0x55e265222728 "udp://[2001:4860:4860::8888]:53", c = 0x0}, dnstimeout = 3000, nextid = 3, userdata = 0x0}
            c = 0x7fb608000b20
            api = 0x7ffc8070c920
            cont = 1
    #13 0x00007fb615af1fa3 in start_thread (arg=<optimized out>) at pthread_create.c:486
            ret = <optimized out>
            pd = <optimized out>
            now = <optimized out>
            unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140420008744704, -3554313377566241517, 140722463360270, 140722463360271, 140420008744704, 0, 3585045260700405011, 3585042937650400531}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
            not_first_call = <optimized out>
    #14 0x00007fb6156ff4cf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
    
    opened by djpiper28 20
  • mg_serve_http broke in v6.3 and v6.4

    mg_serve_http broke in v6.3 and v6.4

    When i run mongoose 6.2, my site works properly (using HTTP). When I swap out mongoose with either v6.3 or v6.4, none of my static pages are sent to the browser properly.

    opened by erappaport 19
  • Websocket server send data

    Websocket server send data

    This is not exactly a bug, but watching the documentation and the examples I cannot find how the server can send data to client using websockets.

    All I can see is that the websockets callbacks are called when a websocket connection is started. But how is it possible to send data from the server to the client?

    I need to send an information every second to the client.

    opened by ventayol 19
  • Rename mip_rxcb to mip_qwrite, add mip_qread and enforce rx() for drivers

    Rename mip_rxcb to mip_qwrite, add mip_qread and enforce rx() for drivers

    • mip_rxcb() --> mip_qwrite()
    • MIP no longer reads the queue, it just calls the driver rx()
      • provided a default rx(): mip_driver_rx() so drivers don't need to implement the obvious. This function calls mip_qread()
    • introduced mip_qread(), calls q_read()
    • Since .rx in mip_if is always filled, MIP can no longer know if the queue will be used.
      • Moved the queue initialization to each driver that uses it; if the user does not fill queue.len, the driver will.
    • Added .rx = mip_driver_rx in existing drivers (stm32, tm4c) and RNDIS examples (F4, F7, Pico)
    • Tested all affected examples for compilation and Pico, TI, F4 for execution
    opened by scaprile 0
  • JSON Unescaspe

    JSON Unescaspe

    Hi,

    the escape sequence / which ist decoded as / is not included. (This is come from solar inverter api.)

    Possible fix:

    static const char *escapeseq(int esc) { return esc ? "\b\f\n\r\t\"/" : "bfnrt\"/"; }

    opened by SkateScout 0
  • completely support of gzip compression

    completely support of gzip compression

    Hi again mongoose already handles the gzip compression in mg_http_serve_file(). but that function is not check the request header "Accept-Encoding:gzip", Also FILE.gz does not have priority over original File. The attached patch fix this issue. Thanks mongoose-completely-support-file-gz.patch.gz

    opened by kashfi59 0
Releases(7.8)
  • 7.8(Aug 28, 2022)

    • Introduced c->is_resp flag for the server-side HTTP connections, for correctly handling pipelined requests that can span several event handler invocations
    • Enhancements to the MIP TCP/IP stack. The baremetal nucleo-f746 example works with device dashboard: HTTP UI, MQTT, Websocket
    • Reduced default MG_HTTP_MAX_HEADERS from 40 to 30 to reduce embedded stack usage
    • Added server and client native JSON-RPC support, see https://mongoose.ws/documentation/#rpc
    • Enhanced example/device-dashboard to show real time graph, MQTT communication and user authentication
    • Added a large number of new tutorials, enhanced existing ones, and added videos: https://mongoose.ws/tutorials/
    • Enhanced illustrations in API reference, e.g. https://mongoose.ws/documentation/#mg_http_reply
    • Add an ability to specify MG_ARCH in mongoose_custom.h
    • Introduced mg_*xprintf formatting functions, https://mongoose.ws/documentation/#mg_xprintf-mg_vxprintf
    • Changed logging to use mg_pfn_t primitive
    • Added tests for large WS frames
    • Added unit tests for auto-gzipped static content
    • Enhanced SNTP time calculation, made it more accurate
    • Refactored MG_EV_HTTP_CHUNK handling, made it more robust and resilient
    • Added epoll support for linux targets
    • Changed mg_log_set(level) : debug level is now an int, not const char *
    • Made fixes for poll() support, added poll() support for Windows, made it default to avoid FD_SETSIZE restrictions
    • Added initial support for RP2040
    • Exported MQTT result code definitions
    • Added MQTT5 support
    • Added native JSON API. Now external JSON libraries are not required: https://mongoose.ws/documentation/#json
    • Added examples/uart-bridge, examples/sntp-time-sync, and many others
    • Added automatic PUBACK responses for MQTT qos > 0
    • Added mg_ws_printf()
    • Implemented automatic pre-compressed .gz handling for static files
    • Added mg_http_serve_opts::page404 for custom 404 handling
    • Added udp/tcp flag for mg_mkpipe()
    Source code(tar.gz)
    Source code(zip)
  • 7.7(May 19, 2022)

    • Added an experimental embedded TCP/IP stack
    • Added MG_ARCH_RTX Keil MDK RTX support
    • Added MG_ARCH_NEWLIB
    • Added MG_ARCH_TIRTOS TI RTOS support
    • Added Keil MDK tutorial
    • Added TI RTOS example
    • Added Zephyr support and 4 TLS-enabled examples
    • Enhanced device dashboard example
    • Changed mg_hexdump() to use logging instead of malloc-ing hex string
    • Refactored multithreading API, enabled bidirectional IO
    • Fixed TLS buffering issue
    • Fixed up / enhanced many util functions
    • Fixed MQTT suback handling
    • Introduced MG_ENABLE_CUSTOM_MILLIS for custom uptime functions
    • Fixed DNS failure handling
    • Added more unit tests - for failed auth TLS validation and others
    • Added valgrind tests
    • Fixed HTTP chunk handling
    • Using independed mg_snprintf() routine instead of C lib
    • Enhanced docs
    • Enhanced fatfs support
    Source code(tar.gz)
    Source code(zip)
  • 7.6(Jan 21, 2022)

    • Fixed mg_check_ip_acl()
    • API change for mg_wakeup() - added ability to pass specific data to the mongoose task
    • API change for mg_mqtt_pub() and mg_mqtt_sub() - using struct mg_str instead of struct mg_str *
    • Added embedded FatFS support, mg_fs_fat
    • API change for mg_http_upload() - added FS parameter
    • API change for struct mg_fs - open and close calls accept void *, not struct mg_fd *
    • Fixed mg_url_port()
    • Added FS parameter to the struct mg_tls, in order to let TLS code to read certs from any FS
    • Fixed DNS resolution issue: propagating DNS errors to the resolving connection
    • Added ability to override stat() call for POSIX FS
    • Improved UDP - not calling connect()
    • Added SSDP search example
    • Added huge-response example
    • Added realpath() convenience macro for Win32
    • Use int64_t for millisecond values in timers and for mg_millis()
    • Removed mg_time() and usleep()
    • Made mongoose friendly to the baremetal Keil build
    Source code(tar.gz)
    Source code(zip)
  • 7.5(Dec 17, 2021)

    • Add MG_HTTP_INDEX build var, default to "index.html", to let user to change directory index file
    • Added MG_CUSTOM_TLS build flag, to enable any 3rd party TLS library integration (or make tweaks to existing integrations)
    • Added example for mg_http_bauth()
    • Added documentation for mg_http_get_header_var()
    • Added CIFuzz integration
    • Fixed captive portal example
    • Added json-rpc-via-ws example
    • Fixed FD_CLOEXEC handling
    • Added Add examples/mqtt-client-aws-iot
    • Add user and pass to struct mg_mqtt_opts
    • Fixed comma handling in mg_http_get_header_var()
    • Fixed UDP handling on Windows
    • Added mbedTLS CRL support
    • Fixed mg_random() on ESP32
    Source code(tar.gz)
    Source code(zip)
  • 7.4(Sep 30, 2021)

    • Added example for NXP RT1020 on Microsoft AzureOS
    • Added support for Microsoft AzureOS
    • Better diagnostics in mg_open_listener, #1359
    • Including ipv6 wrapping brackets [] in the result of mg_url_host()
    • Support multiple serving directories (web roots): opts.root_dir = "/path1,/uri1=/some/other/path". See https://github.com/cesanta/mongoose/commit/2139fbc4b78da492a468baedaf960964f88d7131
    • Security enhancement in MQTT codepath
    • Removed realpath() from the virtualised FS API
    • Enhanced OpenSSL handshake codepath
    • API change mg_iobuf_{append,delete} -> mg_iobuf_{add,del}
    • Added WS defragmentation logic
    • Added Add mg_check_ip_acl()
    • API change: mg_next_comma_entry() -> mg_commalist()
    • Added stm32-nucleo-f746z example
    • Fixed HTTP chunk handling for larger chunks
    • Enhanced FREERTOS + LWIP support - works out of the box!
    • Refactored mg_mkpipe() and multithreading support
    • Sending MG_EV_WS_OPEN to server connections, too
    • Added MQTT over Websocket example
    • Added virtualised FS support and built-in ability to pack static files into server binary and serve files without a "real" FS
    • Added RISCV target to unit test
    Source code(tar.gz)
    Source code(zip)
  • 7.3(Jul 23, 2021)

    • Improved SSI file serving: added Content-Type header
    • Improved compiler compatibility, using traditional header guards instead of #pragma one
    • When listening on port 0, exposing the actual port
    • Disabled SSL 1.1 for OpenSSL
    • Fixed C++ mg_str constructor shadowing
    • Using FD_CLOEXEC on opened sockets on UNIX-like systems
    • Support for new mbedtls 3.x
    • Improved C++ interop with #ifdef __cplusplus
    • Improved MQTT API: added qos and retain params to mg_mqtt_{pub,sub}
    • Optimised RAM usage - mg_iobuf_append()
    • Added MG_ARCH_FREERTOS_LWIP
    • Added stm32f7 example with FreeRTOS+TCP stack
    • Re-enabled Range header support (partial downloads)
    • Multiple documentation fixes
    • Improved mg_random() for Espressif builds
    • Added multiple unit tests
    • Added an ability to load mbedTLS certs from memory
    • Added multipart form upload
    Source code(tar.gz)
    Source code(zip)
  • 7.2(Mar 9, 2021)

    • Added mg_mqtt_next_unsub()
    • Added chunked HTTP client support and MG_EV_HTTP_CHUNK event
    • Restored mg_mqtt_{ping,pong,disconnect} functions
    • Fixed Cygwin and QNX builds
    • Added struct mg_mgr::userdata pointer
    • Added struct mg_http_message::head which contains HTTP line and all headers
    • Add ability to use in-memory CA PEM for mbedtls
    • Improved unicode handling on Win32
    • Improved ESP32 example to use SPIFFS and static serving
    • Improved TLS SNI
    Source code(tar.gz)
    Source code(zip)
  • 7.1(Jan 26, 2021)

    Overview

    This is a bugfix and cleanup release after the major version 7.0 release. A significant number of small issues were fixed, and some new examples added.

    • Continuous integration test switched from CircleCI to Github Actions
    • Added socks5 example
    • Added esp32 example
    • Added esp8266 example
    • Added mingw test
    • Added mbedtls test
    • Added openssl test
    • Added reverse proxy example
    • Added proxy client example
    • Added MQTT server example
    • Many TLS related fixes
    • Fixed DNS resolution timeout
    • Added SSI to mg_http_serve_dir()
    • Fixed file descriptor leak for local cache codepath
    Source code(tar.gz)
    Source code(zip)
  • 7.0(Dec 12, 2020)

    Overview

    This is a major release, aimed primarily at refactoring and cleanup of the codebase. The main focus is made on the embedded usage. The documentation has been fully revamped, and published at https://cesanta.com/docs. Porting from the 6.x version is not straightforward, despite all concepts stayed intact. The major changes include:

    • CGI support has been removed

    • WebDAV support has been removed

    • Socks5 support has been factored to the example

    • Digest auth support has been removed. The anticipated usage is Basic + TLS

    • Mongoose documentation

    Non-amalgamated sources

    The non-amalgamated sources are kept in src/, and amalgamation is performed by Makefile. Set -DMG_ENABLE_LINES compiler option to enable non-amalgamated diagnostics.

    CI tests and coverage

    A Circle CI tests are established, to test on the common platforms and compilers, for both ISO C and ISO C++ mode. Also, an automatic test coverage tracking is performed.

    The plan for the next releases is to add platform-specific examples (like for ESP32, STM32, etc) and integrate them into CI, to ensure they do not break as development continues.

    Continuous fuzzing test

    Mongoose is integrated into Google's https://oss-fuzz.com/ service, to enable continuous fuzzing code tests. This helps to find security issues early on.

    Source code(tar.gz)
    Source code(zip)
  • 6.18(May 21, 2020)

    • Allow OpenSSL session reuse on 2-way SSL
    • Updated certs for OpenSSL tests
    • Fixed OpenSSL error status issue
    • Added HTTP proxy client example
    • Fixed deferencing mg_http_free_proto_data_endpoints
    • Fixed typedef bool for MSC
    Source code(tar.gz)
    Source code(zip)
  • 6.17(Feb 11, 2020)

    Bug fixes

    • An integer overflow bug in parse_mqtt(), CVE-2019-19307
    • MQTT ping logic improved
    • Leak fix for invalid CA
    • Make SSL and non-SSL build binary compatible
    • Make 30x replies keep opened HTTP/1.1 connection
    Source code(tar.gz)
    Source code(zip)
  • 6.16(Sep 30, 2019)

    Bug fixes

    • A critical issue in mg_http_parse() is fixed. Associated fuzzer test added. This is a fix for the CVE-2019-13503 in the Common Vulnerability and Exposure database: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-13503
    Source code(tar.gz)
    Source code(zip)
  • 6.15(Jun 13, 2019)

    Bug fixes

    • A critical MQTT heap-based overflow in parse_mqtt() fixed - credit goes to Yakun Zhang and Zheng Huang of Baidu Security Labs for discovering and reporting the issue
    • mg_resolve2() incorrect memory init fixed
    • Fixed locking in lwip_net_if
    • Fixed callback invocation in mg_net_if_lwip

    Features

    Source code(tar.gz)
    Source code(zip)
  • 6.14(Mar 4, 2019)

    API changes

    • Added MG_MK_STR_N(), mg_str_starts_with(), mg_strfree()
    • Added mbuf_clear(), mbuf_append_and_free(), mbuf_move()
    • Added ability for multipart data handler to provide pushback
    • Made MG_CTL_MSG_MESSAGE_SIZE overridable

    Bug fixes

    • Fixed digest auth result comparison
    • Read all available data during recv poll
    • Ensure that user sees all the data before connection is closed
    • Check for NULL in tcp_recved_tcpip()
    • Send extra options with OPTIONS
    • Properly support MQTT wildcards when matching topics
    • Fix handling of WS handshake error response

    Other changes

    • Log file:line instead of function; add cs_log_set_file_level()
    Source code(tar.gz)
    Source code(zip)
  • 6.13(Oct 8, 2018)

    • When processing chunked response, make sure chunk size is reasonable
    • Open uploaded file in binary mode (Windows)
    • Refactored polling, cleaned up net_if interface somewhat
    • LwIP: Trim recv_mbuf when we know the size of the data
    • Fix unused variable warnings when build w/o logging
    • Added net_if_null
    • Minor doc updates
    Source code(tar.gz)
    Source code(zip)
  • 6.12(Aug 13, 2018)

    Security fix

    This release fixes a security issue, reported at https://www.cvedetails.com/cve/CVE-2018-10945/

    ( Fix body length calculation in mg_handle_cgi)

    Change List:

    • Add mg_url_encode_opt() - a parametrized version of mg_url_encode()

    • Add MG_HIDE_SERVER_INFO

    • mg_file_upload_handler: Support multiple files

    • Add host name verification for OpenSSL

    • Add mg_strstrip: trims whitespace at both ends of a string

    • Fix http pipelining

    • Fix buffer size passed to inet_ntop()

    • Fix an edge case in multipart HTTP upload parsing

    • Fix mg_http_parse_header (treat ; as a delimiter)

    • mg_lwip: Fix race during clean connection teardown

    • Fix a bug in mg_mgr_init_opt with opts.num_ifaces

    • Fix build with CS_ENABLE_STDIO=0

    • Fix warnings on newer versions of GCC

    • Fix body length calculation in mg_handle_cgi

    • Don't touch send_mbuf when sending MQTT messages

    Source code(tar.gz)
    Source code(zip)
  • 6.11(Feb 8, 2018)

    • Fix socket leak when there are too many open file descriptors
    • Fix publish-subscribe example
    • Fix mg_parse_multipart in case of malformed request
    • Websocket: Respond to Ping with Pong
    • Websocket: Properly close a connection with Close frame (in response to a client's close and when protocol failure is detected)
    • Websocket: Fix support of fragmented messages
    • Websocket: Add support for control frames interjected in the middle of a fragmented message
    • Digest authentication: Fix nonce validity check (expired nonce or nonce from the future did not cause the the check to fail)
    • Digest authentication: Fix nonce request value; it worked before because nonce validity check was broken as well
    • Digest authentication: Add nonce argument to mg_http_create_digest_auth_header(): clients should use the value received from the server's authentication request.
    • Fail if passed a NULL handler to mg_bind or mg_bind_opt.
    • Publish sources and tests
    • Remove tunneling functionality which was used by nobody
    • Add UDP client example
    • Don't use user_data in mqtt server
    • Deprecate mg_http_parse_header() and implement mg_http_parse_header2() instead, which allocates a new buffer if the client-provided one is not large enough (similarly to asprintf).
    • Fix limitations of header value lengths, e.g. when parsing authentication headers such as nonce, etc.
    Source code(tar.gz)
    Source code(zip)
  • 6.10(Oct 31, 2017)

    API changes

    • SOCKS5 client and server support
    • Timer value is no longer cleared after MG_EV_TIMER event if it was not changed. User's handler must set it to 0 explicitly to avoid repeated invocation.

    FIxes

    • SSL/TLS listener fix for TI SimpleLink networking interface
    • Double-counting of recved bytes in LWIP interface caused issues
    • MQTT SUBSCRIBE command parsing in the broker code could cause crashes
    • FIxed CGI script connection lifetime management
    Source code(tar.gz)
    Source code(zip)
  • 6.9(Sep 13, 2017)

    API changes:

    • MG_ENABLE_CALLBACK_USERDATA - if set, changes signature of event handler function to include user_data argument. Disabled by default for now, in the future this will become the default.
    • mg_set_nameserver() - specify DNS server to use
    • mg_assemble_uri() - assemble a URI from parts
    • mg_connect_ws() now accepts http:// URLs

    Bug fixes:

    • Fix parsing of MQTT QoS > 0 PUBLISH messages
    • Fix MQTT PUB{ACK,REC,REL,COMP} and UNSUBACK flags
    • Properly shut down the SSL connection (send "close notify" TLS message)
    • Fix mg_get_http_var() return value
    • Fix MQTT handshake; change client protocol to version 3.1.1
    • Fix Handling of multiple MQTT messages per RECV event
    • Update to make lwip_net_if thread-safe
    • Use DhcpNameServer on Windows
    • Fix MQTT message parsing issues
    • Fix DNS name uncompression that could lead to infinite loop
    • Fix WS frame reassembly issues

    https://github.com/cesanta/mongoose/pull/855

    Source code(tar.gz)
    Source code(zip)
  • 6.8(May 19, 2017)

    • Client support for TLS PSK
    • Multipart handling fixes
    • LWIP driver fixes
    • UDP crashes on LWIP fixes
    • Removed mg_enable_multithreading. Added example for multithreaded usage, https://github.com/cesanta/mongoose/tree/dev/examples/multithreaded
    Source code(tar.gz)
    Source code(zip)
  • 6.7(Jan 16, 2017)

    New platforms supported

    A bunch of new platforms are now supported by Mongoose:

    • Windows CE 6.0: See example;
    • TI Tiva TM4C129: See example;
    • PIC32 Harmony TCP/IP: In addition to "bare metal", Mongoose is now able to use PIC32 Harmony TCP/IP Stack. Checkout example here;
    • nRF 51/52: Find example for nRF 51 here and for nRF52 here;
    • mbed: Mongoose is now can be a part of a project based on mbed. Checkout example here;
    • ESP32: Mongoose 6.7 can be compiled for ESP32 platform.

    Other new features

    • NXP Kinetis K64 support improved: New example is here;
    • mbedTLS native support: In addition to OpenSSL, Mongoose 6.7 can use mbedTLS;
    • SNTP client added: Mongoose 6.7 for working with Internet time servers.

    A lot of improvements and bugfixes

    See a list of closed issues here.

    Source code(tar.gz)
    Source code(zip)
  • 6.6(Oct 12, 2016)

    Changes

    STM32 support added

    Mongoose 6.6 can be built and run on STM32 microcontrollers. Check out the new example here for an MQTT Client for STM32. The example runs through how to build an MQTT client for STM32 with TI CC3100 WIFI as network module.

    PIC32 support added

    We’ve also added PIC32 support to Mongoose. And just as for STM32, we have a new example here for you to follow here. It runs through how an MQTT Client is intended for running on PIC32 (MX series with TI CC3100 as a network module).

    TI CC3200 support improved

    We have improved the already support TI CC3200. Here, the TI Compiler on docker image was updated to version 5.8.2.

    New API introductions

    We want to make Mongoose as simple as possible to use. Check out the new API we’ve added in 6.6:

    • mg_http_send_redirect - sends a redirect response
    • mg_http_serve_file - serves a specific file with a given MIME type and optional extra headers.
    • MG_F_ENABLE_BROADCAST - new flag, allows to send broadcast messages
    • MG_EV_SSI_CALL_CTX - new event, the variant of MG_EV_SSI_CALL with context of the SSI call being processed in addition to the tag argument.

    New Examples

    We mentioned the STM32 an PIC32 examples already, but they are not all! Check out these additional examples to help you get started with your embedded project:

    Bugfixes

    We always improve bugs along the way between releases. If you come across anything, let us know in our forum.

    • Use gethostbyname to resolve hocalhost if resolving via /etc/hosts failed. (especially useful for Windows users)
    • Fixed a lot of errors and warning in MSVC compilation
    • Fixed bug in multithreaded mode support:
      • Copy flags for accepted connection
      • Use user timeout in multithreading polling
    • Smaller bug fixes

    Documentation

    We want you to be able to find all the answers you need in our documentation. That’s why we try to improve it as best we can. So you’ll see that we have more clear and structured documentation available as well as explanations for each example added directly in our documentation section.

    Binaries

    Windows and Mac binaries are available for download from the website.

    Licensing

    Mongoose is available under GPLv2. Commercial use requires a license, please contact us for terms.

    Support

    Community support can be found on our forum. Commercial support options are available separately by contacting us.

    Source code(tar.gz)
    Source code(zip)
  • 6.5(Jul 12, 2016)

    Changes

    • Improved TI CC3200 support
      • Newly-rewritten SimpleLink socket handler
      • Added support for SSL
      • NWP restart hook: sl_restart_cb should be invoked by the user to re-init listeners after NWP restart
    • Dedicated JSON Library
      • Support for JSON serialisation/deserialisation has been moved back to a dedicated library (Frozen). It has seen major improvements - printf/scanf like API has been implemented, making parsing and emitting JSON easy and convenient. Users that need JSON functionality are encouraged to check out Frozen.
      • JSON-RPC support is no longer available as part of Mongoose
    • CGI: REMOTE_ADDR and SERVER_PORT variables are now passed to the scripts
    • Fixed a memory leak in mg_connect_ws_opt
    • Fixed issues with HTTP keep-alive connections
    • Other minor fixes

    Binaries

    Windows and Mac binaries are available for download from the website.

    Licensing

    Mongoose is available under GPLv2. Commercial use requires a license, please contact us for terms.

    Support

    Community support can be found on our forum. Commercial support options are available separately by contacting us.

    Source code(tar.gz)
    Source code(zip)
  • 6.4(Apr 12, 2016)

    New features and API changes

    Bug fixes and improvements

    • A number of fixes in handling of UDP, added an example.
    • Fix MQTT parsing of nullary commands.
    • Adjust poll timeout if there are pending timers.

    Licensing

    Mongoose is available under GPLv2. Commercial use requires a license, please contact us for terms.

    Support

    Community support can be found on our forum. Commercial support options are available separately by contacting us.

    Source code(tar.gz)
    Source code(zip)
  • 6.3(Mar 10, 2016)

    This release concerns commercial users only. From this release on, there are no separation for lite/standard/premium version.

    Technical changes (bugfixes, new features) are scheduled for the next 6.4 release in mid-April.

    Source code(tar.gz)
    Source code(zip)
  • 6.2(Jan 12, 2016)

    What's new in the Mongoose Library

    • WebDAV support improvements. With a just a couple of lines of code your web server is ready to serve WebDAV and can be mounted as a network drive in very different clients, like Finder on MacOS, Explorer on Windows and Nemo, Nautilus (and others) on Linux. Just add dav_document_root to initialization parameters and your are ready to go. See simplest_web_server example.
    • Timer support. Mongoose 6.2 introduces new event - MG_EV_TIMER. With event and new API function mg_set_timer things like connection timeout (and a lot of another timeout-related features) can be easily implemented. Call mg_set_timer(my_connection, time(NULL) + N) and my_connection will receive MG_EV_TIMER once N seconds is elapsed. Sub-second precision is also supported, and the mg_time function which returns current time as a fraction floating point value has been added. See API documentation for more details.

    Other changes:

    • MG_EV_CLOSE is now always delivered before connection is destroyed. This should simplify cleanup.
    • New API function: mg_url_decode to decode URL-encoded string.
    • g++ and Microsoft Visual Studio support was improved
    Source code(tar.gz)
    Source code(zip)
    mongoose-6.2.zip(1.90 MB)
    mongoose-lite-6.2.zip(1.87 MB)
    mongoose-premium-6.2.zip(1.90 MB)
  • 6.1(Nov 30, 2015)

    What's new in the Mongoose Library

    • Native support for PicoTCP embedded TCP/IP stack
    • Native support for LWIP embedded TCP/IP stack
    • Native support for ESP8266 SDK (see example)
    • Native support for CC3200 FreeRTOS SDK
    • Added ability to specify extra headers for mg_serve_http() - that implements e.g. CORS on server side
    • Added ability for automatic port-based redirects, for HTTP->HTTPS redirects
    • Multiple bigfixes

    Mongoose editions

    For commercial use, Mongoose is available in three editions:

    • Mongoose Lite: Cross platform integration, SSL/TLS, HTTP support
    • Mongoose: Mongoose Lite + HTTP CGI, HTTP SSI, HTTP Digest Auth, WebSocket support
    • Mongoose Premium: Mongoose + Plain TCP, UDP, JSON-RPC, MQTT, DNS, CoAP support
    Source code(tar.gz)
    Source code(zip)
    mongoose-6.1.zip(1.88 MB)
    mongoose-lite-6.1.zip(1.85 MB)
    mongoose-premium-6.1.zip(1.89 MB)
  • 6.0(Sep 21, 2015)

    Overview

    This is a major release of Mongoose. It brings new capabilities, making Mongoose a multi-protocol network library rather then only HTTP/Websocket. That means more flexible and rich API. New Mongoose API is not backward-compatible with pre-6.0 versions.

    What's New

    • Support for plain TCP, plain UDP
    • Support for Websocket client
    • JSON-RPC client, JSON-RPC server
    • MQTT client, MQTT broker
    • CoAP client, CoAP server
    • DNS client, DNS server, async DNS resolver
    • SSL layer improvements, including modern cryptography support
    • New API

    Architecture notes

    Pre-6.0 Mongoose was hiding the implementation from the user. Like, internal connection structures, sockets, etc. Mongoose 6.0 opens everything to the user. This has it's pro and cons. The decision to open the guts of the library is to provide power users to take full control over the IO engine. Basic use cases are well covered by the example that are provided in abundance.

    Mongoose Editions

    Mongoose is available in three editions to suit your integration needs:

    • Mongoose Lite: Cross platform integration, SSL/TLS, HTTP support
    • Mongoose: Mongoose Lite + HTTP CGI, HTTP SSI, HTTP Digest Auth, WebSocket support
    • Mongoose Premium: Mongoose + Plain TCP, UDP, JSON-RPC, MQTT, DNS, CoAP support
    Source code(tar.gz)
    Source code(zip)
    mongoose-6.0.zip(1.65 MB)
    mongoose-lite-6.0.zip(1.62 MB)
    mongoose-premium-6.0.zip(1.65 MB)
  • 5.6(Nov 29, 2015)

    Changes in Libmongoose library:

    • Added -dav_root configuration option that gives an ability to mount a different root directory (not document_root)
    • Fixes for build under Win23 and MinGW
    • Bugfix: Double dots removal
    • Bugfix: final chunked response double-send
    • Fixed compilation in 64-bit environments
    • Added OS/2 compatibility
    • Added getaddrinfo() call and NS_ENABLE_GETADDRINFO
    • Various SSL-related fixes
    • Added integer overflow protection in iobuf_append() and deliver_websocket_frame()
    • Fixed NetBSD build
    • Enabled NS_ENABLE_IPV6 build for Visual Studio 2008+
    • Enhanced comma detection in parse_header()
    • Fixed unchanged memory accesses on ARM
    • Added ability to use custom memory allocator through NS_MALLOC, NS_FREE, NS_REALLOC

    Changes in Mongoose binary:

    • Added -start_browser option to disable automatic browser launch
    • Added experimental SSL support. To listen on HTTPS port, use ssl://PORT:SSL_CERT format. For example, to listen on HTTP port 8080 and HTTPS port 8043, use -listening_port 8080,ssl://8043:ssl_cert.pem
    Source code(tar.gz)
    Source code(zip)
  • 5.5(Nov 29, 2015)

    Changes in Libmongoose library:

    • Added new API function: mg_forward() for proxying functionality
    • Added new API function: mg_send_file_data() for sending file data
    • Added new utility API functions: mg_mmap() and mg_munmap()
    • Changed the way SSL settings are handled: removed ssl_certificate and ssl_ca_certificate options, and instead made listening_port accept ssl://PORT:SSL_CERT:CA_CERT notation
    • Added ability to listen on multiple ports, see listening_port documentation
    • Added enable_proxy option
    • Added cookie_authentication example
    • Added websocket_ssl_proxy example
    • Added http_client example
    • Increased default 'idle connection' timeout from 30 to 300 seconds
    • Fixed MinGW build
    • Refactored all examples, put each in it's own directory with dedicated build
    • Many smaller bugfixed, including SSL, CGI, API, proxy, etc

    Changes in pre-compiled binaries:

    • Support for multiple listening ports
    • Fixed CGI handling for scripts that specify interpreter in the hashbang line
    Source code(tar.gz)
    Source code(zip)
Owner
Cesanta Software
Embedded Communication
Cesanta Software
Like libevent and libuv, libhv provides event-loop with non-blocking IO and timer, but simpler api and richer protocols.

中文版 Intro Like libevent, libev, and libuv, libhv provides event-loop with non-blocking IO and timer, but simpler api and richer protocols. Features cr

ithewei 5k Jan 4, 2023
Dohd is a minimalist DNS-over-HTTPS daemon that redirects all DoH queries to a local DNS server running on localhost:53 (UDP)

dohd Dohd (pron. doh-dee) is a minimalist DNS-over-HTTPS daemon that redirects all DoH queries to a local DNS server running on localhost:53 (UDP). Fe

Dyne.org 16 Dec 1, 2022
Winpcap-based network packet capture tool, support TLS (part), UDP, ICMP, TCP, ARP, DNS and other protocol analysis, interface reference wireshark.

Winpcap-based network packet capture tool, support TLS (part), UDP, ICMP, TCP, ARP, DNS and other protocol analysis, interface reference wireshark.

null 54 Dec 26, 2022
Ole Christian Eidheim 741 Dec 27, 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
A modern C++ network library for developing high performance network services in TCP/UDP/HTTP protocols.

evpp Introduction 中文说明 evpp is a modern C++ network library for developing high performance network services using TCP/UDP/HTTP protocols. evpp provid

Qihoo 360 3.2k Jan 5, 2023
Portable, single-file, protocol-agnostic TCP and UDP socket wrapper, primarily for game networking

Documentation This is a header-only library, as such most of its functional documentation is contained within the "header section" of the source code

null 64 Dec 3, 2022
an easy implementation of a multi-process tcp server and a multi-thread tcp client

一个TCP多进程服务器-多线程客户端的简单实现。 客户端类似Apache ab的测试功能,能够通过向某一个ip端口发送指定并发量和总数量的tcp短连接;服务端处理tcp短连接,每来一条消息就打印一条log。 使用cmake编译,建议在vscode里编译,或者命令行 # 终端进入目录 mkdir bu

adin 1 Nov 28, 2021
Built a client-server application using TCP and UDP sockets, in which the clients can subscribe/unsubscribe to various topics.

Built a client-server application using TCP and UDP sockets, in which the clients can subscribe/unsubscribe to various topics.

null 1 Jun 22, 2022
A project designed for the esp8266 D1 Mini or the esp8266 D1 Mini PRO to provide a wifi http server and dns server.

PS4 Server 9.00 This is a project designed for the esp8266 D1 Mini or the esp8266 D1 Mini PRO to provide a wifi http server and dns server. this is fo

null 14 Nov 28, 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
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
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
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
Provide translation, currency conversion, and voting services. First using telnet you create a connection to a TCP socket, then the server connects to 3 UDP sockets hosted on other servers to do tasks.

to run micro servers g++ translator.cpp -o translator ./translator <port 1> g++ voting.cpp -o voting ./voting <port 2> g++ currency_converter.cpp -o c

Jacob Artuso 1 Oct 29, 2021
H2O - the optimized HTTP/1, HTTP/2, HTTP/3 server

H2O - an optimized HTTP server with support for HTTP/1.x, HTTP/2 and HTTP/3 (experimental) Copyright (c) 2014-2019 DeNA Co., Ltd., Kazuho Oku, Tatsuhi

H2O 10.2k Dec 30, 2022
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
A protocol for secure client/server connections over UDP

netcode netcode is a simple connection based client/server protocol built on top of UDP. It has the following features: Encrypted and signed packets S

The Network Protocol Company 2.3k Dec 26, 2022