Commit Graph

2844 Commits

Author SHA1 Message Date
Deomid Ryabkov
421e099f2b Refactor mg polling
* Change return type of mg_mgr_poll to return number of events
 * Add mg_mgr_min_timer
 * Refactor main poll loop to remove LwIP-specific stuff

CL: Refactor mg polling

PUBLISHED_FROM=dc94618b32fa3c84a2f053bd04d134297780ec82
2018-09-06 06:34:18 +00:00
Бобби
955d4a3129 Fix file upload on windows
CL: Fix https://github.com/cesanta/mongoose/issues/962 - file upload on windows

PUBLISHED_FROM=85688eee147a1df468cca92f4ac61526ce9c02bf
2018-08-21 15:06:40 +00:00
Deomid Ryabkov
b84981ad03 STM32 OTA support for L475-IOT01 and DISCO-F746
A smattering of other related changes

CL: STM32 OTA support for L475-IOT01 and DISCO-F746

PUBLISHED_FROM=e7142337086d09ba21437455b22d00db47ab33f1
2018-08-18 07:49:30 +00:00
Deomid Ryabkov
0a3e186f11 Mongoose 6.12
CL: Mongoose 6.12

PUBLISHED_FROM=8008e4db2f6d94d972fb6e1077525e262c8744aa
2018-08-13 14:41:42 +00:00
Deomid Ryabkov
c2d83a9db0 Don't touch send_mbuf when sending MQTT messages
h/t @M4GNV5

Fixes https://github.com/cesanta/mongoose/issues/943
Closes https://github.com/cesanta/mongoose/issues/944

CL: mg: Don't touch send_mbuf when sending MQTT messages

PUBLISHED_FROM=da7b4f8acec2e403caa4addd5739d036a6a74c76
2018-08-13 14:04:49 +00:00
Deomid Ryabkov
f33d3a4e02 Fix body length calculation in mg_handle_cgi
Fixes https://nvd.nist.gov/vuln/detail/CVE-2018-10945

CL: mg: Fix body length calculation in mg_handle_cgi

PUBLISHED_FROM=0c30cf36fdb67c75f6148468701e23d6ee72d953
2018-08-13 13:05:22 +00:00
Deomid Ryabkov
86b8a56b05 Add host name verification for OpenSSL
Closes https://github.com/cesanta/mongoose/pull/955

CL: mg: Add host name verification for OpenSSL

PUBLISHED_FROM=e35dd636ba7ce63116f0a38031074d22f6cd5dac
2018-08-13 13:05:21 +00:00
Бобби
ac6ec15aed Make esp8266 compilation a little less verbose
CL: Make esp8266 compilation a little less verbose

PUBLISHED_FROM=0ec1412ea32243f263d52fbe0877ecca1efc5aef
2018-07-23 15:26:47 +00:00
Deomid Ryabkov
31632c6361 Fix build with CS_ENABLE_STDIO=0
Closes https://github.com/cesanta/mongoose/pull/945

CL: Fix build with CS_ENABLE_STDIO=0

PUBLISHED_FROM=7d15f17fc42241facdba5b1004b5b7f3dda599dc
2018-07-12 20:42:45 +00:00
Deomid Ryabkov
98c99279c3 Fix warnings on newer versions of GCC
PUBLISHED_FROM=f1d25145446057fed9e8d634ca637364ca43a5e8
2018-07-09 08:34:29 +00:00
Deomid Ryabkov
cdb8d7b692 Add mg_strstrip: trims whitespace at the ends of s
CL: Add mg_strstrip: trims whitespace at the ends of s

PUBLISHED_FROM=a7e10054ac25fa2b3a878876da93a6b30d9507b3
2018-07-07 14:04:42 +00:00
Deomid Ryabkov
93ac3e19f0 Stringify multi-word macros correctly
Use vararg macros for this.

PUBLISHED_FROM=735c40b79dedef17a1fdbb5b846e984df0ae7018
2018-07-03 15:05:23 +00:00
Deomid Ryabkov
6a51af9efe Fix a bug in mg_mgr_init_opt with opts.num_ifaces
h/t @YankunLi

Closes https://github.com/cesanta/mongoose/pull/939

CL: mg: Fix a bug in mg_mgr_init_opt with opts.num_ifaces

PUBLISHED_FROM=a87518b3505429a3cf9cd6d84b3b781e7dbdcfd5
2018-06-27 08:50:07 +00:00
Deomid Ryabkov
9d73b3470b Add LFS (littleFS) library
CL: mos support for LFS (littlefs) https://github.com/ARMmbed/littlefs

PUBLISHED_FROM=e72957b4fb2c78949af4cf6d5bfef135ddba9fd9
2018-06-26 16:49:42 +00:00
Deomid Ryabkov
1c8449cea6 Fix pipelining issue with multipart upload
Do not clear buffer at the end of multipart request to allow following request to proceed.

Closes https://github.com/cesanta/mongoose/pull/940

CL: mg: Fix pipelining issue with multipart upload

PUBLISHED_FROM=cc7d38b126eaa863553ee4e124cfafcd72030fcf
2018-06-26 12:05:04 +00:00
Deomid Ryabkov
3bbbd41196 Add missing CC3220 sub-header to mongoose.h
CL: Add missing CC3220 sub-header to mongoose.h

PUBLISHED_FROM=a143485b629109c6e16c66b035f02f7552f76129
2018-06-21 16:34:56 +00:00
Deomid Ryabkov
339bbee0df mg_file_upload_handler: Support multiple files
curl -F file1 -F file2 ...

Add a unit test and fix a minor memory leak when returning an error.

CL: mg_file_upload_handler: Support multiple files

PUBLISHED_FROM=5c4bf2be676346fb782e80f50f79df6a6721ac88
2018-06-20 13:35:31 +00:00
Deomid Ryabkov
9ba6eb716d mg_lwip: Fix race during clean conenction teardown
Set CLOSE_IMMEDIATELY flag when destroying conn.
This avoid some races in LWIP adapter.

CL: mg_lwip: Fix race during clean conenction teardown

PUBLISHED_FROM=5c67982390dfaf83527e85d1291f64c6050aa932
2018-06-18 16:35:04 +00:00
Deomid Ryabkov
d949c19c7e mgos_nsleep100 impl for ARM-based platforms
startup cleanup on CC3220

CL: none

PUBLISHED_FROM=0998fad82fbcdbde30dca42833f2e48d148592bf
2018-06-06 08:04:33 +00:00
Deomid Ryabkov
1299d6118f Add MG_HIDE_SERVER_INFO
Closes https://github.com/cesanta/mos-libs/pull/2

CL: Add MG_HIDE_SERVER_INFO

PUBLISHED_FROM=ed8a5b65f1c8238df414cd1c1f8bb1f579082f55
2018-05-17 16:20:44 +00:00
Deomid Ryabkov
244ff92e78 Minor build optimization
PUBLISHED_FROM=9997c64ed0c713b5b8b29df7a49b532e880eac53
2018-05-10 19:05:40 +00:00
Deomid Ryabkov
53f34dea04 Fix TZ on ESP8266
CL: Fix TZ on ESP8266

PUBLISHED_FROM=435a501a8b52524bccb67bb5a8ae7e09dfb4d44a
2018-04-26 15:26:39 +00:00
Sergey Lyubka
7014258c8d Remove copyright notices - that explained in the CLA.
CL: none

PUBLISHED_FROM=9cb4b915906d471ef5de4e0825567d0b942d3f7b
2018-04-17 11:45:31 +00:00
Deomid Ryabkov
1614e7ba8d Restore FFI-ability of struct mg_str
mgos_dlsym needs to include mg_str for ffi_exports to be able to use it

PUBLISHED_FROM=a2dd167c8e8f9e9b7316a856f19a4603080c3632
2018-04-13 17:12:07 +00:00
Deomid Ryabkov
43b5a4e735 Add a special attribute to printf-like funcs
Enables extra compile-time checks

CL: none

PUBLISHED_FROM=9f7d658fbda5c721cf40293bf29967bb056d0437
2018-04-13 17:12:06 +00:00
Deomid Ryabkov
43191db63e Fix boot loader UART baud rate on soft reboot
Also remove `-O3` optimization flasg, it negates `-Os`. Saves ~400 bytes.

CL: none

PUBLISHED_FROM=f40f42e4f54a8e0e003ab65ec8f5838c2d932876
2018-04-11 18:35:15 +00:00
Deomid Ryabkov
e89be2e944 Add mg_url_encode_opt()
CL: Add `mg_url_encode_opt()` - a parametrized version of `mg_url_encode()`

PUBLISHED_FROM=17fa57a7a5325b51b6e3aef3855eac4e82c35782
2018-04-10 11:04:31 +00:00
Deomid Ryabkov
c2fbff6d0e Fix mg_http_parse_header
Per standard, cookies are delimited by `; `.

CL: Fix mg_http_parse_header: treat ";" as a delimiter.

PUBLISHED_FROM=039243c30f5fabf4a4700a43506f841b3268306a
2018-04-10 10:19:36 +00:00
Deomid Ryabkov
b8eca17c55 Reamalgam mongoose.{c,h}
PUBLISHED_FROM=8828792097bd19774472b8a2e61420565684d174
2018-04-03 16:08:21 +00:00
Sergey Lyubka
4650e491df Apache license to common/
CL: Apache license to common/

PUBLISHED_FROM=901e9e4b12a31289b3515d1f86dd56a7f0f35c5e
2018-04-03 11:49:59 +00:00
Deomid Ryabkov
3e33e57707 Mongoose net_if and ssl_if refactoring
A major cleanup, disentangling net_if and ssl_if.
Pulled a lot of common logic into the core and reduced size of net_if implementations.

CL: Mongoose net_if and ssl_if refactoring

PUBLISHED_FROM=29bd4dcb264a1fd96b3dd164e2d880e1c2c0921e
2018-03-30 23:19:49 +00:00
Deomid Ryabkov
c80f4c5313 Fix an edge case in multipart HTTP upload parsing
Consume buffer as soon as we know there is no boundary there, no need to delay until next chunk arrives.
This prevents stall where buffer fills up in one go and next chunk never arrives.

CL: Fix an edge case in multipart HTTP upload parsing

PUBLISHED_FROM=025f9001d272df2a75ece22b199b1944d5db9840
2018-03-30 19:35:20 +00:00
Deomid Ryabkov
132ecbec2f Fix Mongoose and Frozen include paths
In preparation for making moving to lib.
Reduce amount of makefile copypasta a bit.

CL: none

PUBLISHED_FROM=70a016491f9605e37708385bdd698f48a8d64119
2018-03-28 14:12:23 +00:00
Deomid Ryabkov
0a90cab44a Improve mbuf allocation behavior
* Limit total amount of headroom, in absolute terms (`MBUF_SIZE_MAX_HEADROOM`).
 * If unable to allocate with headroom, fall back to allocating the required minimum.
 * For mOS, set default `MBUF_SIZE_MULTIPLIER` to 2 to avoid floating point operations.
   Since max headroom size is now capped to 128 bytes, this will not result in much of a bloat.

PUBLISHED_FROM=11d4fc65a46a805bb7c8960f89a3d0b753c58bb8
2018-03-22 07:49:57 +00:00
Serge A. Zaitsev
d16dbc197f mongoose: fix http pipeline
mongoose: fix formatting

mongoose: fix formatting

mongoose: remove debugging messages

PUBLISHED_FROM=1194e018001cc5f2b598096593d7aac4ec8dc04d
2018-03-20 16:41:56 +00:00
Serge A. Zaitsev
127f27e375 mongoose: unit test for http get pipeline
PUBLISHED_FROM=00e8634913232eb2e50a0d739f85e81706dbc400
2018-03-17 16:35:04 +00:00
novlean
6523cc4da0 2018
PUBLISHED_FROM=63ce52177f5f13cb76f0fcb4689efb65a04318a2
2018-03-12 21:20:20 +00:00
Serge A. Zaitsev
0ae2b82b60 freshen: early attempts to make ota and config work
freshen: implement ota rollback

freshen: api for rpc

freshen: implement rpc api (without transport)

PUBLISHED_FROM=9f935f676161c81464a0dc53d5d8d085b2437ffb
2018-02-27 14:19:33 +00:00
Sergey Lyubka
dab526936f Add missing test files to mongoose repo
PUBLISHED_FROM=9a81cc34aa0039a75c851bc3685055f46936252e
2018-02-23 11:19:42 +00:00
Бобби
780077d118 Fix mg_socketpair for lwip + UDP
CL: Fix mg_socketpair for lwip + UDP

PUBLISHED_FROM=6dd09136b3837016026523fb34acb5cc893cadbe
2018-02-18 16:49:38 +00:00
Deomid Ryabkov
ad8f1d88d4 Fix buffer size passed to inet_ntop()
Fixes https://github.com/cesanta/mongoose-os/issues/394

CL: Fix buffer size passed to inet_ntop()

PUBLISHED_FROM=4a6702527627ccbb780f45200274b09a28be69ee
2018-02-13 12:49:53 +00:00
Deomid Ryabkov
a3c4a48ef7 Make sure test assertions are evaluated once
E.g. if `ASSERT_EQ(myfunc(), 123)` fails, `myfunc()` would be invoked again to print the actual value.
This can cause confusion sometimes.
To avoid this, we cast arguments to double, which is wide enough for most cases and we provide a variant for 64 bit value types for when it's not.
We also perform a check and fail if argument to the check results in loss of precision.

CL: none

PUBLISHED_FROM=a14551289d92e8a5dead21d16471ebddebe938a8
2018-02-10 12:19:40 +00:00
Deomid Ryabkov
84a11fe3b1 Count both tests and individual checks
CL: none

PUBLISHED_FROM=ab7f50e1c68154832e862ebfb4a02d385ef7c6be
2018-02-08 19:20:00 +00:00
Dmitry Frank
2a3cfc9858 Bump mongoose version to 6.11
PUBLISHED_FROM=92604e1b7c65009a6214fea9f1b2460df721d38e
2018-02-08 16:51:43 +00:00
Dmitry Frank
b9b20c6494 Implement mg_http_parse_header2()
Which is a replacement of (deprecated) `mg_http_parse_header`, but,
similarly to `asprintf`, allocates a new buffer if the client-provided
one is not large enough.

Also use it throughout mongoose code, and thus some header-related
limitations are removed; in particular,
https://github.com/cesanta/mongoose/issues/813 is fixed.

CL: Mongoose Web Server: Deprecate `mg_http_parse_header()` and implement `mg_http_parse_header2()` instead, which allocates a new buffer if the client-provided one is not large enough (similarly to `asprintf`).
CL: Mongoose Web Server: Fix limitations of header value lengths, e.g. when parsing authentication headers such as nonce, etc.

PUBLISHED_FROM=c75b1bbbbdb294ea85075ce69b1368f115fdd1ef
2018-02-07 23:04:29 +00:00
Deomid Ryabkov
a8a7d2cf7e Minor tweaks for testing
PUBLISHED_FROM=d52aea1648ed8ec8dd2e71168884795d995b1826
2018-02-07 20:19:31 +00:00
Deomid Ryabkov
50ecc30b4d Commonize unit test main()
CL: none

PUBLISHED_FROM=ee76407d89f3fcbe3da23810117a374d06af0a25
2018-02-07 16:19:32 +00:00
Deomid Ryabkov
cd89db5c2f Add a convenience macro invoke subroutines
To properly fail a test in a subroutine, return value needs to be passed up.
This snippet makes it short.

PUBLISHED_FROM=2f6328b5eb2921a4caa53d8887c02f73a5d817ea
2018-02-07 14:49:23 +00:00
Deomid Ryabkov
1ed99999bd Add ASSERT_{TRUE,FALSE} convenience macros
PUBLISHED_FROM=3cd6dd7f04b650ca637788d1017b6b5146c79569
2018-02-06 16:49:32 +00:00
Dmitry Frank
4afebdcb2b Add UDP client example
CL: Mongoose Web Server: Add UDP client example

Resolves https://github.com/cesanta/mongoose/issues/886

PUBLISHED_FROM=fcce2f1de3a800147e9246ffa01c428c1b8f552b
2018-02-06 13:34:33 +00:00