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.
* Actually drop the connection when no response to ping arrives within the next interval.
* Avoid sending immediate ping when wall time is adjusted, it's usually spurious.
PUBLISHED_FROM=8049280b58edfb94dd0fcb6a1e89ffefe69bcea1
If file ends with .gz and has known "secondary extnesion", i.e. test.html.gz,
its content type is determined by the secondary extension and content-encoding is set to gzip.
PUBLISHED_FROM=a238763b4424bafabec2e58ccae4522cacdd7c78
Also free up some RAM by not allocating ca_cert when `MBEDTLS_X509_CA_CHAIN_ON_DISK` is enabled.
PUBLISHED_FROM=5e5f4103707de98c929973d2aed0aaedf0bb60da
tcpip_callback doesn't wait for the callback to run (as was previosuly assumed).
CL: mg_net_if_lwip: Fix invoking callbacks on tcpip thread
PUBLISHED_FROM=930c45f1346f9c3b024e5e684f4a452c762db92b
Check response code, make sure it's 101.
Pass http_message to the client to keep it appraised.
This represents a slight change in the API -
in case of an error MG_EV_WEBSOCKET_HANDSHAKE_DONE will now be delivered where previosuly connection would just hang.
Clients that do not examine the argument may for a moment think handshake has succeeded but in fact connection will be closed immediately.
CL: mg: Fix handling of WS handshake error response
PUBLISHED_FROM=645a43d9e5bee216e54411f85827c9b974e9a7d1
cs_log_set_filter() is removed in favor of cs_log_set_file_level() which
allows setting log verbosity of individual files and/or lines.
E.g.: `mg_=1,mjs=1,=4` - level for for everything except mjs and mongoose.
We use the fact that we are usually pretty careful with our file names and use prefixes consistently.
In mos, `debug.file_level` sets the option on boot and `Sys.SetDebug` is updated to parse `file_level` option to change it at runtime.
CL: Log file:line instead of function; add cs_log_set_file_level()
PUBLISHED_FROM=49f18d4d0d3dd224865129a4f8fe6cccd1d9bc12
If user throttles receive by setting recv_mbuf_limit,
after the net interface reports connection as closed we must wait
for data to trickle through before disposing of it.
There can still b data in the buffers (e.g. SSL).
CL: mg: Ensure that user sees all the data before connection is closed
PUBLISHED_FROM=22be0fa368950a9fdb03cfb00febc7c0a1674b01
It can specify how much data was actually processed and the rest will be re-delivered on next poll.
CL: mg: Add ability for multipart data handler to provide pushback
PUBLISHED_FROM=e0168c5064c3a32921c9209bc09f4da2079cd616
Should use length of the exected response, not the response sent by the user.
CL: mg: Fix digest auth result comparison
PUBLISHED_FROM=23375133b8babac0b276b51395917ad975e1bd3c
Clean the HTTP connection state when ia request/response has been fully
buffered and handler invoked.
Fixes https://github.com/cesanta/mongoose/issues/971
CL: mg: Fix handling of keepalive HTTP requests/responses
PUBLISHED_FROM=70c854aa306aacb9161f6ee48841f38dc0312e6b
Can be used for cases where device has no networking but mongoose is still needed for its event loop.
CL: mg: Add net_if_null, a no-op net interface
PUBLISHED_FROM=e79b4a8667508bbde1437dda9dad77ce3a3aa630
* 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
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
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
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
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
Per standard, cookies are delimited by `; `.
CL: Fix mg_http_parse_header: treat ";" as a delimiter.
PUBLISHED_FROM=039243c30f5fabf4a4700a43506f841b3268306a
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
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
* 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
freshen: implement ota rollback
freshen: api for rpc
freshen: implement rpc api (without transport)
PUBLISHED_FROM=9f935f676161c81464a0dc53d5d8d085b2437ffb
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
In certain files it was necessary to make tests work from public
mongoose repo, so this commit makes things consistent.
PUBLISHED_FROM=694454d0ff007229c65d524a2a2beaf126420f15
Before it resulted in an endless recursion.
Resolves https://github.com/cesanta/mongoose/issues/871
CL: Mongoose Web Server: Fail if passed a NULL handler to `mg_bind` or `mg_bind_opt`.
PUBLISHED_FROM=376e5d330a643fa530f6a27a422a1500f986c721
CL: Mongoose Web Server: Digest authentication: Fix nonce validity check (expired nonce or nonce from the future did not cause the the check to fail)
CL: Mongoose Web Server: Digest authentication: Fix nonce request value; it worked before because nonce validity check was broken as well
CL: Mongoose Web Server: Digest authentication: Add `nonce` argument to `mg_http_create_digest_auth_header()`: clients should use the value received from the server's authentication request.
Resolves https://github.com/cesanta/mongoose/issues/809
PUBLISHED_FROM=5e59f90ed6b2a4311ed6763159da81c2aaf6af4c
CL: Mongoose Web Server: Websocket: Respond to Ping with Pong
CL: Mongoose Web Server: Websocket: Properly close a connection with Close frame (in response to a client's close and when protocol failure is detected)
CL: Mongoose Web Server: Websocket: Fix support of fragmented messages
CL: Mongoose Web Server: Websocket: Add support for control frames interjected in the middle of a fragmented message
PUBLISHED_FROM=e2b3794aaacc64633540c493194cccc62afa2077
`path_info` was dereferenced without checking for NULL, and a few lines
below, it was checked for NULL.
CL: none
PUBLISHED_FROM=9f14dc68c152b9b1119b276f047686d831bace38
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
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
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
Make sure topic is properly NUL-terminated.
Ignore SUBSCRIBE requests with no topic expressions.
PUBLISHED_FROM=a00f39dda44fe63299e971a91a98f8ee57dd2a64
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
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
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
Add checks on the number of subscribe requests per packet and overall per-session subscription limit.
PUBLISHED_FROM=faaf5c50af31a0694c9308a664f2e418dbb0eb18
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
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
Fixed bug in websocket handshake:
now adding Sec-WebSocket-Protocol header in handshake response.
PUBLISHED_FROM=e4a71ff9dc4aeec63db40cb7f356dc5b25c1215a
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
Merge commits are not explicitly ignored either: they're just naturally
ignored as empty commits.
PUBLISHED_FROM=12871fd4c9b1e9de4e57e13d810bffd98ddba299
Merge commits are not explicitly ignored either: they're just naturally
ignored as empty commits.
PUBLISHED_FROM=2c814104eedd76ee90813488277ecaaf2baf6315
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.
Fixescesanta/mongoose-os#262
PUBLISHED_FROM=4d19f845768b4b3b990d25959d4211972368d7fc
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
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
TCP ACK may arrive after the we've corresponding mg_connection has already been closed.
Fixescesanta/mongoose-os#235
PUBLISHED_FROM=8164b86131ef08c1b2a6a08630920d600b3f91ac
Remote address is not associated with an outgoing UDP socket.
Instead, it is stored in mg_connection.sa
PUBLISHED_FROM=16f82ee8a69b995d684ec96b8db6b5591cd400db
[...] 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
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
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
E.g. given the expression `foo/#`:
- `foo/bar` matches
- `foo/` should not match
- `foo` should not match
PUBLISHED_FROM=40f3290cb9a478b22d9f1ab6382884b5de70e266
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