Compare commits

...
1202 Commits
Author SHA1 Message Date
cpq 0a265e79a6 Remove debug log and add a comment 2022-08-29 13:10:11 +01:00
cpq 7f30c01c58 Correct condition check sequence for the prev fix 2022-08-29 13:01:56 +01:00
cpq 0661f5921a Fix #1690 - mg_json_get for keys with the same prefix 2022-08-29 12:40:50 +01:00
cpq 1c16e95b3a Fix driver link 2022-08-29 08:55:53 +01:00
cpq 44efa45d75 7.8 2022-08-28 14:11:08 +01:00
cpq ef89776517 Add reponse end to the http dir list 2022-08-28 13:58:41 +01:00
cpq 2f3f1357c8 Unbreak after mip init API change 2022-08-27 17:15:11 +01:00
cpq dcdeffff9a MIP refactor: use mg_hton*, move driver_data to ifp, parametrise f746 PLL setup 2022-08-27 16:45:31 +01:00
cpq 229b492ccc Minor refactorings, reduced MG_HTTP_MAX_HEADERS 40 -> 30 to reduce stack usage 2022-08-27 12:31:43 +01:00
cpq 2d45ba1981 Merge branch 'master' of github.com:cesanta/mongoose 2022-08-26 17:41:22 +01:00
cpq b73022096d Let RPC handle responses too 2022-08-26 17:41:13 +01:00
Sergio R. Caprile d1124703b7 Merge pull request #1687 from cesanta/webui-login
Fix SameSite cookie value
2022-08-26 10:24:00 -03:00
Sergio R. Caprile 4a8dd81c93 Fix SameSite cookie value 2022-08-26 10:22:31 -03:00
cpq f474a31484 Rebuild packed_fs.c 2022-08-26 14:21:33 +01:00
cpq e9ec2c5304 Add TLS support to MQTT 2022-08-26 14:20:54 +01:00
cpq c7b9ca68c2 Move mg_mqtt_next-* to the example, and some nits 2022-08-26 14:20:54 +01:00
Sergio R. Caprile ffa033cca9 Merge pull request #1686 from cesanta/device-dashboard
Fix SameSite cookie value
2022-08-26 10:19:08 -03:00
Sergio R. Caprile 3d3f6e09b6 Fix SameSite cookie value 2022-08-26 10:17:49 -03:00
Sergey Lyubka 7252f5385b Merge pull request #1683 from cesanta/multi-threaded
Show how to send data to a worker thread
2022-08-25 23:53:29 +01:00
Sergio R. Caprile ad641880a6 Show how to send data to a worker thread 2022-08-25 17:00:47 -03:00
Sergey Lyubka 1f6d62a635 Merge pull request #1684 from cesanta/nucleo-f746zg-baremetal
Workaround for aliased weak symbol override issue
2022-08-25 05:10:06 +01:00
Sergio R. Caprile 3cd4fd2d61 Workaround for aliased weak symbol override issue
Changed README to use picocom as cu is apparently not able to add carriage return after line feed
2022-08-24 19:02:11 -03:00
cpq d565faa75d Make non-initialised MIP poll work 2022-08-21 23:35:24 +01:00
cpq 786e118f06 Include mongoose_custom.h early to allow overrides 2022-08-20 18:26:29 +01:00
cpq eca612d514 Document all supported MG_ARCH choices 2022-08-20 03:44:29 +01:00
Sergey Lyubka 060f43839d Merge pull request #1680 from cesanta/esp8266
Expanded Makefile
2022-08-20 00:27:09 +01:00
cpq 9c3c4a6f4b MIP client 2022-08-20 00:03:15 +01:00
cpq 101cc1a672 Add define for strdup 2022-08-20 00:02:36 +01:00
Sergio R. Caprile e47f71344d Expanded Makefile 2022-08-19 18:17:52 -03:00
cpq fee6de6a7f Allow NULL head in struct mg_rpc 2022-08-19 15:08:01 +01:00
Sergey Lyubka 2bf25a1406 Merge pull request #1678 from cesanta/esp8266
Improved Makefile to be able to flash
2022-08-18 22:30:20 +01:00
Sergio R. Caprile dd59296be9 Improved Makefile to be able to flash
subtle mod in main.c comment
2022-08-18 17:41:05 -03:00
cpq b382726ed0 Build dashboard by default, fix FPU flag 2022-08-18 21:36:36 +01:00
Sergey Lyubka 01390fe540 Merge pull request #1675 from cesanta/stm32h743
Change README to point to new tutorial location
2022-08-17 08:30:41 +01:00
cpq 8596e1bef7 Enable FPU 2022-08-16 16:45:05 +01:00
Sergey Lyubka 13fffbc5b6 Merge pull request #1674 from cesanta/webui-preact
back to symbolic link
2022-08-16 11:56:08 +01:00
Sergey Lyubka 5f4857ddae Merge pull request #1673 from cesanta/docs
Change argument of %M handler to mg_pfn_t plus some cosmetic changes
2022-08-16 11:55:51 +01:00
Sergey Lyubka 5f36b41785 Merge pull request #1672 from cesanta/webui-push-rest
Change argument of %M handler to mg_pfn_t as in huge_response
2022-08-16 11:55:33 +01:00
Sergio R. Caprile bd8f0c90e1 back to symbolic link 2022-08-15 18:42:20 -03:00
Sergio R. Caprile f49683353d Change argument of %M handler to mg_pfn_t plus some cosmetic changes 2022-08-15 16:07:18 -03:00
Sergio R. Caprile 4f012d6bc6 Change argument of %M handler to mg_pfn_t as in huge_response 2022-08-15 16:04:17 -03:00
cpq e48e353066 Restore mg_file_write() to use tmp file 2022-08-15 16:08:34 +01:00
cpq 6ad7af54dc Fix docs, nits to freertos includes 2022-08-14 23:46:33 +01:00
cpq 6b69bef2ef mg_dtoa, mg_atod, mg_lld made static 2022-08-14 01:25:38 +01:00
cpq d2a27d3d91 mg_*rprintf -> mg_*xprintf 2022-08-13 20:34:20 +01:00
cpq 189aa80743 Update examples to NOT use mg_*mprintf 2022-08-13 20:09:51 +01:00
cpq f122bd5797 Update mg_log_set_fn() 2022-08-13 15:43:27 +01:00
cpq d76f86f7db Get rid of mg_*asprintf 2022-08-13 15:37:55 +01:00
cpq ccf5364187 Squash C++ warn 2022-08-13 14:57:15 +01:00
cpq a3bfe3e61a Use hand-crafted packet for large WS frame test 2022-08-13 14:52:43 +01:00
cpq de10e340b6 Update examples to use mg_http_reply 2022-08-13 14:52:10 +01:00
cpq 40ca26f23b Refactor mg_ws_connect() 2022-08-13 14:44:08 +01:00
cpq da28213613 Squash warning 2022-08-13 11:36:24 +01:00
cpq 6615a821f1 Test WS frames that are larger than 64k 2022-08-13 11:16:13 +01:00
Sergio R. Caprile d627d669bc Change README to point to new tutorial location 2022-08-12 17:08:18 -03:00
cpq ef6fbad0cb Better CFLAGS for SSL when building examples 2022-08-11 12:12:00 +01:00
cpq ef9f7d4c16 Change mg_ws_send: const char * -> const void * 2022-08-11 12:12:00 +01:00
Sergey Lyubka 44a0fa0986 Merge pull request #1670 from cesanta/index.gx-test
Add unit test for gzipped index when / is requested
2022-08-10 23:46:08 +01:00
Sergio R. Caprile 4d9338323a Add unit test for gzipped index when / is requested 2022-08-10 19:06:04 -03:00
Sergey Lyubka 1a6bfb65e6 Merge pull request #1669 from cesanta/embedded-filesystem
Add Embedded Filesystem example
2022-08-10 21:45:23 +01:00
Sergey Lyubka 3b112cc8c8 Merge pull request #1668 from cesanta/index.gz
check for gzipped index file when / is requested
2022-08-10 21:45:09 +01:00
Sergio R. Caprile 014a008c3a Add Embedded Filesystem example 2022-08-10 16:05:34 -03:00
Sergio R. Caprile 374be7b065 check for gzipped index file when / is requested 2022-08-10 15:54:24 -03:00
cpq 2ba3630de9 Remove dangerous mg_pfn_realloc(). Add %q printf specifier 2022-08-10 18:27:58 +01:00
cpq 24cb9467c0 Update docs for mg_rpc_process() 2022-08-10 15:35:07 +01:00
cpq 79c49e64e8 vc2017 -> vc17 2022-08-09 19:22:47 +01:00
cpq c8c0b8fb91 Squash vc98 warn 3 2022-08-09 19:17:40 +01:00
cpq e5585cb0e7 Squash vc98 warn 2 2022-08-09 18:58:58 +01:00
cpq bd32f6e2ef Squash warn on vc98 2022-08-09 15:49:54 +01:00
cpq 08f8ea0cd9 vc2017 -> vc17 2022-08-09 15:38:25 +01:00
cpq 2d48b28b0a Set dockerrun 2022-08-09 13:10:21 +01:00
cpq 9cfaee9b21 Multi-platform docker build 2022-08-09 13:02:50 +01:00
cpq 9393e271de Set dockercmd 2022-08-09 12:47:27 +01:00
cpq 948595fb3b Do not assert on SNTP and local clock diff, since local clock could be off 2022-08-09 12:45:10 +01:00
cpq 6149b619e7 Squash warnings 2022-08-09 12:39:40 +01:00
cpq b7406357c5 Fix #1600 - more precise SNTP time calculation 2022-08-09 12:13:23 +01:00
Sergey Lyubka 2279a51d52 Merge pull request #1666 from cesanta/tcp
Added TLS support
2022-08-08 20:57:11 +01:00
cpq 4d3d0995c9 Use only time.windows.com in SNTP test 2022-08-08 20:56:10 +01:00
Sergio R. Caprile 0ca752662d Added TLS support 2022-08-08 15:42:35 -03:00
cpq 4246f5d206 PATH_MAX -> MG_PATH_MAX 2022-08-06 22:26:07 +01:00
cpq e8289ec17d Fix #1648 - set MG_PATH_MAX to FILENAME_MAX on windows and unix 2022-08-06 22:19:55 +01:00
cpq cde441bca6 Remove tcpdump on port 123 2022-08-06 20:30:12 +01:00
cpq 740b609e1e Fix for deliver_normal_chunks() and a test case 2022-08-06 09:01:34 +01:00
cpq c459c17fab Update docs 2022-08-05 19:55:15 +01:00
cpq 11bbda9bb3 Update images 2022-08-05 19:44:55 +01:00
cpq 6a5c523948 Merge branch 'master' of github.com:cesanta/mongoose 2022-08-05 19:28:04 +01:00
cpq 99c23606c5 Add c->is_resp note 2022-08-05 19:27:56 +01:00
Sergey Lyubka 608b1ee156 Merge pull request #1665 from cesanta/esp32-device-dashboard
Changed README to point to new tutorial location
2022-08-05 19:20:35 +01:00
Sergey Lyubka 12ab5c9964 Merge pull request #1664 from gvanem/patch-1
Fix empty initializer
2022-08-05 19:19:55 +01:00
cpq 779c825e92 Fixes to chunked support when pipelining 2022-08-05 19:18:06 +01:00
Gisle Vanem 96df718304 Fix empty initializer
MSVC does not like such empty initializer:
  xamples/device-dashboard/net.c(116): error C2059: syntax error: '}'
2022-08-05 13:50:55 +02:00
Sergey Lyubka 4bee440a56 Merge pull request #1663 from cesanta/doc-rpc
Add pfn functions and RPC docs
2022-08-04 21:56:24 +01:00
Sergio R. Caprile bb4e4c7cda Add pfn functions docs
Add RPC docs
2022-08-04 17:20:00 -03:00
cpq 582ab220b3 Update mqtt docs 2022-08-04 18:50:20 +01:00
cpq 3e2ad83b2c Fix #1647 - add note in the doc that opts->root_dir is ignored by the mg_http_serve_file() 2022-08-04 17:47:48 +01:00
Sergey Lyubka ae29a1734c Merge pull request #1660 from cesanta/device-dashboard
device-dashboard: default to using packed fs, otherwise hw examples won't work
2022-08-04 17:13:03 +01:00
cpq 457ce5e563 Refactor chunking support. Fix #1656 2022-08-04 17:10:53 +01:00
Sergey Lyubka 154bdb08a9 Merge pull request #1659 from cesanta/scaprile-patch-1
Update README.md
2022-08-04 11:26:33 +01:00
Sergio R. Caprile 22b2dc9ea8 Update README.md 2022-08-03 14:38:12 -03:00
Sergey Lyubka 3ede1a4a5a Merge pull request #1658 from cesanta/ut-pause
Add unit test to check on server pausing between headers and data fir…
2022-08-03 16:20:14 +01:00
Sergio R. Caprile 9e3138b892 Add unit test to check on server pausing between headers and data firing a zero length MG_EV_HTTP_CHUNK 2022-08-03 12:09:24 -03:00
Sergey Lyubka 51cb40acd2 Enable epoll on linux 2022-08-03 15:07:26 +01:00
Sergey Lyubka 4702073458 Merge pull request #1655 from cesanta/esp32-uart-bridge
Fix for new mg_iobuf API
2022-08-03 08:40:04 +01:00
Sergio R. Caprile e01cffff46 Changed README to point to new tutorial location
Expanded Makefile to be able to flash with Docker and esputil
2022-08-02 16:10:34 -03:00
Sergio R. Caprile d88e438679 default to using packed fs, otherwise hw examples won't work 2022-08-02 16:06:19 -03:00
Sergio R. Caprile 70683fc8e7 Fix for new mg_iobuf API 2022-08-02 14:46:27 -03:00
Sergey Lyubka bd7ee0d1e8 Refactor mg_http_reply and mg_http_printf_chunk to use less allocs and mem copies 2022-08-01 21:07:42 +01:00
Sergey Lyubka 17e2fdd4cb Add align to struct mg_iobuf 2022-08-01 12:53:25 +01:00
Sergey Lyubka a468f58128 Use int debug level 2022-08-01 11:19:32 +01:00
Sergey Lyubka 581a0698af Expose rpc guts 2022-07-31 22:51:59 +01:00
Sergey Lyubka f02f88f336 mg_rpc_free -> mg_rpc_del 2022-07-30 21:13:30 +01:00
Sergey Lyubka 43d53b0616 Merge pull request #1650 from cesanta/esp32-uart
Fix Makefile
2022-07-30 07:57:37 +01:00
Sergey Lyubka 54d6bad5e5 Refactor JSON and RPC API 2022-07-30 07:55:26 +01:00
Sergio R. Caprile c37d4f768b Fix Makefile 2022-07-29 18:27:20 -03:00
Sergey Lyubka a4b003b7ac Merge pull request #1644 from cesanta/esp32_uart-bridge
Fix Makefile
2022-07-28 21:04:27 +01:00
Sergey Lyubka 433120ab22 Merge pull request #1637 from cesanta/webui-push-rest
Add data push using REST example
2022-07-28 20:54:20 +01:00
Sergio R. Caprile 109da5f515 Add data push using REST example 2022-07-28 10:20:22 -03:00
Sergey Lyubka 56e6cf406a Fix unamalgamated build 2022-07-28 10:47:12 +01:00
Sergey Lyubka a2289a0625 Fix unamalgamated build 2022-07-28 10:33:44 +01:00
Sergey Lyubka 02943a1082 Merge pull request #1649 from cesanta/tcp
Added plain TCP server and client example
2022-07-28 10:27:10 +01:00
Sergey Lyubka 64a36496e3 Merge pull request #1643 from cesanta/uart-bridge
Fixes to uart-bridge example
2022-07-28 10:26:51 +01:00
Sergey Lyubka f2009ebd62 Move mg_*printf* decls in fmt.h 2022-07-28 10:18:17 +01:00
Sergio R. Caprile 638892ca70 Fix incorrect oninput function call
Check a new config element is present before acting on the previous one

Correctly update config local copy

Fix TCP buffering for ever
2022-07-27 17:19:34 -03:00
Sergio R. Caprile 90fdbd36ec Added plain TCP server and client example 2022-07-27 13:40:02 -03:00
Sergey Lyubka 0dabc45780 Add RPC API 2022-07-27 00:46:05 +01:00
Sergio R. Caprile 0ffec91984 Fix Makefile 2022-07-25 11:27:19 -03:00
Sergey Lyubka 9cacf443e1 Merge pull request #1636 from cesanta/webui-push-ws
Added data push over WS example
2022-07-25 11:03:06 +01:00
Sergey Lyubka 3f21be4fb0 Merge pull request #1639 from cesanta/docs
Add mg_ws_printf()/vprintf() doc
2022-07-25 10:54:06 +01:00
Sergey Lyubka 7587f8212e Merge pull request #1642 from cesanta/fix-json
Fix json's MG_EOO in nested objects
2022-07-25 10:53:30 +01:00
Sergio R. Caprile 1eed80375d Fix MG_EOO 2022-07-22 11:50:23 -03:00
Sergio R. Caprile 806eed6040 Add mg_ws_printf()/vprintf() doc 2022-07-21 11:46:50 -03:00
Sergey Lyubka d1828ecdb4 Merge pull request #1634 from cesanta/webui-plain
Fix former config value not being freed
2022-07-18 21:24:07 +01:00
Sergey Lyubka 5cddb8ecda Merge pull request #1633 from cesanta/webui-login
Added web UI login example
2022-07-18 21:23:41 +01:00
Sergio R. Caprile 1651d9d6d9 Fix former config value not being freed 2022-07-18 16:21:02 -03:00
Sergio R. Caprile 40fc049cdc Added web UI login example 2022-07-18 14:12:42 -03:00
Sergey Lyubka 89afe62121 Merge pull request #1627 from cesanta/webui-rest
added webUI REST basics example
2022-07-17 18:09:02 +01:00
Sergey Lyubka e5b40ee29e Merge pull request #1630 from cesanta/webui-plain
added webUI plain JS example
2022-07-17 18:08:45 +01:00
Sergey Lyubka 4a3d760c06 Add timer ID attribute, for safe cleanup in the scripted environment 2022-07-17 12:52:30 +01:00
Sergio R. Caprile aa326f975d Added data push over WS example 2022-07-15 21:32:41 -03:00
Sergey Lyubka 1fbf534f9a Merge pull request #1631 from cesanta/webui-preact-example
added webUI Preact-based example
2022-07-15 09:15:43 +01:00
Sergey Lyubka 86aa38bfd5 Merge pull request #1629 from jbrzusto/fix-mg_ntp_parse
NTP reponse gives fractional (not micro-) seconds, per RFC5905
2022-07-15 00:43:31 +01:00
Sergio R. Caprile ca929031ee added webUI Preact-based example 2022-07-13 14:41:38 -03:00
Sergio R. Caprile f80477a093 added webUI plain JS example 2022-07-13 11:07:01 -03:00
Sergio R. Caprile abd7698d6d added webUI REST basics example 2022-07-13 10:45:49 -03:00
John Brzustowski d5fe3261f4 NTP reponse gives fractional (not micro-) seconds, per RFC5905 2022-07-13 04:08:54 -03:00
Sergey Lyubka 3f46ae7beb Make generated packed_fs.c independent 2022-07-12 15:09:33 +01:00
Sergey Lyubka 46af09f776 Change ff_open to explicit memcpy() 2022-07-11 18:13:46 +01:00
Sergey Lyubka f40b272eeb Fix #1626 - ignore @ in query string 2022-07-10 15:41:43 +01:00
Sergey Lyubka 9876e3afd7 Merge pull request #1622 from cesanta/percentM
added mg_rprintf(), updated doc to new %M API
2022-07-10 11:15:52 +01:00
Sergio R. Caprile 41df6a6c0b added mg_rprintf(), updated doc to new %M API 2022-07-07 14:15:55 -03:00
Sergey Lyubka dbd25daff8 Merge pull request #1621 from cesanta/percentM
Update (fix) to new %M API
2022-07-07 14:44:54 +01:00
Sergio R. Caprile 71eefb6272 Update to new %M API
Doc still references the old API and mg_rprintf() is not yet documented
2022-07-06 19:01:18 -03:00
Sergey Lyubka a4a340dbd4 Merge branch 'master' of github.com:cesanta/mongoose 2022-07-04 19:18:27 +01:00
Sergey Lyubka 2c01893bb1 Give more time for unit test to detect conn refused on windows 2022-07-04 19:18:20 +01:00
Sergey Lyubka c4e496b001 Merge pull request #1618 from cesanta/mqtt
updated docs and example to recently exported MQTT result codes
2022-07-04 19:07:28 +01:00
Sergio R. Caprile 16e90c3082 updated docs and example to recently exported MQTT result codes 2022-07-04 14:32:12 -03:00
Sergey Lyubka 543b4a132b Fix POLLERR usage 2022-07-04 18:25:13 +01:00
Sergey Lyubka e4a5296fbf Introduce c->is_mqtt5 for keeping mqtt version. Make mqtt over ws work again 2022-07-04 17:47:17 +01:00
Sergey Lyubka 6c796b8552 Fix memset in mg_iotest, add mg_random_str test 2022-07-04 16:13:38 +01:00
Sergey Lyubka e30ad43d36 Merge pull request #1612 from cesanta/mqtt
Exported MQTT result codes
2022-07-04 15:15:19 +01:00
Sergey Lyubka f841b85d7d Merge pull request #1614 from cesanta/udp-ssdp-search
Added parsing of remote responses
2022-07-04 15:14:39 +01:00
Sergey Lyubka 735b7bece6 Squash more warns 2022-07-04 11:43:52 +01:00
Sergey Lyubka 4c9fdaf8b0 Merge pull request #1617 from jameshilliard/osx-clock
util: use correct clock on OSX
2022-07-04 11:12:58 +01:00
Sergey Lyubka 2ccc4acf34 Squash warns for rp2040 builds 2022-07-04 11:10:08 +01:00
James Hilliard c24343f107 util: use correct clock on OSX
CLOCK_MONOTONIC_RAW on OSX is not the same as CLOCK_MONOTONIC_RAW on linux
2022-07-04 04:04:43 -06:00
Sergey Lyubka 81ffcd8ee9 Fix #1616 - randomize mqtt will and client id for parallel test 2022-07-04 11:00:06 +01:00
Sergey Lyubka 432452ea9a Fix #1615 - prefer monotonic clock. Add clock for rp2040 2022-07-04 10:08:21 +01:00
Sergey Lyubka 6c14c7d623 Unbreak mac build 2022-07-04 00:06:01 +01:00
Sergey Lyubka 30126072dc Add MG_ARCH_RP2040 2022-07-03 23:00:15 +01:00
Sergio R. Caprile f7812c9b0a Added parsing of remote responses 2022-07-02 13:16:49 -03:00
Sergey Lyubka dca43f430b Fix poll support for win32 2022-07-02 12:45:44 +01:00
Sergey Lyubka 0947ce9234 Merge branch 'master' of github.com:cesanta/mongoose 2022-07-02 11:57:09 +01:00
Sergey Lyubka 91fa2ad23b Enable poll support on windows 2022-07-02 11:52:16 +01:00
Sergey Lyubka 1b57c56fdc Merge pull request #1613 from cesanta/typo
fix typo
2022-07-02 11:15:43 +01:00
Sergio R. Caprile d13509e302 Update app.js 2022-07-01 15:58:03 -03:00
Sergio R. Caprile 85d300ce71 Exported MQTT result codes 2022-07-01 15:32:24 -03:00
Sergey Lyubka d6e1a3ab4c Unbreak my heart ^W the build 2022-07-01 18:10:40 +01:00
Sergey Lyubka f1da8542ce Nits 2022-07-01 17:28:06 +01:00
Sergey Lyubka a183621268 Fix ff_write() call 2022-07-01 13:22:36 +01:00
Sergey Lyubka 035de980e3 Fix ff_read() call 2022-07-01 13:18:49 +01:00
Sergey Lyubka 99f0688377 Change mg_http_upload API 2022-06-30 21:54:50 +01:00
Sergey Lyubka 56412193e7 Add mg_remove_double_dots(), hide mg_http_upload() 2022-06-30 20:27:43 +01:00
Sergey Lyubka c5751b0bd3 Add mg_json_get_long 2022-06-30 20:03:29 +01:00
Sergey Lyubka 86e57d243d Enhance esp32 makefile 2022-06-30 19:59:23 +01:00
Sergey Lyubka 7fc57a3be7 Merge pull request #1610 from cesanta/http-restful-server
updated SSL build options
2022-06-30 12:27:25 +01:00
Sergio R. Caprile 75069a44c7 updated SSL build options 2022-06-29 17:31:31 -03:00
Sergey Lyubka 2536865c4d Fix freertos-tcp build 2022-06-29 19:39:36 +01:00
Sergey Lyubka d266f822ca Merge branch 'master' of github.com:cesanta/mongoose 2022-06-29 19:19:28 +01:00
Sergey Lyubka 5b8979a0f1 Better connect() result test 2022-06-29 19:19:19 +01:00
Sergey Lyubka 3bc79b9dfd Merge pull request #1609 from cesanta/mqtt-over-ws-client
Added openSSL support
2022-06-29 19:18:25 +01:00
Sergio R. Caprile 0ae75e6db6 Added openSSL support 2022-06-29 14:57:11 -03:00
Sergey Lyubka 89e2a15eb7 Fix build 2022-06-29 18:03:04 +01:00
Sergey Lyubka b1896d9944 Fix typo 2022-06-29 17:57:59 +01:00
Sergey Lyubka d0dedcfd2e Fix build 2022-06-29 17:54:33 +01:00
Sergey Lyubka 73297c8e65 Use mg_putchar_iobuf in mg_vprintf 2022-06-29 17:42:55 +01:00
Sergey Lyubka 017c7290d6 Better error handling - report from iotest 2022-06-29 17:02:37 +01:00
Sergey Lyubka 6a8b5b06d0 Merge pull request #1608 from cesanta/fix_mqtt-over-ws-client
fix incorrect WS packet payload
2022-06-29 14:51:39 +01:00
Sergey Lyubka 93a6bc501e Refactor guess_mime_type() 2022-06-29 10:28:37 +01:00
Sergey Lyubka e8f050c194 Dont use realloc 2022-06-29 00:00:16 +01:00
Sergio R. Caprile 712517b6fa fix incorrect WS packet payload 2022-06-28 16:27:49 -03:00
Sergey Lyubka 434378eda5 Merge pull request #1602 from cesanta/device-dashboard
fixed watch() not being called after login
2022-06-28 20:24:36 +01:00
Sergey Lyubka cf38fdb720 Merge pull request #1606 from cesanta/mqtt-client
fixed TLS build comment
2022-06-28 20:23:45 +01:00
Sergey Lyubka 95d30cf482 Merge pull request #1607 from cesanta/http-client
fixed TLS build comment
2022-06-28 20:20:35 +01:00
Sergio R. Caprile 6542c02b7f fixed TLS build comment 2022-06-28 10:56:56 -03:00
Sergio R. Caprile a13144932a fixed TLS build comment 2022-06-28 10:49:45 -03:00
Sergio R. Caprile 6597830631 fixed watch() not being called after login 2022-06-28 10:26:32 -03:00
Sergey Lyubka ba08140197 Initial mqtt5 support 2022-06-28 11:31:13 +01:00
Sergey Lyubka d65ce3b596 Add mg_rprintf, mg_vrprintf 2022-06-28 00:45:52 +01:00
Sergey Lyubka 4864a6e618 Use SSL_set1_host() 2022-06-28 00:45:47 +01:00
Sergey Lyubka 2bbb2bb1db Merge branch 'master' of github.com:cesanta/mongoose 2022-06-24 14:27:29 +01:00
Sergey Lyubka 47ce004f61 docs nits 2022-06-24 14:24:14 +01:00
Sergey Lyubka 507e392509 Merge pull request #1601 from cesanta/device-dashboard
updated and cleaned up texts
2022-06-24 14:09:36 +01:00
Sergio R. Caprile dcfb014d1f updated and cleaned up texts 2022-06-23 15:33:31 -03:00
Sergey Lyubka 4e880fb6e0 Nit - fix openssl error message 2022-06-23 13:11:04 +01:00
Sergey Lyubka 898e2b1e30 Add mg_json_get_hex(), mg_json_get_b64() 2022-06-22 16:28:22 +01:00
Sergey Lyubka a68f3dc4eb Add %V and %H specifiers for mg_snrpintf() 2022-06-22 13:15:52 +01:00
Sergey Lyubka c446fe0c6d Make stm32 eth declared as volatile 2022-06-21 12:11:59 +01:00
Sergey Lyubka 4246e6c768 Fix #1599 2022-06-21 12:07:00 +01:00
Sergey Lyubka 4f9cfdf65d Merge pull request #1598 from cesanta/http-reverse-proxy
Added openSSL support
2022-06-20 22:00:14 +01:00
Sergey Lyubka b1cd233dda Merge pull request #1597 from cesanta/http-proxy-client
Added openSSL support
2022-06-20 21:59:48 +01:00
Sergey Lyubka 4f63b6093f Merge pull request #1595 from cesanta/http-client
fixed comment, updated TLS section in makefile
2022-06-20 21:59:24 +01:00
Sergio R. Caprile 380a50e39b Added openSSL support
Fixed missing parameter in makefile
Added URI handling
2022-06-20 15:27:46 -03:00
Sergio R. Caprile 3bd3a4ff7b fixed comment, updated TLS section in makefile 2022-06-20 14:50:45 -03:00
Sergey Lyubka 46bf79455c Add examples/esp32/uart-bridge 2022-06-19 18:27:37 +01:00
Sergey Lyubka 2d5c26d44f Rename mg_log_set_fn properly 2022-06-19 09:08:37 +01:00
Sergey Lyubka 9760b7c9d6 Add mg_log_set_fn(), MG_ENABLE_LOG 2022-06-19 09:04:22 +01:00
Sergey Lyubka 0b5a00c99a Change uart_read signature 2022-06-18 20:41:04 +01:00
Sergey Lyubka ba8482c707 Update uart bridge 2022-06-18 11:32:31 +01:00
Sergey Lyubka 1b34360b05 Update uart bridge 2022-06-18 11:30:44 +01:00
Sergey Lyubka c84dab21e4 Refactor UART example 2022-06-18 04:25:11 +01:00
Sergey Lyubka 1640287897 Add mg_http_var 2022-06-18 04:25:11 +01:00
Sergey Lyubka adcf5bab0e Merge pull request #1589 from cesanta/mqtt-client
Add support for openSSL
2022-06-17 22:04:38 +01:00
Sergey Lyubka e024700851 Merge pull request #1593 from cesanta/file-uploads
update file upload example set
2022-06-17 22:03:58 +01:00
Sergio R. Caprile f4fc33d111 brought back 7.5 file-upload as file-upload-multiple-posts; updated to latest API
renamed form-upload to file-upload-html-form
renamed file-upload to file-upload-single-post
2022-06-17 16:35:02 -03:00
Sergio R. Caprile fb446022e2 Added openSSL support
Backend host is https only if TLS is enabled
2022-06-16 11:59:06 -03:00
Sergio R. Caprile e021d7cd9d Add support for openSSL 2022-06-15 10:42:32 -03:00
Sergey Lyubka 3331ed2f49 Merge pull request #1591 from cesanta/jsondoc
fix JSON docs
2022-06-15 06:56:08 +01:00
Sergio R. Caprile 939a8ddc26 fix JSON docs 2022-06-14 14:19:25 -03:00
Sergey Lyubka 3774f676cf Less verbose unit test 2022-06-13 21:12:11 +01:00
Sergey Lyubka 7923509d1e More json docs 2022-06-13 15:04:52 +01:00
Sergey Lyubka 30d6a44b0d Fix mg_http_upload() 2022-06-13 14:48:52 +01:00
Sergey Lyubka 6d46ecaa6c Add mip-pcap example 2022-06-13 02:03:52 +01:00
Sergey Lyubka 5a448ab4f5 Compile driver_stm32.c only for __arm__ 2022-06-13 01:04:09 +01:00
Sergey Lyubka a71262437d Use mip for arm and riscv targets 2022-06-12 12:43:01 +01:00
Sergey Lyubka 52ab963845 Update images 2022-06-11 22:59:20 +01:00
Sergey Lyubka 67280724ba Remove pragma 2022-06-11 19:05:07 +01:00
Sergey Lyubka d8a4b5aa34 Make mip MSVC friendly 2022-06-11 18:54:32 +01:00
Sergey Lyubka fe0b2d0646 Fix typo 2022-06-11 17:40:48 +01:00
Sergey Lyubka d3368e4aad Move mip into mip/ 2022-06-11 17:29:45 +01:00
Sergey Lyubka 903b510411 Merge pull request #1587 from cesanta/timers
fixed poll timeout being larger than timer period
2022-06-10 22:57:44 +01:00
Sergio R. Caprile 0dbc99d9ee fixed poll timeout being larger than timer period 2022-06-10 16:59:14 -03:00
Sergio R. Caprile 505ca96547 fixed typo 2022-06-10 16:25:56 -03:00
Sergey Lyubka 89623d00f9 Update readme 2022-06-10 18:48:32 +01:00
Sergey Lyubka e47bcb3fb6 Merge pull request #1583 from cesanta/multi-threaded
Remove outdated comments
2022-06-10 15:21:32 +01:00
Sergey Lyubka 50d0d68f45 Docs nitpick 2022-06-10 15:00:34 +01:00
Sergio R. Caprile 2f75418c70 Remove outdated comments 2022-06-10 10:37:12 -03:00
Sergey Lyubka 013bc58371 Add json docs 2022-06-10 13:01:52 +01:00
Sergey Lyubka 55948cd431 Allow to set log level 2022-06-10 12:33:30 +01:00
Sergey Lyubka dfca896a64 Update huge response. More tests 2022-06-10 12:14:42 +01:00
Sergey Lyubka 8fc6f3f744 Remove mjson dependency 2022-06-10 09:40:22 +01:00
Sergey Lyubka f65058fa03 Remove mjson dependency
Signed-off-by: Sergey Lyubka <valenok@gmail.com>
2022-06-10 09:39:53 +01:00
Sergey Lyubka 33567bab41 Add %g support to mg_snprintf() 2022-06-10 09:38:36 +01:00
Sergey Lyubka 106662b1d7 Add JSON API 2022-06-09 17:17:33 +01:00
Sergey Lyubka b73115c002 Unbreak build 2022-06-08 22:09:11 +01:00
Sergey Lyubka cff208c5a9 Introduce %Q format specifier, rework device dashboard 2022-06-08 21:44:01 +01:00
Sergey Lyubka a83dd9569d Unbreak esp32 example 2022-06-08 20:04:35 +01:00
Sergey Lyubka 807cd4df9e Make sock.c less verbose 2022-06-08 19:55:24 +01:00
Sergey Lyubka ac3151f871 Make dashboard more robust 2022-06-08 19:53:29 +01:00
Sergey Lyubka d4106b5cbd Send puback for qos > 0 2022-06-08 19:51:03 +01:00
Sergey Lyubka bcb6c2675f Unbreak esp32 device dashboard build 2022-06-08 13:54:20 +01:00
Sergey Lyubka 6b51666248 Move esp32 example 2022-06-08 13:24:41 +01:00
Sergey Lyubka 628a007112 Refresh packed filesystems 2022-06-08 13:22:09 +01:00
Sergey Lyubka ee65342545 docs 2022-06-08 11:30:54 +01:00
Sergey Lyubka 94ea973fb5 Update docs 2022-06-08 11:01:30 +01:00
Sergey Lyubka 9f8424e93f Update readme 2022-06-08 09:06:14 +01:00
Sergey Lyubka 2e750236be Add uart-bridge example 2022-06-08 08:58:32 +01:00
Sergey Lyubka c701315ab5 Merge pull request #1581 from behnejad/patch-1
fixing offset of Content-Length value.
2022-06-07 08:35:24 +01:00
Sergey Lyubka a53dc5c0a0 Fix #1580 - uri_to_path2 for / corner case 2022-06-07 04:33:46 +01:00
Behnejad 895ca80b2b fixing offset of Content-Length value.
in very large HTTP response, this offset might cause a problem with HTTP header format.
2022-06-07 08:00:12 +04:30
Sergey Lyubka 1dcb7dd13d Update mingw target 2022-06-07 00:25:15 +01:00
Sergey Lyubka e75afcba42 Update dash UI 2022-06-05 17:17:19 +01:00
Sergey Lyubka 0f0cf7a5db Integrate #1579 - properly clear c->is_readable and c->is_writable flags in mg_iotest() 2022-06-05 15:27:16 +01:00
Sergey Lyubka 31c7d66245 Rework dashboard 2022-06-05 14:59:59 +01:00
Sergey Lyubka cac7f653c9 Add mg_ws_printf() 2022-06-05 14:59:50 +01:00
Sergey Lyubka 219428c249 Change device dashboard to use MQTT 2022-06-04 22:21:59 +01:00
Sergey Lyubka f4fa1e097d docs 2022-06-04 08:45:34 +01:00
Sergey Lyubka 35b517b434 docs 2022-06-04 08:29:03 +01:00
Sergey Lyubka b3f956ba63 docs 2022-06-04 08:23:25 +01:00
Sergio R. Caprile 3ae8b3f8a7 Merge pull request #1577 from cesanta/sntp
Add sntp-time-sync example
2022-06-03 10:38:25 -03:00
Sergey Lyubka c48349ba56 Add sntp-time-sync example 2022-06-03 13:57:57 +01:00
Sergey Lyubka 0763146254 Fix #1476 - introduce c->is_full to cap the recv buf len for streaming connections 2022-06-03 11:37:35 +01:00
Sergio R. Caprile 7da5d42009 Merge pull request #1573 from cesanta/timers
Minor cosmetic changes
2022-06-02 10:06:41 -03:00
Sergey Lyubka 5ac847076a Change long read_conn -> void read_conn 2022-06-02 14:02:09 +01:00
Sergey Lyubka a88ea776a9 Change MG_MAX_RECV_BUF_SIZE -> MG_MAX_RECV_SIZE 2022-06-02 13:50:44 +01:00
Sergey Lyubka 73a5ff1fb6 Use only TFLAGS, get rid of EXTRA 2022-06-02 12:02:41 +01:00
Sergey Lyubka 7e8901c99f Docs - amend images 2022-06-02 12:02:26 +01:00
Sergey Lyubka 45816ef5db Add missing test file 2022-06-02 06:18:43 +01:00
Sergey Lyubka fe682f8399 Fix #1560 - implement precompressed .gz file serving 2022-06-02 06:13:37 +01:00
Sergey Lyubka 9ffb6fb26a Merge pull request #1570 from behnejad/patch-2
Update README.md
2022-06-01 21:17:52 +01:00
Sergey Lyubka 063244e4ca Minor cosmetic changes 2022-06-01 21:15:31 +01:00
Sergey Lyubka d7b7a0a577 Merge pull request #1572 from cesanta/timers
Modify times example
2022-06-01 17:22:24 +01:00
Sergey Lyubka f735585239 Update timers example 2022-06-01 17:09:15 +01:00
Sergey Lyubka 30349ec217 Update timers example 2022-06-01 17:09:13 +01:00
Sergey Lyubka 55517d48ed Change linux target 2022-06-01 16:25:04 +01:00
Behnejad 0f93ab84e9 Update README.md
after sending buffer to socket, MG_EV_WRITE will generated.
2022-06-01 14:36:17 +04:30
Sergey Lyubka 4dd1891594 Add mg_http_serve_opts.page404 2022-05-31 23:44:03 +01:00
Sergey Lyubka 27e1472d88 Merge pull request #1568 from behnejad/master
adding new api to enable separation of query string with '&'.
2022-05-31 18:25:12 +01:00
Sergey Lyubka a3d63c095a Handle #1562 - add udp/tcp extra param to mg_mkpipe() 2022-05-31 18:23:32 +01:00
Sergey Lyubka dc486a2aa3 Add pics 2022-05-31 12:01:06 +01:00
Sergey Lyubka 9963bdee09 Docs images 2022-05-31 11:38:03 +01:00
Hooman Behnejad 499401d457 adding mg_split function 2022-05-31 14:11:14 +04:30
Sergey Lyubka e2fcf5f92c Fix #1565 - mg_snprintf %.*s with zero len printing 2022-05-30 18:40:44 +01:00
Sergey Lyubka b8bba7513a Fix #1566 - proper error cleanup in mg_listen 2022-05-30 17:56:50 +01:00
Sergey Lyubka 65957527cb Fix #1558 - add opts.extra_headers in 304 responses 2022-05-30 17:44:26 +01:00
Sergey Lyubka e2ce68e3ef Fix build: delete -> del 2022-05-30 16:20:14 +01:00
Sergey Lyubka 44cf02e5ba Fix #1545 - do not send MG_EV_HTTP_MSG if chunks were deleted 2022-05-30 16:02:59 +01:00
Sergey Lyubka a4a70270ee Merge pull request #1564 from behnejad/patch-1
Update README.md
2022-05-30 14:32:17 +01:00
Behnejad 82e1cac1c7 Update README.md
added missing parameter in sample code of `mg_match`.
2022-05-29 18:22:56 +04:30
Sergey Lyubka 21ffe8e3f3 docs 2022-05-29 12:59:33 +01:00
Sergey Lyubka 45f20d5089 Update http_message diagram 2022-05-29 12:03:54 +01:00
Sergey Lyubka cea12a35b7 Merge pull request #1563 from vkoskiv/fix-docs
Small fix to mg_timer_add() documentation
2022-05-28 18:28:27 +01:00
Sergey Lyubka 686320a805 Remove verbose log in mg_iotest() 2022-05-27 23:18:23 +01:00
Sergey Lyubka 14ad51d2d2 More SNtp debug 12 2022-05-27 22:47:12 +01:00
Sergey Lyubka 28c15b3ff4 More SNtp debug 11 2022-05-27 22:36:34 +01:00
Sergey Lyubka f5af28c886 More SNtp debug 10 2022-05-27 22:26:17 +01:00
Sergey Lyubka 6b50039863 More SNtp debug 9 2022-05-27 22:24:45 +01:00
Sergey Lyubka 34c5f63c00 More SNtp debug 8 2022-05-27 22:18:14 +01:00
Sergey Lyubka 53bca4efab More SNtp debug 7 2022-05-27 22:08:05 +01:00
Sergey Lyubka 9029593691 More SNtp debug 6 2022-05-27 21:59:13 +01:00
Sergey Lyubka 4aad859e20 More SNtp debug 5 2022-05-27 21:44:03 +01:00
Sergey Lyubka b9d1d4a94f More SNtp debug 4 2022-05-27 20:48:19 +01:00
Sergey Lyubka be8b01e289 More SNtp debug 4 2022-05-27 20:43:30 +01:00
Sergey Lyubka 360dedd9b2 More SNtp debug 3 2022-05-27 20:39:37 +01:00
Sergey Lyubka e5d3d02307 More SNtp debug 2022-05-27 20:16:08 +01:00
Sergey Lyubka d3e14ca7e5 More SNTP debug 3 2022-05-27 20:05:14 +01:00
Sergey Lyubka 5998208449 More SNTP debug 2022-05-27 19:57:15 +01:00
Sergey Lyubka 4fc84621ae More SNTP debug 2022-05-27 19:55:39 +01:00
Valtteri Koskivuori 8253a84689 Small fix to mg_timer_add() documentation
The return value was not documented.
2022-05-26 23:43:56 +03:00
Sergey Lyubka 6b7f14c69d docs 2022-05-26 20:25:20 +01:00
Sergey Lyubka cfaca604f5 Debug SNTP issue 2 2022-05-26 17:50:56 +01:00
Sergey Lyubka 0226b9db31 Debug SNTP issue 2022-05-26 17:45:52 +01:00
Sergey Lyubka 7f8d12b9f7 Use time.windows.com too 2022-05-26 16:22:44 +01:00
Sergey Lyubka 2ae341cf5e Add nucleo-f746zg-baremetal 2022-05-26 13:53:36 +01:00
Sergey Lyubka 7850b550d8 Unbreak test 2022-05-26 11:18:36 +01:00
Sergey Lyubka 10596a8bdc Proper TLS handling for poll(). Make poll() default on linux 2022-05-26 08:55:28 +01:00
Sergey Lyubka 252e4715d4 Merge pull request #1561 from vkoskiv/add-poll
Add optional poll() implementation under MG_ENABLE_POLL define
2022-05-26 07:53:02 +01:00
Valtteri Koskivuori 420b989adb Add optional poll() implementation under MG_ENABLE_POLL
This adds the ability to substitute select() with poll() on supported
unix environments when MG_ENABLE_POLL is defined. A make flag called
USE_POLL is provided as well.
Using poll() removes the limitation of FD_SETSIZE concurrent sockets,
generally 1024 on Linux environments.
2022-05-26 06:00:27 +03:00
Sergey Lyubka bdb388c79d Fix pedantic warnings 2022-05-26 03:08:08 +01:00
Sergey Lyubka 87148f95f2 Clean up pedantic warnings 2022-05-26 02:50:15 +01:00
Sergey Lyubka fe124354cd Update custom build instructions 2022-05-26 02:10:28 +01:00
Sergey Lyubka 9a28fa71f0 Add -pedantic to gcc/clang CFLAGS 2022-05-26 02:10:07 +01:00
Sergey Lyubka 4139cdaf35 Remove poll() support 2022-05-26 02:07:37 +01:00
Sergey Lyubka ebe04620e1 Better custom build reference 2022-05-25 13:36:39 +01:00
Sergey Lyubka 7e053cd632 Typo fs docs 2022-05-25 13:29:49 +01:00
Sergey Lyubka 1fd65c77fe Enhance fs docs 2022-05-25 13:28:25 +01:00
Sergey Lyubka 2bfc838614 Fix build 2022-05-25 11:18:54 +01:00
Sergey Lyubka 69082db381 Regenerated packed fs 2022-05-25 11:15:00 +01:00
Sergey Lyubka 5ce2130f05 Minor formatting fix 2022-05-25 11:14:42 +01:00
Sergey Lyubka 5b448ec7a6 Integrate #1561 with some minor tweaks - add MG_ENABLE_POLL for poll() support 2022-05-25 11:14:12 +01:00
Sergey Lyubka f72b27d1c1 docs 2022-05-24 20:36:21 +01:00
Sergey Lyubka 9973c5f2b7 docs 2022-05-24 19:20:20 +01:00
Sergey Lyubka 88ee415dd1 docs 2022-05-24 19:19:42 +01:00
Sergey Lyubka 4f168cf346 docs 2022-05-24 19:18:42 +01:00
Sergey Lyubka ad7b5d2cd8 Change packed image 2022-05-24 19:14:20 +01:00
Sergey Lyubka 1e522de4a7 Change mg_iobuf image 2022-05-24 18:57:22 +01:00
Sergey Lyubka c2d2d085cd Add chart example 2022-05-23 15:27:19 +01:00
Sergey Lyubka b3a4c12d67 Handle #1559 - set no flags in send() call 2022-05-22 23:49:38 +01:00
Sergey Lyubka d5993ba27e Fix #1550 - excladdrinuse 2022-05-21 16:18:34 +01:00
Sergey Lyubka ef563603a9 Merge pull request #1557 from cesanta/pc
Remove mg_log_set_callback. Use MG_PUTCHAR macro instead
2022-05-20 10:16:57 +01:00
Sergey Lyubka 7e2ca72310 Remove mg_log_set_callback. Use MG_PUTCHAR macro instead 2022-05-20 09:45:17 +01:00
Sergey Lyubka 7c17c806ad 7.6 -> 7.7 2022-05-19 11:44:32 +01:00
Sergey Lyubka 8e0f529a00 Add MIP - an experimental TCP/IP stack 2022-05-18 21:19:21 +01:00
Sergey Lyubka 47e15a3d47 RTX nits 2022-05-17 19:29:53 +01:00
Sergey Lyubka cac7007069 Merge pull request #1554 from zudwalex/zephyr_ci
Use docker for Zephyr CI
2022-05-16 13:39:25 +01:00
Alex Alashkin ac55c900e7 Use docker for Zephyr CI 2022-05-16 15:30:25 +03:00
Sergey Lyubka 25806e48dc Fix ESP32 build 2022-05-16 11:54:26 +01:00
Sergey Lyubka 3871f4b6ab Fix #1546 - dont send excess for range requests 2022-05-16 11:45:08 +01:00
Sergey Lyubka 27c892806b Fix #1540 - case sensitive match in mg_is_chunked() 2022-05-16 11:19:45 +01:00
Sergey Lyubka 2b9f0480a1 Fix #1549 - fix typo in log format specifier 2022-05-15 21:02:41 +01:00
Sergey Lyubka 72cc433265 Make SNTP test more resilient 2022-05-15 19:41:37 +01:00
Sergey Lyubka 7721b074e6 Log ms in test_sntp() 2022-05-15 19:31:29 +01:00
Sergey Lyubka f5fd176b35 Increate SNTP timeout 3s->5s. Change mg_sntp_send() to mg_sntp_request(), remove one unnecessary parameter 2022-05-15 18:41:01 +01:00
Sergey Lyubka 6db1d7925e Merge pull request #1552 from zudwalex/ti_merged
Add TI support
2022-05-15 17:40:46 +01:00
Alex Alashkin 0ed7545947 Add TI support 2022-05-15 19:25:50 +03:00
Sergey Lyubka 95e22e8d4f Exporting only dashboard func 2022-05-15 14:40:58 +01:00
Sergey Lyubka cf7d1d8041 Address #1551 - better timers handling 2022-05-15 14:29:34 +01:00
Sergey Lyubka 443d0f0c6c Rename complete -> device-dashboard, remove multiple-logins and dashboard 2022-05-14 09:08:23 +01:00
Sergey Lyubka c20e48179f Un-break the test and untie serving code in dash example 2022-05-13 22:15:33 +01:00
Sergey Lyubka 3fbb7de712 Refactor dashboard example 2022-05-13 20:08:08 +01:00
Sergey Lyubka 0294603dfc MG_ARCH_RTX nits 2022-05-12 15:07:02 +01:00
Sergey Lyubka 5458252e4a Add missing src/arch_rtx.h 2022-05-12 08:23:17 +01:00
Sergey Lyubka 31ce219544 Add MG_ARCH_RTX 2022-05-12 08:07:51 +01:00
Sergey Lyubka 86cd567968 Nit - use quotes, not brackets for custom arch 2022-05-11 21:14:44 +01:00
Sergey Lyubka 5c66d32bc0 Refactor mg_open_listener() 2022-05-10 13:43:47 +01:00
Sergey Lyubka 5ac5c93c90 Refactor mg_open_listener() 2022-05-10 13:41:45 +01:00
Sergey Lyubka 84480f4072 Fix #1539 - proper timer cleanup 2022-05-10 07:38:03 +01:00
Sergey Lyubka b82953405d Fix valgrind test 2022-05-09 19:11:27 +01:00
Sergey Lyubka 5271626947 Disable SSI by default 2022-05-08 21:54:15 +01:00
Sergey Lyubka bc16854ccb Get rid of MG_ENABLE_LOG, change mg_hexdump() 2022-05-06 21:09:13 +01:00
Sergey Lyubka 6db0485c7b Set c->loc for accepted and UDP connections 2022-05-06 20:19:40 +01:00
Sergey Lyubka b5fc0d30a8 Add extraconnsize 2022-05-04 17:18:35 +01:00
Sergey Lyubka 38557aac7f Add MG_ARCH_NEWLIB 2022-05-01 13:47:33 +01:00
Sergey Lyubka d621fbfab1 Remove unused macros 2022-05-01 08:18:18 +01:00
Sergey Lyubka f19eec7fae Refactor multithreading API 2022-04-25 14:56:15 +01:00
Sergey Lyubka 8174842b05 docs 2022-04-24 11:39:54 +01:00
Sergey Lyubka ff07d261b2 docs 2022-04-24 11:37:23 +01:00
Sergey Lyubka c55db8a895 docs 2022-04-24 11:33:47 +01:00
Sergey Lyubka 70a9554b72 docs 2022-04-24 11:26:25 +01:00
Sergey Lyubka bdd7d92108 Fix #1533 - fix iotest error on windows 2022-04-22 20:53:54 +01:00
Sergey Lyubka a7cbc19755 Fix #1532 - improve ipv6 DNS lookup 2022-04-22 20:44:53 +01:00
Sergey Lyubka 93ff3e4d1f Add message sequence test 2022-04-21 03:13:31 +01:00
Sergey Lyubka 1dfc748e87 Add message sequence test 2022-04-21 02:50:50 +01:00
Sergey Lyubka e1f17a7ff1 Merge pull request #1531 from zudwalex/fix_tests
Fix zephyr tests
2022-04-20 11:38:00 +01:00
Alex Alashkin 56c40ff0fd Fix zephyr tests 2022-04-20 09:28:36 +03:00
Sergey Lyubka 9dd3b75165 Handle #1529 - do not mark normal conn termination as an error 2022-04-19 20:28:10 +01:00
Sergey Lyubka 20fc8f0279 Handle #1529: add automatic linkage against ws2_32.lib on _WIN32 targets 2022-04-19 18:51:28 +01:00
Sergey Lyubka 944704a12d Fix #1528: pack.c build on Win32 2022-04-19 18:46:29 +01:00
Sergey Lyubka fba9f14b2c Merge pull request #1526 from zudwalex/zephyr3
Add Zephyr build to Github actions
2022-04-19 09:03:30 +01:00
Alex Alaskin a7c24aeeee Add Zephyr build to Github actions 2022-04-13 19:54:08 +03:00
Sergey Lyubka 186eb998ba Adjust to timer API change, add root makefile 2022-04-13 14:03:00 +01:00
Sergey Lyubka d630ba743d Merge pull request #1524 from zudwalex/zephyr2
Add Zephyr examples
2022-04-13 11:17:22 +01:00
Sergey Lyubka e9fabdcc96 Handle #1523 - multiple WS messages 2022-04-13 11:14:57 +01:00
Sergey Lyubka 31698678fb Squash warning 2022-04-13 10:52:06 +01:00
Sergey Lyubka ebd2e89faa Handle #1522 - Fix TLS buffering 2022-04-13 10:48:17 +01:00
Alex Alashkin 17e0fb1c15 Add Zephyr examples 2022-04-13 11:10:22 +03:00
Sergey Lyubka 6e3e77a1a0 Enhance http-streaming-client 2022-04-12 19:06:37 +01:00
Sergey Lyubka ef44f90491 Fix #1520 - move state to struct mg_mgr 2022-04-12 14:14:55 +01:00
Sergey Lyubka 66376885e9 Fix #1521 - add mg_tou64() 2022-04-12 10:20:43 +01:00
Sergey Lyubka db941e2627 Fix #1519 - make opts structs in API calls const 2022-04-12 10:04:55 +01:00
Sergey Lyubka 5f78d34f4d Fix #1513 - fix mg_strdup() documentation 2022-04-12 09:57:25 +01:00
Sergey Lyubka 85281ae128 Fix #1514 - explicitely initialize io in mg_iobuf_init() 2022-04-12 09:54:05 +01:00
Sergey Lyubka e5d1b213c9 Merge pull request #1518 from jameshilliard/mqtt-suback
Ensure MQTT_CMD_SUBACK is received before calling mg_mqtt_pub in tests
2022-04-11 10:45:07 +01:00
James Hilliard e4ab9a4130 Ensure MQTT_CMD_SUBACK is received before calling mg_mqtt_pub in tests 2022-04-07 19:11:51 -06:00
Sergey Lyubka a1ec179229 Use uint64_t for uptime in millis, not int64_t 2022-04-07 13:50:25 +01:00
Sergey Lyubka 2f77855ec1 Handle #1502 - send CLOSE when CLOSE is received 2022-04-05 14:45:39 +01:00
Sergey Lyubka d11173fe90 Fix #1510 - wrap X509_VERIFY_PARAM_set1_host() usage inside a conditional 2022-04-05 13:09:17 +01:00
Sergey Lyubka fde8b82b78 Merge pull request #1507 from jameshilliard/mbedtls-reset
Handle MBEDTLS_ERR_NET_CONN_RESET errors
2022-04-05 13:06:06 +01:00
Sergey Lyubka b20eded30e Fix ESP32 example 2022-04-05 12:54:20 +01:00
James Hilliard 3ec17c41be Handle MBEDTLS_ERR_NET_CONN_RESET errors 2022-04-04 17:17:17 -06:00
Sergey Lyubka 0ed64707f3 Introduce MG_ENABLE_CUSTOM_MILLIS 2022-04-04 18:14:59 +01:00
Sergey Lyubka 417533e90c Merge pull request #1509 from jameshilliard/wakeup-conflict
Fix mg_mgr_wakeup conflicting types error
2022-04-04 09:16:34 +01:00
James Hilliard e268affb5a Fix mg_mgr_wakeup conflicting types error 2022-04-02 22:10:17 -06:00
Sergey Lyubka 4474ada291 Fix #1505: let mg_wakeup() return status 2022-04-03 00:17:31 +01:00
Sergey Lyubka a65c3288d8 Merge pull request #1508 from jameshilliard/mqtt-debug
Print mqtt buffer on error in tests
2022-04-03 00:11:25 +01:00
Sergey Lyubka affcef7e37 Fix clean targets 2022-04-03 00:04:58 +01:00
James Hilliard 173c2ba338 Print mqtt buffer on error in tests
This test seems to fail randomly a lot, print the buffer on error to
make it easier to isolate issues.
2022-04-02 15:26:15 -06:00
Sergey Lyubka b5fcf95b88 Enable mbedTLS 2022-04-01 21:33:09 +01:00
Sergey Lyubka d954851d43 Drop CRL from mbedTLS integration - let customer do a custom init if required 2022-04-01 16:42:41 +01:00
Sergey Lyubka df602c27d5 Disable SSI on Zephyr by default 2022-04-01 16:38:37 +01:00
Sergey Lyubka 3d9fa10485 Increase sock limit, fix multiple connections issue 2022-04-01 15:42:15 +01:00
Sergey Lyubka 6990040626 Set DNS error on UDP send error 2022-04-01 15:41:23 +01:00
Sergey Lyubka b42ea6cd3c Better logging 2022-04-01 15:41:03 +01:00
Sergey Lyubka 8c7fd8b330 Set default socket in mg_connect() to -1 2022-04-01 15:40:53 +01:00
Sergey Lyubka 4e0039625e Remove cruft 2022-03-31 18:07:15 +01:00
Sergey Lyubka 6c909f8935 Disable SNTP 2022-03-31 18:02:29 +01:00
Sergey Lyubka 4f5d385e52 Enable SNTP in zephyr example 2022-03-31 17:42:09 +01:00
Sergey Lyubka 84fe1d87b3 Enable DHCP 2022-03-31 17:26:58 +01:00
Sergey Lyubka bb0bc41f99 Add zephyr example skeleton 2022-03-31 16:58:27 +01:00
Sergey Lyubka 1c2d67ded7 Add missing arch_zephyr.h, add musl target 2022-03-30 09:06:00 +01:00
Sergey Lyubka 7372a05ce5 Add initial Zephyr support 2022-03-30 07:56:44 +01:00
Sergey Lyubka 642befa8d5 Remove unused mg_hmac_sha1() 2022-03-22 13:30:25 +00:00
Sergey Lyubka 3b5a9e2d4b Add tests for mg_ws_wrap() and messages > 128 bytes 2022-03-22 12:46:55 +00:00
Sergey Lyubka 6b3d9d9baf Add failed TLS host validation 2022-03-22 10:51:37 +00:00
Sergey Lyubka 436852d077 Enable TLS host validation in test_http_client() 2022-03-22 10:48:50 +00:00
Sergey Lyubka b78ced4fa9 Honor hostname validation for openssl 2022-03-22 08:50:37 +00:00
Sergey Lyubka 1bc81df00e Fix mg_dns_parse_name_depth() 2022-03-21 16:29:27 +00:00
Sergey Lyubka bf025537b6 Merge pull request #1495 from jameshilliard/optimize-valgrind
Run valgrind tests with appropriate compiler optimizations.
2022-03-21 15:18:58 +00:00
Sergey Lyubka ad4812218d Handle #1497 - handshake format 2022-03-21 15:17:09 +00:00
Sergey Lyubka 0fbc4b8ff4 Reuse sock.c logic in mbedtls integration 2022-03-21 14:39:27 +00:00
Sergey Lyubka 7ef82f5caf Add vc2017 target 2022-03-21 14:38:42 +00:00
Sergey Lyubka 1141ea7933 Add connection timeout 2022-03-20 18:50:01 +00:00
James Hilliard 1e9344161b Run valgrind tests with appropriate compiler optimizations. 2022-03-18 13:51:05 -06:00
Sergey Lyubka 6c021765bb Merge pull request #1479 from zudwalex/infineon_rtx_support
Add RTX-RTOS support
2022-03-18 09:18:49 +00:00
Sergey Lyubka bc151af51d Set IPv6=0 for valgrind test 2022-03-18 09:10:24 +00:00
Sergey Lyubka 8bd09e0e80 Add valgrind test 2022-03-18 09:03:18 +00:00
Sergey Lyubka 5978cb9703 Add valgrind test 2022-03-18 08:56:12 +00:00
Sergey Lyubka 8c447a95dd Fix #1483 - add valgrind target, do not use stdlib strcasecmp() 2022-03-18 08:52:54 +00:00
Sergey Lyubka 870431dc1a Enhance HTTP client example 2022-03-15 14:14:36 +00:00
Sergey Lyubka 1125b1f545 Fix #1490 - add winerror.h to fix old mingw build 2022-03-15 10:10:08 +00:00
Sergey Lyubka d255fc737a Fix mongoose.exe target 2022-03-15 10:03:00 +00:00
Sergey Lyubka 37cb51ee94 Fix #1488 - properly set non-blocking flags on accepted connections 2022-03-14 13:26:00 +00:00
Sergey Lyubka 02cabcc0ec Fix busy loop in TLS case 2022-03-14 11:16:41 +00:00
Sergey Lyubka 3ffb6c046e Merge branch 'master' of github.com:cesanta/mongoose 2022-03-11 15:40:22 +00:00
Sergey Lyubka 7bf8b81995 Fix mg_http_delete_chunk() 2022-03-11 15:38:59 +00:00
Sergey Lyubka 0ddda4a267 Merge pull request #1487 from jameshilliard/update-actions
Update actions/checkout@v2 to actions/checkout@v3
2022-03-08 12:06:08 +00:00
James Hilliard c46ad970cb Update actions/checkout@v2 to actions/checkout@v3 2022-03-06 21:59:25 -07:00
Sergey Lyubka 733abcffbc Merge pull request #1485 from jameshilliard/fix-pack-rebuild
Regenerate pack file when dependencies are changed.
2022-03-06 16:50:03 +00:00
Sergey Lyubka 139f928731 Fix #1481 - use stricter compilation flags 2022-03-06 14:31:42 +00:00
James Hilliard 3da9986232 Regenerate pack file when dependencies are changed.
Should help prevent some spurious test failures due to stale
test/packed_fs.c file.
2022-03-02 10:12:48 -07:00
Sergey Lyubka a284df01d1 Fix #1480 - use memmove instead of memcpy in mg_iobuf_resize() 2022-02-28 16:51:46 +00:00
Alex Alashkin 412f5cf3e0 Add RTX-RTOS support 2022-02-23 19:56:37 +02:00
Sergey Lyubka 42ba1e4aed Fix #1473 - calm static analyzer 2022-02-23 13:34:20 +00:00
Sergey Lyubka 1893b06c13 Fix #1472 - calm static analyzer 2022-02-23 13:31:00 +00:00
Sergey Lyubka b0cbb70e53 Fix #1471 - calm static analyzer 2022-02-23 13:30:14 +00:00
Sergey Lyubka 78e81fef27 Fix #1471 - calm static analyzer 2022-02-23 13:28:56 +00:00
Sergey Lyubka dd08231a34 Fix #1470 - calm static analyzer 2022-02-23 13:25:25 +00:00
Sergey Lyubka 8c78b7ef53 Refactor mg_alloc_conn() 2022-02-23 10:51:01 +00:00
Sergey Lyubka c650fdcdfc Move mg_listen() to net.c 2022-02-23 03:06:02 +00:00
Sergey Lyubka e99973d4b7 Introduce local address 2022-02-22 22:00:55 +00:00
Sergey Lyubka 4012a86bd8 Remove gitter chat link 2022-02-22 21:46:07 +00:00
Sergey Lyubka 048fee5c88 Fix build after mg_connect() move 2022-02-22 21:35:03 +00:00
Sergey Lyubka a287fd97e4 Factor mg_connect() to net.c 2022-02-22 21:27:08 +00:00
Sergey Lyubka 3a249183f8 Factor out mg_alloc_conn() 2022-02-22 21:14:29 +00:00
Sergey Lyubka 393dad97e0 Get rid of ctype dependencies 2022-02-22 20:20:56 +00:00
Sergey Lyubka 113abc71d4 Add SPDX identifier. Fix #1387 2022-02-22 18:13:06 +00:00
Sergey Lyubka 63261ec0d5 Use mg_http_status() 2022-02-19 16:19:51 +00:00
Sergey Lyubka 507935d067 Tiny refactoring - move clearance of the c->is_resolving flag to the mg_connect_resolved() 2022-02-19 16:17:03 +00:00
Sergey Lyubka c579b73f75 Update docs 2022-02-19 15:31:22 +00:00
Sergey Lyubka e69ec148cc Better mbedtls debug 2022-02-19 13:46:07 +00:00
Sergey Lyubka a76ade9bb2 Update packed fs 2022-02-14 17:44:43 +00:00
Sergey Lyubka 4fec149345 Disable dirlist by default 2022-02-14 11:32:01 +00:00
Sergey Lyubka 5bc164de76 Remove MG_ENABLE_DIRLIST 2022-02-14 11:19:24 +00:00
Sergey Lyubka 969b84043c Fix #1465 - rename LL_* constants, introduce MG_* log macros 2022-02-12 18:17:25 +00:00
Sergey Lyubka da72dafbfb Fix #1462 - add helper function for getting HTTP response status code. 2022-02-12 16:51:37 +00:00
Sergey Lyubka 1adf7f6b2b Handle #1463 - add missing includes for windows 2022-02-12 16:43:08 +00:00
Sergey Lyubka 3e085ccbaa Eliminate explicit _WIN32 checks 2022-02-12 14:33:43 +00:00
Sergey Lyubka 3e8e2ab513 Add optional zip cmd to pack.c 2022-02-12 14:28:02 +00:00
Sergey Lyubka 4f802ece52 Enhance mg_snrpintf tests 2022-02-11 18:15:34 +00:00
Sergey Lyubka 313ac34e59 Handle minus in the fmt spec 2022-02-11 11:02:06 +00:00
Sergey Lyubka 54f75889fa Using mg_snprintf() everywhere 2022-02-10 17:11:03 +00:00
Sergey Lyubka f64c86d23f Use mg_snprintf() 2022-02-10 11:56:55 +00:00
Sergey Lyubka 9e634310b4 Use MG_EV_HTTP_CHUNK for streaming upload 2022-02-09 12:24:06 +00:00
Sergey Lyubka 33666e7d6b Fix ESP32 example 2022-02-08 14:13:47 +00:00
Sergey Lyubka 40d4c7e410 Fix ESP32 example 2022-02-08 13:43:34 +00:00
Sergey Lyubka 8cd4699dbc Rename FS API functions to avoid conflicts 2022-02-08 13:36:04 +00:00
Sergey Lyubka 49d5aff8f9 Call realpath() against root_dir only when there are no overrides 2022-02-01 11:10:01 +00:00
Sergey Lyubka b2ee9cb363 Update docs 2022-01-29 11:12:31 +00:00
Sergey Lyubka e9c20ad992 Update docs 2022-01-29 11:11:22 +00:00
Sergey Lyubka 63b880e624 Handle #1459 - deprecate mg_globmatch, introduce mg_match() 2022-01-29 11:03:54 +00:00
Sergey Lyubka 768f67ae0a Fix #1458 - fail on example build error, and fix examples/mqtt-server 2022-01-27 12:10:03 +00:00
Sergey Lyubka fbf5fa53c6 Refactor ff_open() 2022-01-25 10:50:08 +00:00
Sergey Lyubka 4a5824e7a7 Silence error in clean target 2022-01-24 13:07:56 +00:00
Sergey Lyubka 32f3c48b65 Fix FreeBSD build 2022-01-24 02:20:45 +00:00
Sergey Lyubka f7fbcd2451 Disable leaks detection on macos 2022-01-23 06:58:06 +00:00
Sergey Lyubka c6253854ba Disable leaks detection on macos 2022-01-23 06:12:36 +00:00
Sergey Lyubka 544644e94b Refactor - always enable LOG macro. Enhance iolog 2022-01-23 06:10:14 +00:00
Sergey Lyubka f6cebf6956 Listen on INADDR_ANY by default 2022-01-22 17:03:27 +00:00
Sergey Lyubka 1b82aa02aa 7.5 -> 7.6 2022-01-21 12:41:52 +00:00
Sergey Lyubka e565a7e73d Fix #1453 - do not allow empty wakeup buffer 2022-01-21 12:35:28 +00:00
Sergey Lyubka 59c4dfa33b Fix 1452 - byte order issue in mg_check_ip_acl 2022-01-21 12:24:58 +00:00
Sergey Lyubka 1a8e3c2e31 Decrese debug verbosity 2022-01-19 18:15:47 +00:00
Sergey Lyubka 226917e1cd Use mg_str, not pointers, in mg_mqtt_{sub,pub} 2022-01-19 09:57:27 +00:00
Sergey Lyubka fe813ee247 Add buf,len params to mg_mgr_wakeup() 2022-01-19 09:25:01 +00:00
Sergey Lyubka 4cd830a0bf Improve ff_write - save large blocks in chunks 2022-01-19 08:43:34 +00:00
Sergey Lyubka 1259ca9ac9 Add missing mkdir() on ARM targets 2022-01-18 19:31:10 +00:00
Sergey Lyubka d0857fe36c Add mkdir to the FS API 2022-01-18 19:19:34 +00:00
Sergey Lyubka 56a7438114 Add fs arg to mg_file* and mg_http_upload API 2022-01-18 17:11:02 +00:00
Sergey Lyubka 09df542db8 Fix unamalgamated build 2022-01-18 08:02:41 +00:00
Sergey Lyubka 1df102ab93 Add Fat FS support 2022-01-18 07:44:30 +00:00
Sergey Lyubka 02b3b780bb Add missing fs.c 2022-01-17 14:44:59 +00:00
Sergey Lyubka f84f3da012 Change in FS API for fs->open() and fs->close() 2022-01-17 14:42:41 +00:00
Sergey Lyubka c65c8fdaaa Protect against the directory traversal in mg_upload() 2022-01-17 12:08:23 +00:00
Sergey Lyubka b484123f1b gcc and clang 2022-01-15 01:45:31 +00:00
Sergey Lyubka b60119790e Fix wrong memcmp usage in mg_url_port() 2022-01-14 12:45:55 +00:00
Sergey Lyubka 216427cea0 Cleanup suseconds_t usage 2022-01-14 12:33:06 +00:00
Sergey Lyubka c53e2fcc14 Fix #1444 - clang warns on undefined behavior with null pointers 2022-01-14 09:55:15 +00:00
Sergey Lyubka 9fd80fd136 Fix #1445 - send error to a resolving connection when DNS error happens 2022-01-14 08:50:01 +00:00
Sergey Lyubka 5fc284722f Fix #1448 - fix MG_ENABLE_FILE build 2022-01-14 08:21:12 +00:00
Sergey Lyubka ad6e395da0 Fix #1447 - typo in mg_random() 2022-01-14 08:18:28 +00:00
Sergey Lyubka 6c79a406cd Fix localtime_r and gmtmime_r signatures 2022-01-11 19:15:38 +00:00
Sergey Lyubka 456e8bd249 Use 3 params for fcntl() 2022-01-10 18:21:13 +00:00
Sergey Lyubka de95f28598 Make stat and struct stat changeable 2022-01-10 18:07:45 +00:00
Sergey Lyubka 43405afdb2 Dont use ctype.h from str.h 2022-01-10 17:30:51 +00:00
Sergey Lyubka 97f95e17db Better strategy for restoring multicast address 2022-01-07 18:40:48 +00:00
Sergey Lyubka 6725d61b3f Re-init SSDP peer address before every search 2022-01-07 18:28:51 +00:00
Sergey Lyubka ebda2cb100 Use sendto on Mac too 2022-01-07 16:31:29 +00:00
Sergey Lyubka bb72b2494d Fix unamalgamated target 2022-01-07 15:48:09 +00:00
Sergey Lyubka 3b0a509cae Change mg_resolve() 2022-01-07 15:00:10 +00:00
Sergey Lyubka 2f981f9383 Skip connect() on UDP connection 2022-01-06 15:42:55 +00:00
Sergey Lyubka fc3c08e411 Change mg_straddr() API 2022-01-05 19:09:11 +00:00
Sergey Lyubka ff811f287a Squash warnings 2022-01-05 13:57:30 +00:00
Sergey Lyubka 8ebb3bc37b More detailed debug log - show ip/port for sender and receiver 2022-01-05 13:47:11 +00:00
Sergey Lyubka f7ff571c5f Added SSDP search example 2022-01-05 13:22:00 +00:00
Sergey Lyubka 6a82cbee71 Send MG_EV_WRITE for UDP messages 2022-01-05 13:03:56 +00:00
Sergey Lyubka b0585bd0a9 Do not set c->label for DNS connections - let labels be user-only-settable 2022-01-05 11:46:26 +00:00
Sergey Lyubka 6ad4d242c2 Better cleanup 2022-01-05 11:45:22 +00:00
Sergey Lyubka 030b1d9826 Remove wrong comment 2021-12-27 03:31:33 +00:00
Sergey Lyubka f6ffa7b3b9 Add huge-response example 2021-12-27 03:25:28 +00:00
Sergey Lyubka 137efe2233 Show requests in flight 2021-12-24 20:46:31 +00:00
Sergey Lyubka 62411d039e Increase mqtt timeouts 2021-12-24 12:14:06 +00:00
novlean 54b1716e77 Merge pull request #1436 from cesanta/novlean-patch-1
Update README.md
2021-12-23 17:18:55 +00:00
novlean 9f7aba8039 Update README.md 2021-12-23 17:18:45 +00:00
Sergey Lyubka a176b8d566 Upate docs w.r.t. mg_mqtt_opts 2021-12-23 11:12:10 +00:00
Sergey Lyubka 26a97ec36c Fix #1434 - set will QoS in CONNECT message correctly, and rename qos -> will_qos in struct mg_mqtt_opts 2021-12-23 11:00:18 +00:00
Sergey Lyubka f29807aad8 Resolve root path before serving to avoid double dots 2021-12-22 18:05:03 +00:00
Sergey Lyubka 92d3c7a4cd Add realpath() for Win32 2021-12-22 18:04:36 +00:00
Sergey Lyubka af3a0f6af0 Add realpath() for Win32 2021-12-22 18:04:27 +00:00
Sergey Lyubka ce6164ca20 Fail stat() if S_ISDIR is not defined 2021-12-22 18:04:16 +00:00
Sergey Lyubka e9fc3fcecf Update event enum 2021-12-21 22:20:42 +00:00
Sergey Lyubka 25a1a24890 Fallback to time(0) in mg_millis() 2021-12-21 22:04:03 +00:00
Sergey Lyubka bf7fc1d5a9 Amalgamate 2021-12-21 21:58:03 +00:00
Sergey Lyubka 2126b49ab3 Merge pull request #1433 from ryuukk/patch-2
Remove debugging left over
2021-12-21 21:56:41 +00:00
Sergey Lyubka ae6767b1d2 Use int64_t for timers and mg_millis() 2021-12-21 21:50:18 +00:00
ryuukk 133629dbee Remove debugging left over 2021-12-21 21:28:22 +01:00
Sergey Lyubka fb0a9bc7e3 Fix build 2021-12-21 18:16:12 +00:00
Sergey Lyubka 2a3492766f Remove mg_time() and mg_usleep() 2021-12-21 17:44:34 +00:00
Sergey Lyubka 2ec7e5653e Merge branch 'master' of github.com:cesanta/mongoose 2021-12-21 17:40:04 +00:00
Sergey Lyubka 30bfb245f5 Make mongoose more bare-metal Keil friendly. Declare settings after arch. Introduce MG_ENABLE_FILE 2021-12-21 17:39:55 +00:00
Sergey Lyubka 84d89bc4f5 Merge pull request #1431 from ryuukk/patch-1
Closed WS connection is not an error for the logger
2021-12-21 08:47:21 +00:00
ryuukk 7f55fabfec Closed WS connection is not an error for the logger 2021-12-21 01:34:48 +01:00
Sergey Lyubka 9e0f04dc8b Add -S option 2021-12-20 16:35:16 +00:00
Sergey Lyubka 574c2954b3 Docs nitpick 2021-12-19 10:53:17 +00:00
Sergey Lyubka 9d38e26b81 Add MG_HTTP_INDEX build var 2021-12-17 13:54:01 +00:00
Sergey Lyubka 4e75a0c81e 7.4 -> 7.5 2021-12-17 13:34:32 +00:00
Sergey Lyubka d311e967fa Add mingw target 2021-12-16 09:22:28 +00:00
Sergey Lyubka d0a6c111cb Call MG_EV_ERROR with c->is_closing set 2021-12-15 11:31:42 +00:00
Sergey Lyubka aa6d8b4662 Remove TLS custom_init() API 2021-12-15 11:04:43 +00:00
Sergey Lyubka 3f5fd89fd7 Pass more args to custom TLS init 2021-12-14 13:21:59 +00:00
Sergey Lyubka f43a5a005c Introduce custom TLS init function 2021-12-14 13:04:11 +00:00
Sergey Lyubka 755bf3c412 Split TLS files and introduce MG_ENABLE_CUSTOM_TLS 2021-12-14 12:42:41 +00:00
Sergey Lyubka 84f3fb0ba5 Move EXTERN_C to util.h 2021-12-14 12:11:05 +00:00
Sergey Lyubka f2df6c114d Example for mg_http_bauth 2021-12-13 15:14:29 +00:00
Sergey Lyubka f93659e303 Merge branch 'master' of github.com:cesanta/mongoose 2021-12-13 15:08:14 +00:00
Sergey Lyubka 226404d39c Example for mg_http_bauth 2021-12-13 15:08:05 +00:00
Sergey Lyubka c1bcc143b9 Merge pull request #1417 from DavidKorczynski/cifuzz-integration
Add CIFuzz integration
2021-12-13 11:35:31 +00:00
Sergey Lyubka 5ca9062d45 Less verbose serve_dir 2021-12-07 15:23:02 +00:00
Sergey Lyubka 0b209eaabb Add mg_http_get_header_var() 2021-12-03 09:54:03 +00:00
David Korczynski 47ef191ea2 Add CIFuzz integration 2021-11-30 22:48:20 +00:00
Sergey Lyubka 25e76d761e Fix usage message 2021-11-29 14:00:03 +00:00
Sergey Lyubka 9731a51dae Recognise :PORT as a valid URL 2021-11-29 13:57:33 +00:00
Sergey Lyubka 81220fa590 Remove noisy debug 2021-11-26 16:23:06 +00:00
Sergey Lyubka 24e8c4d81a Increase SNMP test timeout 2021-11-25 17:31:41 +00:00
Sergey Lyubka 013520b0c0 Add note for mg_http_serve_dir() 2021-11-25 12:29:45 +00:00
Sergey Lyubka f012bcb027 Update issue template 2021-11-25 11:47:26 +00:00
Sergey Lyubka 922e1ce529 Make captive portal work on Linux 2021-11-23 17:52:54 +00:00
Sergey Lyubka 7a707cc64b Add README 2021-11-23 15:08:34 +00:00
Sergey Lyubka 1967acfef2 Make it build on vc98 2021-11-23 13:24:21 +00:00
Sergey Lyubka e24cb04003 Update URL 2021-11-23 09:37:03 +00:00
Sergey Lyubka 67974746ff Add json-rpc-over-ws example 2021-11-22 16:45:14 +00:00
Sergey Lyubka 8d916d41d7 Fix #1409 - remove VLA which confuses MSVC 2021-11-22 12:24:58 +00:00
Sergey Lyubka 08444e3942 Fix links and typos 2021-11-16 12:30:40 +00:00
Sergey Lyubka 9c41a0cd26 Fix links 2021-11-16 09:54:36 +00:00
Sergey Lyubka 2c50069d98 Do not clean the recv buffer 2021-11-14 16:47:40 +00:00
Sergey Lyubka 31059f6728 Add test.html 2021-11-14 14:31:51 +00:00
Sergey Lyubka 2000752b2c Remove dead code 2021-11-11 15:15:47 +00:00
Sergey Lyubka dd34830443 Update README 2021-11-11 15:11:57 +00:00
Sergey Lyubka c58f4ee51b Add symlinks 2021-11-11 14:21:52 +00:00
Sergey Lyubka 00f7e8cb2a Support wildcards 2021-11-11 12:08:17 +00:00
Sergey Lyubka 439904e27f Add signal handler 2021-11-11 10:35:41 +00:00
Sergey Lyubka 4d6590ece2 Add readme 2021-11-11 10:29:16 +00:00
Sergey Lyubka 9b0c4b970d Add README.md 2021-11-11 08:26:31 +00:00
Sergey Lyubka a80ce1b12a Add signal handler 2021-11-11 07:36:25 +00:00
Sergey Lyubka 57dd74c180 Add reconnection logic 2021-11-10 12:57:02 +00:00
Sergey Lyubka 90c67e4226 Reformatting for better readability 2021-11-06 11:29:56 +00:00
Sergey Lyubka 093cd6a6a3 Fix FD_CLOEXEC setting 2021-11-05 13:30:12 +00:00
Sergey Lyubka 975db86306 Add READMEs 2021-11-05 13:02:36 +00:00
Sergey Lyubka eba688e11b Update docs 2021-11-04 23:07:47 +00:00
Sergey Lyubka 05b44204d5 Set FD_CLOEXEC properly 2021-11-04 18:28:32 +00:00
Sergey Lyubka 0bb017c1d5 Add examples/mqtt-client-aws-iot 2021-11-03 20:58:57 +00:00
Sergey Lyubka a6efd0b335 Merge branch 'master' into dec 2021-11-02 22:43:59 +00:00
Sergey Lyubka c3d237e9c6 More verbose log 2021-11-02 22:43:23 +00:00
Sergey Lyubka 09d28f5570 Print a clarifying message at start 2021-11-02 16:53:57 +00:00
Sergey Lyubka ba02937ec6 Squash warnings 2021-11-02 16:40:25 +00:00
Sergey Lyubka 3d78b14deb Fix #1396 - JS sorting code for dir listing 2021-11-02 16:01:06 +00:00
Sergey Lyubka f558551d1d Fix #1395 - show decoded URI in dir listing 2021-11-02 15:11:56 +00:00
Sergey Lyubka 12fe66370f Fix #1393 - cleanup mime types 2021-11-01 20:31:45 +00:00
Sergey Lyubka 423aaa492c Fix #1394 - mg_mqtt_sub(). Add MG_EV_OPEN, too. 2021-11-01 16:20:00 +00:00
Sergey Lyubka 2016586475 Clearer client init 2021-11-01 13:29:44 +00:00
Sergey Lyubka bf88167152 Add missing test files 2021-10-31 12:50:06 +00:00
Sergey Lyubka 52be84f04e Add user and pass to struct mg_mqtt_opts 2021-10-31 12:48:32 +00:00
Sergey Lyubka 03d187b147 Fix #1375 - change event processing order 2021-10-31 12:40:56 +00:00
Sergey Lyubka 3329047579 More explicit check on hm->uri.len 2021-10-31 12:37:40 +00:00
Sergey Lyubka 86c70e5abb Fix #1391 - make remove_double_dots less aggressive 2021-10-31 12:36:34 +00:00
Sergey Lyubka b17f4108ea Change MG_PATH_MAX for ESP8266 2021-10-30 19:34:53 +01:00
Sergey Lyubka 4e523cc455 Remove binary section 2021-10-27 20:13:05 +01:00
Sergey Lyubka 49c9be9159 Set MG_IO_SIZE -> 128 2021-10-27 19:20:52 +01:00
Sergey Lyubka f1bfe0760f Optimise TLS read 2021-10-27 19:18:44 +01:00
Sergey Lyubka 35f02fdaad Use small IO buffer 2021-10-27 19:18:19 +01:00
Sergey Lyubka 6ac09966ba Fix #1374 - fix ESP32 build 2021-10-22 22:06:10 +01:00
Sergey Lyubka af9a7617f5 Merge pull request #1381 from ptsolakos/master
Certificate revocation checking when using mbedtls
2021-10-22 20:30:47 +01:00
Sergey Lyubka 42c89732c8 Remove private.h 2021-10-22 19:41:26 +01:00
Sergey Lyubka 054475ddbf Fix #1376 - handle comma for unquoted header vars 2021-10-22 14:33:51 +01:00
Sergey Lyubka 126d556d6a Merge pull request #1380 from jameshilliard/fix-time
util: Actually return uptime on OSX/Linux for mg_millis
2021-10-22 14:06:44 +01:00
Sergey Lyubka 529a302e77 Merge pull request #1379 from jameshilliard/fix-sntp
sntp: Don't set Leap Indicator in client messages.
2021-10-22 14:04:54 +01:00
Sergey Lyubka acbf978452 Merge pull request #1378 from jameshilliard/undef
Fix some undefined macro warnings.
2021-10-22 14:03:42 +01:00
Sergey Lyubka 90b22716ea Merge branch 'master' into undef 2021-10-22 14:03:25 +01:00
Sergey Lyubka fb90c504a6 Remove private.h 2021-10-22 14:00:31 +01:00
Sergey Lyubka 65fd834654 Increate mqtt test timeout 2021-10-22 13:58:51 +01:00
Sergey Lyubka a84acf5b8b Merge pull request #1385 from zudwalex/move_stm32_examples
Move STM32 examples to stm32 folder
2021-10-22 13:39:13 +01:00
Sergey Lyubka e9505db146 Merge pull request #1384 from zudwalex/master
Add more NXP examples and move them to nxp folder
2021-10-22 13:39:02 +01:00
Sergey Lyubka 4fb49b011e Merge pull request #1377 from jameshilliard/missing-prototypes
Make private functions static and add missing prototypes.
2021-10-22 13:16:06 +01:00
Alex Alashkin 6742991469 Move STM32 examples to stm32 folder 2021-10-22 14:19:50 +03:00
Alex Alashkin 2430cc5aac Add more NXP examples and move them to nxp folder 2021-10-22 14:04:15 +03:00
Sergey Lyubka 54590aaf26 Use UDP sendto() on win32 only 2021-10-22 09:14:18 +01:00
Sergey Lyubka 7c5e67b272 Fix #1382 - use sendto for UDP send 2021-10-22 08:56:45 +01:00
Sergey Lyubka c62c8ea4dd Correct licensing URL 2021-10-20 10:04:49 +01:00
Panagiotis Tsolakos 383653d608 mbedtls CRL support
Certificate revocation checking when using mbedtls
2021-10-14 17:56:31 +02:00
James Hilliard 001dc3f33d util: Actually return uptime on OSX/Linux for mg_millis
The documentation for mg_millis indicates it will:
Return current uptime in milliseconds.

So we should use API's that actually return uptime.

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
2021-10-13 17:06:18 -06:00
James Hilliard 37d45b3fbb sntp: Don't set Leap Indicator in client messages.
Per RFC4330:
This field is significant only in server messages

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
2021-10-13 16:48:33 -06:00
James Hilliard f72b8c6034 Fix some undefined macro warnings.
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
2021-10-13 13:06:00 -06:00
James Hilliard c11e5a9383 Make private functions static and add missing prototypes.
Fixes:
mongoose/mongoose.c:180:8: warning: no previous prototype for ‘mg_dns_parse_name’ [-Wmissing-prototypes]
  180 | size_t mg_dns_parse_name(const uint8_t *s, size_t n, size_t ofs, char *dst,
      |        ^~~~~~~~~~~~~~~~~
mongoose/mongoose.c:306:6: warning: no previous prototype for ‘mg_dns_send’ [-Wmissing-prototypes]
  306 | void mg_dns_send(struct mg_connection *c, const struct mg_str *name,
      |      ^~~~~~~~~~~
mongoose/mongoose.c:925:6: warning: no previous prototype for ‘mg_http_parse_headers’ [-Wmissing-prototypes]
  925 | void mg_http_parse_headers(const char *s, const char *end,
      |      ^~~~~~~~~~~~~~~~~~~~~
mongoose/mongoose.c:1125:7: warning: no previous prototype for ‘mg_http_etag’ [-Wmissing-prototypes]
 1125 | char *mg_http_etag(char *buf, size_t len, size_t size, time_t mtime) {
      |       ^~~~~~~~~~~~
mongoose/mongoose.c:2578:6: warning: no previous prototype for ‘mg_sha1_transform’ [-Wmissing-prototypes]
 2578 | void mg_sha1_transform(uint32_t state[5], const unsigned char buffer[64]) {
      |      ^~~~~~~~~~~~~~~~~
mongoose/mongoose.c:2976:8: warning: no previous prototype for ‘mg_open_listener’ [-Wmissing-prototypes]
 2976 | SOCKET mg_open_listener(const char *url, struct mg_addr *addr) {
      |        ^~~~~~~~~~~~~~~~

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
2021-10-12 20:18:11 -06:00
Sergey Lyubka b5147a149e Merge pull request #1373 from zudwalex/fix_board_ci
Use mongoose.[ch] from main repo
2021-10-06 12:31:27 +01:00
Alex Alashkin 655529f30b Use mongoose.[ch] from parent repo 2021-10-06 13:15:12 +03:00
novlean fd5319e0ce Merge pull request #1372 from cesanta/novlean-patch-1
license
2021-10-05 17:09:43 +01:00
novlean f8c84ca672 license 2021-10-05 17:09:35 +01:00
novlean 1b81ac8916 Merge pull request #1371 from cesanta/novlean-patch-1
mongoose.ws
2021-10-05 16:54:43 +01:00
novlean c64e2ebb16 mongoose.ws 2021-10-05 16:54:34 +01:00
Sergey Lyubka 3771f2c088 Merge branch 'master' of github.com:cesanta/mongoose 2021-10-04 19:47:34 +01:00
Sergey Lyubka 6d398bd5c7 Fix mg_random() for ESP32 2021-10-04 19:47:24 +01:00
Sergey Lyubka 5c355a5ff3 Merge pull request #1368 from zudwalex/nxp_examples
Add NXP examples
2021-10-04 12:04:00 +01:00
Alex Alashkin d2f8b346e6 Add nxp to actions 2021-10-04 13:15:32 +03:00
Alex Alashkin 5cdaa931f9 Add NXP examples 2021-10-04 12:54:15 +03:00
Sergey Lyubka 693863a51e Merge pull request #1366 from zudwalex/fix_rtos_lwip
Add missed include for FreeRTOS/LwIP arch
2021-10-02 22:45:08 +01:00
Sergey Lyubka a204c80308 Update ca.pem links 2021-10-01 09:25:34 +01:00
Sergey Lyubka 7d620965e2 Update ca.pem: DST root CA has expired 2021-10-01 09:22:49 +01:00
Sergey Lyubka 0149654791 Update README 2021-10-01 08:26:34 +01:00
Sergey Lyubka f08d280429 Version 7.4 2021-09-30 13:35:44 +01:00
Sergey Lyubka 6fbb749431 7.4 -> 7.5 2021-09-30 13:34:55 +01:00
Alex Alashkin bc7178e5f7 Add missed include 2021-09-29 12:25:25 +03:00
Sergey Lyubka 61070d136d Add nxp-mimxrt1020-azurertos to Actions 2021-09-27 13:55:19 +01:00
Sergey Lyubka ea85f93e37 Merge branch 'master' of github.com:cesanta/mongoose 2021-09-27 13:52:59 +01:00
Sergey Lyubka 46029c501a Fix #1359 - add conditional for MSVC, _DEBUG and strdup 2021-09-27 13:52:39 +01:00
Sergey Lyubka 78e1fdd1c9 Merge pull request #1365 from zudwalex/mimxrt1020_example
Add NXP MIMXRT1020 AzureRTOS example
2021-09-27 11:50:48 +01:00
Alex Alashkin 9ef5c7c667 Add NXP MIMXRT1020 AzureRTOS example 2021-09-27 11:12:15 +03:00
Sergey Lyubka cdf279e438 Merge pull request #1358 from yermin/master
makes it more readable
2021-09-27 09:00:11 +01:00
Sergey Lyubka cdd192abe4 Merge pull request #1363 from tophatgeeks/patch-1
Update README - Jordan Ramsey Edits.md
2021-09-27 08:44:42 +01:00
Sergey Lyubka 9af6f4b02e Merge pull request #1360 from zudwalex/azure_basics
Add AzureRTOS basic support
2021-09-27 08:39:15 +01:00
Alex Alashkin d86ceecd8c Add AzureRTOS basic support 2021-09-26 10:25:44 +03:00
yermin 8f693b92a7 makes it more readable
Signed-off-by: yermin <yermin@buaa.edu.cn>
2021-09-24 11:30:21 +08:00
tophatgeeks 6b1ff37cf3 Update README.md
I have gone through and edited for consistency, punctuation, wording, and grammar. If you have questions feel free to reach out.  I fixed some spelling errors "if" instead of "is" "update" instead of "updatw", etc. 

-Jordan Ramsey
2021-09-23 12:07:00 -04:00
Sergey Lyubka c490ff8ae7 Fix typo 2021-09-22 20:38:28 +01:00
Sergey Lyubka f73ebbf689 Fix #1354 - report correct errno in mg_open_listener() 2021-09-22 18:52:42 +01:00
Sergey Lyubka 1928ba9c1f Merge branch 'master' of github.com:cesanta/mongoose 2021-09-22 11:51:26 +01:00
Sergey Lyubka ad3655fb92 Docs spelling 2021-09-22 11:51:16 +01:00
novlean 29e0158689 Merge pull request #1355 from cesanta/novlean-patch-1
2021
2021-09-21 18:07:33 +01:00
novlean aaf55b6da0 2021 2021-09-21 18:02:11 +01:00
Sergey Lyubka 90a131bd29 Include ipv6 wrapping brackets [] in the result of mg_url_host() 2021-09-21 08:10:27 +01:00
Sergey Lyubka 8652006aea Remove dead code 2021-09-20 12:26:09 +01:00
Sergey Lyubka 2139fbc4b7 Support multiple web roots 2021-09-20 12:24:44 +01:00
Sergey Lyubka 2b48e8b03a Send suback 2021-09-18 20:56:56 +01:00
Sergey Lyubka a7afea0963 Handle ipv4-mapped addresses 2021-09-18 19:38:59 +01:00
Sergey Lyubka 9d1e61de93 Update docs 2021-09-17 15:59:15 +01:00
Sergey Lyubka 9b6b1a68f4 Add MQTT version check 2021-09-17 14:02:29 +01:00
Sergey Lyubka c7bd63ef53 Fix #1351 - squash warning 2021-09-17 11:07:20 +01:00
Sergey Lyubka 40b3382023 Enable WS data size check 2021-09-17 10:56:58 +01:00
Sergey Lyubka a70c5e726d Merge branch 'master' of github.com:cesanta/mongoose 2021-09-16 11:17:02 +01:00
Sergey Lyubka 409fdaec59 Rename posix_* -> p_* to avoid build conflict on linux 2021-09-16 11:16:10 +01:00
Sergey Lyubka 372aa369c4 Merge pull request #1350 from zudwalex/mg_parameters_retval
Add parameters descriptions to documentation
2021-09-15 20:51:18 +01:00
Alex Alashkin eb94704d8d Add params and retvals 2021-09-15 22:18:44 +03:00
Sergey Lyubka 894a168833 Get rid of fs->realpath 2021-09-15 07:43:48 +01:00
Sergey Lyubka f3eb466af3 Update docs 2021-09-15 07:43:24 +01:00
Sergey Lyubka df848973dc Fix unamalgamated target 2021-09-14 12:27:02 +01:00
Sergey Lyubka f37e5ecc38 WS frame len sanity check 2021-09-14 10:26:03 +01:00
Sergey Lyubka 6316609a5f Show log level 2021-09-13 13:48:02 +01:00
Sergey Lyubka dca08d32bd Fix URL 2021-09-13 13:47:49 +01:00
Sergey Lyubka 2b287f50f1 Add gitter badge 2021-09-02 10:28:16 +01:00
Sergey Lyubka acf58972f7 Fix posix_open() 2021-09-02 10:20:55 +01:00
Sergey Lyubka 5bf5516b29 struct iobuf doc 2021-08-30 13:06:45 +01:00
Sergey Lyubka 40b99e3751 Print openssl error on TLS error 2021-08-30 11:45:30 +01:00
Sergey Lyubka 28a56370d4 Fix zeromem() call in mg_iobuf_del() 2021-08-30 11:39:19 +01:00
Sergey Lyubka e3589577ed Update OpenSSL handshake error codepath 2021-08-29 16:54:24 +01:00
Sergey Lyubka 38beb4cbc0 Update readme 2021-08-28 22:00:46 +01:00
Sergey Lyubka 167af7f160 docs update 2021-08-28 20:27:55 +01:00
Sergey Lyubka 7d91885413 Update docs 2021-08-28 11:16:45 +01:00
Sergey Lyubka 0de83157dc Update docs 2021-08-28 08:52:41 +01:00
Sergey Lyubka cc9639b3cb Update docs 2021-08-28 08:48:47 +01:00
Sergey Lyubka cb0ac1868f Update docs 2021-08-28 08:46:01 +01:00
Sergey Lyubka e653147119 Merge pull request #1344 from timgates42/bugfix_typo_priority
docs: fix simple typo, priorty -> priority
2021-08-28 08:37:26 +01:00
Sergey Lyubka f3d15a0440 Update docs 2021-08-28 08:25:31 +01:00
Sergey Lyubka 0bc736d384 Update docs 2021-08-28 08:23:33 +01:00
Sergey Lyubka 3bf7b817f6 Update docs 2021-08-28 08:21:29 +01:00
Sergey Lyubka 477e48bf54 mg_iobuf_append -> mg_iobuf_add 2021-08-28 08:08:54 +01:00
Sergey Lyubka 913e730ec2 mg_iobuf_delete -> mg_iobuf_del 2021-08-28 07:16:38 +01:00
Sergey Lyubka bd64043377 mg_comma -> mg_commalist 2021-08-28 06:54:56 +01:00
Tim Gates 9f827feeaa docs: fix simple typo, priorty -> priority
There is a small typo in examples/stm32-freertos-tcp/stm32f7/core_cm7.h.

Should read `priority` rather than `priorty`.
2021-08-28 07:46:08 +10:00
Sergey Lyubka 714b7a8145 Handle WS fragmentation 2021-08-27 10:25:24 +01:00
Sergey Lyubka 7ba6fda236 Add stm32-nucleo-h743z and stm32-nucleo-f429z 2021-08-26 11:40:47 +01:00
Sergey Lyubka fc9c454518 Add mg_check_ip_acl() 2021-08-25 07:59:31 +01:00
Sergey Lyubka 1c456fc2df mg_next_comma_entry -> mg_comma 2021-08-23 16:54:58 +01:00
Sergey Lyubka 9b37ac384f Merge pull request #1341 from lnksz/bugfix-1340-http_chunked
Fix #1340: Long HTTP Chunks
2021-08-23 14:50:39 +01:00
Sergey Lyubka 99b279d5e5 Add examples/stm32-nucleo-f746z 2021-08-23 10:38:11 +01:00
Kristof Havasi 4d07a99ee2 Fix bug in long HTTP chunk handling
Due to a copy/paste error, the start of the payload in the latest parsed
chunk was compared to chunk-length of the terminating chunk (5 chars).
So only chunks were parsed as expected, which also had a single hex
digit length.
2021-08-23 08:50:58 +02:00
Kristof Havasi f6f0e49de4 Add failing test for HTTP chunk
This test would have caught #1340: handling chunks longer than 15 chars
2021-08-23 08:19:46 +02:00
Sergey Lyubka 07568a8f06 Docs nits 2021-08-22 10:51:40 +01:00
Sergey Lyubka 71e9019211 Docs nitpicks 2021-08-20 20:31:32 +01:00
Sergey Lyubka 0937213f4b Merge pull request #1336 from zudwalex/freertos_lwip_support
Update FREERTOS + LWIP support
2021-08-12 12:57:06 +01:00
Sergey Lyubka 6c42350fcf docs 2021-08-12 12:24:28 +01:00
Alex Alashkin 453d4be4d0 Update FREERTOS + LWIP support 2021-08-12 13:54:43 +03:00
Sergey Lyubka 104c4fab19 More docs 2021-08-11 19:24:33 +01:00
Sergey Lyubka fd5eb2d3f9 Refactor mg_mkpipe() 2021-08-11 19:17:04 +01:00
Sergey Lyubka 8b770d2a0d Fix #1334 - typo in mg_call(..MG_EV_WS_OPEN) call 2021-08-11 04:52:39 +01:00
Sergey Lyubka b739aa89f1 Update readme 2021-08-09 09:43:21 +01:00
Sergey Lyubka 11c07470bb Refactor UDP handling 2021-08-07 22:55:13 +01:00
Sergey Lyubka 76865cbe14 Fix STM32 build 2021-08-07 17:52:51 +01:00
Sergey Lyubka b7ce8213d7 Better multithreading support: remove mg_socketpair, add mg_mkpipe() and mg_rmpipe() 2021-08-07 17:22:47 +01:00
Sergey Lyubka 86f43cd8d6 Refactor mg_socketpair and document MG_ENABLE_NATIVE_SOCKETPAIR 2021-08-06 10:23:08 +01:00
Sergey Lyubka 2407509ce0 More detailed environment questions 2021-08-05 10:49:24 +01:00
Sergey Lyubka 47ce072af7 Fix #1331 - add comment about order of operations in conn_close() 2021-08-05 10:39:24 +01:00
Sergey Lyubka c2c6ff11ed Fix #1329 - send MG_EV_WS_OPEN for server connections 2021-08-04 11:38:32 +01:00
Sergey Lyubka 9b18a6350a Make ws_upgrade() respond with error if request is not and upgrade 2021-08-03 23:37:50 +01:00
Sergey Lyubka a36050ab4b Fix #1326 - spelling errors 2021-08-02 00:23:01 +01:00
Sergey Lyubka 568484f079 Fix #920 - add MQTT over Websocket client example 2021-08-01 14:10:21 +01:00
Sergey Lyubka 3ea4f1fda8 Merge pull request #1324 from ignacionr/fix/issue-1323
allow for in-url colon, when port is not specified
2021-07-31 22:30:04 +01:00
Sergey Lyubka 5366844581 Fix #1325 - squash gcc 10 warning, and optimise casts 2021-07-31 22:26:43 +01:00
Ignacio Rodriguez e52a6184c4 test and fix 2021-07-30 12:34:55 -05:00
Sergey Lyubka b40b1232cc Enhance packed fs serving 2021-07-30 17:41:23 +01:00
Sergey Lyubka 3a46055e52 Better packed test 2021-07-30 13:19:20 +01:00
Sergey Lyubka 2af5d07467 Fix stm32 GA 2021-07-29 14:28:20 +01:00
Sergey Lyubka c2176f969b Implement FS virtualization 2021-07-29 14:21:20 +01:00
Sergey Lyubka 9346122c29 Add FS API layer 2021-07-28 21:11:07 +01:00
Sergey Lyubka b98556a4dc Enable mg_fopen_packed on ARM 2021-07-27 09:54:45 +01:00
Sergey Lyubka 55d102e450 Enable mg_fopen_packed in newlib 2021-07-27 09:50:11 +01:00
Sergey Lyubka dfc22af10f Run docker non-interactive 2021-07-26 18:18:29 +01:00
Sergey Lyubka 2d585474c1 Add riscv target, enhance arm target 2021-07-26 11:00:37 +01:00
Sergey Lyubka 53ee984eb7 Fix mg_prefix test 2021-07-26 09:26:52 +01:00
Sergey Lyubka bdb747f9de Fix mg_prefix test 2021-07-26 09:15:17 +01:00
Sergey Lyubka 299075c930 Add test for fopen_packed() 2021-07-26 09:05:34 +01:00
Sergey Lyubka b0e0247b21 Add ascii to the packed data 2021-07-25 21:08:02 +01:00
Sergey Lyubka 35abd695cd Add packed FS 2021-07-25 10:22:56 +01:00
Sergey Lyubka df2ffd1187 Refactor serve dir even more 2021-07-24 22:00:37 +01:00
Sergey Lyubka b378082ec4 Refactor mg_http_serve_dir() 2021-07-24 21:48:19 +01:00
Sergey Lyubka fb4fae9174 Optimise file serving path 2021-07-24 21:23:52 +01:00
Sergey Lyubka cddff2b1b8 Cleanup on riscv baremetal build 2021-07-24 11:40:52 +01:00
Sergey Lyubka d6dbf831f7 Remove mg_stat 2021-07-24 10:35:48 +01:00
Sergey Lyubka 7e1d4325ec Fail examples target if any example fails 2021-07-24 08:45:51 +01:00
Sergey Lyubka 2a2c17a232 Remove MG_ENABLE_STDIO and cleanup 2021-07-24 03:44:00 +01:00
Sergey Lyubka d130c6f42d Remove leftovers 2021-07-24 02:44:25 +01:00
Sergey Lyubka a09238debd Place config.h before arch*.h 2021-07-23 20:48:48 +01:00
Sergey Lyubka 328a87b02a Remove mg_file_size() 2021-07-23 20:18:34 +01:00
Sergey Lyubka 529faa1172 MG_ENABLE_FS -> MG_ENABLE_STDIO 2021-07-23 19:47:26 +01:00
Sergey Lyubka 8e5efd4804 7.3 -> 7.4 2021-07-23 12:17:05 +01:00
Sergey Lyubka 32406b678b Increase sntp test timeout 2021-07-22 23:03:20 +01:00
Sergey Lyubka 55e2077a46 Use mg_fopen only on win32 2021-07-22 22:46:33 +01:00
Sergey Lyubka a771d6a19d Add unicode filename 2021-07-22 20:16:50 +01:00
Sergey Lyubka 0d5d7bb26f Keep directory listing compile-time option 2021-07-21 11:05:27 +01:00
Sergey Lyubka 3808dd3222 Update issue template 2021-07-21 10:31:48 +01:00
Sergey Lyubka 8fc94e12af Add enable_dirlist to mg_http_serve_opts 2021-07-20 17:22:41 +01:00
Sergey Lyubka 824e33ef8a Merge pull request #1319 from ignacionr/patch-1
The sanitiser pointed out this problem
2021-07-20 16:46:30 +01:00
Sergey Lyubka 655f9a9f79 Add Content-Type header to the SSI files 2021-07-20 11:33:38 +01:00
Ignacio Rodríguez 6ac6aa521c The sanitiser pointed out this problem
And I believe it's right. Other-side-close should be done only for the 'A' (proxy-client-side) connection.
2021-07-20 00:04:05 -05:00
Sergey Lyubka 3982e065c8 Fix #1315, fix #1317 - use #ifndef instead of #pragma once for compilers that do not support #pragma once 2021-07-19 09:04:18 +01:00
Sergey Lyubka 497b8027f5 Fix #1314 - expose local port for listeners 2021-07-19 08:47:38 +01:00
Sergey Lyubka 89757388c7 Disable SSL v1.1 2021-07-16 12:10:48 +01:00
Sergey Lyubka 77fae5c562 Fix #1298 - shadowing struct mg_str constructor 2021-07-15 02:18:32 +01:00
Sergey Lyubka 80fcba91c8 Fix #1297 - %p warning 2021-07-14 04:00:27 +01:00
Sergey Lyubka 39d64be581 Fix FD_CLOEXEC setting 2021-07-13 22:49:36 +01:00
Sergey Lyubka 2bfd30ab4b Fix mac test 2021-07-13 20:49:19 +01:00
Sergey Lyubka 60004eb209 Fix mac test 2021-07-13 20:01:46 +01:00
Sergey Lyubka db11897d71 Fix #1302 - set FD_CLOEXEC on sockets 2021-07-13 19:32:31 +01:00
Sergey Lyubka 5e466f9037 Fix #1294 - add more common mime types 2021-07-13 19:24:46 +01:00
Sergey Lyubka 6b2698a503 Squash warning in mg_random() 2021-07-13 18:07:38 +01:00
Sergey Lyubka 4788db7e00 Fix #1301 - use correct openssl version conditional for SSL_use_certificate_chain_file() 2021-07-13 18:05:57 +01:00
Sergey Lyubka d9680df510 Support mbedtls 3.x.x 2021-07-13 17:28:07 +01:00
Sergey Lyubka f20ee1f305 Open HTTP and HTTPS ports 2021-07-13 14:40:52 +01:00
cpq 302bf865f9 Fix #1310 - wrap _CRT_SECURE_NO_WARNINGS into #ifndef 2021-07-13 07:13:06 +01:00
Sergey Lyubka 03929dcdaa Merge pull request #1306 from SimonNitzsche/patch-1
Fixed typo on README
2021-07-13 07:06:30 +01:00
cpq 89af2e9638 Merge branch 'master' of github.com:cesanta/mongoose 2021-07-13 06:58:52 +01:00
cpq 015586950f Fix #1305 - add #ifdef __cplusplus for C++ linkage 2021-07-13 06:58:34 +01:00
Simon Nitzsche 9df261a0eb Fixed typo on README
Added a dot to "etc" on the README
2021-07-04 17:40:18 +02:00
Sergey Lyubka a2a3c84450 Merge pull request #1303 from Jasper-Ben/master
Makefile: change curly brackets to round brackets
2021-07-02 18:28:53 +01:00
novlean 6611348ebf added customers references 2021-07-01 15:02:51 +01:00
Jasper Orschulko e69ee90acf Makefile: change curly brackets to round brackets
Esthetic change which replaces the curly brackets introduced by me in
commit b6ee9e637b with round brackets.
2021-06-30 21:46:58 +02:00
Sergey Lyubka 8f3554d08a Merge pull request #1295 from Jasper-Ben/add_linux_lib_targets
Add static and dynamic lib targets to Makefile
2021-06-21 11:35:43 +01:00
Jasper Orschulko b6ee9e637b Makefile: add static and dynamic lib targets 2021-06-21 11:51:42 +02:00
cpq f46453f80f Squash warnings 2021-06-10 19:37:03 +01:00
cpq 3deafaea7f Extend mg_mqtt_{pub,sub} by adding qos and retain 2021-06-10 19:27:19 +01:00
cpq a15d518571 Add mg_mqtt_pubex 2021-06-10 19:15:50 +01:00
cpq 886a29d659 Fix #1292 - allow requests with missing protocol version, responses with no reason fields 2021-05-29 10:07:05 +01:00
cpq e69de57def Optimise mg_iobuf_append() 2021-05-29 09:46:50 +01:00
cpq 9d68e20dcc Fix #1288 - better mg_iobuf_append allocation strategy 2021-05-29 09:44:07 +01:00
cpq c0a8546330 Add MG_ARCH_FREERTOS_LWIP 2021-05-28 23:49:26 +01:00
cpq 4c0002e28a Separate examples job 2021-05-28 19:05:10 +01:00
cpq 7c37d75bf4 Squash even more warnings 2021-05-28 18:57:47 +01:00
cpq 879261981f Squash more warnings 2021-05-28 18:54:39 +01:00
cpq 838b0bcd27 Squash more warnings 2021-05-28 18:45:35 +01:00
cpq 736b8ad7b7 Fix #1285 - __builtin___snprintf_chk warning. Tighten test flags and refactor the code to squash all warnings 2021-05-28 18:30:42 +01:00
cpq db27fae40e Update issue template 2021-05-24 10:18:44 +01:00
cpq 594111a255 Update issue template 2021-05-24 10:16:33 +01:00
cpq 53a46a2739 Change issue template 2021-05-24 09:53:39 +01:00
Sergey Lyubka eef7a55904 Merge pull request #1290 from lnksz/patch-1
Propose an issue template
2021-05-24 09:49:35 +01:00
Kristóf Havasi a68fa5e6e0 Propose an issue template
As it is in the discussion of raised issues to have some extra iteration because of architecture, library version, and other meta information, an issue template could save these extra rounds and possibly reduce the number of duplicates by highlighting where one can check for answers.

This is just a sketch based on what notifications I got from mongoose in the past months. Feel free to change it.
2021-05-23 22:44:16 +02:00
cpq 7c0d126edc Build with -DMG_ENABLE_FS=1 2021-05-19 08:10:38 +01:00
cpq 1a5e3d3151 Fix #1286 2021-05-19 00:19:21 +01:00
cpq 95ff6c56af Update readme 2021-05-19 00:15:45 +01:00
cpq e2ef392633 Update readme 2021-05-19 00:14:27 +01:00
cpq dbc2356768 FreeRTOS-Plus-TCP fixes 2021-05-19 00:00:32 +01:00
cpq 47e5e984df stm32f7 example starts on real h/w, with plus-TCP driver 2021-05-17 17:36:57 +01:00
cpq 0f32f50c50 Add missing files 2021-05-13 22:05:00 +01:00
cpq 606cc1f538 Build w/semihosting support 2021-05-13 22:04:29 +01:00
cpq 2bb11888d5 Build w/semihosting support 2021-05-13 22:03:46 +01:00
cpq 09b1d6aa72 Running two blinkers 2021-05-13 15:05:09 +01:00
cpq 72f0489ec2 Using nucleo-f746zg. Moved 3party libs to test/. Using headers from ST 2021-05-13 14:56:14 +01:00
cpq 7b39973065 docs 2021-05-12 11:44:15 +01:00
cpq 30b64483fd docs 2021-05-12 11:39:46 +01:00
cpq 5369fb0376 Remove low-level lwip stubs 2021-05-12 11:06:19 +01:00
cpq 5fe34fd6c3 Remove MG_ENABLE_MGOS 2021-05-12 11:05:05 +01:00
Sergey Lyubka 0fbdda4d2e Merge pull request #1284 from cesanta/stm32
Stm32
2021-05-12 10:28:43 +01:00
cpq a98e980c8f Nits to have tests pass 2021-05-12 09:25:21 +01:00
cpq 2b836504ab rename 2021-05-12 08:44:16 +01:00
cpq 0de3f0d985 f1 build works 2021-05-12 08:43:34 +01:00
cpq 151e375091 FreeRTOS w/blink works 2021-05-11 20:44:14 +01:00
cpq c44549bfa5 Blinky works 2021-05-11 18:05:03 +01:00
cpq d6852f5e74 First stab 2021-05-11 09:12:06 +01:00
novlean 9173034b96 Update README.md 2021-05-04 17:03:53 +01:00
novlean 2888ab1f52 Merge pull request #1277 from cesanta/novlean-patch-1
more typos + some fixes
2021-05-04 17:02:55 +01:00
novlean 26b5416641 more typos + some fixes 2021-05-04 17:02:46 +01:00
novlean 8bcac7e955 Merge pull request #1276 from cesanta/novlean-patch-1
fixed typo + added few things
2021-05-04 16:54:28 +01:00
novlean ea25e8129c fixed typo + added few things 2021-05-04 16:54:16 +01:00
cpq 26cb44f9d9 Typo in readme 2021-05-04 13:55:45 +01:00
cpq 7a37a44433 Update README 2021-05-04 13:53:17 +01:00
cpq a752f3f8c7 Update README 2021-05-04 13:46:44 +01:00
Sergey Lyubka 946e07644c Merge pull request #1275 from panosto/master
Corrected small typo in docs
2021-04-29 19:26:46 +01:00
Panagiotis 497b26a249 Corrected small typo in docs 2021-04-29 18:16:33 +02:00
cpq 79aad7fabf Put Range support back 2021-04-29 11:00:57 +01:00
cpq 7851930ac3 Fix #1256 2021-04-29 09:50:33 +01:00
cpq 758572872d Fix #1255 2021-04-29 09:26:37 +01:00
cpq 111551477a Integrate #1266 2021-04-29 09:17:24 +01:00
cpq 31c9e3fb7e Make mg_random() weak, see #1269 2021-04-29 09:09:21 +01:00
cpq 7061b7202f Integrate 1265 2021-04-29 08:49:23 +01:00
novlean d88b6a3c95 Update README.md 2021-04-28 17:07:39 +01:00
novlean cea2a62ee0 Added Schneider Electric case study & testimonial 2021-04-28 17:06:27 +01:00
cpq 35a8b8e8e8 TLS nits, more DNS logging 2021-04-22 15:21:16 +01:00
cpq 1b8624f135 Better log trace 2021-04-13 21:02:05 +01:00
cpq e217066bf6 Squash warning 2021-04-13 19:42:47 +01:00
cpq 5430408218 Merge branch 'master' of github.com:cesanta/mongoose 2021-04-09 16:55:16 +01:00
cpq d2744063a0 Remove unused MG_SWAPxx macros 2021-04-09 16:55:12 +01:00
Sergey Lyubka 03356616ef Merge pull request #1259 from mcottrell1/fix-msvc-compile-errors
fixed msvc errors around VLAs when using TLS
2021-04-09 16:54:23 +01:00
Mark Cottrell 6ce2e48dd3 fixed msvc errors around VLAs 2021-04-09 08:11:16 -07:00
novlean 16a7ba6bf0 Added 4 new sections
Why Mongoose
Used to implement
Case Studies
Testimonials
2021-03-25 17:50:56 +00:00
cpq e9d122f231 Stricter checks for mg_url_*() 2021-03-24 15:49:35 +00:00
cpq 0ae5c61759 More comments 2021-03-23 14:02:24 +00:00
cpq 691460c5fc Add linux target to http-server example 2021-03-22 11:30:48 +00:00
cpq ab1c924388 Better check in mg_iobuf_resize() 2021-03-22 11:30:29 +00:00
cpq 05050eba38 Squash warning in mg_random 2021-03-22 11:29:59 +00:00
cpq 912dd518bf Tests for mg_to64() 2021-03-21 16:18:44 +00:00
cpq e0395a9907 Merge branch 'master' of github.com:cesanta/mongoose 2021-03-21 16:14:56 +00:00
cpq 0051f23e12 Even stricted check in mg_to64() 2021-03-21 16:14:44 +00:00
novlean a9bb8fa9fc Update README.md 2021-03-19 14:02:23 +00:00
novlean 09f5d2fdae Merge pull request #1247 from cesanta/novlean-patch-1
added video call offer
2021-03-19 14:01:45 +00:00
novlean 006a9d914c added video call offer 2021-03-19 14:01:30 +00:00
cpq 9009cbc528 Adjust recv.len after stripping chunked body 2021-03-19 13:13:24 +00:00
cpq a1862986b8 Better docstring for file upload example 2021-03-18 12:23:03 +00:00
cpq cc2989a848 Merge branch 'master' of github.com:cesanta/mongoose 2021-03-18 12:01:32 +00:00
cpq 4deb95776f Remove multipart example code 2021-03-18 11:59:23 +00:00
Sergey Lyubka f195b27884 Merge pull request #1245 from panosto/mbedtls_parse_crt_and_key_from_buffer
mbedtls parse cert and key from buffer
2021-03-18 08:51:04 +00:00
panosto 5036a71334 mbedtls parse cert and key from buffer 2021-03-17 15:23:45 +01:00
cpq 531c47b47c mg_to64 overflow protection 2021-03-17 13:46:50 +00:00
cpq 4dbb2da78f Add form-upload example 2021-03-17 13:28:36 +00:00
cpq 41c1e0f08d Squash truncation warning 2021-03-17 12:22:19 +00:00
cpq e7b1905e49 Add -Wno-error=format-truncation for test++ build 2021-03-17 12:15:46 +00:00
cpq e00265f855 Add -Wno-error=format-truncation for linux++ build 2021-03-17 12:11:05 +00:00
cpq cd36708b6d Fix tests 2021-03-17 07:46:39 +00:00
cpq 5bd22cb5e4 Add mg_http_next_multipart() 2021-03-17 07:43:29 +00:00
cpq bc00d5159a Add mg_http_next_part 2021-03-15 13:20:53 +00:00
cpq bcb0874477 Add file upload code example 2021-03-15 09:36:27 +00:00
cpq 5326e8d212 Update docs 2021-03-15 09:18:02 +00:00
cpq 4528cc28ef Add sizep param to mg_file_read() 2021-03-15 09:16:34 +00:00
cpq 381d7cce54 Do not call setsockopts() on a listening connection 2021-03-13 12:36:00 +00:00
cpq 2594e7b37a Stricter MG_ARCH_CUSTOM and type conversions in sock.c 2021-03-13 12:34:26 +00:00
Sergey Lyubka 4356b953ca Merge pull request #1238 from cesanta/novlean-patch-1
Fixed typos
2021-03-11 13:16:06 +00:00
cpq e788853156 Fix typos 2021-03-11 13:15:53 +00:00
novlean 91ed6de166 Fixed typos 2021-03-11 13:01:45 +00:00
novlean cf3aafc32e added . 2021-03-11 10:16:17 +00:00
cpq c2d7ff8179 Update readme 2021-03-10 13:44:32 +00:00
cpq e5eaa1c633 Update readme 2021-03-10 13:42:46 +00:00
cpq 6366c832b0 Add struct mg_http_serve_opts::extra_headers 2021-03-10 07:56:14 +00:00
cpq f326cbedbe Fix doc example 2021-03-09 17:44:15 +00:00
cpq 5b272c2b5c Bump HEAD to 7.3 2021-03-09 11:38:37 +00:00
cpq 452bcc68a4 Add mg_mqtt_next_unsub() signature 2021-03-09 11:29:53 +00:00
cpq 829827d46f Add mg_mqtt_next_unsub 2021-03-09 09:54:02 +00:00
cpq ff9d0e462e Tiny refactor in walkchunks() 2021-03-09 08:22:52 +00:00
cpq e84ea91a4a Process chunked body before sending MG_EV_HTTP_MSG 2021-03-09 08:21:29 +00:00
cpq 2dcb10ef36 Less verbose test 2021-03-08 15:45:09 +00:00
cpq 99fa7f0851 2020 -> 2021 2021-03-08 15:44:57 +00:00
cpq 1b5cc341a5 Add streaming client support, MG_EV_HTTP_CHUNK 2021-03-08 15:41:16 +00:00
cpq d50dc288cd Add mg_crc32 2021-03-08 15:40:39 +00:00
cpq 060bb29cdc Restore mg_mqtt_{ping,pong,disconnect} 2021-03-07 12:21:59 +00:00
cpq 366426e8bb Avoid extra allocation for static HTTP handling 2021-03-07 11:56:20 +00:00
cpq e710df4c80 Define WEAK to nothing on Cygwin 2021-03-04 14:25:50 +00:00
cpq 79e5841483 Fix QNX build 2021-03-04 11:09:57 +00:00
cpq 374ab4ecf0 Add struct mg_mgr::userdata 2021-02-28 16:40:27 +00:00
cpq 56980be48c Do not reveal full root dir path 2021-02-17 16:07:18 +00:00
cpq 602c5c0866 Refactor mg_url_encode 2021-02-15 14:42:55 +00:00
cpq 7ce5009de1 Remove reduntant code 2021-02-15 14:42:22 +00:00
cpq 51e3a1304b Fix TLS build 2021-02-13 10:45:27 +00:00
cpq d5a1d5a5e8 Stricter realpath checks 2021-02-11 15:03:22 +00:00
cpq ae5f6c0920 Increase conn label size 32 -> 50 2021-02-10 11:09:13 +00:00
cpq 0a9303bb07 Stricter mg_http_parse() 2021-02-09 21:16:33 +00:00
cpq 42bc7b1f47 Add "struct mg_http_message::head" attr 2021-02-09 13:27:17 +00:00
cpq 4844ed60bd Remove fflush in logging 2021-02-09 00:16:13 +00:00
cpq 41f5daeb47 Fix mg_random 2021-02-08 19:43:01 +00:00
cpq a3f8f33d50 Allow mbedtls CA being inline PEM 2021-02-08 17:50:00 +00:00
cpq fd8db5c53a Better unicode handling on win32 2021-02-07 22:43:49 +00:00
cpq a2f027e798 Change mws binary link 2021-02-07 14:51:37 +00:00
novlean dad5c8fe87 Update README.md 2021-02-05 16:56:06 +00:00
novlean 98783a41ba Update README.md 2021-02-05 16:55:26 +00:00
cpq 1517d2985a Update README 2021-02-04 10:40:33 +00:00
Sergey Lyubka acc0564957 Merge pull request #1213 from csimons/drainig
README.md: fix typo: is_drainig -> is_draining
2021-02-03 08:30:55 +00:00
Christopher Simons 421bc126b5 README.md: fix typo: is_drainig -> is_draining 2021-02-02 22:17:15 -05:00
cpq ed1a98c381 Remove debug logs 2021-02-03 02:19:17 +00:00
cpq 457d76b049 Fix #1211 - adjust ESP32 example to serve FS 2021-02-03 02:13:05 +00:00
cpq 6827972f71 Fix #1210 - on win32, open upload file in binary mode 2021-02-02 08:43:56 +00:00
cpq 7eb998891e Show served dir in the start message 2021-02-01 00:02:33 +00:00
cpq 582fde5c6e Fix #1209 2021-01-31 19:54:42 +00:00
cpq d327ee9834 Improve SNI 2021-01-30 13:03:11 +00:00
cpq 31cf6f8969 https://localhost -> http://0.0.0.0 2021-01-29 13:18:34 +00:00
cpq 86b1053678 Add error check for iobuf allocation 2021-01-29 12:32:34 +00:00
cpq 6678e36278 Use openssl/ssl.h 2021-01-28 08:45:24 +00:00
cpq 5118355732 Use 64bit file ops even on 32bit systems 2021-01-26 17:43:31 +00:00
cpq 5b4b7f7dc5 Fix test 2021-01-26 17:01:43 +00:00
cpq 7614a8101f Wrap util funcs that use FILE into MG_ENABLE_FS 2021-01-26 16:34:42 +00:00
cpq 3c851bcfc3 mg_file_write -> mg_file_printf 2021-01-26 16:30:44 +00:00
cpq 01691dafa0 Released 7.1, move HEAD to 7.2 2021-01-26 13:07:42 +00:00
cpq 8e52075636 Handle calloc failures 2021-01-26 12:16:58 +00:00
cpq 7200f079bf Remove dead code 2021-01-25 14:43:56 +00:00
cpq d155db81de Add socks5 server example 2021-01-25 14:43:08 +00:00
Sergey Lyubka 25e3bbf039 Merge pull request #1200 from Davonter/master
Fix README.md mg_mgr_free
2021-01-25 10:37:35 +00:00
cpq eecf3d854b Show accepted IPv6 peer corrently 2021-01-25 10:35:45 +00:00
cpq 7c2499fc06 -D -> -v 2021-01-25 10:35:14 +00:00
cpq 1aa605c620 desktop-server -> http-server 2021-01-25 10:09:48 +00:00
cpq 66287ad6c1 TLS nits 2 2021-01-25 10:08:15 +00:00
cpq 9a19485454 TLS nits 2021-01-24 13:57:40 +00:00
cpq 7d67d578fd TLS krypton compat 2021-01-23 17:47:51 +00:00
wangtun 960d3c7880 Fix README.md mg_mgr_free 2021-01-23 15:49:55 +08:00
cpq 9eabf3fa81 URL decoding URI 2021-01-21 17:14:08 +00:00
cpq 89beadd2ce Squash warning in unit test 2021-01-21 10:24:49 +00:00
cpq 6ecb6c1500 Fix DNS timeout, add unit test 2021-01-21 10:00:18 +00:00
cpq 51bc5f70c5 Disable native socketpair by default, fix multithreaded win32 example 2021-01-21 09:12:49 +00:00
cpq be62ac9c14 Add more docs 2021-01-20 11:28:47 +00:00
cpq 161c34384d Enable SO_EXCLUSIVEADDRUSE on Win32. Better listdir response. 2021-01-20 11:10:02 +00:00
cpq 89784ab90a Restore to a simple version 2021-01-19 14:21:50 +00:00
cpq d83e547fa9 Make mg_url_port() return 80 for ws:// 2021-01-18 18:39:22 +00:00
Sergey Lyubka 30d86928d5 Merge pull request #1191 from RiccardoDalFiume/master
FIX README mg_http_serve*
2021-01-17 11:18:32 +00:00
cpq 12c32d09fb Pass mg_http_message to MG_EV_WS_OPEN 2021-01-17 11:16:19 +00:00
cpq ae6fd6aa35 Add extra headers param to mg_ws_upgrade() 2021-01-16 22:48:43 +00:00
cpq 72d3a49352 Restore SO_EXCLUSIVEADDRUSE 2021-01-13 03:47:11 +00:00
cpq 87b62390b7 No static for linux 2021-01-13 03:10:42 +00:00
cpq 6c93446a1f Better reuseaddr handling on Win32 2021-01-13 03:08:11 +00:00
cpq 83c106a857 UI for Win32 2021-01-13 03:07:51 +00:00
cpq facb2846fd Bump version 2021-01-13 03:07:38 +00:00
cpq 596c70d3dc Add config file processing 2021-01-12 15:18:19 +00:00
Riccardo Dal Fiume 7beff0201d FIX README mg_http_serve* 2021-01-12 11:28:41 +01:00
cpq a4c9d1ecb7 Update mg_http_serve_file() doc 2021-01-07 16:21:01 +00:00
cpq b7a79a556a Add extra headers param to mg_http_serve_file 2021-01-07 12:48:20 +00:00
cpq 03ab9e4e0d Update axios 2021-01-06 17:11:53 +00:00
cpq 7e855f5c8f Add oss-fuzz badge 2021-01-05 18:10:01 +00:00
Sergey Lyubka 9e510d5831 Merge pull request #1185 from hakabahitoyo/master
Suppress error: cast from ‘void*’ to ‘int’ loses precision [-fpermissive] in MG_ENABLE_OPENSSL build.
2021-01-05 11:46:49 +00:00
Hakaba Hitoyo 1689a0d56b Update mongoose.c. 2021-01-05 12:35:28 +09:00
cpq 9ff774e7df Trigger test on pull requests 2021-01-04 12:02:55 +00:00
Hakaba Hitoyo c78ad0b574 Supress error: cast from ‘void*’ to ‘int’ loses precision [-fpermissive] 2021-01-04 16:25:06 +09:00
cpq 117aeaa15d Fix fd leak for cached static files 2021-01-03 09:39:46 +00:00
cpq e135743efa Fix example build 2021-01-03 08:55:00 +00:00
cpq 2c1324dc0a Remove -r option 2021-01-03 08:43:56 +00:00
cpq c7e09bd7b4 Add SSI include file=, include virtual= 2021-01-02 17:57:51 +00:00
cpq 86824795a0 Pass opts structure to mg_http_serve_dir() 2021-01-02 12:30:09 +00:00
cpq 1b0636c2d2 More checks in mg_ws_send 2021-01-02 12:20:08 +00:00
cpq 2f9d2bbdf6 Update readme 2020-12-29 18:15:06 +00:00
cpq 21a1b2c15c Update readme 2020-12-29 17:59:05 +00:00
cpq bdef3d6afd Fix win98 test 2020-12-28 06:32:55 +00:00
cpq a882aab30e Add captive dns server example 2020-12-28 05:25:29 +00:00
cpq 788b577d65 Add README 2020-12-27 01:32:58 +00:00
cpq 71a22adc06 Add ESP8266 example 2020-12-27 01:29:42 +00:00
cpq 7d1ef2ffe8 Add mingw tests to actions 2020-12-25 19:28:05 +00:00
cpq 55f5f74658 Add mingw gcc and g++ tests 2020-12-25 19:24:51 +00:00
cpq e1fd82bc46 Remove unused code 2020-12-25 15:04:43 +00:00
cpq 49b8480bfb Add http-reverse-proxy example 2020-12-25 04:32:56 +00:00
cpq b2ab484883 Fix #954 2020-12-24 19:10:54 +00:00
cpq 4c3b97be7d Squash -DMG_ENABLE_FS=0 build warning 2020-12-24 18:48:28 +00:00
cpq 60e1b64455 Fix https://github.com/cesanta/mongoose/issues/1030 2020-12-24 17:01:49 +00:00
cpq 6bcd02bb1c Enhance HTTP client example 2020-12-24 16:52:58 +00:00
cpq 66f302a613 Make DNS debug log less verbose 2020-12-24 16:52:33 +00:00
cpq 1716af6c72 Add HTTP client code 2020-12-24 16:52:12 +00:00
cpq 749326c83a Add more mg_http_parse unit tests 2020-12-24 14:33:23 +00:00
cpq 9657577c00 Fix typo in fuzz test 2020-12-24 09:09:25 +00:00
cpq 9f5216d259 Add more fuzz tests 2020-12-24 09:07:55 +00:00
cpq c8826e8f9c Refactor mg_ntoa and mg_straddr 2020-12-24 08:05:54 +00:00
cpq 25bc13ef1e Squash some warnings under mingw crosscompiler 2020-12-24 07:26:50 +00:00
cpq 4d123a15f9 Drop deprecated register keyword 2020-12-23 21:20:48 +00:00
cpq 2cf1b09767 Workaround for WIN32 C++ snprintf/vsnprintf/strdup calls 2020-12-23 21:05:46 +00:00
cpq abfd81cb9d Fix WS frame length encoding for len 0xffff 2020-12-23 16:18:49 +00:00
cpq 3895678bee Use MG_EV_WS_CTL for WS control messages 2020-12-23 11:58:08 +00:00
cpq e0a1feafe0 Fix localhost resolution 2020-12-23 10:15:09 +00:00
cpq c75eb24eb8 Add proxy client example 2020-12-22 21:01:14 +00:00
cpq c3aae185df Add ipv6 server test 2020-12-22 10:16:31 +00:00
cpq 2e87783246 Add IPv6 client test 2020-12-22 09:44:59 +00:00
cpq fbab767b9f Fix mg_prefix job 2020-12-21 12:39:03 +00:00
cpq 7bc38b5eaa Add examples build, fix prefix build 2020-12-21 12:33:27 +00:00
cpq b93456f512 Do not create socket until resolved 2020-12-21 12:26:44 +00:00
cpq ddb700eee5 Fix openssl build 2020-12-20 21:50:46 +00:00
cpq 1052ee0766 Fix openssl build, and add openssl test 2020-12-20 21:45:58 +00:00
cpq 29534218d7 IPv6 related refactoring 2020-12-20 16:55:33 +00:00
cpq d7abd53062 Always send MG_EV_CONNECT on TCP connect 2020-12-18 15:13:19 +00:00
cpq aede72fa37 Refactor HTTP client 2020-12-18 14:29:30 +00:00
cpq b0a5165b44 Uload coverage 2020-12-18 11:47:56 +00:00
cpq 4919f792f2 Make build badge a link 2020-12-18 11:32:59 +00:00
cpq d5927f5d50 Remove travis - migrated to Github Actions 2020-12-18 11:31:31 +00:00
cpq e68330e045 Rename workflow 2020-12-18 11:26:17 +00:00
cpq b5d5b3763f Add workflow badge 2020-12-18 11:24:36 +00:00
cpq b6a6687c1e Rename workflow 2020-12-18 11:24:06 +00:00
cpq 3843b670a5 Fix typo 2020-12-18 11:14:21 +00:00
cpq 249efdd378 Add windows test 2020-12-18 11:12:08 +00:00
cpq 18ce1669fc Add mac test 2020-12-18 11:09:03 +00:00
cpq e8d3b8030e Install mbedtls 2020-12-18 10:56:35 +00:00
Sergey Lyubka a752abf318 Create test.yml 2020-12-18 10:41:27 +00:00
cpq d3ebcaf5d2 Remove unneeded defines that break vc2015 build 2020-12-18 09:48:28 +00:00
cpq 0abb8322d9 Disable noisy debug 2020-12-18 09:48:05 +00:00
cpq 99ed58ec4d Better docstrings 2020-12-18 09:08:28 +00:00
cpq 04450ec659 Update http server example to showcase SSL 2020-12-18 09:01:14 +00:00
cpq 82a378e519 Add extra param to http_reply() 2020-12-17 22:47:55 +00:00
cpq 29d31ba919 More boundary checks for mg_dns_parse() 2020-12-17 19:14:17 +00:00
cpq 4519ea568d Add conditional for SSL_use_certificate_chain_file() 2020-12-17 12:12:46 +00:00
cpq 9f88f31f01 Add timer example 2020-12-17 11:44:30 +00:00
cpq 4bdea2b467 Add README to the esp32 example 2020-12-17 11:24:28 +00:00
cpq 2252a74cd7 Note on UDP 2020-12-17 11:19:13 +00:00
cpq d1fa7b88e0 Disable brew update 2020-12-16 14:05:36 +00:00
cpq 9ecf42578c Fix screenshot link 2020-12-16 10:54:47 +00:00
cpq 754fc25924 Add description & screenshots 2020-12-16 10:54:09 +00:00
cpq d9551c75b1 Refactor MQTT parsing 2020-12-16 10:14:00 +00:00
cpq 8d45cf6972 Add mqtt-server example 2020-12-15 20:29:47 +00:00
cpq f176e1ae59 Handle more mime types 2020-12-15 11:58:30 +00:00
cpq fa8f62fb5d Squash warnings under linux 2020-12-14 14:05:01 +00:00
cpq 0c142f20d7 Using linux for docker tests 2020-12-14 13:09:56 +00:00
cpq b641fc6b79 Add esp32 example 2020-12-14 12:58:27 +00:00
cpq 1252a61479 More docs 2020-12-14 09:36:46 +00:00
cpq 5f631c0b96 More docs 2020-12-14 09:35:03 +00:00
cpq 348c579521 Add dns test case 2020-12-14 09:31:23 +00:00
cpq 7ce9cdf0b9 More docs 2020-12-14 09:31:03 +00:00
cpq 09beadb98a Fix c++ fuzzer build 2020-12-13 16:56:30 +00:00
cpq 5b265a76bd Add minor case to fuzzer 2020-12-13 16:33:46 +00:00
cpq c5a4a1c6f2 Remove debug leftover 2020-12-13 00:37:04 +00:00
cpq 88ada54045 More tests 2020-12-12 20:38:09 +00:00
cpq c5b1c08d05 Use MSG_NONBLOCKING for recv/send 2020-12-12 16:48:47 +00:00
cpq a0765ade6b Use -DMG_ENABLE_LINES for fuzzer build 2020-12-12 14:23:28 +00:00
cpq 54250f5fbf Rename, use hyphen 2020-12-12 10:22:45 +00:00
cpq f3f397f31e Add MQTT client example 2020-12-12 10:03:19 +00:00
cpq d806ed5d5f Better coverage 2020-12-11 22:58:50 +00:00
cpq 37e9a2ee95 Fix C++ build error 2020-12-11 18:26:54 +00:00
cpq 7ad6a08002 Fix C++ build error 2020-12-11 18:21:29 +00:00
cpq 90686ee5c9 Add ws examples 2020-12-11 17:35:58 +00:00
cpq 85c5577955 mg_dns_parse_name() recursion protection 2020-12-11 14:02:52 +00:00
cpq 30d4a1ad0f Fix mg_sntp_parse() 2020-12-11 13:16:51 +00:00
cpq 1b551741b8 Fix mg_url_decode fuzz 2020-12-11 09:35:50 +00:00
cpq 369f44adfa Add version.h 2020-12-10 17:46:26 +00:00
cpq 763f4551d5 More log messages 2020-12-10 17:42:59 +00:00
cpq 42d7865e14 Pre-built desktop server 2020-12-10 17:39:40 +00:00
cpq cf62702f08 Switch to hivemq 2020-12-10 16:36:24 +00:00
cpq 14ccd78782 Update README 2020-12-10 14:21:38 +00:00
cpq 6c4b5efd98 Add restful and client example 2020-12-10 13:26:05 +00:00
cpq 05a43c563c Update READMEs 2020-12-08 16:53:35 +00:00
cpq 94d2e86b60 More docs 2020-12-08 16:26:17 +00:00
cpq d1b8f9e01f Fuzz-test mg_http_var and base64 2020-12-07 18:52:40 +00:00
cpq 228acefa36 Fix native socketpair call 2020-12-07 10:55:50 +00:00
cpq d1d8a77bf6 Use socketpair syscall when available 2020-12-07 10:25:28 +00:00
cpq 7ea3293aba More tests 2020-12-07 08:54:58 +00:00
cpq 082a498afd Fix badges 2020-12-07 08:08:21 +00:00
cpq 866c987409 Tuning test 2020-12-07 05:46:47 +00:00
cpq 1d0e65d17a Tuning test 2020-12-07 05:39:07 +00:00
cpq 136a37ef73 Tuning test 2020-12-07 05:18:07 +00:00
cpq 0ce49b5c71 Tuning test 2020-12-07 05:08:21 +00:00
cpq 490ad3834b Tuning test 2020-12-07 05:00:27 +00:00
cpq bcc62c96c8 Tuning test 2020-12-07 04:56:50 +00:00
cpq 15d6cb3065 Tuning test 2020-12-07 04:44:23 +00:00
cpq a490660b38 Tuning test 2020-12-07 04:19:26 +00:00
cpq 72019b7427 Tuning test 2020-12-07 04:18:29 +00:00
cpq 21c0024a2f Tuning test 2020-12-07 03:59:42 +00:00
cpq d7a02d13e4 Add test++ linx++ 2020-12-07 03:47:37 +00:00
cpq cb220837b9 Tuning test 2020-12-07 01:27:44 +00:00
cpq ddaae51d42 Tuning test 2020-12-07 01:12:21 +00:00
cpq 629e55f97d Tuning test 2020-12-07 01:00:35 +00:00
cpq 909ebad276 Install deps 2020-12-06 23:32:15 +00:00
cpq cb7743fa39 Move tests -> test 2020-12-06 23:19:56 +00:00
cpq 6197842bca Merge branch '7.0' 2020-12-06 22:52:11 +00:00
cpq 77d461dcbf Remove travis build 2020-12-06 22:51:32 +00:00
cpq 47b6060910 Add docs 2020-12-06 21:12:05 +00:00
cpq 47d3fe5af6 Add travis build 2020-12-05 11:58:32 +00:00
cpq 6691a2fdad Add badges 2020-12-05 11:46:12 +00:00
cpq 746f56f42a README update 2020-12-05 11:41:23 +00:00
cpq 87de05881c Add travis build 2020-12-05 11:34:58 +00:00
cpq f2fba1d200 7.0 refactor 2020-12-05 11:26:32 +00:00
Sergey Lyubka 34d4fb8cf0 Merge pull request #1157 from rojer/qq
Add mg_next_query_string_entry_n() and mg_url_decode_n()
2020-10-26 13:25:31 +00:00
Deomid Ryabkov be64f81eee Add mg_next_query_string_entry_n() and mg_url_decode_n()
Move to mg_util.h so encode and decode are next ot each other.

Pull out mg_next_list_entry_n() for advanced use cases.

Add unit tests.
2020-10-24 22:53:50 +01:00
Sergey Lyubka 9fe1c93c9b Merge pull request #1143 from rojer/cs_log_lock
Add cs_log_{lock,unlock}
2020-08-28 20:46:37 +01:00
Deomid Ryabkov a4b6d58b24 Add cs_log_{lock,unlock}
In implementatiosn that have preemptive scheduelrs these can be implemented
to ensure logging from different threads is properly serialized.
2020-08-28 20:29:13 +01:00
Sergey Lyubka 86f391c701 Merge pull request #1139 from rojer/warns
Fix warnings and sync line numbers of unamalgamated sources
2020-08-20 00:45:02 +01:00
Sergey Lyubka 36de38bd11 Merge pull request #1138 from rojer/1135
Add missing range check in mg_get_http_header()
2020-08-20 00:44:36 +01:00
Deomid Ryabkov a308872c88 Fix warnings and sync line numbers of unamalgamated sources 2020-08-19 22:02:50 +01:00
Deomid Ryabkov a369160296 Add missing range check in mg_get_http_header()
h/t BushraAloraini

Fixes https://github.com/cesanta/mongoose/issues/1135
2020-08-19 21:48:45 +01:00
Sergey Lyubka 0a09b46c94 Merge pull request #1128 from rojer/amalgam
Sync src with amalgamated versions
2020-07-12 15:32:42 +01:00
Deomid Ryabkov b0a1cd7b0d Sync src with amalgamated versions
Now src contains exactly what's embedded in mongoose.c and .h, nothing more.

Added `tools/amalgam.sh` to aamlgamate both files at once.

There are no functional changes to mongoose.c, .h in this PR, only slight filename changes.
2020-07-08 02:08:49 +01:00
novlean 73a2b92278 Merge pull request #1124 from cesanta/novlean-patch-1
added MWS white paper
2020-06-24 17:08:49 +01:00
novlean c3bb5bd89e added MWS white paper
Download “9 Things NOT to do when embedding a web server” white paper.
2020-06-24 17:08:35 +01:00
Sergey Lyubka d22ff2fce7 Really revert 4880069 2020-06-11 19:08:55 +01:00
Sergey Lyubka fee2980d95 Merge branch 'master' of github.com:cesanta/mongoose 2020-06-11 19:04:45 +01:00
Sergey Lyubka d6693ed360 Revert 4880069 2020-06-11 19:04:24 +01:00
Sergey Lyubka 4880069775 Fix #1112 2020-06-11 18:38:42 +01:00
Sergey Lyubka 5d217a1262 Merge branch 'dev' of github.com:cesanta/mongoose into dev 2020-06-11 18:29:58 +01:00
Sergey Lyubka f778d22eac Make it possible to override default FS update algorithm
PUBLISHED_FROM=774a111548da97bd9d195e177b5fb66b0fd66135
2020-06-11 18:27:48 +01:00
Sergey Lyubka 3aa76dcaec Subst CREDPARAMS
PUBLISHED_FROM=545e8dff4ea0bef061c893252c613e3429f56184
2020-06-11 18:27:46 +01:00
Deomid "rojer" Ryabkov 4680573a6b Fixes for -pedantic build mode
PUBLISHED_FROM=d0a15356cf047e579c74869ce3e8fe813752e8c7
2020-05-23 15:55:27 +00:00
Deomid "rojer" Ryabkov 95fcb261eb Fix processing of keep-alive requests when chunks are consumed
PUBLISHED_FROM=136ce2ed4f143d7ee246e5fd1078c431e205bb3a
2020-05-22 23:07:38 +00:00
Sergey Lyubka 5867c67da2 Allow OpenSSL session reuse on 2-way SSL, integrate https://github.com/cesanta/mongoose/pull/877
PUBLISHED_FROM=6e2568b963869d062dd51b590f8e536d043c4ca2
2020-05-22 18:56:31 +00:00
Sergey Lyubka 80d74e9e34 Merge branch 'dev' 2020-05-21 16:45:34 +01:00
Sergey Lyubka 43a0b500f5 6.17 -> 6.18
PUBLISHED_FROM=7893a216b1f7e86e845122eb425e4fed271244b4
2020-05-21 16:42:09 +01:00
Sergey Lyubka 3d53ed17fb Allow OpenSSL session reuse on 2-way SSL, integrate https://github.com/cesanta/mongoose/pull/877
PUBLISHED_FROM=6e2568b963869d062dd51b590f8e536d043c4ca2
2020-05-21 16:17:14 +01:00
Sergey Lyubka 4ea452307e Update certs used for SSL test
PUBLISHED_FROM=2236ecf7fe06bdaf9a89e697b83ff69e1f8c805c
2020-05-21 16:17:12 +01:00
Deomid "rojer" Ryabkov e61f20f1ed Convert amalgam.py to Python 3
No mongoose.{c,h} diffs

PUBLISHED_FROM=a995a6d6548a914087969e28908f4e8c9ef1d379
2020-05-09 10:48:41 +00:00
Sergey Lyubka ca11f5ab49 Fix OpenSSL error issue
PUBLISHED_FROM=a3bcdb68f48a4de4a4f55b4399792fdd5211c88d
2020-05-02 11:19:29 +00:00
Sergey Lyubka 000d24d31a Add http proxy client example
PUBLISHED_FROM=443a0d3db63df1b78555a9fa4eff808bef3a9a01
2020-03-25 16:32:49 +00:00
Sergey Lyubka ef92f2e9c5 Integrate cesanta/dev#1062 - Fix dereferencing in mg_http_free_proto_data_endpoints
PUBLISHED_FROM=47fd1a4de07d2c53c994d29c88ac1d3a7f61c1a0
2020-02-21 14:30:21 +00:00
Sergey Lyubka 4e89eac8dd Integrate cesanta/dev#1074 - Fix typedef bool for MSC
PUBLISHED_FROM=f52fe15edd617d9f1ba2aa4051c116e79671554d
2020-02-21 14:24:50 +00:00
Sergey Lyubka b015e33ea5 Integrate https://github.com/cesanta/mongoose/pull/1096 - dir listing nits
PUBLISHED_FROM=a343bd61f98cbcc0f8cab02a62b912e494c27601
2020-02-14 08:30:56 +00:00
Sergey Lyubka 96e762d4a1 Change contributions section
PUBLISHED_FROM=676548efdb09989c300693a81dd592fe1cd987b0
2020-02-14 08:30:54 +00:00
1255 changed files with 124060 additions and 276217 deletions

No files matched your search

+6
View File
@@ -0,0 +1,6 @@
BasedOnStyle: Google
AllowShortFunctionsOnASingleLine: false
SpaceAfterCStyleCast: true
PointerBindsToType: false
DerivePointerBinding: false
IncludeBlocks: Preserve
+12
View File
@@ -0,0 +1,12 @@
- My goal is: _describe_
- My actions were: _describe_
- My expectation was: _describe_
- The result I saw: _provide logs or description_
- My question is: _your question_
# Environment
- mongoose version: _X.Y_
- Compiler/IDE and SDK: ZZZ version _X.Y_
- Target hardware/board: _?_
- Connectivity chip/module: _?_
+26
View File
@@ -0,0 +1,26 @@
name: CIFuzz
on: [pull_request]
jobs:
Fuzzing:
runs-on: ubuntu-latest
steps:
- name: Build Fuzzers
id: build
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
with:
oss-fuzz-project-name: 'mongoose'
dry-run: false
language: c++
- name: Run Fuzzers
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
with:
oss-fuzz-project-name: 'mongoose'
fuzz-seconds: 600
dry-run: false
language: c++
- name: Upload Crash
uses: actions/upload-artifact@v1
if: failure() && steps.build.outcome == 'success'
with:
name: artifacts
path: ./out/artifacts
+128
View File
@@ -0,0 +1,128 @@
name: build
on: [push, pull_request]
jobs:
linux:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
cc: [gcc, clang]
target: [test, test++, valgrind]
ssl: [MBEDTLS, OPENSSL]
name: linux ${{ matrix.target }} CC=${{ matrix.cc }} SSL=${{ matrix.ssl }}
env:
IPV6: 0
CC: ${{ matrix.cc }}
SSL: ${{ matrix.ssl }}
steps:
- uses: actions/checkout@v3
- name: Install packages
run: sudo apt-get update ; sudo apt-get install libmbedtls-dev valgrind
- name: test
run: make ${{ matrix.target }}
- name: unamalgamated
run: make unamalgamated
examples:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: sudo apt-get install libmbedtls-dev libpcap-dev
- run: make clean examples
- run: make clean test IPV6=0 MG_ENABLE_POLL=1
macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- run: HOMEBREW_NO_AUTO_UPDATE=1 brew install jq mbedtls openssl
- run: make test++ upload-coverage IPV6=0 ASAN_OPTIONS=
- run: make test SSL=OPENSSL IPV6=0 ASAN_OPTIONS= OPENSSL=`echo /usr/local/Cellar/openssl*/*`
- run: make mg_prefix
windows:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: make vc98
- run: make vc17
- run: make vc22
- run: make mingw
- run: make mingw++
arm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: make arm
matrix_examples:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
example:
- name: esp32/device-dashboard
path: esp32/device-dashboard
- name: esp8266
path: esp8266
- name: stm32-freertos-tcp
path: stm32/stm32-freertos-tcp
- name: stm32-nucleo-f746z
path: stm32/stm32-nucleo-f746z
- name: stm32-nucleo-f429z
path: stm32/stm32-nucleo-f429z
- name: stm32-nucleo-h743z
path: stm32/stm32-nucleo-h743z
- name: stm32-nucleo-f746zg-baremetal
path: stm32/nucleo-f746zg-baremetal
- name: nxp-mimxrt1020-azurertos
path: nxp/nxp-mimxrt1020-azurertos
- name: nxp-frdmk66f-freertos
path: nxp/nxp-frdmk66f-freertos
- name: nxp-lpcxpresso54s018m-freertos
path: nxp/nxp-lpcxpresso54s018m-freertos
- name: nxp-mimxrt1020-freertos
path: nxp/nxp-mimxrt1020-freertos
- name: nxp-evkbimxrt1050-lwip-freertos
path: nxp/nxp-evkbimxrt1050-lwip-freertos
- name: nxp-evkmimxrt1020-lwip-freertos
path: nxp/nxp-evkmimxrt1020-lwip-freertos
- name: nxp-evkmimxrt1024-lwip-freertos
path: nxp/nxp-evkmimxrt1024-lwip-freertos
- name: nxp-evkmimxrt1060-lwip-freertos
path: nxp/nxp-evkmimxrt1060-lwip-freertos
- name: nxp-evkmimxrt1064-lwip-freertos
path: nxp/nxp-evkmimxrt1064-lwip-freertos
- name: nxp-evkmimxrt1160-cm7-lwip-freertos
path: nxp/nxp-evkmimxrt1160-cm7-lwip-freertos
- name: nxp-evkmimxrt1170-cm7-lwip-freertos
path: nxp/nxp-evkmimxrt1170-cm7-lwip-freertos
- name: nxp-frdmk64f-lwip-freertos
path: nxp/nxp-frdmk64f-lwip-freertos
- name: nxp-frdmk66f-lwip-freertos
path: nxp/nxp-frdmk66f-lwip-freertos
- name: nxp-lpcxpresso54018-lwip-freertos
path: nxp/nxp-lpcxpresso54018-lwip-freertos
- name: nxp-lpcxpresso54608-lwip-freertos
path: nxp/nxp-lpcxpresso54608-lwip-freertos
- name: nxp-lpcxpresso54618-lwip-freertos
path: nxp/nxp-lpcxpresso54618-lwip-freertos
- name: nxp-lpcxpresso54628-lwip-freertos
path: nxp/nxp-lpcxpresso54628-lwip-freertos
- name: nxp-twrk65f180m-lwip-freertos
path: nxp/nxp-twrk65f180m-lwip-freertos
- name: nxp-twrkv58f220m-lwip-freertos
path: nxp/nxp-twrkv58f220m-lwip-freertos
- name: infineon-xmc4700_4800-lwip-rtx-rtos
path: infineon/infineon-xmc4700_4800-lwip-rtx-rtos
- name: ti
path: ti/ti-ek-tm4c1294xl-http-server
- name: nucleo_f746zg-zephyr-http-client
path: zephyr/http-client
- name: nucleo_f746zg-zephyr-http-server
path: zephyr/http-server
- name: nucleo_f746zg-zephyr-mqtt-aws-client
path: zephyr/mqtt-aws-client
- name: nucleo_f746zg-zephyr-websocket-server
path: zephyr/websocket-server
name: ${{ matrix.example.name }}
steps:
- uses: actions/checkout@v3
- name: ${{ matrix.example.name }}
run: make -C examples/${{ matrix.example.path }} build
-9
View File
@@ -1,9 +0,0 @@
binary/
deps/
docker/
docs/
examples/
platforms/
src/
test/
multilingual/
+3 -3
View File
@@ -1,5 +1,5 @@
Copyright (c) 2004-2013 Sergey Lyubka <valenok@gmail.com>
Copyright (c) 2013-2018 Cesanta Software Limited
Copyright (c) 2004-2013 Sergey Lyubka
Copyright (c) 2013-2021 Cesanta Software Limited
All rights reserved
This software is dual-licensed: you can redistribute it and/or modify
@@ -13,4 +13,4 @@ warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
Alternatively, you can license this software under a commercial
license, as set out in <https://www.cesanta.com/license>.
license, as set out in <https://mongoose.ws/licensing/>.
+164
View File
@@ -0,0 +1,164 @@
SRCS = mongoose.c test/unit_test.c test/packed_fs.c
HDRS = $(wildcard src/*.h) $(wildcard mip/*.h)
DEFS ?= -DMG_MAX_HTTP_HEADERS=7 -DMG_ENABLE_LINES -DMG_ENABLE_PACKED_FS=1 -DMG_ENABLE_SSI=1
C_WARN ?= -Wmissing-prototypes -Wstrict-prototypes
WARN ?= -pedantic -W -Wall -Werror -Wshadow -Wdouble-promotion -fno-common -Wconversion -Wundef $(C_WARN)
OPTS ?= -O3 -g3
VALGRIND_OPTS ?= -O0 -g3
INCS ?= -Isrc -I.
SSL ?= MBEDTLS
CWD ?= $(realpath $(CURDIR))
ENV ?= -e Tmp=. -e WINEDEBUG=-all
DOCKER ?= docker run --platform linux/amd64 --rm $(ENV) -v $(CWD):$(CWD) -w $(CWD)
VCFLAGS = /nologo /W3 /O2 /MD /I. $(DEFS) $(TFLAGS)
IPV6 ?= 1
ASAN ?= -fsanitize=address,undefined -fno-sanitize-recover=all
ASAN_OPTIONS ?= detect_leaks=1
EXAMPLES := $(dir $(wildcard examples/*/Makefile)) examples/stm32/nucleo-f746zg-baremetal
PREFIX ?= /usr/local
VERSION ?= $(shell cut -d'"' -f2 src/version.h)
COMMON_CFLAGS ?= $(WARN) $(INCS) $(DEFS) -DMG_ENABLE_IPV6=$(IPV6) $(TFLAGS)
CFLAGS ?= $(OPTS) $(ASAN) $(COMMON_CFLAGS)
VALGRIND_CFLAGS ?= $(VALGRIND_OPTS) $(COMMON_CFLAGS)
VALGRIND_RUN ?= valgrind --tool=memcheck --gen-suppressions=all --leak-check=full --show-leak-kinds=all --leak-resolution=high --track-origins=yes --error-exitcode=1 --exit-on-first-error=yes
.PHONY: examples test valgrind
ifeq "$(SSL)" "MBEDTLS"
MBEDTLS ?= /usr/local
CFLAGS += -DMG_ENABLE_MBEDTLS=1 -I$(MBEDTLS)/include -I/usr/include
LDFLAGS ?= -L$(MBEDTLS)/lib -lmbedtls -lmbedcrypto -lmbedx509
endif
ifeq "$(SSL)" "OPENSSL"
OPENSSL ?= /usr/local
CFLAGS += -DMG_ENABLE_OPENSSL=1 -I$(OPENSSL)/include
LDFLAGS ?= -L$(OPENSSL)/lib -lssl -lcrypto
endif
all: mg_prefix unamalgamated unpacked test test++ arm examples vc98 vc17 vc22 mingw mingw++ linux linux++ fuzz
examples:
@for X in $(EXAMPLES); do test -f $$X/Makefile || continue; $(MAKE) -C $$X example || exit 1; done
test/packed_fs.c: Makefile src/ssi.h test/fuzz.c test/data/a.txt
$(CC) $(CFLAGS) test/pack.c -o pack
$(RUN) ./pack Makefile src/ssi.h test/fuzz.c test/data/a.txt test/data/range.txt > $@
DIR ?= test/data/
OUT ?= fs_packed.c
mkfs:
$(CC) $(CFLAGS) test/pack.c -o pack
$(RUN) ./pack -s $(DIR) `find $(DIR) -type f` > $(OUT)
# find $(DIR) -type f | sed -e s,^$(DIR),,g -e s,^/,,g
# Check that all external (exported) symbols have "mg_" prefix
mg_prefix: mongoose.c mongoose.h
$(CC) mongoose.c $(CFLAGS) -c -o /tmp/x.o && nm /tmp/x.o | grep ' T' | grep -v 'mg_' ; test $$? = 1
# C++ build
test++: test
test++: CC = g++
test++: C_WARN = -std=c++2a -Wno-vla -Wno-shadow -Wno-missing-field-initializers -Wno-deprecated
musl: test
musl: ASAN =
musl: WARN += -Wno-sign-conversion
musl: CC = $(DOCKER) mdashnet/cc1 gcc
musl: RUN = $(DOCKER) mdashnet/cc1
# Make sure we can build from an unamalgamated sources
unamalgamated: $(HDRS) Makefile test/packed_fs.c
$(CC) src/*.c test/packed_fs.c test/unit_test.c $(CFLAGS) $(LDFLAGS) -g -o unit_test
unpacked:
$(CC) -I. mongoose.c test/unit_test.c -o $@
fuzzer: mongoose.c mongoose.h Makefile test/fuzz.c
clang++ mongoose.c test/fuzz.c $(WARN) $(INCS) $(TFLAGS) -DMG_ENABLE_LINES -fsanitize=fuzzer,signed-integer-overflow,address -Wno-deprecated -Wno-vla-extension -o $@
fuzz: fuzzer
$(RUN) ./fuzzer
unit_test: Makefile mongoose.h $(SRCS)
$(CC) $(SRCS) $(CFLAGS) $(LDFLAGS) -g -o unit_test
# make CC=/usr/local/opt/llvm\@8/bin/clang ASAN_OPTIONS=detect_leaks=1
test: unit_test
ASAN_OPTIONS=$(ASAN_OPTIONS) $(RUN) ./unit_test
coverage: CFLAGS += -coverage
coverage: test
gcov -l -n *.gcno | sed '/^$$/d' | sed 'N;s/\n/ /'
gcov -t mongoose.c > mongoose.gcov
upload-coverage: coverage
curl -s https://codecov.io/bash | /bin/bash
valgrind_unit_test: Makefile mongoose.h $(SRCS)
$(CC) $(SRCS) $(VALGRIND_CFLAGS) $(LDFLAGS) -g -o valgrind_unit_test
valgrind: valgrind_unit_test
$(VALGRIND_RUN) ./valgrind_unit_test
infer:
infer run -- cc test/unit_test.c -c -W -Wall -Werror -Isrc -I. -O2 -DMG_ENABLE_MBEDTLS=1 -DMG_ENABLE_LINES -I/usr/local/Cellar/mbedtls/2.23.0/include -DMG_ENABLE_IPV6=1 -g -o /dev/null
arm: DEFS += -DMG_ENABLE_FILE=0 -DMG_ENABLE_MIP=1 -DMG_ARCH=MG_ARCH_NEWLIB
arm: mongoose.h $(SRCS)
$(DOCKER) mdashnet/armgcc arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb $(SRCS) $(OPTS) $(WARN) $(INCS) $(DEFS) $(TFLAGS) -o unit_test -nostartfiles --specs nosys.specs -e 0
riscv: DEFS += -DMG_ENABLE_FILE=0 -DMG_ENABLE_MIP=1 -DMG_ARCH=MG_ARCH_NEWLIB
riscv: mongoose.h $(SRCS)
$(DOCKER) mdashnet/riscv riscv-none-elf-gcc -march=rv32imc -mabi=ilp32 $(SRCS) $(OPTS) $(WARN) $(INCS) $(DEFS) $(TFLAGS) -o unit_test
vc98: Makefile mongoose.h $(SRCS)
$(DOCKER) mdashnet/vc98 wine cl $(SRCS) $(VCFLAGS) ws2_32.lib /Fe$@.exe
$(DOCKER) mdashnet/vc98 wine $@.exe
# vc17: DEFS += -DMG_ENABLE_IPV6=1
vc17: Makefile mongoose.h $(SRCS)
$(DOCKER) mdashnet/vc17 wine64 cl $(SRCS) $(VCFLAGS) ws2_32.lib /Fe$@.exe
$(DOCKER) mdashnet/vc17 wine64 $@.exe
# vc22: DEFS += -DMG_ENABLE_IPV6=$(IPV6)
vc22: Makefile mongoose.h $(SRCS)
$(DOCKER) mdashnet/vc22 wine64 cl $(SRCS) $(VCFLAGS) ws2_32.lib /Fe$@.exe
$(DOCKER) mdashnet/vc22 wine64 $@.exe
mingw: Makefile mongoose.h $(SRCS)
$(DOCKER) mdashnet/mingw x86_64-w64-mingw32-gcc $(SRCS) -W -Wall -Werror -I. $(DEFS) -lwsock32 -o $@.exe
$(DOCKER) mdashnet/mingw wine64 $@.exe
mingw++: Makefile mongoose.h $(SRCS)
$(DOCKER) mdashnet/mingw x86_64-w64-mingw32-g++ $(SRCS) -W -Wall -Werror -I. $(DEFS) -lwsock32 -o $@.exe
linux: IPV6=0
linux: Makefile mongoose.h $(SRCS)
$(DOCKER) mdashnet/cc2 gcc $(SRCS) $(CFLAGS) $(LDFLAGS) -o unit_test_gcc
$(DOCKER) mdashnet/cc2 ./unit_test_gcc
linux++: CC = g++
linux++: WARN += -Wno-missing-field-initializers
linux++: linux
linux-libs: CFLAGS += -fPIC
linux-libs: mongoose.o
$(CC) mongoose.o $(LDFLAGS) -shared -o libmongoose.so.$(VERSION)
$(AR) rcs libmongoose.a mongoose.o
install: linux-libs
install -Dm644 libmongoose.a libmongoose.so.$(VERSION) $(DESTDIR)$(PREFIX)/lib
ln -s libmongoose.so.$(VERSION) $(DESTDIR)$(PREFIX)/lib/libmongoose.so
install -Dm644 mongoose.h $(DESTDIR)$(PREFIX)/include/mongoose.h
uninstall:
rm -rf $(DESTDIR)$(PREFIX)/lib/libmongoose.a $(DESTDIR)$(PREFIX)/lib/libmongoose.so.$(VERSION) $(DESTDIR)$(PREFIX)/include/mongoose.h $(DESTDIR)$(PREFIX)/lib/libmongoose.so
mongoose.c: Makefile $(wildcard src/*) $(wildcard mip/*.c)
(cat src/license.h; echo; echo '#include "mongoose.h"' ; (for F in src/*.c mip/*.c ; do echo; echo '#ifdef MG_ENABLE_LINES'; echo "#line 1 \"$$F\""; echo '#endif'; cat $$F | sed -e 's,#include ".*,,'; done))> $@
mongoose.h: $(HDRS) Makefile
(cat src/license.h; echo; echo '#ifndef MONGOOSE_H'; echo '#define MONGOOSE_H'; echo; cat src/version.h ; echo; echo '#ifdef __cplusplus'; echo 'extern "C" {'; echo '#endif'; cat src/arch.h src/arch_*.h src/config.h src/str.h src/fmt.h src/log.h src/timer.h src/fs.h src/util.h src/url.h src/iobuf.h src/base64.h src/md5.h src/sha1.h src/event.h src/net.h src/http.h src/ssi.h src/tls.h src/tls_mbed.h src/tls_openssl.h src/ws.h src/sntp.h src/mqtt.h src/dns.h src/json.h src/rpc.h mip/mip.h | sed -e 's,#include ".*,,' -e 's,^#pragma once,,'; echo; echo '#ifdef __cplusplus'; echo '}'; echo '#endif'; echo '#endif // MONGOOSE_H')> $@
clean:
rm -rf $(PROG) *.exe *.o *.dSYM unit_test* valgrind_unit_test* ut fuzzer *.gcov *.gcno *.gcda *.obj *.exe *.ilk *.pdb slow-unit* _CL_* infer-out data.txt crash-* test/packed_fs.c pack unpacked
@for X in $(EXAMPLES); do $(MAKE) -C $$X clean; done
+59 -54
View File
@@ -1,68 +1,73 @@
# Mongoose - Embedded Web Server / Embedded Networking Library
![](https://img.shields.io/badge/license-GPL_2-green.svg "License")
[![License: GPLv2/Commercial](https://img.shields.io/badge/License-GPLv2%20or%20Commercial-green.svg)](https://opensource.org/licenses/gpl-2.0.php)
[![Build Status]( https://github.com/cesanta/mongoose/workflows/build/badge.svg)](https://github.com/cesanta/mongoose/actions)
[![Code Coverage](https://codecov.io/gh/cesanta/mongoose/branch/master/graph/badge.svg)](https://codecov.io/gh/cesanta/mongoose)
[![Fuzzing Status](https://oss-fuzz-build-logs.storage.googleapis.com/badges/mongoose.svg)](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:mongoose)
Mongoose is ideal for embedded environments. 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.
Mongoose is a networking library for C/C++. It implements event-driven
non-blocking APIs for TCP, UDP, HTTP, WebSocket, MQTT. It is 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. Features include:
- [Download Mongoose Source Code here](https://www.cesanta.com/download.html)
- Cross-platform: works on Linux/UNIX, MacOS, Windows, Android, FreeRTOS, etc.
- Supported embedded architectures: ESP32, NRF52, STM32, NXP, and more
- Built-in 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
- Works with any network stack with socket API, like LwIP or FreeRTOS-Plus-TCP
- Very easy to integrate: just copy `mongoose.c` and `mongoose.h` files to your build tree
- Detailed [documentation](https://mongoose.ws/documentation/) and
[tutorials](https://mongoose.ws/tutorials/)
Looking for a complete IoT firmware solution?
Check out [Mongoose OS](https://mongoose-os.com) - open source embedded operating system for low-power connected microcontrollers. Secure, designed for Internet of Things, complete environment for prototyping, development and managing.
# Commercial use
- Mongoose is used by hundreds of businesses, from Fortune500 giants like
Siemens, Schneider Electric, Broadcom, Bosch, Google, Samsung, Qualcomm, Caterpillar to the small businesses
- Used to solve a wide range of business needs, like implementing Web UI
interface on devices, RESTful API services, telemetry data exchange, remote
control for a product, remote software updates, remote monitoring, and others
- Deployed to hundreds of millions devices in production environment worldwide
- See [Case Studies](https://mongoose.ws/case-studies/) from our respected
customers like [Schneider Electric](https://mongoose.ws/case-studies/schneider-electric/) (industrial automation), [Broadcom](https://mongoose.ws/case-studies/broadcom/) (semiconductors), [Pilz](https://mongoose.ws/case-studies/pilz/) (industrial automation), and others
- See [Testimonials](https://mongoose.ws/testimonials/) from engineers that integrated Mongoose in their commercial products
- We provide [Evaluation and Commercial licensing](https://mongoose.ws/licensing/), [support](https://mongoose.ws/support/), consultancy and integration
assistance - don't hesitate to [contact us](https://mongoose.ws/contact/)
# Support
- [Study mongoose example code](https://github.com/cesanta/mongoose/tree/master/examples)
- [Read User Guide and API reference](https://cesanta.com/docs/overview/intro.html)
- [Support Forum - ask your technical questions here](https://community.mongoose-os.com/)
- [Commercial licensing and support available](https://www.cesanta.com/licensing.html)
- [Check our latest releases](https://github.com/cesanta/mongoose/releases)
# Features
# Security
* Cross-platform: works on Linux/UNIX, MacOS, QNX, eCos, Windows, Android,
iPhone, FreeRTOS (TI CC3200, ESP8266), etc
* Supported hardware platforms: TI CC3200, TI MSP432, NRF52, STM32, PIC32, ESP8266, ESP32 and more
* Builtin protocols:
- plain TCP, plain UDP, SSL/TLS (over TCP, one-way or two-way)
- HTTP client, HTTP server
- WebSocket client, WebSocket server
- MQTT client, MQTT broker
- CoAP client, CoAP server
- DNS client, DNS server, async DNS resolver
* Single-threaded, asynchronous, non-blocking core with simple event-based API
* Native support for [PicoTCP embedded TCP/IP stack](http://www.picotcp.com),
[LWIP embedded TCP/IP stack](https://en.wikipedia.org/wiki/LwIP)
* Tiny static and run-time footprint
* Source code is both ISO C and ISO C++ compliant
* Very easy to integrate: just copy
[mongoose.c](https://raw.githubusercontent.com/cesanta/mongoose/master/mongoose.c) and
[mongoose.h](https://raw.githubusercontent.com/cesanta/mongoose/master/mongoose.h)
files to your build tree
We take security seriously:
1. Mongoose repository runs a
[continuous integration test powered by GitHub](https://github.com/cesanta/mongoose/actions),
which runs through hundreds of unit tests on every commit to the repository.
Our [unit tests](https://github.com/cesanta/mongoose/tree/master/test)
are built with modern address sanitizer technologies, which help to find
security vulnerabilities early
2. Mongoose repository is integrated into Google's
[oss-fuzz continuous fuzzer](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:mongoose)
which scans for potential vulnerabilities continuously
3. We receive periodic vulnerability reports from the independent security
groups like
[Cisco Talos](https://www.cisco.com/c/en/us/products/security/talos.html),
[Microsoft Security Response Center](https://www.microsoft.com/en-us/msrc),
[MITRE Corporation](https://www.mitre.org/),
[Compass Security](https://www.compass-security.com/en/) and others.
In case of the vulnerability found, we act according to the industry best
practice: hold on to the publication, fix the software and notify all our
customers that have an appropriate subscription
4. Some of our customers (for example NASA)
have specific security requirements and run independent security audits,
of which we get notified and in case of any issue, act similar to (3).
# Licensing
Mongoose is released under Commercial and [GNU GPL v.2](http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) open source licenses.
Commercial Projects: [Contact us for commercial license.](https://www.cesanta.com/contact.html)
# 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:
![](http://www.cesanta.com/images/dashboard.png)
[Developing a new product? Contact us today to discuss how Mongoose can help.](https://www.cesanta.com/contact.html)
# Contributions
To submit contributions, sign [Cesanta CLA](https://cesanta.com/cla.html)
and send GitHub pull request.
Contributions are welcome! Please follow the guidelines below:
# Looking for a pre-compiled Mongoose web server Windows or Mac binary?
- [Download pre-compiled Mongoose web server binary.](https://www.cesanta.com/binary.html)
- Sign [Cesanta CLA](https://cesanta.com/cla.html) and send GitHub pull request
- Make sure that PRs have only one commit, and deal with one issue only
+4188
View File
File diff suppressed because it is too large. Load diff
-16
View File
@@ -1,16 +0,0 @@
---
items:
- { name: mbuf.h }
- { name: mg_net.h }
- { name: mg_http.h }
- { name: mg_http_server.h }
- { name: mg_http_client.h }
- { name: mg_dns.h }
- { name: mg_dns_server.h }
- { name: mg_resolv.h }
- { name: mg_mqtt.h }
- { name: mg_mqtt_server.h }
- { name: mg_coap.h }
- { name: mg_util.h }
- { name: mg_uri.h }
---
-23
View File
@@ -1,23 +0,0 @@
---
title: "mbuf.h"
symbol_kind: "intro"
decl_name: "mbuf.h"
items:
- { name: mbuf_append.md }
- { name: mbuf_append_and_free.md }
- { name: mbuf_clear.md }
- { name: mbuf_free.md }
- { name: mbuf_init.md }
- { name: mbuf_insert.md }
- { name: mbuf_move.md }
- { name: mbuf_remove.md }
- { name: mbuf_resize.md }
- { name: mbuf_trim.md }
- { name: struct_mbuf.md }
---
Mbufs are mutable/growing memory buffers, like C++ strings.
Mbuf can append data to the end of a buffer or insert data into arbitrary
position in the middle of a buffer. The buffer grows automatically when
needed.
-12
View File
@@ -1,12 +0,0 @@
---
title: "mbuf_append()"
decl_name: "mbuf_append"
symbol_kind: "func"
signature: |
size_t mbuf_append(struct mbuf *, const void *data, size_t data_size);
---
Appends data to the Mbuf.
Returns the number of bytes appended or 0 if out of memory.
-13
View File
@@ -1,13 +0,0 @@
---
title: "mbuf_append_and_free()"
decl_name: "mbuf_append_and_free"
symbol_kind: "func"
signature: |
size_t mbuf_append_and_free(struct mbuf *, void *data, size_t data_size);
---
Appends data to the Mbuf and frees it (data must be heap-allocated).
Returns the number of bytes appended or 0 if out of memory.
data is freed irrespective of return value.
-10
View File
@@ -1,10 +0,0 @@
---
title: "mbuf_clear()"
decl_name: "mbuf_clear"
symbol_kind: "func"
signature: |
void mbuf_clear(struct mbuf *);
---
Removes all the data from mbuf (if any).
-10
View File
@@ -1,10 +0,0 @@
---
title: "mbuf_free()"
decl_name: "mbuf_free"
symbol_kind: "func"
signature: |
void mbuf_free(struct mbuf *);
---
Frees the space allocated for the mbuffer and resets the mbuf structure.
-11
View File
@@ -1,11 +0,0 @@
---
title: "mbuf_init()"
decl_name: "mbuf_init"
symbol_kind: "func"
signature: |
void mbuf_init(struct mbuf *, size_t initial_capacity);
---
Initialises an Mbuf.
`initial_capacity` specifies the initial capacity of the mbuf.
-14
View File
@@ -1,14 +0,0 @@
---
title: "mbuf_insert()"
decl_name: "mbuf_insert"
symbol_kind: "func"
signature: |
size_t mbuf_insert(struct mbuf *, size_t, const void *, size_t);
---
Inserts data at a specified offset in the Mbuf.
Existing data will be shifted forwards and the buffer will
be grown if necessary.
Returns the number of bytes inserted.
-10
View File
@@ -1,10 +0,0 @@
---
title: "mbuf_move()"
decl_name: "mbuf_move"
symbol_kind: "func"
signature: |
void mbuf_move(struct mbuf *from, struct mbuf *to);
---
Moves the state from one mbuf to the other.
-10
View File
@@ -1,10 +0,0 @@
---
title: "mbuf_remove()"
decl_name: "mbuf_remove"
symbol_kind: "func"
signature: |
void mbuf_remove(struct mbuf *, size_t data_size);
---
Removes `data_size` bytes from the beginning of the buffer.
-13
View File
@@ -1,13 +0,0 @@
---
title: "mbuf_resize()"
decl_name: "mbuf_resize"
symbol_kind: "func"
signature: |
void mbuf_resize(struct mbuf *, size_t new_size);
---
Resizes an Mbuf.
If `new_size` is smaller than buffer's `len`, the
resize is not performed.
-10
View File
@@ -1,10 +0,0 @@
---
title: "mbuf_trim()"
decl_name: "mbuf_trim"
symbol_kind: "func"
signature: |
void mbuf_trim(struct mbuf *);
---
Shrinks an Mbuf by resizing its `size` to `len`.
-14
View File
@@ -1,14 +0,0 @@
---
title: "struct mbuf"
decl_name: "struct mbuf"
symbol_kind: "struct"
signature: |
struct mbuf {
char *buf; /* Buffer pointer */
size_t len; /* Data length. Data is located between offset 0 and len. */
size_t size; /* Buffer size allocated by realloc(1). Must be >= len */
};
---
Memory buffer descriptor
-26
View File
@@ -1,26 +0,0 @@
---
title: "CoAP API reference"
symbol_kind: "intro"
decl_name: "mg_coap.h"
items:
- { name: mg_coap_add_option.md }
- { name: mg_coap_compose.md }
- { name: mg_coap_free_options.md }
- { name: mg_coap_parse.md }
- { name: mg_coap_send_ack.md }
- { name: mg_coap_send_message.md }
- { name: mg_set_protocol_coap.md }
- { name: struct_mg_coap_message.md }
- { name: struct_mg_coap_option.md }
---
CoAP message format:
```
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
|Ver| T | TKL | Code | Message ID | Token (if any, TKL bytes) ...
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
| Options (if any) ... |1 1 1 1 1 1 1 1| Payload (if any) ...
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
```
@@ -1,14 +0,0 @@
---
title: "mg_coap_add_option()"
decl_name: "mg_coap_add_option"
symbol_kind: "func"
signature: |
struct mg_coap_option *mg_coap_add_option(struct mg_coap_message *cm,
uint32_t number, char *value,
size_t len);
---
Adds a new option to mg_coap_message structure.
Returns pointer to the newly created option.
Note: options must be freed by using mg_coap_free_options
-12
View File
@@ -1,12 +0,0 @@
---
title: "mg_coap_compose()"
decl_name: "mg_coap_compose"
symbol_kind: "func"
signature: |
uint32_t mg_coap_compose(struct mg_coap_message *cm, struct mbuf *io);
---
Composes CoAP message from mg_coap_message structure.
This is a helper function.
Return value: see `mg_coap_send_message()`
@@ -1,11 +0,0 @@
---
title: "mg_coap_free_options()"
decl_name: "mg_coap_free_options"
symbol_kind: "func"
signature: |
void mg_coap_free_options(struct mg_coap_message *cm);
---
Frees the memory allocated for options.
If the cm parameter doesn't contain any option it does nothing.
-22
View File
@@ -1,22 +0,0 @@
---
title: "mg_coap_parse()"
decl_name: "mg_coap_parse"
symbol_kind: "func"
signature: |
uint32_t mg_coap_parse(struct mbuf *io, struct mg_coap_message *cm);
---
Parses CoAP message and fills mg_coap_message and returns cm->flags.
This is a helper function.
NOTE: usually CoAP works over UDP, so lack of data means format error.
But, in theory, it is possible to use CoAP over TCP (according to RFC)
The caller has to check results and treat COAP_NOT_ENOUGH_DATA according to
underlying protocol:
- in case of UDP COAP_NOT_ENOUGH_DATA means COAP_FORMAT_ERROR,
- in case of TCP client can try to receive more data
Return value: see `mg_coap_send_message()`
-12
View File
@@ -1,12 +0,0 @@
---
title: "mg_coap_send_ack()"
decl_name: "mg_coap_send_ack"
symbol_kind: "func"
signature: |
uint32_t mg_coap_send_ack(struct mg_connection *nc, uint16_t msg_id);
---
Composes CoAP acknowledgement from `mg_coap_message`
and sends it into `nc` connection.
Return value: see `mg_coap_send_message()`
@@ -1,19 +0,0 @@
---
title: "mg_coap_send_message()"
decl_name: "mg_coap_send_message"
symbol_kind: "func"
signature: |
uint32_t mg_coap_send_message(struct mg_connection *nc,
struct mg_coap_message *cm);
---
Composes a CoAP message from `mg_coap_message`
and sends it into `nc` connection.
Returns 0 on success. On error, it is a bitmask:
- `#define MG_COAP_ERROR 0x10000`
- `#define MG_COAP_FORMAT_ERROR (MG_COAP_ERROR | 0x20000)`
- `#define MG_COAP_IGNORE (MG_COAP_ERROR | 0x40000)`
- `#define MG_COAP_NOT_ENOUGH_DATA (MG_COAP_ERROR | 0x80000)`
- `#define MG_COAP_NETWORK_ERROR (MG_COAP_ERROR | 0x100000)`
@@ -1,10 +0,0 @@
---
title: "mg_set_protocol_coap()"
decl_name: "mg_set_protocol_coap"
symbol_kind: "func"
signature: |
int mg_set_protocol_coap(struct mg_connection *nc);
---
Sets CoAP protocol handler - triggers CoAP specific events.
@@ -1,20 +0,0 @@
---
title: "struct mg_coap_message"
decl_name: "struct mg_coap_message"
symbol_kind: "struct"
signature: |
struct mg_coap_message {
uint32_t flags;
uint8_t msg_type;
uint8_t code_class;
uint8_t code_detail;
uint16_t msg_id;
struct mg_str token;
struct mg_coap_option *options;
struct mg_str payload;
struct mg_coap_option *optiomg_tail;
};
---
CoAP message. See RFC 7252 for details.
@@ -1,16 +0,0 @@
---
title: "struct mg_coap_option"
decl_name: "struct mg_coap_option"
symbol_kind: "struct"
signature: |
struct mg_coap_option {
struct mg_coap_option *next;
uint32_t number;
struct mg_str value;
};
---
CoAP options.
Use mg_coap_add_option and mg_coap_free_options
for creation and destruction.
-20
View File
@@ -1,20 +0,0 @@
---
title: "DNS API reference"
symbol_kind: "intro"
decl_name: "mg_dns.h"
items:
- { name: mg_dns_copy_questions.md }
- { name: mg_dns_encode_name.md }
- { name: mg_dns_encode_record.md }
- { name: mg_dns_insert_header.md }
- { name: mg_dns_parse_record_data.md }
- { name: mg_dns_uncompress_name.md }
- { name: mg_parse_dns.md }
- { name: mg_send_dns_query.md }
- { name: mg_set_protocol_dns.md }
- { name: struct_mg_dns_message.md }
- { name: struct_mg_dns_resource_record.md }
---
@@ -1,15 +0,0 @@
---
title: "mg_dns_copy_questions()"
decl_name: "mg_dns_copy_questions"
symbol_kind: "func"
signature: |
int mg_dns_copy_questions(struct mbuf *io, struct mg_dns_message *msg);
---
Appends already encoded questions from an existing message.
This is useful when generating a DNS reply message which includes
all question records.
Returns the number of appended bytes.
-10
View File
@@ -1,10 +0,0 @@
---
title: "mg_dns_encode_name()"
decl_name: "mg_dns_encode_name"
symbol_kind: "func"
signature: |
int mg_dns_encode_name(struct mbuf *io, const char *name, size_t len);
---
Encodes a DNS name.
@@ -1,25 +0,0 @@
---
title: "mg_dns_encode_record()"
decl_name: "mg_dns_encode_record"
symbol_kind: "func"
signature: |
int mg_dns_encode_record(struct mbuf *io, struct mg_dns_resource_record *rr,
const char *name, size_t nlen, const void *rdata,
size_t rlen);
---
Encodes and appends a DNS resource record to an IO buffer.
The record metadata is taken from the `rr` parameter, while the name and data
are taken from the parameters, encoded in the appropriate format depending on
record type and stored in the IO buffer. The encoded values might contain
offsets within the IO buffer. It's thus important that the IO buffer doesn't
get trimmed while a sequence of records are encoded while preparing a DNS
reply.
This function doesn't update the `name` and `rdata` pointers in the `rr`
struct because they might be invalidated as soon as the IO buffer grows
again.
Returns the number of bytes appended or -1 in case of error.
@@ -1,13 +0,0 @@
---
title: "mg_dns_insert_header()"
decl_name: "mg_dns_insert_header"
symbol_kind: "func"
signature: |
int mg_dns_insert_header(struct mbuf *io, size_t pos,
struct mg_dns_message *msg);
---
Inserts a DNS header to an IO buffer.
Returns the number of bytes inserted.
@@ -1,20 +0,0 @@
---
title: "mg_dns_parse_record_data()"
decl_name: "mg_dns_parse_record_data"
symbol_kind: "func"
signature: |
int mg_dns_parse_record_data(struct mg_dns_message *msg,
struct mg_dns_resource_record *rr, void *data,
size_t data_len);
---
Parses the record data from a DNS resource record.
- A: struct in_addr *ina
- AAAA: struct in6_addr *ina
- CNAME: char buffer
Returns -1 on error.
TODO(mkm): MX
@@ -1,21 +0,0 @@
---
title: "mg_dns_uncompress_name()"
decl_name: "mg_dns_uncompress_name"
symbol_kind: "func"
signature: |
size_t mg_dns_uncompress_name(struct mg_dns_message *msg, struct mg_str *name,
char *dst, int dst_len);
---
Uncompresses a DNS compressed name.
The containing DNS message is required because of the compressed encoding
and reference suffixes present elsewhere in the packet.
If the name is less than `dst_len` characters long, the remainder
of `dst` is terminated with `\0` characters. Otherwise, `dst` is not
terminated.
If `dst_len` is 0 `dst` can be NULL.
Returns the uncompressed name length.
-10
View File
@@ -1,10 +0,0 @@
---
title: "mg_parse_dns()"
decl_name: "mg_parse_dns"
symbol_kind: "func"
signature: |
int mg_parse_dns(const char *buf, int len, struct mg_dns_message *msg);
---
Low-level: parses a DNS response.
-11
View File
@@ -1,11 +0,0 @@
---
title: "mg_send_dns_query()"
decl_name: "mg_send_dns_query"
symbol_kind: "func"
signature: |
void mg_send_dns_query(struct mg_connection *nc, const char *name,
int query_type);
---
Sends a DNS query to the remote end.
@@ -1,19 +0,0 @@
---
title: "mg_set_protocol_dns()"
decl_name: "mg_set_protocol_dns"
symbol_kind: "func"
signature: |
void mg_set_protocol_dns(struct mg_connection *nc);
---
Attaches a built-in DNS event handler to the given listening connection.
The DNS event handler parses the incoming UDP packets, treating them as DNS
requests. If an incoming packet gets successfully parsed by the DNS event
handler, a user event handler will receive an `MG_DNS_REQUEST` event, with
`ev_data` pointing to the parsed `struct mg_dns_message`.
See
[captive_dns_server](https://github.com/cesanta/mongoose/tree/master/examples/captive_dns_server)
example on how to handle DNS request and send DNS reply.
@@ -1,18 +0,0 @@
---
title: "struct mg_dns_message"
decl_name: "struct mg_dns_message"
symbol_kind: "struct"
signature: |
struct mg_dns_message {
struct mg_str pkt; /* packet body */
uint16_t flags;
uint16_t transaction_id;
int num_questions;
int num_answers;
struct mg_dns_resource_record questions[MG_MAX_DNS_QUESTIONS];
struct mg_dns_resource_record answers[MG_MAX_DNS_ANSWERS];
};
---
DNS message (request and response).
@@ -1,17 +0,0 @@
---
title: "struct mg_dns_resource_record"
decl_name: "struct mg_dns_resource_record"
symbol_kind: "struct"
signature: |
struct mg_dns_resource_record {
struct mg_str name; /* buffer with compressed name */
int rtype;
int rclass;
int ttl;
enum mg_dns_resource_record_kind kind;
struct mg_str rdata; /* protocol data (can be a compressed name) */
};
---
DNS resource record.
-12
View File
@@ -1,12 +0,0 @@
---
title: "DNS server API reference"
symbol_kind: "intro"
decl_name: "mg_dns_server.h"
items:
- { name: mg_dns_create_reply.md }
- { name: mg_dns_reply_record.md }
- { name: mg_dns_send_reply.md }
---
Disabled by default; enable with `-DMG_ENABLE_DNS_SERVER`.
@@ -1,36 +0,0 @@
---
title: "mg_dns_create_reply()"
decl_name: "mg_dns_create_reply"
symbol_kind: "func"
signature: |
struct mg_dns_reply mg_dns_create_reply(struct mbuf *io,
struct mg_dns_message *msg);
---
Creates a DNS reply.
The reply will be based on an existing query message `msg`.
The query body will be appended to the output buffer.
"reply + recursion allowed" will be added to the message flags and the
message's num_answers will be set to 0.
Answer records can be appended with `mg_dns_send_reply` or by lower
level function defined in the DNS API.
In order to send a reply use `mg_dns_send_reply`.
It's possible to use a connection's send buffer as reply buffer,
and it will work for both UDP and TCP connections.
Example:
```c
reply = mg_dns_create_reply(&nc->send_mbuf, msg);
for (i = 0; i < msg->num_questions; i++) {
rr = &msg->questions[i];
if (rr->rtype == MG_DNS_A_RECORD) {
mg_dns_reply_record(&reply, rr, 3600, &dummy_ip_addr, 4);
}
}
mg_dns_send_reply(nc, &reply);
```
@@ -1,18 +0,0 @@
---
title: "mg_dns_reply_record()"
decl_name: "mg_dns_reply_record"
symbol_kind: "func"
signature: |
int mg_dns_reply_record(struct mg_dns_reply *reply,
struct mg_dns_resource_record *question,
const char *name, int rtype, int ttl, const void *rdata,
size_t rdata_len);
---
Appends a DNS reply record to the IO buffer and to the DNS message.
The message's num_answers field will be incremented. It's the caller's duty
to ensure num_answers is properly initialised.
Returns -1 on error.
@@ -1,19 +0,0 @@
---
title: "mg_dns_send_reply()"
decl_name: "mg_dns_send_reply"
symbol_kind: "func"
signature: |
void mg_dns_send_reply(struct mg_connection *nc, struct mg_dns_reply *r);
---
Sends a DNS reply through a connection.
The DNS data is stored in an IO buffer pointed by reply structure in `r`.
This function mutates the content of that buffer in order to ensure that
the DNS header reflects the size and flags of the message, that might have
been updated either with `mg_dns_reply_record` or by direct manipulation of
`r->message`.
Once sent, the IO buffer will be trimmed unless the reply IO buffer
is the connection's send buffer and the connection is not in UDP mode.
-26
View File
@@ -1,26 +0,0 @@
---
title: "Common API reference"
symbol_kind: "intro"
decl_name: "mg_http.h"
items:
- { name: mg_connect_ws.md }
- { name: mg_connect_ws_opt.md }
- { name: mg_http_is_authorized.md }
- { name: mg_http_send_digest_auth_request.md }
- { name: mg_printf_websocket_frame.md }
- { name: mg_send_websocket_frame.md }
- { name: mg_send_websocket_framev.md }
- { name: mg_send_websocket_handshake.md }
- { name: mg_send_websocket_handshake2.md }
- { name: mg_send_websocket_handshake3.md }
- { name: mg_send_websocket_handshake3v.md }
- { name: mg_set_protocol_http_websocket.md }
- { name: mg_url_decode.md }
- { name: struct_http_message.md }
- { name: struct_mg_http_multipart_part.md }
- { name: struct_mg_ssi_call_ctx.md }
- { name: struct_websocket_message.md }
---
-29
View File
@@ -1,29 +0,0 @@
---
title: "mg_connect_ws()"
decl_name: "mg_connect_ws"
symbol_kind: "func"
signature: |
struct mg_connection *mg_connect_ws(struct mg_mgr *mgr,
MG_CB(mg_event_handler_t event_handler,
void *user_data);
---
Helper function that creates an outbound WebSocket connection.
`url` is a URL to connect to. It must be properly URL-encoded, e.g. have
no spaces, etc. By default, `mg_connect_ws()` sends Connection and
Host headers. `extra_headers` is an extra HTTP header to send, e.g.
`"User-Agent: my-app\r\n"`.
If `protocol` is not NULL, then a `Sec-WebSocket-Protocol` header is sent.
Examples:
```c
nc1 = mg_connect_ws(mgr, ev_handler_1, "ws://echo.websocket.org", NULL,
NULL);
nc2 = mg_connect_ws(mgr, ev_handler_1, "wss://echo.websocket.org", NULL,
NULL);
nc3 = mg_connect_ws(mgr, ev_handler_1, "ws://api.cesanta.com",
"clubby.cesanta.com", NULL);
```
-14
View File
@@ -1,14 +0,0 @@
---
title: "mg_connect_ws_opt()"
decl_name: "mg_connect_ws_opt"
symbol_kind: "func"
signature: |
struct mg_connection *mg_connect_ws_opt(
struct mg_mgr *mgr, MG_CB(mg_event_handler_t ev_handler, void *user_data);
---
Helper function that creates an outbound WebSocket connection
Mostly identical to `mg_connect_ws`, but allows to provide extra parameters
(for example, SSL parameters)
@@ -1,16 +0,0 @@
---
title: "mg_http_is_authorized()"
decl_name: "mg_http_is_authorized"
symbol_kind: "func"
signature: |
int mg_http_is_authorized(struct http_message *hm, struct mg_str path,
const char *domain, const char *passwords_file,
int flags);
---
Checks whether an http request is authorized. `domain` is the authentication
realm, `passwords_file` is a htdigest file (can be created e.g. with
`htdigest` utility). If either `domain` or `passwords_file` is NULL, this
function always returns 1; otherwise checks the authentication in the
http request and returns 1 only if there is a match; 0 otherwise.
@@ -1,11 +0,0 @@
---
title: "mg_http_send_digest_auth_request()"
decl_name: "mg_http_send_digest_auth_request"
symbol_kind: "func"
signature: |
void mg_http_send_digest_auth_request(struct mg_connection *c,
const char *domain);
---
Sends 401 Unauthorized response.
@@ -1,14 +0,0 @@
---
title: "mg_printf_websocket_frame()"
decl_name: "mg_printf_websocket_frame"
symbol_kind: "func"
signature: |
void mg_printf_websocket_frame(struct mg_connection *nc, int op_and_flags,
const char *fmt, ...);
---
Sends WebSocket frame to the remote end.
Like `mg_send_websocket_frame()`, but allows to create formatted messages
with `printf()`-like semantics.
@@ -1,26 +0,0 @@
---
title: "mg_send_websocket_frame()"
decl_name: "mg_send_websocket_frame"
symbol_kind: "func"
signature: |
void mg_send_websocket_frame(struct mg_connection *nc, int op_and_flags,
const void *data, size_t data_len);
---
Send WebSocket frame to the remote end.
`op_and_flags` specifies the frame's type. It's one of:
- WEBSOCKET_OP_CONTINUE
- WEBSOCKET_OP_TEXT
- WEBSOCKET_OP_BINARY
- WEBSOCKET_OP_CLOSE
- WEBSOCKET_OP_PING
- WEBSOCKET_OP_PONG
Orred with one of the flags:
- WEBSOCKET_DONT_FIN: Don't set the FIN flag on the frame to be sent.
`data` and `data_len` contain frame data.
@@ -1,12 +0,0 @@
---
title: "mg_send_websocket_framev()"
decl_name: "mg_send_websocket_framev"
symbol_kind: "func"
signature: |
void mg_send_websocket_framev(struct mg_connection *nc, int op_and_flags,
const struct mg_str *strings, int num_strings);
---
Like `mg_send_websocket_frame()`, but composes a single frame from multiple
buffers.
@@ -1,22 +0,0 @@
---
title: "mg_send_websocket_handshake()"
decl_name: "mg_send_websocket_handshake"
symbol_kind: "func"
signature: |
void mg_send_websocket_handshake(struct mg_connection *nc, const char *uri,
const char *extra_headers);
---
Send websocket handshake to the server.
`nc` must be a valid connection, connected to a server. `uri` is an URI
to fetch, extra_headers` is extra HTTP headers to send or `NULL`.
This function is intended to be used by websocket client.
Note that the Host header is mandatory in HTTP/1.1 and must be
included in `extra_headers`. `mg_send_websocket_handshake2` offers
a better API for that.
Deprecated in favour of `mg_send_websocket_handshake2`
@@ -1,19 +0,0 @@
---
title: "mg_send_websocket_handshake2()"
decl_name: "mg_send_websocket_handshake2"
symbol_kind: "func"
signature: |
void mg_send_websocket_handshake2(struct mg_connection *nc, const char *path,
const char *host, const char *protocol,
const char *extra_headers);
---
Send websocket handshake to the server.
`nc` must be a valid connection, connected to a server. `uri` is an URI
to fetch, `host` goes into the `Host` header, `protocol` goes into the
`Sec-WebSocket-Proto` header (NULL to omit), extra_headers` is extra HTTP
headers to send or `NULL`.
This function is intended to be used by websocket client.
@@ -1,13 +0,0 @@
---
title: "mg_send_websocket_handshake3()"
decl_name: "mg_send_websocket_handshake3"
symbol_kind: "func"
signature: |
void mg_send_websocket_handshake3(struct mg_connection *nc, const char *path,
const char *host, const char *protocol,
const char *extra_headers, const char *user,
const char *pass);
---
Like mg_send_websocket_handshake2 but also passes basic auth header
@@ -1,17 +0,0 @@
---
title: "mg_send_websocket_handshake3v()"
decl_name: "mg_send_websocket_handshake3v"
symbol_kind: "func"
signature: |
void mg_send_websocket_handshake3v(struct mg_connection *nc,
const struct mg_str path,
const struct mg_str host,
const struct mg_str protocol,
const struct mg_str extra_headers,
const struct mg_str user,
const struct mg_str pass);
---
Same as mg_send_websocket_handshake3 but with strings not necessarily
NUL-temrinated
@@ -1,61 +0,0 @@
---
title: "mg_set_protocol_http_websocket()"
decl_name: "mg_set_protocol_http_websocket"
symbol_kind: "func"
signature: |
void mg_set_protocol_http_websocket(struct mg_connection *nc);
---
Attaches a built-in HTTP event handler to the given connection.
The user-defined event handler will receive following extra events:
- MG_EV_HTTP_REQUEST: HTTP request has arrived. Parsed HTTP request
is passed as
`struct http_message` through the handler's `void *ev_data` pointer.
- MG_EV_HTTP_REPLY: The HTTP reply has arrived. The parsed HTTP reply is
passed as `struct http_message` through the handler's `void *ev_data`
pointer.
- MG_EV_HTTP_CHUNK: The HTTP chunked-encoding chunk has arrived.
The parsed HTTP reply is passed as `struct http_message` through the
handler's `void *ev_data` pointer. `http_message::body` would contain
incomplete, reassembled HTTP body.
It will grow with every new chunk that arrives, and it can
potentially consume a lot of memory. An event handler may process
the body as chunks are coming, and signal Mongoose to delete processed
body by setting `MG_F_DELETE_CHUNK` in `mg_connection::flags`. When
the last zero chunk is received,
Mongoose sends `MG_EV_HTTP_REPLY` event with
full reassembled body (if handler did not signal to delete chunks) or
with empty body (if handler did signal to delete chunks).
- MG_EV_WEBSOCKET_HANDSHAKE_REQUEST: server has received the WebSocket
handshake request. `ev_data` contains parsed HTTP request.
- MG_EV_WEBSOCKET_HANDSHAKE_DONE: server has completed the WebSocket
handshake. `ev_data` is a `struct http_message` containing the
client's request (server mode) or server's response (client).
In client mode handler can examine `resp_code`, which should be 101.
- MG_EV_WEBSOCKET_FRAME: new WebSocket frame has arrived. `ev_data` is
`struct websocket_message *`
When compiled with MG_ENABLE_HTTP_STREAMING_MULTIPART, Mongoose parses
multipart requests and splits them into separate events:
- MG_EV_HTTP_MULTIPART_REQUEST: Start of the request.
This event is sent before body is parsed. After this, the user
should expect a sequence of PART_BEGIN/DATA/END requests.
This is also the last time when headers and other request fields are
accessible.
- MG_EV_HTTP_PART_BEGIN: Start of a part of a multipart message.
Argument: mg_http_multipart_part with var_name and file_name set
(if present). No data is passed in this message.
- MG_EV_HTTP_PART_DATA: new portion of data from the multipart message.
Argument: mg_http_multipart_part. var_name and file_name are preserved,
data is available in mg_http_multipart_part.data.
- MG_EV_HTTP_PART_END: End of the current part. var_name, file_name are
the same, no data in the message. If status is 0, then the part is
properly terminated with a boundary, status < 0 means that connection
was terminated.
- MG_EV_HTTP_MULTIPART_REQUEST_END: End of the multipart request.
Argument: mg_http_multipart_part, var_name and file_name are NULL,
status = 0 means request was properly closed, < 0 means connection
was terminated (note: in this case both PART_END and REQUEST_END are
delivered).
-19
View File
@@ -1,19 +0,0 @@
---
title: "mg_url_decode()"
decl_name: "mg_url_decode"
symbol_kind: "func"
signature: |
int mg_url_decode(const char *src, int src_len, char *dst, int dst_len,
int is_form_url_encoded);
---
Decodes a URL-encoded string.
Source string is specified by (`src`, `src_len`), and destination is
(`dst`, `dst_len`). If `is_form_url_encoded` is non-zero, then
`+` character is decoded as a blank space character. This function
guarantees to NUL-terminate the destination. If destination is too small,
then the source string is partially decoded and `-1` is returned.
*Otherwise,
a length of the decoded string is returned, not counting final NUL.
@@ -1,36 +0,0 @@
---
title: "struct http_message"
decl_name: "struct http_message"
symbol_kind: "struct"
signature: |
struct http_message {
struct mg_str message; /* Whole message: request line + headers + body */
struct mg_str body; /* Message body. 0-length for requests with no body */
/* HTTP Request line (or HTTP response line) */
struct mg_str method; /* "GET" */
struct mg_str uri; /* "/my_file.html" */
struct mg_str proto; /* "HTTP/1.1" -- for both request and response */
/* For responses, code and response status message are set */
int resp_code;
struct mg_str resp_status_msg;
/*
* Query-string part of the URI. For example, for HTTP request
* GET /foo/bar?param1=val1&param2=val2
* | uri | query_string |
*
* Note that question mark character doesn't belong neither to the uri,
* nor to the query_string
*/
struct mg_str query_string;
/* Headers */
struct mg_str header_names[MG_MAX_HTTP_HEADERS];
struct mg_str header_values[MG_MAX_HTTP_HEADERS];
};
---
HTTP message
@@ -1,24 +0,0 @@
---
title: "struct mg_http_multipart_part"
decl_name: "struct mg_http_multipart_part"
symbol_kind: "struct"
signature: |
struct mg_http_multipart_part {
const char *file_name;
const char *var_name;
struct mg_str data;
int status; /* <0 on error */
void *user_data;
/*
* User handler can indicate how much of the data was consumed
* by setting this variable. By default, it is assumed that all
* data has been consumed by the handler.
* If not all data was consumed, user's handler will be invoked again later
* with the remainder.
*/
size_t num_data_consumed;
};
---
HTTP multipart part
@@ -1,14 +0,0 @@
---
title: "struct mg_ssi_call_ctx"
decl_name: "struct mg_ssi_call_ctx"
symbol_kind: "struct"
signature: |
struct mg_ssi_call_ctx {
struct http_message *req; /* The request being processed. */
struct mg_str file; /* Filesystem path of the file being processed. */
struct mg_str arg; /* The argument passed to the tag: <!-- call arg -->. */
};
---
SSI call context
@@ -1,14 +0,0 @@
---
title: "struct websocket_message"
decl_name: "struct websocket_message"
symbol_kind: "struct"
signature: |
struct websocket_message {
unsigned char *data;
size_t size;
unsigned char flags;
};
---
WebSocket message
-12
View File
@@ -1,12 +0,0 @@
---
title: "Client API reference"
symbol_kind: "intro"
decl_name: "mg_http_client.h"
items:
- { name: mg_connect_http.md }
- { name: mg_connect_http_opt.md }
- { name: mg_http_create_digest_auth_header.md }
---
@@ -1,33 +0,0 @@
---
title: "mg_connect_http()"
decl_name: "mg_connect_http"
symbol_kind: "func"
signature: |
struct mg_connection *mg_connect_http(
struct mg_mgr *mgr,
MG_CB(mg_event_handler_t event_handler, void *user_data);
---
Helper function that creates an outbound HTTP connection.
`url` is the URL to fetch. It must be properly URL-encoded, e.g. have
no spaces, etc. By default, `mg_connect_http()` sends the Connection and
Host headers. `extra_headers` is an extra HTTP header to send, e.g.
`"User-Agent: my-app\r\n"`.
If `post_data` is NULL, then a GET request is created. Otherwise, a POST
request is created with the specified POST data. Note that if the data being
posted is a form submission, the `Content-Type` header should be set
accordingly (see example below).
Examples:
```c
nc1 = mg_connect_http(mgr, ev_handler_1, "http://www.google.com", NULL,
NULL);
nc2 = mg_connect_http(mgr, ev_handler_1, "https://github.com", NULL, NULL);
nc3 = mg_connect_http(
mgr, ev_handler_1, "my_server:8000/form_submit/",
"Content-Type: application/x-www-form-urlencoded\r\n",
"var_1=value_1&var_2=value_2");
```
@@ -1,15 +0,0 @@
---
title: "mg_connect_http_opt()"
decl_name: "mg_connect_http_opt"
symbol_kind: "func"
signature: |
struct mg_connection *mg_connect_http_opt(
struct mg_mgr *mgr, MG_CB(mg_event_handler_t ev_handler, void *user_data);
---
Helper function that creates an outbound HTTP connection.
Mostly identical to mg_connect_http, but allows you to provide extra
*parameters
(for example, SSL parameters)
@@ -1,13 +0,0 @@
---
title: "mg_http_create_digest_auth_header()"
decl_name: "mg_http_create_digest_auth_header"
symbol_kind: "func"
signature: |
int mg_http_create_digest_auth_header(char *buf, size_t buf_len,
const char *method, const char *uri,
const char *auth_domain, const char *user,
const char *passwd, const char *nonce);
---
Creates digest authentication header for a client request.
-33
View File
@@ -1,33 +0,0 @@
---
title: "Server API reference"
symbol_kind: "intro"
decl_name: "mg_http_server.h"
items:
- { name: mg_check_digest_auth.md }
- { name: mg_file_upload_handler.md }
- { name: mg_get_http_basic_auth.md }
- { name: mg_get_http_header.md }
- { name: mg_get_http_var.md }
- { name: mg_http_check_digest_auth.md }
- { name: mg_http_parse_header.md }
- { name: mg_http_parse_header2.md }
- { name: mg_http_reverse_proxy.md }
- { name: mg_http_send_error.md }
- { name: mg_http_send_redirect.md }
- { name: mg_http_serve_file.md }
- { name: mg_parse_http.md }
- { name: mg_parse_http_basic_auth.md }
- { name: mg_parse_multipart.md }
- { name: mg_printf_html_escape.md }
- { name: mg_printf_http_chunk.md }
- { name: mg_register_http_endpoint.md }
- { name: mg_send_head.md }
- { name: mg_send_http_chunk.md }
- { name: mg_send_response_line.md }
- { name: mg_serve_http.md }
- { name: mg_fu_fname_fn.md }
- { name: struct_mg_serve_http_opts.md }
---
@@ -1,17 +0,0 @@
---
title: "mg_check_digest_auth()"
decl_name: "mg_check_digest_auth"
symbol_kind: "func"
signature: |
int mg_check_digest_auth(struct mg_str method, struct mg_str uri,
struct mg_str username, struct mg_str cnonce,
struct mg_str response, struct mg_str qop,
struct mg_str nc, struct mg_str nonce,
struct mg_str auth_domain, FILE *fp);
---
Authenticates given response params against an opened password file.
Returns 1 if authenticated, 0 otherwise.
It's used by mg_http_check_digest_auth().
@@ -1,41 +0,0 @@
---
title: "mg_file_upload_handler()"
decl_name: "mg_file_upload_handler"
symbol_kind: "func"
signature: |
void mg_file_upload_handler(struct mg_connection *nc, int ev, void *ev_data,
mg_fu_fname_fn local_name_fn
MG_UD_ARG(void *user_data);
---
File upload handler.
This handler can be used to implement file uploads with minimum code.
This handler will process MG_EV_HTTP_PART_* events and store file data into
a local file.
`local_name_fn` will be invoked with whatever name was provided by the client
and will expect the name of the local file to open. A return value of NULL
will abort file upload (client will get a "403 Forbidden" response). If
non-null, the returned string must be heap-allocated and will be freed by
the caller.
Exception: it is ok to return the same string verbatim.
Example:
```c
struct mg_str upload_fname(struct mg_connection *nc, struct mg_str fname) {
// Just return the same filename. Do not actually do this except in test!
// fname is user-controlled and needs to be sanitized.
return fname;
}
void ev_handler(struct mg_connection *nc, int ev, void *ev_data) {
switch (ev) {
...
case MG_EV_HTTP_PART_BEGIN:
case MG_EV_HTTP_PART_DATA:
case MG_EV_HTTP_PART_END:
mg_file_upload_handler(nc, ev, ev_data, upload_fname);
break;
}
}
```
@@ -1,11 +0,0 @@
---
title: "mg_fu_fname_fn"
decl_name: "mg_fu_fname_fn"
symbol_kind: "typedef"
signature: |
typedef struct mg_str (*mg_fu_fname_fn)(struct mg_connection *nc,
struct mg_str fname);
---
Callback prototype for `mg_file_upload_handler()`.
@@ -1,14 +0,0 @@
---
title: "mg_get_http_basic_auth()"
decl_name: "mg_get_http_basic_auth"
symbol_kind: "func"
signature: |
int mg_get_http_basic_auth(struct http_message *hm, char *user, size_t user_len,
char *pass, size_t pass_len);
---
Gets and parses the Authorization: Basic header
Returns -1 if no Authorization header is found, or if
mg_parse_http_basic_auth
fails parsing the resulting header.
@@ -1,13 +0,0 @@
---
title: "mg_get_http_header()"
decl_name: "mg_get_http_header"
symbol_kind: "func"
signature: |
struct mg_str *mg_get_http_header(struct http_message *hm, const char *name);
---
Searches and returns the header `name` in parsed HTTP message `hm`.
If header is not found, NULL is returned. Example:
struct mg_str *host_hdr = mg_get_http_header(hm, "Host");
@@ -1,17 +0,0 @@
---
title: "mg_get_http_var()"
decl_name: "mg_get_http_var"
symbol_kind: "func"
signature: |
int mg_get_http_var(const struct mg_str *buf, const char *name, char *dst,
size_t dst_len);
---
Fetches a HTTP form variable.
Fetches a variable `name` from a `buf` into a buffer specified by `dst`,
`dst_len`. The destination is always zero-terminated. Returns the length of
a fetched variable. If not found, 0 is returned. `buf` must be valid
url-encoded buffer. If destination is too small or an error occured,
negative number is returned.
@@ -1,12 +0,0 @@
---
title: "mg_http_check_digest_auth()"
decl_name: "mg_http_check_digest_auth"
symbol_kind: "func"
signature: |
int mg_http_check_digest_auth(struct http_message *hm, const char *auth_domain,
FILE *fp);
---
Authenticates a HTTP request against an opened password file.
Returns 1 if authenticated, 0 otherwise.
@@ -1,15 +0,0 @@
---
title: "mg_http_parse_header()"
decl_name: "mg_http_parse_header"
symbol_kind: "func"
signature: |
int mg_http_parse_header(struct mg_str *hdr, const char *var_name, char *buf,
size_t buf_size);
---
DEPRECATED: use mg_http_parse_header2() instead.
Same as mg_http_parse_header2(), but takes buffer as a `char *` (instead of
`char **`), and thus it cannot allocate a new buffer if the provided one
is not enough, and just returns 0 in that case.
@@ -1,30 +0,0 @@
---
title: "mg_http_parse_header2()"
decl_name: "mg_http_parse_header2"
symbol_kind: "func"
signature: |
int mg_http_parse_header2(struct mg_str *hdr, const char *var_name, char **buf,
size_t buf_size);
---
Parses the HTTP header `hdr`. Finds variable `var_name` and stores its value
in the buffer `*buf`, `buf_size`. If the buffer size is not enough,
allocates a buffer of required size and writes it to `*buf`, similar to
asprintf(). The caller should always check whether the buffer was updated,
and free it if so.
This function is supposed to parse cookies, authentication headers, etc.
Example (error handling omitted):
char user_buf[20];
char *user = user_buf;
struct mg_str *hdr = mg_get_http_header(hm, "Authorization");
mg_http_parse_header2(hdr, "username", &user, sizeof(user_buf));
// ... do something useful with user
if (user != user_buf) {
free(user);
}
Returns the length of the variable's value. If variable is not found, 0 is
returned.
@@ -1,19 +0,0 @@
---
title: "mg_http_reverse_proxy()"
decl_name: "mg_http_reverse_proxy"
symbol_kind: "func"
signature: |
void mg_http_reverse_proxy(struct mg_connection *nc,
const struct http_message *hm, struct mg_str mount,
struct mg_str upstream);
---
Proxies a given request to a given upstream http server. The path prefix
in `mount` will be stripped of the path requested to the upstream server,
e.g. if mount is /api and upstream is http://localhost:8001/foo
then an incoming request to /api/bar will cause a request to
http://localhost:8001/foo/bar
EXPERIMENTAL API. Please use http_serve_http + url_rewrites if a static
mapping is good enough.
@@ -1,11 +0,0 @@
---
title: "mg_http_send_error()"
decl_name: "mg_http_send_error"
symbol_kind: "func"
signature: |
void mg_http_send_error(struct mg_connection *nc, int code, const char *reason);
---
Sends an error response. If reason is NULL, the message will be inferred
from the error code (if supported).
@@ -1,20 +0,0 @@
---
title: "mg_http_send_redirect()"
decl_name: "mg_http_send_redirect"
symbol_kind: "func"
signature: |
void mg_http_send_redirect(struct mg_connection *nc, int status_code,
const struct mg_str location,
const struct mg_str extra_headers);
---
Sends a redirect response.
`status_code` should be either 301 or 302 and `location` point to the
new location.
If `extra_headers` is not empty, then `extra_headers` are also sent
after the response line. `extra_headers` must NOT end end with new line.
Example:
mg_http_send_redirect(nc, 302, mg_mk_str("/login"), mg_mk_str(NULL));
@@ -1,28 +0,0 @@
---
title: "mg_http_serve_file()"
decl_name: "mg_http_serve_file"
symbol_kind: "func"
signature: |
void mg_http_serve_file(struct mg_connection *nc, struct http_message *hm,
const char *path, const struct mg_str mime_type,
const struct mg_str extra_headers);
---
Serves a specific file with a given MIME type and optional extra headers.
Example code snippet:
```c
static void ev_handler(struct mg_connection *nc, int ev, void *ev_data) {
switch (ev) {
case MG_EV_HTTP_REQUEST: {
struct http_message *hm = (struct http_message *) ev_data;
mg_http_serve_file(nc, hm, "file.txt",
mg_mk_str("text/plain"), mg_mk_str(""));
break;
}
...
}
}
```
@@ -1,15 +0,0 @@
---
title: "mg_parse_http()"
decl_name: "mg_parse_http"
symbol_kind: "func"
signature: |
int mg_parse_http(const char *s, int n, struct http_message *hm, int is_req);
---
Parses a HTTP message.
`is_req` should be set to 1 if parsing a request, 0 if reply.
Returns the number of bytes parsed. If HTTP message is
incomplete `0` is returned. On parse error, a negative number is returned.
@@ -1,13 +0,0 @@
---
title: "mg_parse_http_basic_auth()"
decl_name: "mg_parse_http_basic_auth"
symbol_kind: "func"
signature: |
int mg_parse_http_basic_auth(struct mg_str *hdr, char *user, size_t user_len,
char *pass, size_t pass_len);
---
Parses the Authorization: Basic header
Returns -1 iif the authorization type is not "Basic" or any other error such
as incorrectly encoded base64 user password pair.
@@ -1,46 +0,0 @@
---
title: "mg_parse_multipart()"
decl_name: "mg_parse_multipart"
symbol_kind: "func"
signature: |
size_t mg_parse_multipart(const char *buf, size_t buf_len, char *var_name,
size_t var_name_len, char *file_name,
size_t file_name_len, const char **chunk,
size_t *chunk_len);
---
Parses the buffer `buf`, `buf_len` that contains multipart form data chunks.
Stores the chunk name in a `var_name`, `var_name_len` buffer.
If a chunk is an uploaded file, then `file_name`, `file_name_len` is
filled with an uploaded file name. `chunk`, `chunk_len`
points to the chunk data.
Return: number of bytes to skip to the next chunk or 0 if there are
no more chunks.
Usage example:
```c
static void ev_handler(struct mg_connection *nc, int ev, void *ev_data) {
switch(ev) {
case MG_EV_HTTP_REQUEST: {
struct http_message *hm = (struct http_message *) ev_data;
char var_name[100], file_name[100];
const char *chunk;
size_t chunk_len, n1, n2;
n1 = n2 = 0;
while ((n2 = mg_parse_multipart(hm->body.p + n1,
hm->body.len - n1,
var_name, sizeof(var_name),
file_name, sizeof(file_name),
&chunk, &chunk_len)) > 0) {
printf("var: %s, file_name: %s, size: %d, chunk: [%.*s]\n",
var_name, file_name, (int) chunk_len,
(int) chunk_len, chunk);
n1 += n2;
}
}
break;
```
@@ -1,10 +0,0 @@
---
title: "mg_printf_html_escape()"
decl_name: "mg_printf_html_escape"
symbol_kind: "func"
signature: |
void mg_printf_html_escape(struct mg_connection *nc, const char *fmt, ...);
---
Sends a printf-formatted HTTP chunk, escaping HTML tags.
@@ -1,11 +0,0 @@
---
title: "mg_printf_http_chunk()"
decl_name: "mg_printf_http_chunk"
symbol_kind: "func"
signature: |
void mg_printf_http_chunk(struct mg_connection *nc, const char *fmt, ...);
---
Sends a printf-formatted HTTP chunk.
Functionality is similar to `mg_send_http_chunk()`.
@@ -1,36 +0,0 @@
---
title: "mg_register_http_endpoint()"
decl_name: "mg_register_http_endpoint"
symbol_kind: "func"
signature: |
void mg_register_http_endpoint(struct mg_connection *nc, const char *uri_path,
MG_CB(mg_event_handler_t handler,
void *user_data);
---
Registers a callback for a specified http endpoint
Note: if callback is registered it is called instead of the
callback provided in mg_bind
Example code snippet:
```c
static void handle_hello1(struct mg_connection *nc, int ev, void *ev_data) {
(void) ev; (void) ev_data;
mg_printf(nc, "HTTP/1.0 200 OK\r\n\r\n[I am Hello1]");
nc->flags |= MG_F_SEND_AND_CLOSE;
}
static void handle_hello2(struct mg_connection *nc, int ev, void *ev_data) {
(void) ev; (void) ev_data;
mg_printf(nc, "HTTP/1.0 200 OK\r\n\r\n[I am Hello2]");
nc->flags |= MG_F_SEND_AND_CLOSE;
}
void init() {
nc = mg_bind(&mgr, local_addr, cb1);
mg_register_http_endpoint(nc, "/hello1", handle_hello1);
mg_register_http_endpoint(nc, "/hello1/hello2", handle_hello2);
}
```
@@ -1,22 +0,0 @@
---
title: "mg_send_head()"
decl_name: "mg_send_head"
symbol_kind: "func"
signature: |
void mg_send_head(struct mg_connection *n, int status_code,
int64_t content_length, const char *extra_headers);
---
Sends the response line and headers.
This function sends the response line with the `status_code`, and
automatically
sends one header: either "Content-Length" or "Transfer-Encoding".
If `content_length` is negative, then "Transfer-Encoding: chunked" header
is sent, otherwise, "Content-Length" header is sent.
NOTE: If `Transfer-Encoding` is `chunked`, then message body must be sent
using `mg_send_http_chunk()` or `mg_printf_http_chunk()` functions.
Otherwise, `mg_send()` or `mg_printf()` must be used.
Extra headers could be set through `extra_headers`. Note `extra_headers`
must NOT be terminated by a new line.
@@ -1,25 +0,0 @@
---
title: "mg_send_http_chunk()"
decl_name: "mg_send_http_chunk"
symbol_kind: "func"
signature: |
void mg_send_http_chunk(struct mg_connection *nc, const char *buf, size_t len);
---
Sends buffer `buf` of size `len` to the client using chunked HTTP encoding.
This function sends the buffer size as hex number + newline first, then
the buffer itself, then the newline. For example,
`mg_send_http_chunk(nc, "foo", 3)` will append the `3\r\nfoo\r\n` string
to the `nc->send_mbuf` output IO buffer.
NOTE: The HTTP header "Transfer-Encoding: chunked" should be sent prior to
using this function.
NOTE: do not forget to send an empty chunk at the end of the response,
to tell the client that everything was sent. Example:
```
mg_printf_http_chunk(nc, "%s", "my response!");
mg_send_http_chunk(nc, "", 0); // Tell the client we're finished
```
@@ -1,21 +0,0 @@
---
title: "mg_send_response_line()"
decl_name: "mg_send_response_line"
symbol_kind: "func"
signature: |
void mg_send_response_line(struct mg_connection *nc, int status_code,
const char *extra_headers);
---
Sends the response status line.
If `extra_headers` is not NULL, then `extra_headers` are also sent
after the response line. `extra_headers` must NOT end end with new line.
Example:
mg_send_response_line(nc, 200, "Access-Control-Allow-Origin: *");
Will result in:
HTTP/1.1 200 OK\r\n
Access-Control-Allow-Origin: *\r\n
@@ -1,28 +0,0 @@
---
title: "mg_serve_http()"
decl_name: "mg_serve_http"
symbol_kind: "func"
signature: |
void mg_serve_http(struct mg_connection *nc, struct http_message *hm,
struct mg_serve_http_opts opts);
---
Serves given HTTP request according to the `options`.
Example code snippet:
```c
static void ev_handler(struct mg_connection *nc, int ev, void *ev_data) {
struct http_message *hm = (struct http_message *) ev_data;
struct mg_serve_http_opts opts = { .document_root = "/var/www" }; // C99
switch (ev) {
case MG_EV_HTTP_REQUEST:
mg_serve_http(nc, hm, opts);
break;
default:
break;
}
}
```
@@ -1,165 +0,0 @@
---
title: "struct mg_serve_http_opts"
decl_name: "struct mg_serve_http_opts"
symbol_kind: "struct"
signature: |
struct mg_serve_http_opts {
/* Path to web root directory */
const char *document_root;
/* List of index files. Default is "" */
const char *index_files;
/*
* Leave as NULL to disable authentication.
* To enable directory protection with authentication, set this to ".htpasswd"
* Then, creating ".htpasswd" file in any directory automatically protects
* it with digest authentication.
* Use `mongoose` web server binary, or `htdigest` Apache utility to
* create/manipulate passwords file.
* Make sure `auth_domain` is set to a valid domain name.
*/
const char *per_directory_auth_file;
/* Authorization domain (domain name of this web server) */
const char *auth_domain;
/*
* Leave as NULL to disable authentication.
* Normally, only selected directories in the document root are protected.
* If absolutely every access to the web server needs to be authenticated,
* regardless of the URI, set this option to the path to the passwords file.
* Format of that file is the same as ".htpasswd" file. Make sure that file
* is located outside document root to prevent people fetching it.
*/
const char *global_auth_file;
/* Set to "no" to disable directory listing. Enabled by default. */
const char *enable_directory_listing;
/*
* SSI files pattern. If not set, "**.shtml$|**.shtm$" is used.
*
* All files that match ssi_pattern are treated as SSI.
*
* Server Side Includes (SSI) is a simple interpreted server-side scripting
* language which is most commonly used to include the contents of a file
* into a web page. It can be useful when it is desirable to include a common
* piece of code throughout a website, for example, headers and footers.
*
* In order for a webpage to recognize an SSI-enabled HTML file, the
* filename should end with a special extension, by default the extension
* should be either .shtml or .shtm
*
* Unknown SSI directives are silently ignored by Mongoose. Currently,
* the following SSI directives are supported:
* &lt;!--#include FILE_TO_INCLUDE --&gt;
* &lt;!--#exec "COMMAND_TO_EXECUTE" --&gt;
* &lt;!--#call COMMAND --&gt;
*
* Note that &lt;!--#include ...> directive supports three path
*specifications:
*
* &lt;!--#include virtual="path" --&gt; Path is relative to web server root
* &lt;!--#include abspath="path" --&gt; Path is absolute or relative to the
* web server working dir
* &lt;!--#include file="path" --&gt;, Path is relative to current document
* &lt;!--#include "path" --&gt;
*
* The include directive may be used to include the contents of a file or
* the result of running a CGI script.
*
* The exec directive is used to execute
* a command on a server, and show command's output. Example:
*
* &lt;!--#exec "ls -l" --&gt;
*
* The call directive is a way to invoke a C handler from the HTML page.
* On each occurence of &lt;!--#call COMMAND OPTIONAL_PARAMS> directive,
* Mongoose calls a registered event handler with MG_EV_SSI_CALL event,
* and event parameter will point to the COMMAND OPTIONAL_PARAMS string.
* An event handler can output any text, for example by calling
* `mg_printf()`. This is a flexible way of generating a web page on
* server side by calling a C event handler. Example:
*
* &lt;!--#call foo --&gt; ... &lt;!--#call bar --&gt;
*
* In the event handler:
* case MG_EV_SSI_CALL: {
* const char *param = (const char *) ev_data;
* if (strcmp(param, "foo") == 0) {
* mg_printf(c, "hello from foo");
* } else if (strcmp(param, "bar") == 0) {
* mg_printf(c, "hello from bar");
* }
* break;
* }
*/
const char *ssi_pattern;
/* IP ACL. By default, NULL, meaning all IPs are allowed to connect */
const char *ip_acl;
#if MG_ENABLE_HTTP_URL_REWRITES
/* URL rewrites.
*
* Comma-separated list of `uri_pattern=url_file_or_directory_path` rewrites.
* When HTTP request is received, Mongoose constructs a file name from the
* requested URI by combining `document_root` and the URI. However, if the
* rewrite option is used and `uri_pattern` matches requested URI, then
* `document_root` is ignored. Instead, `url_file_or_directory_path` is used,
* which should be a full path name or a path relative to the web server's
* current working directory. It can also be an URI (http:// or https://)
* in which case mongoose will behave as a reverse proxy for that destination.
*
* Note that `uri_pattern`, as all Mongoose patterns, is a prefix pattern.
*
* If uri_pattern starts with `@` symbol, then Mongoose compares it with the
* HOST header of the request. If they are equal, Mongoose sets document root
* to `file_or_directory_path`, implementing virtual hosts support.
* Example: `@foo.com=/document/root/for/foo.com`
*
* If `uri_pattern` starts with `%` symbol, then Mongoose compares it with
* the listening port. If they match, then Mongoose issues a 301 redirect.
* For example, to redirect all HTTP requests to the
* HTTPS port, do `%80=https://my.site.com`. Note that the request URI is
* automatically appended to the redirect location.
*/
const char *url_rewrites;
#endif
/* DAV document root. If NULL, DAV requests are going to fail. */
const char *dav_document_root;
/*
* DAV passwords file. If NULL, DAV requests are going to fail.
* If passwords file is set to "-", then DAV auth is disabled.
*/
const char *dav_auth_file;
/* Glob pattern for the files to hide. */
const char *hidden_file_pattern;
/* Set to non-NULL to enable CGI, e.g. **.cgi$|**.php$" */
const char *cgi_file_pattern;
/* If not NULL, ignore CGI script hashbang and use this interpreter */
const char *cgi_interpreter;
/*
* Comma-separated list of Content-Type overrides for path suffixes, e.g.
* ".txt=text/plain; charset=utf-8,.c=text/plain"
*/
const char *custom_mime_types;
/*
* Extra HTTP headers to add to each server response.
* Example: to enable CORS, set this to "Access-Control-Allow-Origin: *".
*/
const char *extra_headers;
};
---
This structure defines how `mg_serve_http()` works.
Best practice is to set only required settings, and leave the rest as NULL.
-29
View File
@@ -1,29 +0,0 @@
---
title: "MQTT API reference"
symbol_kind: "intro"
decl_name: "mg_mqtt.h"
items:
- { name: mg_mqtt_connack.md }
- { name: mg_mqtt_disconnect.md }
- { name: mg_mqtt_match_topic_expression.md }
- { name: mg_mqtt_next_subscribe_topic.md }
- { name: mg_mqtt_ping.md }
- { name: mg_mqtt_pong.md }
- { name: mg_mqtt_puback.md }
- { name: mg_mqtt_pubcomp.md }
- { name: mg_mqtt_publish.md }
- { name: mg_mqtt_pubrec.md }
- { name: mg_mqtt_pubrel.md }
- { name: mg_mqtt_suback.md }
- { name: mg_mqtt_subscribe.md }
- { name: mg_mqtt_unsuback.md }
- { name: mg_mqtt_unsubscribe.md }
- { name: mg_mqtt_vmatch_topic_expression.md }
- { name: mg_send_mqtt_handshake.md }
- { name: mg_send_mqtt_handshake_opt.md }
- { name: mg_set_protocol_mqtt.md }
- { name: struct_mg_mqtt_proto_data.md }
---
-10
View File
@@ -1,10 +0,0 @@
---
title: "mg_mqtt_connack()"
decl_name: "mg_mqtt_connack"
symbol_kind: "func"
signature: |
void mg_mqtt_connack(struct mg_connection *nc, uint8_t return_code);
---
Sends a CONNACK command with a given `return_code`.
@@ -1,10 +0,0 @@
---
title: "mg_mqtt_disconnect()"
decl_name: "mg_mqtt_disconnect"
symbol_kind: "func"
signature: |
void mg_mqtt_disconnect(struct mg_connection *nc);
---
Sends a DISCONNECT command.
@@ -1,12 +0,0 @@
---
title: "mg_mqtt_match_topic_expression()"
decl_name: "mg_mqtt_match_topic_expression"
symbol_kind: "func"
signature: |
int mg_mqtt_match_topic_expression(struct mg_str exp, struct mg_str topic);
---
Matches a topic against a topic expression
Returns 1 if it matches; 0 otherwise.
@@ -1,15 +0,0 @@
---
title: "mg_mqtt_next_subscribe_topic()"
decl_name: "mg_mqtt_next_subscribe_topic"
symbol_kind: "func"
signature: |
int mg_mqtt_next_subscribe_topic(struct mg_mqtt_message *msg,
struct mg_str *topic, uint8_t *qos, int pos);
---
Extracts the next topic expression from a SUBSCRIBE command payload.
The topic expression name will point to a string in the payload buffer.
Returns the pos of the next topic expression or -1 when the list
of topics is exhausted.
Loaded 100 of 1255 files, more files were not shown because too many files have changed in this diff. Show more