Commit Graph

1165 Commits

Author SHA1 Message Date
Dmitry Frank
4656e7b0dd Don't access nc->ssl if SSL is disabled
PUBLISHED_FROM=bdbd9416f73f84a3d8afbffe886d0922c36769d4
2016-10-17 10:07:37 +00:00
Alexander Alashkin
4216cf2ac1 Enable FS for WinCE
PUBLISHED_FROM=ec3ed105e29251bdd9b8ad08e8e56c0873ced8ae
2016-10-17 09:22:32 +00:00
Deomid Ryabkov
37e4f51668 MG_DISABLE_SOCKETPAIR -> MG_ENABLE_BROADCAST
PUBLISHED_FROM=81b6289a4b54043df557142f0de8cc66bc5190d4
2016-10-17 04:07:06 +00:00
Deomid Ryabkov
1dae0373c8 MG_DISABLE_POPEN -> MG_ENABLE_HTTP_SSI_EXEC
PUBLISHED_FROM=55b2b70a688234f6ebcfba37eced20ee5d5387a1
2016-10-16 23:21:56 +00:00
Deomid Ryabkov
e928f36456 MG_DISABLE_HTTP(|_SSI|_WEBSOCKET) -> MG_ENABLE$1
Factor out SSI and WS code from http.c

HTTP + WS are enabled by default, but MQTT is built without HTTP
support as a compilation test.

PUBLISHED_FROM=925ed9a55abb193ed7deac1c9675a0e5b35dca50
2016-10-14 17:06:19 +00:00
Alexander Alashkin
fcb94a1742 Port Mongoose to WinCE, part I
PUBLISHED_FROM=292d73fa3e90377b1f929ae47ae1073dab5a4089
2016-10-14 13:37:07 +00:00
Deomid Ryabkov
8ff010ca0f MG_DISABLE_FILESYSTEM -> MG_ENABLE_FILESYSTEM
PUBLISHED_FROM=026810475d98df117ab1dadf40276759190aad19
2016-10-14 12:37:13 +00:00
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