Commit Graph

1096 Commits

Author SHA1 Message Date
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