Commit Graph

1126 Commits

Author SHA1 Message Date
Alexander Alashkin
2efc859829 Fix mt
PUBLISHED_FROM=6e33f546c4d096ef03103f6010124e5d568700b0
2016-08-15 16:21:14 +00:00
Deomid Ryabkov
5fa544fc78 Make mg_http_serve_file public
A way to serve a single, specific file as opposed to the hairy monster
that is mg_serve_http.

PUBLISHED_FROM=6ed1bc487b9d41d212a5907337182f23b040aecf
2016-08-09 10:51:02 +00:00
Deomid Ryabkov
1070dd2d87 Fix overrun in url rewrites, add tests
PUBLISHED_FROM=03dc62aa69dddcbe41d5bc5c014de248332da918
2016-08-09 10:06:12 +00:00
Deomid Ryabkov
447bf4adb0 Compile examples with -Werror
PUBLISHED_FROM=5a24bda9029db3fc7bf04dc871656d65d551f4ab
2016-08-08 10:36:19 +00:00
Marko Mikulicic
a6230bafe7 Make unamalgamated build work with bazel
PUBLISHED_FROM=c6756bc74e6c25e4c120024e3ee2e3406068ad92
2016-07-30 02:21:16 +00:00
Deomid Ryabkov
69f810febc Remove debug that slipped into prod code
PUBLISHED_FROM=7bacb1af60e85e4ed56a600fa3d1dbba1679db59
2016-07-26 18:39:48 +00:00
Deomid Ryabkov
15643f8e67 Use rand() instead of random(), it's more standard
Remove the random() stubs from the codebase

PUBLISHED_FROM=0f56ec7dffa0af1f5061a17d8801239d6f0e32a5
2016-07-22 11:06:16 +00:00
Deomid Ryabkov
1c80fc28ee Destroy net interface before invoking MG_EV_CLOSE
So that socket/connection/whatever is really closed by the time user code is run.

Speed up test_http_endpoints by using appropriate wait conditions.

PUBLISHED_FROM=5fc8a772cc2a9c3b8c9dbddde9f99b41ce4d334c
2016-07-20 14:52:12 +00:00
Deomid Ryabkov
256aa0296d Fix compilation for non-MGIOT projects
That don't have CONSOLE_UART defined

PUBLISHED_FROM=7930bb639baf81cff8ce53c6f81e9739668aae08
2016-07-15 13:34:59 +00:00
Deomid Ryabkov
2eb506c5e0 Make console output in SLFS adapter overrideable
PUBLISHED_FROM=455184fbe730cf62340046c73ffd8ae4b0e0a2c1
2016-07-15 13:19:51 +00:00
Deomid Ryabkov
9f78a2902b Fix SSL stuff
Do not use CA bundle on CC3200, it doesn't work.
Make ssl_ca_cert = "*" mean "no verification" and make sure
SSL is enabled on the connection when it's required, even w/o verification.

PUBLISHED_FROM=c8710a5d24ecfe174ef45b7f81c114d41faf5c12
2016-07-14 13:19:55 +00:00
Deomid Ryabkov
ab208b71c4 Do not define rename() when compiling with TI libc
PUBLISHED_FROM=e9878fc5d55b0b2da854573a7a84e8e14e2f301d
2016-07-13 19:49:47 +00:00
Alexander Alashkin
68dd8d277d Get rid of ubjson
PUBLISHED_FROM=e6f1dca95ec7ed3795adf493cca9cdcdc07381f5
2016-07-12 20:49:59 +00:00
Deomid Ryabkov
68437de416 Fix handling of socket write errors
PUBLISHED_FROM=7264edfb3b8e4e37f15f2993f479dfe0a9550b1d
2016-07-12 11:04:59 +00:00
Deomid Ryabkov
459cd1b095 Properly override rename on Newlib
Newlib implements rename as _link and _unlink, not _rename.
There is no _link on either SLFS or SPIFFS, so override rename directly.

PUBLISHED_FROM=ebb54664f8a3c8664ecab1fac021bef286a0e230
2016-07-11 16:49:56 +00:00
Deomid Ryabkov
fc0bf1953a Fix and improve sorting on Mongoose index pages
Remember sorting settings in url fragment, reverse order on repeated
header click.

PUBLISHED_FROM=faa033eddc86d0aafc12a86aea4145646ea2c89c
2016-07-07 15:49:59 +00:00
Deomid Ryabkov
c907e6c5fb Commonize mg_str
PUBLISHED_FROM=0e6a1c1a2356c1e12580e498c64ba7be367f601c
2016-07-06 23:49:57 +00:00
Deomid Ryabkov
29b3950ee7 Handle SimpleLink restarts in Mongoose
SimpleLink restart invalidates all sockets.
Listeners are restarted, outgoing connections are closed.

PUBLISHED_FROM=15567dfb822bffbd44d39ba0e69a7ac64fd7a1c8
2016-07-06 13:56:50 +00:00
Deomid Ryabkov
0e0c6b8357 Fix off-by one
cesanta/mongoose#677

PUBLISHED_FROM=4b62bdefac08fa3bedf511dc4d6f7463af3325fc
2016-07-06 13:56:48 +00:00
Sergey Lyubka
b7a0748312 Ditch JSON-RPC from mongoose
PUBLISHED_FROM=89b978c02be2f10eb930ff13673d45249fd67763
2016-07-01 11:35:18 +00:00
Alexander Alashkin
421b420a0c Fix mp+keepalive combination
PUBLISHED_FROM=dbfcfa91ad85d6447726d0d7e9fe15709f4c4646
2016-06-29 23:12:25 +03:00
Deomid Ryabkov
4d65cb1c0f Make Mongoose's SHA1 algo pluggable
PUBLISHED_FROM=bdaeed6628ffb544e31d7fd59475f3a2e78c2967
2016-06-28 10:05:31 +00:00
Deomid Ryabkov
79325bd219 Lower verbosity of a message
PUBLISHED_FROM=3b4cbc497c4a0eee2d46f561c0717415ca85c242
2016-06-27 10:50:32 +00:00
Deomid Ryabkov
5a19135c35 Ignore SL_ENOPROTOOPT w/ DOMAIN_NAME_VERIFICATION
Domain name verification feature was added in NWP service pack
(reported version: 2.6.0.5). Older versions do not support it.
There's not much we can do about it, so we just ignore the error.

PUBLISHED_FROM=9495250de1945aae4f2bdf7dddcd7bf1248e24c2
2016-06-24 13:35:33 +00:00
Deomid Ryabkov
290e5f83d4 Switch to TI compiler + UMM malloc for CC3200
Frees up ~19KB RAM:

Before:
  Code size: 210616
  RAM at startup: 48636 total, 34472 free
  RAM after sys init: 15024 free

After:
  Code size: 195784
  RAM at startup: 65096 total, 52980 free
  RAM after sys init: 34116 free

PUBLISHED_FROM=32a9cb8fb6d75cf428bc3548dd5684ce6e52c508
2016-06-22 19:05:07 +00:00
Deomid Ryabkov
b535cb319a Ensure asprintf'd string is NUL-terminated
PUBLISHED_FROM=b4062780d22be37acdbecd86e5951245e2908ff8
2016-06-22 16:20:15 +00:00
rojer
441eaa7f6c Handle errors better in listening code for CC3200
PUBLISHED_FROM=9d4ab680fa672690735b827f56e135330f72beed
2016-06-15 14:32:44 +01:00
Sergey Lyubka
f9d0ad9dc3 Do not leak in mg_connect_ws_opt()
PUBLISHED_FROM=e6de3b3747a1cd79c3930c2640fadc8356ffed61
2016-06-15 12:05:00 +00:00
rojer
1d4f97bb4c SimpleLink net_if impl w/ async support; MG_F_SSL
SimpleLink sockets are suffciently different from BSD that all the
ifdefs have become too messy to warrant a separate net_if
implementation. As part of this we also implement proper async connect
support.

Added MG_F_SSL to identify SSL-enabled connections in a generic way,
since SSL state can be different depending on the implementation.

PUBLISHED_FROM=9cdb8c880b90683e4a26b972cf439d47d6f60917
2016-06-09 17:49:53 +00:00
rojer
dcf1cedec9 SimpleLink SSL support; split cert and key opts
SL requires cert and key to be separate files in DER format.

Date verification is disabled for now.

PUBLISHED_FROM=7d76150ed356140728a1e5fd82d8a0456347b7dc
2016-06-09 11:04:56 +00:00
Marko Mikulicic
845e608280 Clean docs while publishing
PUBLISHED_FROM=274a19d6988002fb029e614bffea4083002324a1
2016-06-07 20:40:26 +00:00
rojer
06b6bf6185 Propagate nc->err to err on CC3200
PUBLISHED_FROM=db7254b5bf25961a700cbce954ef02d41b176500
2016-06-07 16:43:24 +02:00
rojer
04a38b446f Fix compilation with MG_DISABLE_HTTP_WEBSOCKET
Make restful_server and netcat examples compilation tests:
 - netcat doesn't use HTTP, compile it with MG_DISABLE_HTTP
 - restful_server doesn't use websocket, compile it with
   MG_DISABLE_HTTP_WEBSOCKET

h/t @labourcier, cesanta/mongoose#665

PUBLISHED_FROM=4494ac3cbd81e8314beb557ab301b4b44c4afb89
2016-06-07 16:43:24 +02:00
Dmitry Frank
177e829f4b Add v7 arg to _mk_ and _get_ functions
`v7_mk_undefined()` and `v7_mk_null()` are left unchanged, but marked
deprecated, and `V7_UNDEFINED` and `V7_NULL` are public now.

Xtensa code size with instrumentation: 590400 -> 590432, i.e. 32 bytes.
Xtensa code size without instrumentation: 530848 -> 531760, i.e. 912
bytes.

As objdump reveals, inside v7.c, `v7_mk_number` and others are inlined,
so the extra v7 argument is eliminated; outside of v7.c it's obviously
not inlined.

----

Also, v7_get_int() is added, which currently just casts stored double
value to int

PUBLISHED_FROM=e984b7308faf2380b3de388f238e0fae0aea545d
2016-05-28 18:59:27 +01:00
Marko Mikulicic
b5b672ec89 Implement MQTT connect username/password
PUBLISHED_FROM=be604dc6b3650c78daaa02ea4db8cd067069b5e1
2016-05-18 12:07:20 +03:00
Deomid Ryabkov
5e4d9dc17a Restore REMOTE_ADDR and SERVER_PORT CGI env vars
cesanta/mongoose#573

PUBLISHED_FROM=687722f0dbc3c49e6691e01e0d0b1ab2d181bd2f
2016-05-16 13:57:14 +03:00
Sergey Lyubka
4ac688e560 Make mg_http_check_digest_auth() public
PUBLISHED_FROM=f00b94cabc2a89d27d5bc78d68d67db0930811b4
2016-05-16 13:57:13 +03:00
Dmitry Frank
d4b81bb911 Refactor v7_to_number -> v7_get_double and others
We wanted to avoid `to` since it implies some kind of conversion, but
these functions merely return underlying C entity.

Public API changes:

- `v7_to_number()` -> `v7_get_double()`
- `v7_to_boolean()` -> `v7_get_bool()`
- `v7_to_cstring()` -> `v7_get_cstring()`
- `v7_get_string_data()` -> `v7_get_string()`
- `v7_to_foreign()` -> `v7_get_ptr()`

Private API changes:

- `v7_to_pointer()` -> `get_ptr()`
- `v7_to_generic_object()` -> `get_generic_object_struct()`
- `v7_to_object()` -> `get_object_struct()`
- `to_js_function()` -> `get_js_function_struct()`
- `to_cfunction()` -> `get_cfunction_ptr()`

PUBLISHED_FROM=036ac18d442c1128106292ad3e7a818b177eec6a
2016-05-15 22:07:13 +03:00
Deomid Ryabkov
81bf4921d4 Compile mg-iot-cc3200 with ARM compiler, step 1
Code size: 167144 vs 199440

More changes to come (console support, warnings cleanup).

PUBLISHED_FROM=cbc06efcb354c240654518b493496a69293ebc2a
2016-05-03 13:13:04 +01:00
Deomid Ryabkov
8a81dce0c1 Handle orderly shutdown of remote sockets
When getting a EOF from remote, do not close immediately, drain the send
buffer.

PUBLISHED_FROM=e06cdaa2abc0d67d5d88bf3e72d887590a7aeccf
2016-04-29 15:16:46 +01:00
Deomid Ryabkov
203d4a79e2 Improved handling of sockets > FD_SETSIZE
PUBLISHED_FROM=0bf765bf2248d43514643f335592a77d5875618e
2016-04-29 15:16:45 +01:00
Deomid Ryabkov
21665e367c Auto-disable CGI if socketpair is disabled
h/t @danielinux, cesanta/mongoose#652

PUBLISHED_FROM=68c9a86280d63d01b6e4cb72aa6cfd766e4d4be3
2016-04-26 21:02:18 +01:00
Deomid Ryabkov
61672c7805 Properly handle keep-alive connections
HTTP/1.1 connections are keep-alive by default,
HTTP/1.0 are KA only if explicitly requested.

PUBLISHED_FROM=cb2070c2d4e4be6beeab4ae5914b8a01b04bc0cb
2016-04-26 13:30:03 +01:00
Deomid Ryabkov
69bb96113b Add a bit of branding to our responses
Server header and directory index footer

PUBLISHED_FROM=85ced96f70a0241a2970be7613994a3af7238ba9
2016-04-26 13:30:03 +01:00
Deomid Ryabkov
7fdb50807c Resolve *dir function decl conflict on Win32
We used to declare these functions twice: in plaform_windows.h
and cs_dirent.h. Removed decl from platform_windows.h and moved
cs_dirent.h to be privately included by mongoose.c

PUBLISHED_FROM=ab62370409e29e3c62a8b8eab0f75795b5d7ed0f
2016-04-22 16:19:18 +01:00
Deomid Ryabkov
55398684cc Ignore "non-errors" when sending
h/t @f00bard

PUBLISHED_FROM=5deab05502797bb6393e8dbbd5684aba4a72a799
2016-04-22 14:23:49 +01:00
Deomid Ryabkov
41d7520585 Suppress a TI compiler warning
PUBLISHED_FROM=63810a48861c6e2b3e3eb8bab981927f6f85dd40
2016-04-22 12:32:32 +02:00
Deomid Ryabkov
bf9a2b45ef SLFS file size hint
PUBLISHED_FROM=532200881406349585612ea5d59aaa323789a688
2016-04-19 17:44:26 +01:00
Alexander Alashkin
56c687b39b Check for null in DNS handler
PUBLISHED_FROM=e8b719d491688032e6395b75d5859ffad7d7ea23
2016-04-19 12:27:49 +01:00
Deomid Ryabkov
083d398631 Only copy questions when creating reply
In particular, there may be additional records which should not be copied

PUBLISHED_FROM=6b348868cb62d7b3fc4df0e935ffd5a31a314a08
2016-04-19 12:27:48 +01:00