Commit Graph

1624 Commits

Author SHA1 Message Date
Dmitry Frank
0b4bf13335 Fix mg_parse_multipart in case of malformed req
CL: Mongoose Web Server: Fix mg_parse_multipart in case of malformed request

PUBLISHED_FROM=9b33b03e9ab2ca204ad2f8d061df169246644072
2018-01-30 19:39:03 +00:00
Dmitry Frank
228984a3fc Fix a corner case in receiving UDP data
CL: none

PUBLISHED_FROM=9c13882517374644c6d799976f1048f04ae446d7
2018-01-30 14:35:15 +00:00
Dmitry Frank
255da78bed Fix socket leak when there are too many open fds
CL: Mongoose Web Server: Fix socket leak when there are too many open file descriptors

Fixes https://github.com/cesanta/mongoose/issues/870

PUBLISHED_FROM=c802b6834a54eca37821d46efde192c527e0a6b7
2018-01-30 13:37:42 +00:00
Бобби
961fb96bb7 Fix OOB access in mg_match_prefix_n()
CL: Fix OOB access in mg_match_prefix_n().
    Made mg_match_prefix_n() return non-negative result.

PUBLISHED_FROM=611454df6a6c55bfa7ddf05e7d268a86fa0457a8
2018-01-27 13:50:13 +00:00
Deomid Ryabkov
d6475fcd19 Fix TCP RX path regression in SSL mode
CL: Fix TCP RX path regression in SSL mode

PUBLISHED_FROM=2cfdb33e5f711bbc4b98e2d24ba3377de0f1d3c5
2018-01-18 11:04:45 +00:00
Dmitry Frank
ac538f755f Close undrained and stuck http connections
CL: - Mongoose Web Server: close undrained and stuck http connections

PUBLISHED_FROM=a11656b195dbe2ef8473455a171a583e37cedb2c
2018-01-16 15:20:47 +00:00
Deomid Ryabkov
5b2eb4f0e1 Enable building with CS_ENABLE_STDIO=0
h/t @kzyapkov

PUBLISHED_FROM=d15a5a0057f69f2f755af6436e676b1b179d069d
2018-01-15 20:20:36 +00:00
Dmitry Frank
80f4133bbf Get rid of magic numbers in parse_mqtt
PUBLISHED_FROM=63cc7ed8c3378bebf209d3620efb09d73675370c
2018-01-02 10:50:38 +00:00
Dmitry Frank
d10fb9451c Move the recv limit check to mqtt
PUBLISHED_FROM=028d6f56ec1cc15484c995335f00d087b590faef
2017-12-29 17:35:29 +00:00
Dmitry Frank
88ae2ecadb Drain rx_chain before closing the connection
PUBLISHED_FROM=08eee4052dd9bbc364875a577409cb78665dee30
2017-12-29 07:50:43 +00:00
Dmitry Frank
85d19dad47 Respect recv_mbuf_limit in lwip
PUBLISHED_FROM=470ff0f484bff3e4478651f0b64cc160bba8ebfc
2017-12-28 12:49:54 +00:00
Dmitry Frank
17703fe3e8 Improve docs for logging
PUBLISHED_FROM=72f0892ecfba5b1c3c2a70f0ecd5715578d7ffce
2017-12-16 17:55:53 +00:00
Бобби
4e11d5cdbf Move shadow to event API
PUBLISHED_FROM=cd059adee921dd10fd89100b0e2500ff8d7743eb
2017-12-14 13:32:11 +00:00
Sergey Lyubka
987bc1d580 Use 8k iobuf limit for aws
PUBLISHED_FROM=971951e1eeb82078b986cd6e25e52cfc1ccef286
2017-12-02 21:26:35 +00:00
Dmitry Frank
ddd35c0cba Fail if authn file is configured but doesn't exist
PUBLISHED_FROM=2c176091ffb6c7c5cfe8ea4f05b6109e00b33383
2017-11-28 19:35:22 +00:00
Sergey Lyubka
c97b615785 Fix mg_parse_uri()
PUBLISHED_FROM=e5b829d93ecf946e5bdbbf33132be7068ffe0dd2
2017-11-28 16:45:52 +00:00
Dmitry Frank
9ab6d084df Expose digest auth checking functions
PUBLISHED_FROM=1bfc6e332f56b68eb6155bb729a97a0d8d5a316c
2017-11-28 10:05:36 +00:00
Deomid Ryabkov
cf8d0a25aa Rename base64.{c,h} to cs_base64.{c,h}
To avoid name clashes.

PUBLISHED_FROM=e6ae32ec48f9b599eace7a9214a1863cdc185fd9
2017-11-24 11:36:12 +00:00
Deomid Ryabkov
90716417c9 Compatibility with LwIP 2.0
2.0 redefined LWIP_VERSION in a way that is no longer compatible with use by preprocessor (boo).
also, tcp_pcb.acked is gone, but we only use it for debug, so it doesn't matter.

PUBLISHED_FROM=776f90a08bd5024fa8a61dae257af6c60ec6710d
2017-11-23 10:05:43 +00:00
Deomid Ryabkov
101afbc9b8 Use weaker but faster cipher suites
ECDHE is way too slow on ESP8266 w/o cryptochip, this sometimes results in WiFi STA deauths.
Disable DHE completely because it's just hopelessly slow.

PUBLISHED_FROM=d9c8e95b7d5c992f9e127726c569f187b1e0b453
2017-11-21 15:33:00 +00:00
Бобби
a197646867 Integrate cesanta/mongoose-os/pull/370
PUBLISHED_FROM=5bee629477514370f9b670771e786c4f4ddae934
2017-11-09 09:49:28 +00:00
Бобби
00d1d2c0e7 Make mjs & frozen vc98 & vc2017 friendly
PUBLISHED_FROM=7cde8b374d5e318b5cdd69fc5b4de86b2a9552f5
2017-11-08 16:04:08 +00:00
Deomid Ryabkov
7942803a75 Fix MQTT SUBSCRIBE parsing
Make sure topic is properly NUL-terminated.
Ignore SUBSCRIBE requests with no topic expressions.

PUBLISHED_FROM=a00f39dda44fe63299e971a91a98f8ee57dd2a64
2017-10-30 15:34:22 +00:00
Deomid Ryabkov
a8b74a9021 Fix bug when network conn is closed before CGI
NULL out cgi_nc->user_data so it doesn't touch nc anymore.

PUBLISHED_FROM=de2f76981c377d8951fb8e18e8b3d41dbfcf38b1
2017-10-30 14:20:27 +00:00
Deomid Ryabkov
27a9a62843 Fix SimpleLink listener for SSL
Must set SSL parameters before invoking sl_Listen

PUBLISHED_FROM=9147e7aa945f75e73d5c7cd7987cb5749025a86b
2017-10-24 07:19:45 +00:00
Deomid Ryabkov
9b268b6c77 Fix timer handling
ev_timer_time may remain the same for legit reason, so to prevent looping, instead, reset it before invoking the handler.
To let user know what the initial setting was, pass it as the argument instead of current time (which is kind of pointless).

PUBLISHED_FROM=fa328009f097f9b49b5b0dd13a38ee6d6e6518de
2017-10-21 09:19:42 +00:00
Sergey Lyubka
3b3ac48edd Fix potential leak in socks client
PUBLISHED_FROM=2cb4449d2f36d59db2b0dc37c46b35de6a461810
2017-10-19 13:49:43 +00:00
Бобби
b5dd0e8093 Use verbose flags in both socks client and server
PUBLISHED_FROM=d17e96a97e1621e9788844bcd627c3143d37315c
2017-10-19 13:24:30 +00:00
Deomid Ryabkov
9b24fdfd1d Reformat mongoose
PUBLISHED_FROM=5202fa46a6a834bde35168ba566d3dce7c48f453
2017-10-19 13:24:26 +00:00
Бобби
8193302162 Initial socks5 client & server implementation
PUBLISHED_FROM=05d3cca6223c963e7ae89dde3628fa8fad46e6bd
2017-10-18 14:05:13 +00:00
Dmitry Frank
f0c6630a16 BREAKING: Sys config API change
Now apps should use getters and setters instead of accessing struct
fields directly, e.g. instead of `get_cfg()->update.timeout` it should
be `mgos_sys_config_get_update_timeout()` to get the current value, and
`mgos_sys_config_set_update_timeout(123)` to update the value.

For now, the config structs are public, but they will be made private
soon, so use accessors to keep your code working.

PUBLISHED_FROM=f7d582421a8d7e4d1ed50a280f2670d8b62f8d45
2017-10-11 11:15:48 +00:00
Deomid Ryabkov
1db747da29 Do not double-count recved bytes
Mongoose would report consumed bytes twice if mg_call is invoked recursively (e.g. proto_handler uses mg_call to invoke user's handler).
Reporting twice as much recved as was delivered effectively disables LwIP's TCP throttling and causes buffers to grow too big.

PUBLISHED_FROM=4ad5cd5db4dd54623bd6de2d50d32ddcc9e2b08a
2017-09-14 13:51:03 +00:00
Deomid Ryabkov
8065439f96 Acquire lock when manipulating rx in SSL recv path
PUBLISHED_FROM=a34cfa3ebc12daf75d7f24c8d3f3707dcc33d9a2
2017-09-14 11:06:24 +00:00
Dmitry Frank
0aaba7a461 Add cs_timegm
Which is a slightly modified version from
https://stackoverflow.com/questions/283166/easy-way-to-convert-a-struct-tm-expressed-in-utc-to-time-t-type

PUBLISHED_FROM=b73f920ca42c45473c23337782e815306bdf69f1
2017-09-12 16:20:16 +00:00
Deomid Ryabkov
3d6b568c6e Prefer ECDHE with CBC over DHE ciphersuites
PUBLISHED_FROM=4ddfc25af77247fac7e7d04cc0e56d6f3800f87b
2017-09-07 11:04:38 +00:00
Deomid Ryabkov
2b2816cfe4 Store reassembled WS frame length in proto_data
PUBLISHED_FROM=7bbe7dd20dca8435c786dca30200a4973ae0827d
2017-09-06 19:05:00 +00:00
Deomid Ryabkov
2fa18b47db Fix DNS name uncompression
PUBLISHED_FROM=07e820f539fa5feca2ad1cf81faca8404b773a65
2017-09-06 18:05:29 +00:00
Deomid Ryabkov
c8af7cdd27 Check for int overflow when parsing WS frames
PUBLISHED_FROM=b7325b38e881455df703b0b628c41931565ccb33
2017-09-06 17:34:37 +00:00
Deomid Ryabkov
f857f6394f Access QoS field after validating topic length
PUBLISHED_FROM=6f2d9849d75ca1ec2b6dade11ccad8d0c5d4b3bd
2017-09-06 15:35:15 +00:00
Deomid Ryabkov
97d733e129 Fix MQTT broker SUBSCRIBE request parsing
Add checks on the number of subscribe requests per packet and overall per-session subscription limit.

PUBLISHED_FROM=faaf5c50af31a0694c9308a664f2e418dbb0eb18
2017-09-06 13:23:13 +00:00
Deomid Ryabkov
77e44c7c0e Harden MQTT variable length parsing
PUBLISHED_FROM=e16ee57bc30277e5b5684e53da78e69baaf9f779
2017-09-06 11:49:43 +00:00
Наше вам с кисточкой
abf89d32d9 Make C ws client work with Go
PUBLISHED_FROM=263553121b992ec0f66b0275b4e10f4176281812
2017-09-01 08:35:53 +00:00
Deomid Ryabkov
177e05deb2 CC3220: AWS connection works
PUBLISHED_FROM=5831462c5be0b79afff32130a1f45784f32bc524
2017-08-31 21:52:31 +00:00
Deomid Ryabkov
c7bea65ae7 CC3220 FS support
For now, we only support SPIFFS-in-a-box, same as CC3200.
On CC3200SF it should be possible to have SPIFFS on built-in flash, but that is left for later.

PUBLISHED_FROM=dee337c8cd8ed288c22abe9960eef81e6e90cc4a
2017-08-30 16:50:03 +00:00
Deomid Ryabkov
d5a9000d46 Harden MQTT parser some more
PUBLISHED_FROM=5e7fcc7bf145aa8e1045e8d627b1c0731bb4341b
2017-08-30 12:49:30 +00:00
Deomid Ryabkov
f62018451f Fix subscription parsing in MQTT broker
Also, do not accept PUBLISH and SUBSCRIBE before a sucessful CONNECT.

PUBLISHED_FROM=b5096cdc2ec5da1358244c428efbbb2e20be1a05
2017-08-30 08:49:35 +00:00
Deomid Ryabkov
0a93e301c9 CC3220: Exception handling, NWP init
Also make CC3200 use newer ARM compiler, generates slightly smaller code.

PUBLISHED_FROM=a0be49d7ea864a95886f7110887a59f6f11802d7
2017-08-29 21:49:53 +00:00
Dmitry Frank
6fe9cae62a Add mg_next_comma_list_entry_n()
And mgos_conf_check_access_n()

PUBLISHED_FROM=c7de937b4f5463ca463d604183a4ee831617bd6d
2017-08-27 12:49:28 +00:00
Deomid Ryabkov
38e984a008 CC3220 first steps
Achievement unlocked: CC3220 port prints a boot banner.
Then locks up.

Included in this PR is refactoring to pull out common parts to be shared with CC3200.

PUBLISHED_FROM=5fb9d9a00bb9ce7f63dde20bc1876076b76d5257
2017-08-26 17:05:00 +00:00
Our CI Bot
09e4254718 Add mqtt_over_websocket_server example
Fixed bug in websocket handshake:
now adding Sec-WebSocket-Protocol header in handshake response.

PUBLISHED_FROM=e4a71ff9dc4aeec63db40cb7f356dc5b25c1215a
2017-08-24 10:34:35 +00:00
Dmitry Frank
d4b55c4ceb Separate digest auth from HTTP headers parsing
PUBLISHED_FROM=f97569ae2f31ab94ce4875eae4d0a198f719c388
2017-08-22 19:51:53 +00:00
Deomid Ryabkov
7d5479985d Enable LWIP net_if locking on ESP32 (doh!)
https://forum.mongoose-os.com/discussion/comment/4620/#Comment_4620

PUBLISHED_FROM=679dd48e078615ef4f57d1879957b734f549ef2e
2017-08-21 14:24:51 +00:00
ruslanvaliullin
7632a5e4af Fix ignoring DhcpNameServer
PUBLISHED_FROM=73d6767e4aaa7249eeb5d76f9e7160be041292ca
2017-08-17 15:51:21 +00:00
ruslanvaliullin
7f20c41dd5 Implement rmdir & sleep func instead macros
PUBLISHED_FROM=62c73e5fb4f70e2b5b8824ce092012508640b173
2017-08-17 14:32:36 +00:00
ruslanvaliullin
66b23b11b0 Fix Nmap reset on ESP8266
PUBLISHED_FROM=7b9c85e7708721f2c6d0e2fc8ad5c32c61b48854
2017-08-16 17:40:48 +00:00
Deomid Ryabkov
448b44094a Add automated check for extern "C"
Fix headers that didn't have it

PUBLISHED_FROM=ce8140783d4b661f16278a4a5adc957b21965473
2017-07-27 11:19:56 +00:00
Sergey Lyubka
8bbb44f90c Always send MG_EV_HTTP_CHUNK
PUBLISHED_FROM=33957356e1510b73b37768496c74a6bf12630215
2017-07-21 13:34:52 +00:00
Deomid Ryabkov
0fba87c755 Make mg_url_encode public
Change the API to heap-allocate the string and get rid of a bunch of fat stack buffers.

PUBLISHED_FROM=c793dc64a9a044a9769d92ea16859f5d704a2181
2017-07-21 12:06:52 +00:00
Sergey Lyubka
fea648496c Fix https://github.com/cesanta/mongoose-os/issues/318
PUBLISHED_FROM=2fc7b59b2edd0f473acd22067439471778acef8e
2017-07-20 08:05:12 +00:00
Deomid Ryabkov
4c37e49274 Disable insecure and deprectaed SSL protocols
Also allow disabling conmpression and forcing server cipher list.

PUBLISHED_FROM=5539deec9c2382ba34597872dd7f3a5abc0cc311
2017-07-05 17:04:31 +00:00
Deomid Ryabkov
2a2bc33a89 Add mg_strstr
PUBLISHED_FROM=4306e870e2cab854febb6becc198ca2247e2e002
2017-07-05 16:20:32 +00:00
Dmitry Frank
41558bbf64 Fix formatting
PUBLISHED_FROM=4d4d49136e13ba8035d452a4f64fcaf48f15bdb3
2017-07-04 19:35:55 +00:00
Sergey Lyubka
4d0cc95ff4 Add JS net api test
PUBLISHED_FROM=f2821b104f8f2fc196ce4064b7c9f35ea152368d
2017-07-04 19:04:45 +00:00
Deomid Ryabkov
cfd28a4f7a Add mg_strchr
Write unit tests for some mg_str functions.

PUBLISHED_FROM=1fc7e1d5d5ef259d4023f295aec8651caa3e7e86
2017-07-03 15:05:54 +00:00
Deomid Ryabkov
5a0b6fc35a Use SSL_CTX_{get,set}_app_data to store context
h/t @hendrikw01

Fixes https://github.com/cesanta/mongoose/issues/826
Closes https://github.com/cesanta/mongoose/pull/831

PUBLISHED_FROM=d5e1285bee9bcbb85d581ee62972a2fde7d9c0db
2017-07-03 11:04:40 +00:00
Sergey Lyubka
ae611a6e55 Clean up v7 from mongoose
PUBLISHED_FROM=efa9cc3aaf0c5ae8841e029370f882b615cebf1b
2017-07-01 08:51:09 +00:00
Sergey Lyubka
a7a2e3deb1 Introduce log filter
PUBLISHED_FROM=b8f538f87e034452032284d45b78090338e87f72
2017-06-29 14:34:28 +00:00
Deomid Ryabkov
cae0a1cbc0 Fix mongoose amalgamation
PUBLISHED_FROM=16ae777c949caf87e7dce428d62fa8878a30d318
2017-06-28 19:13:47 +00:00
Sergey Lyubka
244e5f67d3 Commonize pattern matching functions
PUBLISHED_FROM=e69e298a51dbe0f9c47184169ecad06eef0676fc
2017-06-28 18:35:37 +00:00
Sergey Lyubka
8d76733fad Make mg_conn_addr_to_str return len
Also amend api_net.js to use returned length.

PUBLISHED_FROM=38e15f9587edf28049c5b9e5f126b4db159910e8
2017-06-26 21:02:02 +00:00
Deomid Ryabkov
fb3a5a7d90 Disable cert verification when ssl_ca_cert is '*'
PUBLISHED_FROM=578706e48a2c1fbbf5e9aaab3eba743e7d13fa61
2017-06-21 14:23:30 +00:00
Deomid Ryabkov
f374ac5f9a Do not close already closed connection
PUBLISHED_FROM=9e345f2319141f20b89e28a2d29adba21ea213e1
2017-06-20 20:06:18 +00:00
Deomid Ryabkov
02707364f0 Lower conn accept message verbosity to DEBUG
Raised in previous commit by mistake

PUBLISHED_FROM=31a73fb610c34ed0c85d081bfa11a8067f216696
2017-06-20 19:14:33 +00:00
Deomid Ryabkov
104106b9cf Invoke tcp_accepted() on the listening pcb
As required by the LWIP API

PUBLISHED_FROM=7bfc6d816aa69f8fdd7592ade48b2d52e2d4991a
2017-06-20 19:14:31 +00:00
Deomid Ryabkov
474e065a30 MAX_PATH_SIZE -> MG_MAX_PATH
PUBLISHED_FROM=32bda9e86a11cad3b908d211a1f7bc9d27312874
2017-06-20 18:06:36 +00:00
Deomid Ryabkov
27094896b1 mOS filesystem refactoring: introduce VFS
With different filesystem implementations and storage drivers, like grown-ups have :)
This is not currently used to add any new functionality, we still have
only one FS and driver on ESP8266 and ESP32; CC3200 has two: SPIFFS and SLFS.
This will be used soon to implement filesystems on additional SPI flash chips and SD cards.

PUBLISHED_FROM=293960fef82952c505e9b1925aac7724c7308362
2017-06-13 15:35:38 +00:00
Dmitry Frank
cd48bcfd7d Don't ignore userdata in mg_bind
PUBLISHED_FROM=0ffcd770535efa66ff1b6f9201f2caf832bd5055
2017-06-09 19:05:40 +00:00
Sergey Lyubka
5baeba53d7 Reorg docs
PUBLISHED_FROM=657a53762ada0ab3fe715a15939eb510a637e37f
2017-06-09 19:05:34 +00:00
Dmitry Frank
3a3b433849 Don't ignore userdata in mg_bind
PUBLISHED_FROM=0ffcd770535efa66ff1b6f9201f2caf832bd5055
2017-06-09 16:18:45 +03:00
ruslanvaliullin
a2192ae483 Add mbuf_append result check
PUBLISHED_FROM=967a7ff3684e548ddbfe92365f7718a99e14d098
2017-06-07 18:50:24 +00:00
Deomid Ryabkov
023b55f2e5 MQTT client keep alive fixes
- Move keep alive management up to the Mongoose library
 - Only outgoing control messgaes should reset keepalive timer
 - Add unit test

https://forum.mongoose-os.com/discussion/1155/mqtt-keep-alive-compliance-issue

PUBLISHED_FROM=f86e30744ded53a6f7f96afec066b4ff3b4372c0
2017-06-04 21:50:23 +00:00
Deomid Ryabkov
e4309d472b Annotate cs_log_printf with format attribute
This adds compile-time checks for format strings.

Fix issues exposed by this.

PUBLISHED_FROM=b9f820d8ad44fce9186dfdad4fe109fafa5371ce
2017-05-30 12:05:34 +00:00
Deomid Ryabkov
c5452fc2ec Don't ignore non-merge commits when publishing
Merge commits are not explicitly ignored either: they're just naturally
ignored as empty commits.

PUBLISHED_FROM=12871fd4c9b1e9de4e57e13d810bffd98ddba299
2017-05-28 13:22:49 +00:00
Dmitry Frank
f78ee9d42e Don't ignore non-merge commits when publishing
Merge commits are not explicitly ignored either: they're just naturally
ignored as empty commits.

PUBLISHED_FROM=2c814104eedd76ee90813488277ecaaf2baf6315
2017-05-28 13:22:48 +00:00
Deomid Ryabkov
c8416cc17d NULL out name server field properly
Fixes https://github.com/cesanta/mongoose-os/issues/260

PUBLISHED_FROM=e95076915d52edb2298e3ea386281c277e42c89a
2017-05-26 14:44:11 +00:00
Deomid Ryabkov
cf0a969a65 ESP8266 and ESP32 build image updates
ESP32: 2.0-r6
ESP8266: 2.0.0-1.5.0-r5

This brings updated mbedTLS with support for on-disk CA chains:
https://github.com/cesanta/mbedtls/compare/esp32_2.0-r5...esp32_2.0-r6
ESP8266 gets bigger rollup (ESP32 got those changes earlier, seems ok):
https://github.com/cesanta/mbedtls/compare/esp8266...esp8266_2.0.0-1.5.0-r5

Saves ~1.5K RAM for now, but will allow adding more roots to ca.pem without wasting RAM.

Refactored docker build for ESP8266 in the same way as was done earlier for ESP32.

PUBLISHED_FROM=db8eb0f91875d02266a8baaf1141c0d65eb59674
2017-05-25 17:20:18 +00:00
Deomid Ryabkov
06670d3401 Fix double-removal of send_mbuf data with SSL on
Other minor fixes.
Also decrease idle poll interval to 100 ms, as a workaround for some cases of incorrect next poll delay computation.

Added HW tests for SSL fetches.

Fixes cesanta/mongoose-os#262

PUBLISHED_FROM=4d19f845768b4b3b990d25959d4211972368d7fc
2017-05-19 16:20:00 +00:00
Deomid Ryabkov
acfc66cd60 Correctly report bytes sent via SSL
This prevented hexdump from showing data sent over SSL when using LWIP net_if

PUBLISHED_FROM=aa520a27bdd21294484c52bf33c8580f3b4bad65
2017-05-11 10:07:09 +00:00
Deomid Ryabkov
6f140202ad Fix LWIP net_if when RTOS is used; use for ESP32
All calls to core LWIP APIs should go through the tcpip thread.

PUBLISHED_FROM=ebe8c7f043394a75a46810f2b6626582c63b9e68
2017-05-09 16:27:53 +00:00
Deomid Ryabkov
d7a633bfa3 Fix timers when polling loop gets delayed
Past due timers should be brought forward to restore interval.

PUBLISHED_FROM=dbe1b8b98804cf8de81e1dbe814222422363278f
2017-05-03 12:51:15 +00:00
Deomid Ryabkov
0ea3cdd228 Implement sending stdout and stderr to MQTT topics
Configured via `debug.std{out,err}_topic`

PUBLISHED_FROM=66c581c38c5039aa9ecc406f8aac0b7e3c6541fc
2017-05-02 21:23:58 +00:00
Deomid Ryabkov
ddef065493 Enable SNTP on CC3200
PUBLISHED_FROM=cea0fc4db21f5b68fd3e779334989fef84a1637a
2017-05-02 21:05:40 +00:00
Deomid Ryabkov
663e928d65 Fix mg_strdup_nul
PUBLISHED_FROM=25bc4d20016bcb71c4e2e4b7be8d2d0566fdfa2e
2017-04-27 14:39:46 +00:00
Deomid Ryabkov
189cd8c5f6 Add mg_assemble_uri
PUBLISHED_FROM=533e134a48e0fca55509c3eb16b0a6b64c1188e8
2017-04-27 13:50:33 +00:00
Deomid Ryabkov
692f436b3d Make mg_connect_ws accept http:// URLs
As well as URLs without prefix

PUBLISHED_FROM=ee298f6575603c8b384888633fe16413695ba70d
2017-04-27 10:51:31 +00:00
Deomid Ryabkov
2e65ce8272 Fix mg_parse_uri for URIs with fragment but no qs
PUBLISHED_FROM=8fb53581e8979c28026f9c2bcacb89de740c18cf
2017-04-26 14:50:38 +00:00
Deomid Ryabkov
a35e5bd966 A function to make a NUL-terminated copy of mg_str
PUBLISHED_FROM=c1310b7d62f3ad6e2f24fea9f5229588c56b0bbe
2017-04-25 10:47:30 +00:00
Deomid Ryabkov
83fe5a17f3 Make mg_connect_{http,ws} use mg_parse_uri
Remove the specialized URI parser, clean up code a bit.

Fix parsing of URIs with IPv6 hosts (http://[2001:2:3::4]:567/)

PUBLISHED_FROM=968ad97585d928123106ce3828920ee073113f83
2017-04-24 14:59:52 +00:00
Deomid Ryabkov
49bbfaf130 Fix mg_lwip_if_get_conn_addr when there's no pcb
Connection may not (yet) have a TCP or UDP PCB associated with it.
mg_lwip_if_get_conn_addr should not crash in this case.

PUBLISHED_FROM=fd0ed683b18b3f549135c9d79eeadfc7348ab05a
2017-04-21 19:33:17 +00:00
Deomid Ryabkov
f868fc861b Enable hosts and resolv.conf lookups on UNIX only
Not relevant for other platforms

PUBLISHED_FROM=65b8959ee677555e2fb330c84d443e0a93d9fd1c
2017-04-18 22:39:24 +00:00
Deomid Ryabkov
84907d5bc4 Ignore tcp sent cb when there's no asscociated nc
TCP ACK may arrive after the we've corresponding mg_connection has already been closed.
Fixes cesanta/mongoose-os#235

PUBLISHED_FROM=8164b86131ef08c1b2a6a08630920d600b3f91ac
2017-04-18 14:38:08 +00:00
Deomid Ryabkov
1cee8a16b9 Fix mg_socket_if_get_conn_addr for UDP sockets
Remote address is not associated with an outgoing UDP socket.
Instead, it is stored in mg_connection.sa

PUBLISHED_FROM=16f82ee8a69b995d684ec96b8db6b5591cd400db
2017-04-18 12:41:54 +00:00
Deomid Ryabkov
57e32b87c7 Fix MQTT will_message length calculation
PUBLISHED_FROM=d2400f6ef4837411586fb27db0b1fa03d94283c6
2017-04-17 07:24:54 +00:00
Deomid Ryabkov
f9596cc1db Perform endpoint auth check on multipart requests
https://github.com/cesanta/mongoose-os/issues/229#issuecomment-293613426

PUBLISHED_FROM=1c34db7ab2598eca1db0266cc6cdd31c32a16fff
2017-04-12 16:59:49 +00:00
Deomid Ryabkov
b2e2ad9a45 Fix hexdump on ESP8266, deliver MG_EV_SEND [...]
[...] after handing data off to LWIP, do not wait for ACK.
We don't do it in net_if_socket, don't do it here either.
Also prevents multiple send attempt on the same send_mbuf data.

PUBLISHED_FROM=4e5a677ebda84af1514f34299e53ce856a537883
2017-04-12 15:54:29 +00:00
Deomid Ryabkov
a07fb2be51 Log DNS failures in mOS
To aid disagnosing cases like https://forum.cesanta.com/index.php?p=/discussion/397/retries-connecting-to-aws-broker

PUBLISHED_FROM=98680b594dbed42234fc53050c9df292feb32f35
2017-04-11 15:51:27 +00:00
Deomid Ryabkov
7f259f2a79 Add optional digest auth to mOS HTTP server
If http.auth_{domain,file} are configured, all HTTP requests require valid digest authorization header.
This applies to files served by mg_http_serve as well as synamic endpoints such as /update and /rpc.

mongoose-os#229

PUBLISHED_FROM=824d594147cfeb2428b463d24478b207839aa5e2
2017-04-11 10:39:45 +00:00
Sergey Lyubka
8ce34af9f3 Clean send_mbuf in mg_if_sent_cb, fix hexdump
PUBLISHED_FROM=3d222e548a3323b957376666e6702b408843b5a3
2017-04-11 00:06:03 +00:00
Deomid Ryabkov
08a10a8af5 Handle multiple MQTT messages per RECV event
PUBLISHED_FROM=fc98c51254dd94d3f443fb66e49449da7d9e754c
2017-04-10 15:51:13 +00:00
Dmitry Frank
bd130136bc Commonize arg checking in cfunctions
Add `mjs_check_arg()` which checks whether argument is provided, and
checks its type. It simplifies code and makes it smaller (because
error strings are not ad-hoc, so they are not duplicated)

As part of that, also commonize type stringifying: implement
`mjs_stringify_type` and reimplement `mjs_typeof` on top of that.

Use `mjs_check_arg()` in `mjs_string_slice()` and
`mjs_string_char_code_at()`.

PUBLISHED_FROM=0b72cf479738ff405d991cbd4bf9e75edda0f111
2017-04-10 10:09:07 +00:00
Ruslan Valiullin
fb04203b72 Fix eintr, zombie
PUBLISHED_FROM=f6d7d0f9c6de8ffeeb3bcd8aace6c1434281ddf7
2017-04-09 16:07:59 +00:00
Deomid Ryabkov
4172c190e5 Fix MQTT handshake; change to version 3.1.1
Differences between 3.1 and 3.1.1:
https://github.com/mqtt/mqtt.github.io/wiki/Differences-between-3.1.0-and-3.1.1

None of them are breaking.

PUBLISHED_FROM=cf2abd28deb1dabf787e07bcfdb335ff72462865
2017-04-08 07:21:01 +00:00
Deomid Ryabkov
920abd627b Minor SNTP fixes
PUBLISHED_FROM=03d04996f160f777339eec9528f2f187e1051ff9
2017-04-07 11:10:37 +00:00
Deomid Ryabkov
02b7399f9a Fix a typo
PUBLISHED_FROM=183a1bb571d0e2f5c23181107d30417f73c1eeb1
2017-04-03 14:20:16 +00:00
Alexander Alashkin
b8402ed073 Fix crash in multipart handling
Close cesanta/dev#6974

PUBLISHED_FROM=4d4e4a46eceba10aec8dacb7f8f58bd078c92307
2017-04-03 09:25:12 +00:00
Deomid Ryabkov
06c5c4d2a4 Handle NULL tpcb in mg_lwip_tcp_write
This can happen if the underlying LWIP TCP PCB has been destroyed (we got tcp_error_cb).

PUBLISHED_FROM=7a060aa4ca2a0c5a818fe9bc6b08cd0733c0ef8f
2017-03-30 15:32:33 +00:00
Ilia Penev
8ec47111d5 Fix COAP compilation
PUBLISHED_FROM=0a0ef6f68d743cbba91d9ba911f1c5be69e6aac7
2017-03-29 12:47:33 +00:00
Alexander Alashkin
8b67274cc0 Fix mg_get_http_var retval
PUBLISHED_FROM=257deff5ea20302627e77a0f29cf2359276a41d4
2017-03-24 13:24:37 +00:00
Dmitry Frank
af22fb7a06 Include mg_mem.h into str_util
PUBLISHED_FROM=990564aa54946b2a5b52d3a9c31f80b8e93c6b44
2017-03-23 22:07:22 +00:00
David Hargat
df5fff5e72 Consistent MG_MALLOC, MG_REALLOC and MG_FREE calls
PUBLISHED_FROM=e7f306b5d1a1366d3ec71fa238c5e18c03aadf8d
2017-03-23 18:54:06 +00:00
benrubson
d9243d1c0b Fix MD5 disabling
PUBLISHED_FROM=bb03593fb2abfb79daa3118b786428ee3e693e3d
2017-03-21 10:50:32 +00:00
Alexander Alashkin
2fb145d39d Fix DISABLE_MD5 and DISABLE_SHA1 naming
PUBLISHED_FROM=2babde0d0c6add14aa500f4bf1c833715d979c6c
2017-03-21 10:24:11 +00:00
Alexander Alashkin
380e87ddfa Honor DNS server from DHCP
PUBLISHED_FROM=10772301ef115c31ada3521ff4235c33a421b782
2017-03-20 09:53:12 +00:00
Deomid Ryabkov
a83e7d8c42 Properly shut down the SSL connection
By sending close_notify

PUBLISHED_FROM=028a001cb9470a16cc7a6544805bfb042a435779
2017-03-15 23:12:57 +00:00
Dmitry Frank
bf7dd7ac63 Add separate userdata for each http endpoint hdlr
PUBLISHED_FROM=29a204c2c7f35724b6f1e8435edb94869da2362c
2017-03-15 17:43:19 +00:00
Dmitry Frank
0fc3370859 First step towards separate userdata argument
PUBLISHED_FROM=93fe1cc2c5e2513509511a81e5919cbd37056b10
2017-03-15 00:52:59 +00:00
Deomid Ryabkov
c416012f97 MGOS SNTP support for ESP8266 and ESP32
PUBLISHED_FROM=8e07541e7a3b951dcfd08381b46f6143773eae45
2017-03-13 17:53:35 +00:00
Deomid Ryabkov
d3a8862bd8 Make interface vtables const
Frees up a bit of ram on ESP

PUBLISHED_FROM=0ea046cc63704481bca138b3096937669b94733d
2017-03-11 00:11:56 +00:00
Deomid Ryabkov
08353731ef Fix MQTT PUB{ACK,REC,REL,COMP} and UNSUBACK flags
Flags should be 0 for all of these, except PUBREL (flags = 2).

PUBLISHED_FROM=46bf63fe12020d4cb493e52ceb3bae0291484b40
2017-03-08 00:23:14 +00:00
Deomid Ryabkov
16700244b0 Fix parsing of MQTT QoS > 0 PUBLISH messages
Message ID comes after topic, not before.

PUBLISHED_FROM=1ec2a56e290b67061b18c745671dc7f089b9cc0d
2017-03-07 23:52:42 +00:00
Deomid Ryabkov
49ca223e9c Minor memory optimization
Release pbuf sooner: after copying data from, before invoking user code

PUBLISHED_FROM=b877c96ef602bbca26762b18b9dde17eb880d1f9
2017-03-07 17:19:47 +00:00
Sergey Lyubka
38efe632ae Squash warning
PUBLISHED_FROM=72d80f8ed2c10866b44d56d8133c76b22bc105b0
2017-03-06 21:51:43 +00:00
Deomid Ryabkov
39a3bb7e44 Log method and URI in mg_http_handler
PUBLISHED_FROM=34c3e49d523b0f5c7056f91e4b422f21f5694df9
2017-03-02 09:36:08 +00:00
Alexander Alashkin
920e8d9145 Add shims for mongoose file operations
PUBLISHED_FROM=b5b12cdf4273f21dbcdac9bfb6a06063152914c9
2017-03-01 10:06:47 +00:00
Alexander Alashkin
aed6d05d8c Do not test reassembled buffer for WS_OP_CLOSE
PUBLISHED_FROM=0e8de208b553b63c8367f66893389587bd17359f
2017-03-01 10:06:46 +00:00
Alexander Alashkin
d85d95a40b Fix potential out-of-bound
PUBLISHED_FROM=71b40189bcedbe9338915c1aad939835125dad26
2017-03-01 10:06:45 +00:00
Alexander Alashkin
b5dd54a404 Fix doc typos
PUBLISHED_FROM=1bdacf793b35ebe70d0a3a9d64260dd2bd135c73
2017-03-01 06:19:58 +00:00
Dmitry Frank
349d25dccf Fix # matching logic
E.g. given the expression `foo/#`:

- `foo/bar` matches
- `foo/` should not match
- `foo` should not match

PUBLISHED_FROM=40f3290cb9a478b22d9f1ab6382884b5de70e266
2017-02-24 15:35:20 +00:00
Dmitry Frank
3942914945 Fix subscription to wildcard topics
`mg_mqtt_match_topic_expression()` and friends are public now.

So far, only `#` is supported.

PUBLISHED_FROM=20c031bcf34be84771c4a9c456318634eb9a517c
2017-02-24 14:21:33 +00:00
Dmitry Frank
60c16bbb5d Fix mos docker image name
PUBLISHED_FROM=91016ab1629a65976d2cc2f00aec4e1667cb4a8f
2017-02-23 21:35:24 +00:00
Sergey Lyubka
70b5f4130e Add http post example
PUBLISHED_FROM=94f830a5fa4b806fb2cf60c93a9e8744022ff8d7
2017-02-23 17:50:14 +00:00
Deomid Ryabkov
81879be4be RTOS stability improvements
PUBLISHED_FROM=2992473e6c05c1dc95878cc549eccba7abcedccf
2017-02-16 16:05:22 +00:00
Deomid Ryabkov
0a094d4c1f Decouple mg_lwip_accept_cb from mg_if_accept_tcp_cb
Must be invoked on mongoose main task, not on LWIP

Also request immediate poll oif there is data to be sent and space to
send it.

PUBLISHED_FROM=53576651452d8d7193da9e63f5b97f6f8729c45b
2017-02-16 12:19:23 +00:00
Deomid Ryabkov
66a96410d4 ESP8266: Add RTOS SDK port (MGOS_ESP8266_RTOS=1)
PUBLISHED_FROM=ca5332e63700274ed9aeea9d9d1802e89fa788fa
2017-02-16 11:05:34 +00:00
Deomid Ryabkov
d4b23f08b6 Implement client support for TLS-PSK
For both OpenSSL and mbedTLS

PUBLISHED_FROM=0bfd5f128b4c4c062cb6f0ca0da9b30790aa8bf8
2017-02-15 08:20:53 +00:00
Sergey Lyubka
ab1c464950 Fix https://github.com/cesanta/mongoose/issues/765
PUBLISHED_FROM=f7f8ce9421d96a5f0d90afe4c930c53662b4e907
2017-02-11 04:50:44 +00:00
Deomid Ryabkov
f20b5191f2 Check UDP pbuf for being NULL
cesanta/mongoose-os#186

PUBLISHED_FROM=30460b56211eb0dff4d05bff45f256ac1da2caf4
2017-02-10 02:35:08 +00:00
Deomid Ryabkov
fc113d64f5 Add mg_hexdumpf: mg_hexdump that outputs to a file
PUBLISHED_FROM=f0fe58c9f01ef0c7b491ed0e5f51b983e4119507
2017-02-09 10:33:33 +00:00
Deomid Ryabkov
6f6b12bee7 Lower verbosity of a debug message
PUBLISHED_FROM=6ff979319c31363df16cedf99b2432bd83db1473
2017-02-09 10:21:15 +00:00
Deomid Ryabkov
4e6c2867da UDP fixes: move recv callback into event loop, ...
...and fix a leak where UDP connections with SEND_AND_CLOSE set would not be closed

PUBLISHED_FROM=d60f1fc037e8e57671c7d3146fabc1f068bbb514
2017-02-09 10:21:12 +00:00
Alexander Alashkin
54989e819a Fix multipart parsing
Close cesanta/mongoose#770

PUBLISHED_FROM=ae55988f1c6ccdff172b8db405adb36c91289d95
2017-02-08 10:54:46 +00:00
Deomid Ryabkov
4072062b72 Add MG_SSL_IF_MBEDTLS_MAX_FRAG_LEN
And set to 1024 for mOS.

PUBLISHED_FROM=ee3a66ad935cfb50355ebd7bae59c8230914878d
2017-02-08 08:25:31 +00:00
Alexander Alashkin
d6ba37dc3c Correct msg len for chunked encoding
Close cesanta/dev#6485

PUBLISHED_FROM=172ab4f18f1fb3e6110ad03eea18a7f87f2e531a
2017-02-07 12:25:06 +00:00
Alexander Alashkin
a58d21aa28 Add overrun protection to mg_sock_to_str
Relate to cesanta/mongoose#780

PUBLISHED_FROM=145d94c52be03ac2d909eae8166774ffd40f0df1
2017-02-07 12:25:05 +00:00
Alexander Alashkin
6e8d4129b2 Use _exit in CGI. Close cesanta/mongoose#779
PUBLISHED_FROM=bfe62d3824ee3a6e66b7d1a57ee7bad3b726649d
2017-02-07 11:09:49 +00:00
Alexander Alashkin
2485a8f8d9 Fix signs comparison. Close cesanta/mongoose#774
PUBLISHED_FROM=a875606de6f4b2c202b25ce20efcb1ca33eb75b8
2017-02-07 08:25:31 +00:00
Sergey Lyubka
dfa83f2c85 Fix TCP close sequence
PUBLISHED_FROM=ed6cf7fd63b6f80d5c37ab93899ecd09bac6102b
2017-02-01 20:26:46 +00:00
Alexander Alashkin
91bdbc5193 Fix warn in mg_lwip_if_poll
PUBLISHED_FROM=0bcb3e892e1ba2329aef5d17375fe4d3879dc666
2017-01-31 13:39:29 +00:00
Alexander Alashkin
707b9ed2d6 Remove mg_enable_multithreading. Close cesanta/dev#6511
PUBLISHED_FROM=7864ffa26cb553f5d4a93248f67c288327ec23b0
2017-01-30 13:55:49 +00:00
Deomid Ryabkov
2ea63a0ea6 Limit len of prefix; makes log tidy w/ long names
PUBLISHED_FROM=570530179da327f8bb156bbbd7c557014c1630c1
2017-01-30 09:24:48 +00:00
Deomid Ryabkov
7988acbff4 Raise log level of mbedTLS socket evs to LL_DEBUG
PUBLISHED_FROM=ed0ac4133342c733977e7884a6bbadab7ee74127
2017-01-26 12:38:30 +00:00
Deomid Ryabkov
7bdbd80552 Fix ESP32 encr. OTA; clean up {open,read,close}dir
Fixed a bunch of things to make OTA work on ESP32 with flash encryption:
writes to app aprtitions must be 32-byte aligned and mod 32 in size.
When merging filesystems during update, use spiffs_vfs_* functions so
that old fs is properly decrypted.

Refactored cs_dirent stuff: SPIFFS support moved to spiffs_vfs.c,
added dirent.h on ESP8266 and CC3200 which includes cs_dirent.h
Define DIR and dirent only if asked (ESP8266, CC3200, WIN32).

PUBLISHED_FROM=58b0d05cdc41b1a9e02d341e2a1cdcb012829232
2017-01-24 12:53:35 +00:00
Alexander Alashkin
58b9ee41fa Use LWIP in stm32/cube
PUBLISHED_FROM=da389ddabf96918fd1bc022e0696dbb4542c71c1
2017-01-11 12:37:44 +00:00
Deomid Ryabkov
20370e65d6 Fix parsing of SSL cipher suite specs for mbedtls
The list of cipher suites must be retained while the context is alive.

PUBLISHED_FROM=a3a82e42c1214c54ae1a40fbc49bc26bca32c053
2017-01-10 13:38:08 +00:00
Deomid Ryabkov
67626d49c9 Add ssl_cipher_suites to mg_{bind,connect}_opts
Optional specification of SSL/TLS cipher suites.

PUBLISHED_FROM=e8968c6c7a92f10514d3ee575c2fb9be862e6cf8
2017-01-09 23:53:00 +00:00
Deomid Ryabkov
cd9e179fcb Format for previous commit
PUBLISHED_FROM=609ef3587e4293b0cdbf865cfc466bbb85233361
2017-01-09 17:04:03 +00:00
Deomid Ryabkov
0ba28e6153 Raise verbosity of some log messages
These are not spammy and help debug issues with serving files

PUBLISHED_FROM=84b0ee174314373d472678a14ca87f575fda6e14
2017-01-09 17:04:02 +00:00
Deomid Ryabkov
c55d06ed57 Add directory listing support ot ESP32
PUBLISHED_FROM=336d6b28d6165ece75d25911058ffdd075a3c191
2016-12-23 12:37:07 +00:00
Deomid Ryabkov
54ebcc5bd8 Minor fixes to socket support when used with LWIP
- LWIP UDP sockets are always writable and they are not reported as
   such by select() (bug? featuyre?). TCP sockets are ok.
 - Always deliver MG_EV_POLL, whether we have other fd_events or not.
   Otherwise MG_EV_POLL would not be delivered at all to perma-writable
   UDP sockets (as they are on LWIP).
 - Ignore EAGAIN/EWOULDBLOCK errors while connecting, this happens
   during SSL handshake.

PUBLISHED_FROM=3b1ee0d2b0c672512da5c9d6141aba1112983426
2016-12-21 13:06:21 +00:00
Alexander Alashkin
02499d672b Build c_mqtt/stm32 - part 1, with stubs
PUBLISHED_FROM=de4b9f3e9eeafa75bb8919abacd86fb23fdefc1b
2016-12-15 14:06:50 +00:00
Alexander Alashkin
8c2e641ed7 Simplest c_hello/stm32
PUBLISHED_FROM=3a22eb96ff011ef8327cd1b78b56a3af86ba2c84
2016-12-14 16:22:16 +00:00
Sergey Lyubka
a447ae5eab MQTT parsing fix
PUBLISHED_FROM=41f43cb0e707259740de3346308f746c2a3778fd
2016-12-13 10:37:06 +00:00
Dmitry Frank
5ebff5d15e Rename pic32_harmony -> pic32
PUBLISHED_FROM=00ca7b2adabde94a683ac4d33be1f2bdbb17772f
2016-12-09 22:06:14 +00:00
Dmitry Frank
731512a947 Define mg_file_upload_handler() only if needed
Namely, define it if only `MG_ENABLE_HTTP_STREAMING_MULTIPART` and
`MG_ENABLE_FILESYSTEM` are on

PUBLISHED_FROM=3094738a4b76ceb09a3c2374e8d9d914b71c3441
2016-12-09 16:06:17 +00:00
Alexander Alashkin
304dbca63d Fix miot-mbed errors and warning, part 3
PUBLISHED_FROM=2f6fb7ea5abdcd4ca9b06956172938ee3bc28459
2016-12-09 12:36:00 +00:00
Marko Mikulicic
9937e88985 Fix comparisons
PUBLISHED_FROM=4d86de7f73ef9d4c0f236e1fe1201e5de792f19f
2016-12-07 18:05:56 +00:00
Sergey Lyubka
57f964a139 Add mqtt last will
PUBLISHED_FROM=fb856714ead67390dfd7ce9d208ae5ae19ce7c6d
2016-12-07 17:21:56 +00:00
Alexander Alashkin
fba32acb73 Replace memcmp with strncmp in mongoose
PUBLISHED_FROM=3c5859f06ab838bba7c95c4878c4e7e883329810
2016-12-02 13:51:30 +00:00
Sergey Lyubka
2fdb1f78a2 Fix amalgamation conflicts: POC
PUBLISHED_FROM=5b63325ade34b9032476fc88ac407816990f1cfc
2016-12-01 22:21:14 +00:00
Alexander Alashkin
ea2069df51 Fix coredump in mg_reverse_proxy_handler
PUBLISHED_FROM=ca0ae588290f133ef7640ca538847a63c0cb544b
2016-12-01 09:21:11 +00:00
Alexander Alashkin
7267fc757d Fix mg_stat
PUBLISHED_FROM=e6fb19c5256b6d43359f21b325e16b415152f26f
2016-11-29 13:36:55 +00:00
Alexander Alashkin
ea7d69060d Replace fopen with mg_fopen
PUBLISHED_FROM=764ea806a5d31bd545a5d99de80e2ee0234ebcab
2016-11-29 13:36:54 +00:00
Alexander Alashkin
6e5e2eb694 Restore HTTP errors descriptions
PUBLISHED_FROM=26becdaf7dd61481b88b166ea87d44a7bc796660
2016-11-29 11:22:06 +00:00
Deomid Ryabkov
51466df7b9 Check for SEND_AND_CLOSE after HANDSHAKE_REQUEST
Assume handshake request was declined if either MG_F_CLOSE_IMMEDIATELY _or_ MG_F_SEND_AND_CLOSE is set.

PUBLISHED_FROM=60af32a3f8890e826205465b9add2f58b1d46e5f
2016-11-28 15:51:14 +00:00
Deomid Ryabkov
d6259332d4 Fix use-after-free
Free keys and cert before conf, not after

PUBLISHED_FROM=5628f56eb6973a779179d641fb425d0f14db39cf
2016-11-28 15:21:18 +00:00
Deomid Ryabkov
260229a4d1 Free certs and keys on client TLS connections
Renegotiation is disabled, so we don't need them.
Reduces per-connection usage when idle by 3K.

PUBLISHED_FROM=24b2ac9557107f7da412dae6a42257c9b7c812d5
2016-11-28 12:05:41 +00:00
Deomid Ryabkov
7776df241c Enable server name verification on mbedTLS
PUBLISHED_FROM=54774944d5402a5d6a351b4609428940c0ad20ea
2016-11-28 08:50:42 +00:00
Deomid Ryabkov
e17fdcb077 Minor memory shavings on ESP8266; ~2.5K less
- Only allow one TCP segment in flight. Each segment is 1.5K and it
   adds up. This may increase latency, but memory is precious on ESP.
   At teh same time, optimize use of tcp_output: do not send a new segment
   on every write, only call tcp_output at the end of connection
   processing during poll.

 - Build LWIP with DNS disabled. We have our won resolver, and LWIP's
   allocates large static buffers (1K).

 - mbedTLS: Deallocate peer's certificate at the end of SSL handshake,
   reduces idle SSL connection footprint by ~1.5K.

 Some tweaks to the heap log viewer (which made all the above possible).

PUBLISHED_FROM=6e84bba64eacb2d737561e09313918104921ea80
2016-11-27 17:21:29 +00:00
Deomid Ryabkov
d96629cdf4 Add support for PEM certs on SimpleLink
Also performs trnasparent SPIFFS -> SLFS cert copy.

If the file's extension is .pem, convert it to DER format and put on SLFS.

PUBLISHED_FROM=364caab21969ca28a05802c4dde93a11d1e0feda
2016-11-25 19:30:05 +00:00
Dmitry Frank
0c79fcfbd0 Add a flag to prevent a tunnel from reconnection
Also fixed a memory leak on reconnect: previously, each reconnect was
creating a `struct mg_connection` which was never reclaimed

PUBLISHED_FROM=eefdcf557e032ac81d5ed3aba55ac912e400148e
2016-11-25 11:36:14 +00:00
Alexander Alashkin
9125830de6 Fix stkovf in mg_resolve_async_opt
PUBLISHED_FROM=8e37c51c6b0bf7d0782f3a997360827471b95d2e
2016-11-25 08:21:38 +00:00
Deomid Ryabkov
44f7b91826 Fix use of SLFS from TI libc "device" interface
PUBLISHED_FROM=e1bb89268dfc4d51880b89b07fb2f69cb49e053b
2016-11-24 12:50:52 +00:00
Deomid Ryabkov
731ea5d50d Increase debug level of stat() and open() messages
Useful for debugging at level 3

PUBLISHED_FROM=b6a4565df0de0dccf37c182c71d2f4c852f2291a
2016-11-24 10:21:58 +00:00
Alexander Alashkin
9e517fde00 Implement SNTP client
PUBLISHED_FROM=ac54bcbc81a9ee688e8b90e261172be76a9fbacd
2016-11-24 09:51:58 +00:00
Dmitry Frank
1ff61837ac Fix mg_http_common_url_parse
The only client of `mg_http_common_url_parse` (namely,
`mg_connect_http_base`) expects `port_i` to be the index in the address
string at which the port was added.

PUBLISHED_FROM=b095926b5485e4674e3c59ff8481171831fb61ae
2016-11-23 18:06:50 +00:00
Deomid Ryabkov
3a8464e4b8 Reinstate fs_slfs_rename stub
Needed by TI libc for use with add_device

PUBLISHED_FROM=ff0713c5f4d04810894d8e1a82aaac25aa101365
2016-11-23 11:07:11 +00:00
Marko Mikulicic
39b0b8e2fd Fix clang formatting
PUBLISHED_FROM=ea64670e42ae58bbe26abee5d928f2afcd83bd46
2016-11-23 08:06:09 +00:00
Sergey Lyubka
3a61186491 Ubreak v7 build - add missing includes
PUBLISHED_FROM=01d691c9e06486cab0903b8db98e56fffc3fb234
2016-11-22 16:21:38 +00:00
Deomid Ryabkov
2180e1786c Allow use of absolute paths on SLFS
If the path starts with /, do not drop it.
There are no directories on SLFS, but use of /pretend/paths/to/files.txt
is common. What we do drop is the ./ prefix (added by mongoose when document_root=.)

PUBLISHED_FROM=5108bc078dfaf8f8afa4db554b4769d9d7b8a103
2016-11-22 15:52:04 +00:00
Deomid Ryabkov
8fb5e8ef19 mbedTLS support for LWIP net_if
PUBLISHED_FROM=a733ba6e06887a448f96f92679f6f8adbe9c61f7
2016-11-22 13:21:42 +00:00
Ilia Penev
a8f54d1851 Integrate PR170
PUBLISHED_FROM=f1a804466bea6d6d77103525d76ef7b819b63477
2016-11-22 08:05:55 +00:00
Marko Mikulicic
a23daa1547 Move mg_a*printf to common
PUBLISHED_FROM=cccd28ef43ec4e08fa52340ce78bda10db5ac27a
2016-11-18 15:36:00 +00:00
Sergey Lyubka
9dba6c806b Add endpoint to list tunnels
PUBLISHED_FROM=f45d9832a884374f6f9ea3f2e0a8c9465f214896
2016-11-18 12:21:11 +00:00
Marko Mikulicic
fc635a9340 Move mg_ncasecmp and sister to common string utils
PUBLISHED_FROM=182c43c3bd82190cb816c8ebaddccc13a94950d0
2016-11-17 11:21:17 +00:00
Alexander Alashkin
81f738af3f Fix mg_http_common_url_parse
PUBLISHED_FROM=51c44c445309aa0850b227949a0a0a6be433d08c
2016-11-17 11:05:57 +00:00
Alexander Alashkin
f6165d23e4 Fix stack overflow in mg_hexdump
PUBLISHED_FROM=5025692f3f4593b3ea38af51f8f49e1ac4df6b88
2016-11-16 17:36:14 +00:00
Alexander Alashkin
e4a4b6f260 Fix coredump in mg_tun_destroy_client
PUBLISHED_FROM=56ff5afe805e4680e02183a8c3887ea60ee5ebfe
2016-11-16 12:21:31 +00:00
Alexander Alashkin
8a6cf95fad Fix mg_match_prefix
PUBLISHED_FROM=4fdfa61e7b3b62083b0ac8fe74dd2dd3793f50fe
2016-11-15 13:36:31 +00:00
Dmitry Frank
37a7031f4e Minor formatting fix
PUBLISHED_FROM=c56b4ae00c454e6931ab29b095641bf0222f860c
2016-11-15 09:51:14 +00:00
Dmitry Frank
8874f3de9d Fix simplelink SSL context
It wasn't checked for `NULL`, and on CC3200 NULL dereferencing addresses
doesn't cause a crash, so it worked by pure luck: ctx->ssl_key was 0.
After `mg_` to `miot_` refactoring it's not the case anymore (presumably
because linker arranged objects in a different order), so this bug shown
up.

PUBLISHED_FROM=0f1cc73a078c18432c68ae0f9b14dd06b3bb4279
2016-11-15 09:06:03 +00:00
Marko Mikulicic
3c5d48ea13 Promote tun example to a unit test
PUBLISHED_FROM=0454cdeec5c7120eb4bf905fdd5b7abdcb4003c2
2016-11-14 18:06:04 +00:00
Marko Mikulicic
74b75899d3 Make cc3200 sprintf workaround smaller
in light of the root cause discovered by rojer
and addressed in cesanta/dev#5882 for the http connection code path.

PUBLISHED_FROM=aea563150a0411cbe3fdc6f7911529f3136cc76f
2016-11-14 17:06:31 +00:00
Deomid Ryabkov
240eca0b68 Avoid passing NULL to %.*s
CC3200 (TI's C library) doesn't like it

https://e2e.ti.com/support/development_tools/compiler/f/343/t/554883

PUBLISHED_FROM=d0e9fb7ebb7d189d1a76451d609f1f1861c7a837
2016-11-14 16:20:08 +00:00
Deomid Ryabkov
65e01dbabc Initial support for mbedTLS
PUBLISHED_FROM=edb1063d3fd64e3c732f16b8bf101c065cdacddd
2016-11-14 16:20:02 +00:00
Deomid Ryabkov
f67fe352cf Pull out common SSL interface
Currently only OpenSSL API impl, but the plan is to add more.

PUBLISHED_FROM=c85b26fa2312047768bdcf3eca583e60862aba90
2016-11-11 20:51:01 +00:00
Marko Mikulicic
4805797752 Fix hexdump memory overflow
PUBLISHED_FROM=a6f3f33432ce43b6d4462de623ba61a53e7f18df
2016-11-11 16:05:53 +00:00
Marko Mikulicic
4c038508f2 Extract tun proto name constant
PUBLISHED_FROM=574362ea7d90a17cd49963a430559824cfcff802
2016-11-11 10:06:02 +00:00
Marko Mikulicic
15db11c0e6 Fix tunnel teardown
PUBLISHED_FROM=2c23e4a4dfc7129da657c5935f06335fc022394a
2016-11-11 08:21:37 +00:00
Deomid Ryabkov
97fe505bb4 clang-format more stuff in common
PUBLISHED_FROM=8b5c6f70d5582402f327c4da7baee7cc15ee13aa
2016-11-10 23:50:42 +00:00
Deomid Ryabkov
fd45a6d31b CS_LOG_TS_DIFF -> CS_LOG_ENABLE_TS_DIFF; ifdef->if
PUBLISHED_FROM=48c8d4326ea8a24edd8d1ca011be9e7643219084
2016-11-10 16:21:28 +00:00
Marko Mikulicic
e1a9ad7f82 Overload mg_bind to bind to tunnel
PUBLISHED_FROM=f554cc63dfea12455fe5e428c6ce5f3152774f8e
2016-11-10 13:07:17 +00:00
Deomid Ryabkov
296affc6e4 Make Krypton define KR_VERSION; use it to detect
PUBLISHED_FROM=ea039cdc30aec44db074871ff6b2d2582f98b5c9
2016-11-10 11:50:56 +00:00
Marko Mikulicic
1889e12b54 Support username:pass authority in HTTP/WS urls
PUBLISHED_FROM=39a1c2a271c5cd961670e11c830105c17ba0b2e4
2016-11-10 11:21:43 +00:00
Sergey Lyubka
5e91d919e0 Make mg_register_http_endpoint work for websocket
PUBLISHED_FROM=5bf5a007929b3b6275121f3cf949526e881fb482
2016-11-09 17:21:38 +00:00
Marko Mikulicic
5934846852 Make mg_tun_bind take separate user+pass
PUBLISHED_FROM=3ee9478275c4b9253b1dd4f98a69cecc89290bce
2016-11-09 15:51:08 +00:00
Marko Mikulicic
5045dfab74 Mongoose TCP tunnel
PUBLISHED_FROM=f03b963aaec02574e47c28ee8033551440b94f2d
2016-11-09 15:05:46 +00:00
Alexander Alashkin
499a7d6a37 Fix mg_is_error
PUBLISHED_FROM=80481f8dbcb93d04eee51ecc6366949420a61f2f
2016-11-09 13:50:52 +00:00
Alexander Alashkin
f72c3fa9a7 Unbreak PIC32 compilation. Close cesanta/dev#5807
PUBLISHED_FROM=cfd7de45e4357a17719501b8ab004c2edbd3e87e
2016-11-09 11:21:02 +00:00
Alexander Alashkin
d0c50632cd Fixes in MQTT for AWS support
PUBLISHED_FROM=2b82f3793b3c6d0cf1266e4cc0e67930f43002c5
2016-11-09 10:05:40 +00:00
Marko Mikulicic
fffb54e2c6 Implementing MG interfaces
PUBLISHED_FROM=46496c2d5340a0bbe4fe1c6c9ff187bc65d2d35f
2016-11-08 22:36:13 +00:00
Dmitry Frank
76bb35d5db Adjust udp_recv callback type for nRF5x
PUBLISHED_FROM=66db56192ae710e3f865fef47593b49e0ed4f133
2016-11-04 17:35:37 +00:00
Deomid Ryabkov
fd763846e5 TI Tiva TM4C129 support and example project
PUBLISHED_FROM=c3d59657adff247f565bf0be59192e32d5d0bbf6
2016-11-02 18:55:04 +00:00
Alexander Alashkin
f4f310cf51 Add WinCE example, update Mongoose for WinCE6.0
PUBLISHED_FROM=2a76ccddb62b63caeaca3785a07d7d0b94125eaf
2016-11-02 10:11:20 +00:00
Deomid Ryabkov
39a17f8a72 Add text msgs for HTTP status codes 400 and 503
PUBLISHED_FROM=1bd3308933354e147c4e8aa375728a1ede6d8ab4
2016-11-01 18:10:46 +00:00
Deomid Ryabkov
78454da3b3 BREAKING: Set MG_F_SEND_AND_CLOSE on UDP conns
Long-lived UDP "connections" i.e. interactions that involve more
than one request and response are rare, most are transactional:
response is sent and the "connection" is closed. Or - should be.
But users (including ourselves) tend to forget about that part,
because UDP is connectionless and one does not think about
processing a UDP request as handling a connection that needs to be
closed. Thus, we begin with SEND_AND_CLOSE flag set, which should
be a reasonable default for most use cases, but it is possible to
turn it off the connection should be kept alive after processing.

PUBLISHED_FROM=1677d8024aa9afa7e18d8a04d829b699f7f2f103
2016-11-01 14:26:00 +00:00
Deomid Ryabkov
6a12bd7abc Wrap LOG and DBG in do { ... } while(0)
PUBLISHED_FROM=c4f3d44ed16dba60db3198b90478c1b2e6f2a5c1
2016-10-31 20:11:37 +00:00
Deomid Ryabkov
92b15395a4 Add CS_P_NXP_LPC - platform def for NXP LPC MCUs
PUBLISHED_FROM=d6ed793313a98545d5a89faafc8526b658ffff66
2016-10-28 18:12:08 +00:00
Marko Mikulicic
f2e7facbc3 Fix master build
amalgamation, ansi C and queue.h usage issue

PUBLISHED_FROM=96a2b8a90d590da0f2d9939c1d2bc7a64d1fe36a
2016-10-28 14:29:58 +00:00
Sergey Lyubka
f1b4f0c463 Fix SEGFAULT in MQTT server
PUBLISHED_FROM=6455082726781aab819a7f8645e81adaa7fc7669
2016-10-28 14:12:40 +00:00
Dmitry Frank
c04e3f80b9 Make mongoose compile for nRF51
PUBLISHED_FROM=6af3ed56802d2619f673c36059370440a0c06397
2016-10-28 11:08:09 +00:00
Deomid Ryabkov
5c9f463cab Add MG_EV_HTTP_MULTIPART_REQUEST_END
This event is sent at the end of the request

PUBLISHED_FROM=0b841a26320e3edbf73126e2ed8d286d4e5f3fa8
2016-10-27 18:09:57 +00:00
Sergey Lyubka
3a8f47befd Mqtt: parsing auth info in the connect message
PUBLISHED_FROM=017e707ea2bd7b1d1972fbb92e5d98c74e17e9d0
2016-10-27 17:53:17 +00:00
Marko Mikulicic
a3e2a41834 Improve error reporting of mg_connect_http
PUBLISHED_FROM=8149fc5ab3c6f7d6ec360473f0e6847040ca820b
2016-10-27 15:22:31 +00:00
Dmitry Frank
b667bd709d Specify void arguments explicitly
PUBLISHED_FROM=345ac55417a9b012e89244d36bfb9ebf8e908637
2016-10-27 12:37:38 +00:00
Marko Mikulicic
a4c668e37a Expose reverse proxy API for dynamic mounts
PUBLISHED_FROM=00772400bce7c15368d91741092ebc8ab0842e19
2016-10-27 12:08:05 +00:00
Marko Mikulicic
900bbe724a Mongoose forwarding
PUBLISHED_FROM=51652f0157bb951a43508f0fe948c62c351e96ba
2016-10-26 14:52:10 +00:00
Alexander Alashkin
06b430e57f PIC32 Harmony TCP/IP support basics
PUBLISHED_FROM=31f8f61de954fa3a36ebad162bdb730c0db95b58
2016-10-26 12:00:13 +00:00
Sergey Lyubka
99377bdd30 Fix user registration flow
PUBLISHED_FROM=bac8c10063215f7f7163f607213d15a3c5f81552
2016-10-26 11:02:09 +00:00
Marko Mikulicic
c151f9bc59 Denoisify mongoose poll logging
PUBLISHED_FROM=ec1cb82cc2404cfe2abdf3bd445ddec3d4ff3e57
2016-10-25 16:55:50 +00:00
Deomid Ryabkov
204bf9acec Krypton + LWIP fixes
* Make kr_{send,recv} report status via return code instaed of errno
 * Move mg_if_* recv and connect callback invocation out of LWIP
   callbacks: these can be nested and we don't want that to happen
   to our callbacks. Instead, we post events for the event manager to
   process during next poll.

PUBLISHED_FROM=9b3c1de796fae381dea1641807e51d7a897a398e
2016-10-25 15:30:04 +00:00