Commit Graph

1258 Commits

Author SHA1 Message Date
Deomid Ryabkov
241090a82b CS_DISABLE_(STDIO|HEXDUMP) -> CS_ENABLE_$1
PUBLISHED_FROM=9fd0cebfa8df53b5d9574a8d013305ddda5e7a18
2016-10-14 10:22:30 +00:00
Deomid Ryabkov
3b69f5d500 MG_DISABLE_DAV -> MG_ENABLE_HTTP_WEBDAV
PUBLISHED_FROM=62267ea0a8e10d8ba7bad590d1a56b179bcffce9
2016-10-14 07:06:13 +00:00
Deomid Ryabkov
b298d46a40 MG_DISABLE_MQTT -> MG_ENABLE_MQTT
PUBLISHED_FROM=34e6028b68e286f81be7ba0f8ae73b760f144131
2016-10-13 21:08:22 +00:00
Deomid Ryabkov
75059d1bdc Rename MG_DISABLE_CGI -> MG_ENABLE_CGI
Also factor out CGI-related code from http.c, it's getting too big.

Build tests with -Wundef

PUBLISHED_FROM=a1e82fafba73812c249db0b49c59d1b48417b60d
2016-10-13 19:22:50 +00:00
Deomid Ryabkov
15e9a92798 Run V7 tests with -Wundef
PUBLISHED_FROM=e2375c5b10be12a75f6a5f9df56ebe9f5faa9331
2016-10-13 19:07:34 +00:00
Deomid Ryabkov
bafc30bec6 Change from using #ifdef to #if for features tests
"#if FOO" still works with simple -DFOO, but gives more flexibility.
Specifically, if user expressed no preference (FOO is not defined),
we can apply reasonable defaults (this is the legitimate use of ifdef).

In short, from now on, please use

 #if MG_ENABLE_FOO

instead of

 #ifdef MG_ENABLE_FOO

Since we are all used to #ifdef, this change also adds a precommit check
to police this. Specifically, in *.h and *.c files that are Copyright Cesanta,
"ifdef" and "if defined()" are not allowed to be used with macros that contain
ENABLE or DISABLE, unless the like also contains "ifdef-ok".

Hence, if you are sure you want to use ifdef, use this:

 #ifdef MG_ENABLE_FOO /* ifdef-ok */

PUBLISHED_FROM=9be829448f53cff575d6cae8b9945fb12531c15a
2016-10-13 18:07:25 +00:00
Deomid Ryabkov
ab48174bac esp_mg_net_if refactoring: split LWIP & ESP parts
esp_mg_net_if was a rat's nest of mongoose net_if and event manager
implementaions and the event loop task for the ESP8266 miot port.
From that, pieces that are related to LWIP support have been pulled out,
separated into net_if and event manager files, and event loop task
has been moved under the miot esp8266 dirrectory.

This is done to facilitate LWIP code reuse. This may not be the end of
it, but it's a start.

Note: custom retransmit logic has been removed for now. Can be
reintroduced later is necessary.

PUBLISHED_FROM=fd5bbf75714583ce95776d4c76b6c5b5dc535364
2016-10-11 18:38:10 +00:00
Deomid Ryabkov
f9a6403b11 Add MG_EV_SSI_CALL_CTX
This is the variant of MG_EV_SSI_CALL with context of the SSI call being
processed in addition to the tag argument. Specifically, call handler
now gets access to the HTTP request and the name of the file being processed.

MG_EV_SSI_CALL is preserved for backward compatibility.

PUBLISHED_FROM=eeea7487c062505abdb23b6f64994ff7a6b60ff8
2016-10-04 23:51:29 +00:00
Deomid Ryabkov
460d95afc5 Add mg_http_send_redirect and make examples use it
PUBLISHED_FROM=f45e06aeba1c00212078d539b6f74cb8bd054326
2016-09-30 11:22:00 +00:00
Alexander Alashkin
8f522048d8 Use gethostbyname for localhost
PUBLISHED_FROM=97c58e8624e0d4fa0f043acf6b20e2a1a5ca1b51
2016-09-30 06:50:52 +00:00
Marko Mikulicic
286fa90ee9 Simple mDNS + DNS-SD impl
Main TODOs:
1. the spec requires the impl to resend the reply once and
   to send gratuitous updates

2. advertise our clubby services as DNS-SD sub-services.

---

Tested with:

1. https://play.google.com/store/apps/details?id=com.grokkt.android.bonjour&hl=en
2. https://play.google.com/store/apps/details?id=com.druk.bonjour.browser&hl=en
3. osx `dns-sd`

Works well enough; it doesn't have some glitches due the fact that we
don't retransmit yet and we don't send gratuitous updates.

PUBLISHED_FROM=38d7a50beb274d4aeeda5b0b58e44dfa0789da84
2016-09-28 08:51:47 +00:00
Deomid Ryabkov
4d76a3be4c Amalgamation changes - clean up paths
Make paths embedded in amalgamated files nice and relative.
This facilitates subsequent clean un- and re-amalgamation.

PUBLISHED_FROM=d83e6000617c54ceaeb78b80c25814996043fe66
2016-09-27 05:06:32 +00:00
Alexander Alashkin
2e748fdbf1 Fix handles leak in CGI
PUBLISHED_FROM=6052b7bfec6af33328cbe369da60e9672ebac437
2016-09-23 15:06:46 +00:00
Deomid Ryabkov
6c99691d1c Add build target for leenoox (using docker)
PUBLISHED_FROM=46a7902a727e0ba34c3dbbe5ee04d5119afbaaff
2016-09-23 15:06:45 +00:00
Alexander Alashkin
fd067c8077 Fix handles leak in CGI
PUBLISHED_FROM=6052b7bfec6af33328cbe369da60e9672ebac437
2016-09-23 15:06:02 +00:00
Alexander Alashkin
0ec1a141f1 Fix mg_http_parse_headers
PUBLISHED_FROM=7e88f60283d499732e8df663814067849d9567bb
2016-09-23 10:21:36 +00:00
Deomid Ryabkov
7414a4fb06 Stop pretending that sl_* API is BSD-compatible
PUBLISHED_FROM=355fea9a5a75ac926d4c64d41828ebcd96c04080
2016-09-22 19:51:06 +00:00
Deomid Ryabkov
abbd44e276 Fix WS handshake nonce generation
PUBLISHED_FROM=ae8d436db9aee9aec7b5ac1cbee6bc4e32d8c6cf
2016-09-22 16:05:38 +00:00
Sergey Lyubka
13e80e6bd5 Add HTTP examples for MIOT
PUBLISHED_FROM=a7ca2e0b705390b32bf2bac44aaaf60c6fcc8522
2016-09-22 14:21:11 +00:00
Alexander Alashkin
238bf1a29e Fix MSVC2015 warnings in mongoose
PUBLISHED_FROM=9e2d5c45d112b9e9493d995b12fe989e93d66d5b
2016-09-13 08:51:20 +00:00
Alexander Alashkin
4cbf81da59 Use user timeout in multithreading polling
PUBLISHED_FROM=dbf75bfba087f1b0aa0531e5003ba3e69ed1a6ab
2016-09-12 14:21:05 +00:00
Alexander Alashkin
d9b7ec18e7 Add MG_F_ENABLE_BROADCAST option
PUBLISHED_FROM=293a54ab09e6879b6f0c36975a137eeaeff92098
2016-09-12 12:36:56 +00:00
Alexander Alashkin
ffed9c4d8c Copy flags for accepted connection
PUBLISHED_FROM=4787d59fdc9f4da525ddfae46e5203d06a596ef4
2016-09-12 10:51:11 +00:00
Dmitry Frank
2a541175b5 Use void arguments list consistently in C code
On my way, fixed a couple of cases where we had `()` in the header, and
non-empty argument list in the source file.

PUBLISHED_FROM=5519526cf84e2bbd425a726fcc112fea1a95cbf1
2016-09-05 15:51:19 +00:00
Alexander Alashkin
5f93f7162f Add STM32F4/CC3100 example & Co
PUBLISHED_FROM=7f805d89dcb795c9b3ee637ef1dbdcfcf3323469
2016-09-05 15:06:21 +00:00
Sergey Lyubka
12437fd7fe Refactor Mongoose documentation
PUBLISHED_FROM=e9a4e5c7b4a1d03b93a2a79e29de19e60e919929
2016-09-01 14:35:02 +00:00
Deomid Ryabkov
844c7787f9 Ignore SL_EAGAIN
It was observed that sl_Send can return SL_EAGAIN, despite the fact that
we only call write_to_socket if it was reported as writeable.

PUBLISHED_FROM=e4cbacb3f16bb7abb479222d7dcbfbe113a39161
2016-08-29 18:20:54 +00:00
Deomid Ryabkov
0fe9ec1499 C Clubby refactoring
Complete rewrite of the C Clubby implementation: it is now modeled after
the Go implementation, with a slight difference that codec and channel
are the same object (something we should probably do in Go as well, as
we only have a single type of channel so far, which is used with all
types of codecs).

This implementation also comes with a new external API,
which is hopefully cleaner and easier to use (see mg_clubby.h).

In this PR I am not adding any new types of channels, but a UART channel
as well as websocket listener channel will be added after this lands.

PUBLISHED_FROM=d545d4bb6434e2a02ad159f9e4b64e594a4797e7
2016-08-29 11:20:54 +00:00
Alexander Alashkin
2deaf084e4 Fix clang -std=c99 compilation
PUBLISHED_FROM=fc3f24d40f92f206e5de4a2fd15100430db87717
2016-08-24 12:50:59 +00:00
Artem Bulavin
fd839f1827 Pointer to int casting warning
PUBLISHED_FROM=6bf2a710edaae6133d68eaf900ede14bba75ad5a
2016-08-19 09:05:55 +00:00
Alexander Alashkin
f149f4aab1 Remove cs_dbg.h from amalgamated headers
PUBLISHED_FROM=993c4b1bec363e3f7975b83710e694792bedf5b3
2016-08-18 14:06:18 +00:00
Alexander Alashkin
8cdd19bcae Call MG_EV_ACCEPT on spawn
PUBLISHED_FROM=f1b4ce4334d24bf613db88ccb28cb3668390ce1d
2016-08-16 09:36:05 +00:00
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
Deomid Ryabkov
923c432977 Add C++ externs to common headers
Closes cesanta/mongoose#649

PUBLISHED_FROM=7d331576ba8f75a7a4ebf833e056dc22f6eda811
2016-04-18 16:06:58 +01:00
Marko Mikulicic
7054b09584 Use invalid socket
Socket type is unsigned int on windows.

PUBLISHED_FROM=fb406d7542ea4d7a529f87b8a3a5a8ba27f5f934
2016-04-15 14:48:25 +01:00
Deomid Ryabkov
67ac6ae191 Fix parsing truncated DNS records
PUBLISHED_FROM=8b849b5dfd72bb3055df34113ec74e47c620af2e
2016-04-12 14:21:06 +01:00
Deomid Ryabkov
c8b09c2238 Move mg_task to SimpleLink platform code
It'll be used for MSP432 as well

PUBLISHED_FROM=cb5dcda4cc5d9edc6dea71540d51ab00e252186e
2016-04-12 11:18:37 +01:00
Deomid Ryabkov
f36b452f00 MSP432 port, step 1
Doesn't actually work yet, but bits common with CC3200 (SimpleLink) are
moved out.

PUBLISHED_FROM=9d9a51cf7d8262694199c46bfd0ac514fc88889e
2016-04-11 09:43:07 +01:00
Deomid Ryabkov
7564623d46 Restore function of CS_DISABLE_STDIO
PUBLISHED_FROM=99c1c7a8cfcb84d283e4ed712f4da6879c41209c
2016-04-08 10:56:10 +02:00
Deomid Ryabkov
ccd0167e40 Switch to CC3200 SDK 1.2.0
PUBLISHED_FROM=857459178e3af50fa6626379d1f71a725cd3b68b
2016-04-06 08:25:50 +01:00
Deomid Ryabkov
19dd02acfd Remove epoll() support
1) It's broken; most likely in more ways than one
2) It doesn't make much sense as long as we maintain MG_EV_POLL and
   have to traverse the list of connections anyway.
3) In Mongoose, simplicity trumps performance.

PUBLISHED_FROM=61d2aeee4f74678bc186063c0977e720a8a414cb
2016-04-05 23:50:24 +01:00
Deomid Ryabkov
8296e0f485 Do not allocate connection state for MG timers
PUBLISHED_FROM=c7cd64eea0ab7553450c452ac30bdd7a5032cbbe
2016-04-05 23:50:19 +01:00
Alexander Alashkin
f57fcbcb50 Implement connect_ws_opt and connect_http_opt
PUBLISHED_FROM=dcec33211d4c7933bd0a78fdb572556df93e51d2
2016-04-05 23:50:12 +01:00
Alexander Alashkin
ce53e9dd2b Fix multipart handling for small files
PUBLISHED_FROM=b43cb8ca061d50ea8c0b6b20287b9382a4a6be22
2016-04-05 23:50:09 +01:00
Alexander Alashkin
55c2634416 Check listener when reusing UDP conn. Closes cesanta/dev#3139
PUBLISHED_FROM=f03f8fad30faee62f290d37b0b909ef49f301b80
2016-04-05 23:50:08 +01:00
Alexander Alashkin
5a02c9dbed Fix create and close conn for UDP. Closes cesanta/dev#3162
PUBLISHED_FROM=071fb54d90750143751c1badc52757f0ba90bdb5
2016-04-05 23:50:05 +01:00
Deomid Ryabkov
81ee559905 Roll CC3200 support into mongoose.{c,h}
This is less than ideal, but will do for now.

PUBLISHED_FROM=86cdc7eb8567b23520169976fb8a2103353b9416
2016-04-01 03:14:41 +01:00
Deomid Ryabkov
96150bf568 Commonize file upload and make it part of Mongoose
PUBLISHED_FROM=23819ed308aeb8c1d6bdb08f5edd257df458ab38
2016-04-01 03:14:38 +01:00
Deomid Ryabkov
f49df51544 Change mg_match_prefix_n to take mg_str
Part of general drive to use mg_str instead of pointer + length.
Adda unit test for mg_match_prefix.

PUBLISHED_FROM=1402506769b0941c6dbe6ae06e03e41df32d6008
2016-04-01 03:14:35 +01:00
Deomid Ryabkov
673796fb3a Improve HTTP erro reporting (send reason)
A few tweaks to TI example
Clean up mbuf_insert code a bit

PUBLISHED_FROM=00ed7aff05d6b760e10c7f14a503eccfc9a284bd
2016-04-01 03:14:32 +01:00
Deomid Ryabkov
482ab33c03 Move printing log prefix into a separate function
Reduces code size a bit and makes it cleaner

PUBLISHED_FROM=c08064102dc64f59dcdc1f80655f32e1ed94c850
2016-04-01 03:14:30 +01:00
Deomid Ryabkov
fb53cd37e7 Make it possible to set log file
And use stdout for CC3200 demo because
  (1) an apparent bug which causes output sent to stderr to be
      printed v-e-r-y s-l-o-w-l-y (yes, it is really like that;
      https://e2e.ti.com/support/development_tools/code_composer_studio/f/81/t/501881)
  (2) in CCS it is printed in BLOOD RED, which is annoying

PUBLISHED_FROM=36a86744bc8ea193e99e98670dadc7f3ab6ed53e
2016-04-01 03:14:29 +01:00
Sergey Lyubka
c9fc7a1320 Fix JSON-RPC error formatting
PUBLISHED_FROM=9af7e0a2a90fab6e012174c154f62ee29c8b879c
2016-04-01 03:14:27 +01:00
Deomid Ryabkov
5f59b7e747 Enable SSI on CC3200 (w/o exec)
Disable CGI automatically, as it's never going to work.

PUBLISHED_FROM=37d7abc54be4637dfec5031bc3398e97a1be3090
2016-04-01 03:14:26 +01:00
Deomid Ryabkov
604c0b189f MG_CC3200 -> MG_SOCKET_SIMPLELINK; some cleanups
PUBLISHED_FROM=865b94073c5ed088847d05f57c1103119648fcaa
2016-04-01 03:14:25 +01:00
Alexander Alashkin
356f1f5119 Fix connection reuse in mg_if_recv_udp_cb
PUBLISHED_FROM=5d248fd465ade7f42293611bc2d60ed72439a489
2016-04-01 03:14:22 +01:00
Deomid Ryabkov
2fc1ff68cf Fix receive on UDP connections
Should only read on outgoing or listening "connections"

PUBLISHED_FROM=e84ff26b899a5f29ddef29ad6c5ba1d18e76e4ad
2016-04-01 03:14:18 +01:00
Deomid Ryabkov
6c4fecc4f7 TI compiler cannot analyze returns from branches
Thinks that mg_ws_random_mask does not return a value.
Help the poor, mentally challenged compiler.

PUBLISHED_FROM=e7c0c47dd2fcbb4e847515892939d69c7a573c2e
2016-04-01 03:14:17 +01:00
Deomid Ryabkov
0991ad7cc8 Minor cleanup
TI compiler detects "multipart" as unused

PUBLISHED_FROM=ababf8965a742418cff610df319e4d8c42e02439
2016-04-01 03:14:17 +01:00
Deomid Ryabkov
d742b67878 Fix address stringification on CC3200 (SimpleLink)
PUBLISHED_FROM=b741acc999d0d2160528b4cb805f315b926ac65b
2016-03-25 17:11:01 +00:00
Deomid Ryabkov
3b345a81c4 Add debug info to websocket conns
PUBLISHED_FROM=7454716e089be5c54359113cc188215e2475ea29
2016-03-22 12:51:48 +00:00
Deomid Ryabkov
6f4c21c218 Do not bypass auth when handling CGI request
PUBLISHED_FROM=9faccf9fedd92d0fb54b7ff660c0cf99c1cbdb74
2016-03-22 11:45:49 +00:00
Deomid Ryabkov
4f9627c612 CC3200 FS refactoring and basic Mongoose example
Moved filesystem-related code out of SJS and into common.
Made it possible to have one, both or no filesystems enabled.
FailFS is now SimpleLinkFS, SLFS (ahem).

Example just serves a "Hello, world!" index page for now.

PUBLISHED_FROM=0e98ee4b8d95782c10791522c42eae5a7ba314f9
2016-03-21 22:45:53 +00:00
Deomid Ryabkov
012f241005 Fix the ESP8266_RTOS example, add it to CI
PUBLISHED_FROM=3d58ec06fe3108a81d1c35f8261783690bb12c4d
2016-03-21 22:45:53 +00:00
Marko Mikulicic
a43709b4a8 Fix MQTT parsing of nullary commands
Closes cesanta/smart.js#619
Also http://forum.cesanta.com/index.php?p=/discussion/35/mixing-up-http-and-mqtt&#

PUBLISHED_FROM=ee040880b75048192c111c602610460071f33066
2016-03-21 13:29:39 +01:00
Alexander Alashkin
e95c074965 Replace strnlen with c_strnlen
PUBLISHED_FROM=815cfaea77171761c952966e98466b87b719de06
2016-03-21 13:29:35 +01:00
Marko Mikulicic
29d6c4ac04 Fix url path parsing
The url parser had two bugs:
- `http://example.com` -> `GET // HTTP/1.1`
- `foo://bar/baz` -> path is `"baz"` instead of `"/baz"`

Now the path returned by  `mg_http_common_url_parse` always
starts with `/`.

Closes cesanta/mongoose#631

PUBLISHED_FROM=f56ed97361ca14ee31d6ed26cf7afe5cd11e0dc5
2016-03-17 13:57:11 +01:00
Deomid Ryabkov
8148b6d037 SJ timer API cleanup; added setInterval and clear*
Timers/intervals are now implemented on top of Mongoose.
Got rid of all the platform-specific code (yay!)

Added interval support and ability to clear previously added timeouts.

PUBLISHED_FROM=93866dd80b95b0fa6e137d87f86138330e720154
2016-03-17 10:43:20 +01:00
Deomid Ryabkov
3327e0e871 Make it legal to have a conn with INVALID_SOCKET
E.g. a timer-only connection

PUBLISHED_FROM=e8d4d2b6e5e0dfa8e8f987b2ded6b973c39e2919
2016-03-17 10:43:19 +01:00
Alexander Alashkin
0456f0f59b Fix boundary problem
PUBLISHED_FROM=b78c97a337208007e1f622fde072cd59664ef76f
2016-03-17 10:43:18 +01:00
Deomid Ryabkov
d1cc952859 Add a tool to fix header guards, apply globally
Identifiers starting with _ are reserved, fix those.
Wrote a tool to do it and applied it globally, why not.

PUBLISHED_FROM=db0fa27c90cbfb06ed06469406f9867c5a5bd3c4
2016-03-14 17:42:20 +01:00
Deomid Ryabkov
f56c5b201d Do not set cipher list if PFS is disabled
Remove Krypton TODO: SSL{,_CTX}_set_cipher_list have been added
(but these ciphers are not supported).

Fixes cesanta/dev#2975

PUBLISHED_FROM=25bf330b785f0a61e18ba409069ebccbd50dcf65
2016-03-14 17:36:58 +01:00
Alexander Alashkin
077b9eb7a4 Fix var initialization
PUBLISHED_FROM=87ce6442efb2c725025942381c01ae2a2de738c7
2016-03-14 14:32:36 +01:00
Deomid Ryabkov
15c333feb0 Increase buffer size for the range header
This should cover 2^64-2^64/2^64

H/T @julee

PUBLISHED_FROM=bcc9f0193ab52375ece00a34c5758ddfe3b628c6
2016-03-14 14:32:35 +01:00
Alexander Alashkin
31c20ab32c Replace m-part&endpoints mbufs with plain structs
PUBLISHED_FROM=b30cf26077b7c6374f0d588e5ef5ba504f979bb3
2016-03-14 14:32:35 +01:00
Deomid Ryabkov
69215cf9eb Adjust poll timeout if there are timers enabled
PUBLISHED_FROM=bbdc998ab4170d55d40d067bab027ae52c9304ec
2016-03-13 15:49:08 +01:00
Alexander Alashkin
4927195ee4 Use mongoose event to free updater resources
PUBLISHED_FROM=3044287fe2623b591ddbf5c619398c21d6753411
2016-03-10 13:11:22 +01:00
Alexander Alashkin
63be1ebd38 Mongoose MSVC2015 warnings cleanup, part1
PUBLISHED_FROM=9e173215ed69464d1aa421d43a8fda814f36f96d
2016-03-08 08:44:23 +01:00
Alexander Alashkin
796dc18cfb Move http endpoints away from mg_conn and more
PUBLISHED_FROM=abd5bcf168194f9d38fbcbf3725eaae209e42fc4
2016-03-08 08:44:23 +01:00
Marko Mikulicic
14e116553f Add mg_connect_ws helper
PUBLISHED_FROM=0ff1c9becea2f0842dcf020d2d2ad64a8c5d95ae
2016-03-08 08:44:23 +01:00
Alexander Alashkin
dbb38fffae Make (http) proto_data persistent
PUBLISHED_FROM=8210f4730a3411b3298274d792fc33da79f47b8a
2016-03-04 16:09:42 +01:00
Marko Mikulicic
672a68219a Fix a few build issues on OSX
PUBLISHED_FROM=d6e7ab0b45c960a4ca0bcb56cbc26bc05d641374
2016-03-04 16:09:41 +01:00
Alexander Alashkin
22cb0efd00 Implement FW upload via POST
PUBLISHED_FROM=6167cc57df932f6c113d03096eba0af0b456c3c3
2016-03-04 16:09:41 +01:00
Deomid Ryabkov
a68d3d63b2 Make mg_mk_str take NULL, rename MG_STR MG_MK_STR
PUBLISHED_FROM=77f24c29667ca2aed3ad8a5102d7e1264f84228b
2016-03-04 16:09:39 +01:00
Deomid Ryabkov
c18828af7b Digest auth fixes
PUBLISHED_FROM=dda24a5bdb42848a74460865dd23794941b46bd4
2016-03-01 09:53:50 +00:00
Marko Mikulicic
8a5f8439b4 Make sure iobuf is renamed to mbuf everywhere
PUBLISHED_FROM=b1049c57352286abda168df521002cfc87136fd6
2016-03-01 09:53:49 +00:00
Deomid Ryabkov
8f0374569e Increase buffer size for cnonce
PUBLISHED_FROM=0dcb2aba0c00da6803227c775e2178230c195f5f
2016-02-29 19:14:53 +00:00
Deomid Ryabkov
d347247bf3 Add POST file upload to SJ web interface
PUBLISHED_FROM=b9575b2dd1da21b40bbfbf98d7c0cf835442c46a
2016-02-29 14:56:25 +01:00
Alexander Alashkin
a6c66fb669 Implement multipart streaming in MG (edition 2)
PUBLISHED_FROM=de89316ca3b53b8eb46ea69e88b5fbd277c80dc2
2016-02-29 14:56:24 +01:00
Deomid Ryabkov
b4dbc825b1 Minor fixes to Mongoose
PUBLISHED_FROM=8a8692e5cfaab63723fc9e241a50e8f229a26438
2016-02-29 14:56:23 +01:00
Deomid Ryabkov
4a0cc8223e Add SSL options to mg_{bind,connect}_opt
PUBLISHED_FROM=7e28eb43742b76c073c9c2c879c64d7b4d3e9a7e
2016-02-25 12:53:04 +00:00
Marko Mikulicic
7db10857b3 Fix build with clang
PUBLISHED_FROM=0cec0e6db4f46a76130fa7b6ec955d4151b28aae
2016-02-25 12:53:03 +00:00
Deomid Ryabkov
7e927b43ad Initial support for SSL in TCPUART 2
PUBLISHED_FROM=93cb3cf49ce9173a7361af17c1bd47858bb2602e
2016-02-25 12:53:03 +00:00
Deomid Ryabkov
9eea072f2a Add optional log of timestamp difference
PUBLISHED_FROM=046ac695f1c771ab156bdd950a8d5cbecbf65bfa
2016-02-25 12:53:02 +00:00
Deomid Ryabkov
aa2ff674db Call recved when data is consumed from recv_mbuf
PUBLISHED_FROM=5fb212ed3114c57182781d441b6886cf83100a76
2016-02-25 12:53:01 +00:00
Alexander Alashkin
db8df41396 Implement mg_register_http_endpoint
PUBLISHED_FROM=357e722e80a2597aa3959756e69db03dc1057ded
2016-02-19 10:14:51 +00:00
Marko Mikulicic
bda05d9372 Import frozen
PUBLISHED_FROM=9f6f38e92b5952b9571d73569c2752b6805f15c5
2016-02-15 15:48:12 +01:00
rojer
00a23ee330 Good bye osdep.h, you won't be missed
PUBLISHED_FROM=f08a8324dfde5f9e22eee0e5e4dbae0e3d45cb3f
2016-02-13 13:59:16 +00:00
Deomid Ryabkov
51ad50a641 Rewrite URI -> path mapping, Windows fixes
PUBLISHED_FROM=6088958e92af2b028646816435892828ce9f7625
2016-02-13 13:59:16 +00:00
Alexander Alashkin
148e1926e8 Fix crash in c_vsnprintf
PUBLISHED_FROM=020d1b9ea66862f71b08232b827cdd6e97528765
2016-02-13 13:59:15 +00:00
Alexander Alashkin
96c023df41 Add zx/zd/zu support to c_vsnprintf
PUBLISHED_FROM=83bf0e541a8541e484a83390108ca73d3af95c38
2016-02-13 13:59:15 +00:00