mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-26 12:14:56 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2a3cfc9858 | ||
|
|
b9b20c6494 | ||
|
|
a8a7d2cf7e | ||
|
|
50ecc30b4d | ||
|
|
cd89db5c2f | ||
|
|
1ed99999bd | ||
|
|
4afebdcb2b | ||
|
|
c3d9d17e34 | ||
|
|
7bf5144e62 | ||
|
|
3eb4eb8074 | ||
|
|
ab000c684a | ||
|
|
aba60dadec | ||
|
|
f29457e967 | ||
|
|
8742fac5d8 | ||
|
|
0ab1c7ef76 | ||
|
|
47abc641f1 | ||
|
|
7519b2ef3a | ||
|
|
ce8657f12f | ||
|
|
8e366916d5 | ||
|
|
33f53ab000 | ||
|
|
bd15ad4301 | ||
|
|
e5b3b8ad32 | ||
|
|
e116c48bef | ||
|
|
7d7bb3b388 | ||
|
|
0b4bf13335 | ||
|
|
228984a3fc | ||
|
|
f084ad8008 | ||
|
|
255da78bed | ||
|
|
5d5badfcee | ||
|
|
4cf9f99ae9 | ||
|
|
673f25f75a | ||
|
|
961fb96bb7 | ||
|
|
d6475fcd19 | ||
|
|
ac538f755f | ||
|
|
5b2eb4f0e1 | ||
|
|
10c274c774 | ||
|
|
eb3b81297d | ||
|
|
80f4133bbf | ||
|
|
d10fb9451c | ||
|
|
88ae2ecadb | ||
|
|
85d19dad47 | ||
|
|
c5cc414181 | ||
|
|
17703fe3e8 | ||
|
|
04aeeba2fa | ||
|
|
4e11d5cdbf | ||
|
|
be63c0dc89 | ||
|
|
987bc1d580 | ||
|
|
ddd35c0cba | ||
|
|
c97b615785 | ||
|
|
9ab6d084df | ||
|
|
cf8d0a25aa | ||
|
|
0a0852b576 | ||
|
|
90716417c9 | ||
|
|
101afbc9b8 | ||
|
|
a197646867 | ||
|
|
00d1d2c0e7 | ||
|
|
6e50fe4475 | ||
|
|
7942803a75 | ||
|
|
a8b74a9021 | ||
|
|
27a9a62843 | ||
|
|
9b268b6c77 | ||
|
|
3b3ac48edd | ||
|
|
598e96a0cc | ||
|
|
b5dd0e8093 | ||
|
|
9b24fdfd1d | ||
|
|
8313896a85 | ||
|
|
8193302162 | ||
|
|
6e3e5560d0 | ||
|
|
f0c6630a16 | ||
|
|
1db747da29 | ||
|
|
8065439f96 | ||
|
|
62c896a872 | ||
|
|
2db07dfc3b | ||
|
|
34eb3f1e66 | ||
|
|
9d30e892e9 | ||
|
|
0aaba7a461 | ||
|
|
3d6b568c6e | ||
|
|
2b2816cfe4 | ||
|
|
2fa18b47db | ||
|
|
c8af7cdd27 | ||
|
|
f857f6394f | ||
|
|
97d733e129 | ||
|
|
77e44c7c0e | ||
|
|
abf89d32d9 | ||
|
|
177e05deb2 | ||
|
|
eb5645241c | ||
|
|
202300952c | ||
|
|
c7bea65ae7 | ||
|
|
d5a9000d46 | ||
|
|
f62018451f | ||
|
|
0a93e301c9 | ||
|
|
6fe9cae62a | ||
|
|
38e984a008 | ||
|
|
09e4254718 | ||
|
|
d4b55c4ceb | ||
|
|
7d5479985d | ||
|
|
6517af3dea | ||
|
|
7632a5e4af | ||
|
|
7f20c41dd5 | ||
|
|
66b23b11b0 | ||
|
|
448b44094a | ||
|
|
8bbb44f90c | ||
|
|
0fba87c755 | ||
|
|
fea648496c | ||
|
|
944a6b761c | ||
|
|
f1ae183752 | ||
|
|
a0ece4e969 | ||
|
|
0bb14abbdd | ||
|
|
4c37e49274 | ||
|
|
2a2bc33a89 | ||
|
|
41558bbf64 | ||
|
|
4d0cc95ff4 | ||
|
|
cfd28a4f7a | ||
|
|
5a0b6fc35a | ||
|
|
3e59e1c465 | ||
|
|
ae611a6e55 | ||
|
|
a7a2e3deb1 | ||
|
|
cae0a1cbc0 | ||
|
|
244e5f67d3 | ||
|
|
ff078882d5 | ||
|
|
8d76733fad | ||
|
|
fb3a5a7d90 | ||
|
|
f374ac5f9a | ||
|
|
02707364f0 | ||
|
|
104106b9cf | ||
|
|
474e065a30 | ||
|
|
27094896b1 | ||
|
|
cd48bcfd7d | ||
|
|
5baeba53d7 | ||
|
|
3a3b433849 | ||
|
|
a2192ae483 | ||
|
|
023b55f2e5 | ||
|
|
e4309d472b | ||
|
|
c5452fc2ec | ||
|
|
f78ee9d42e | ||
|
|
c8416cc17d | ||
|
|
cf0a969a65 | ||
|
|
06670d3401 | ||
|
|
acfc66cd60 | ||
|
|
6f140202ad | ||
|
|
cfe77a3d58 | ||
|
|
a0527a7f0e | ||
|
|
c90cffa688 | ||
|
|
d7a633bfa3 | ||
|
|
0ea3cdd228 | ||
|
|
ddef065493 | ||
|
|
ac857d18db | ||
|
|
663e928d65 | ||
|
|
189cd8c5f6 | ||
|
|
692f436b3d | ||
|
|
2e65ce8272 | ||
|
|
a35e5bd966 | ||
|
|
83fe5a17f3 | ||
|
|
49bbfaf130 | ||
|
|
cd9c7dcbec | ||
|
|
f868fc861b | ||
|
|
84907d5bc4 | ||
|
|
1cee8a16b9 | ||
|
|
57e32b87c7 | ||
|
|
6926655513 | ||
|
|
8354319e72 | ||
|
|
f9596cc1db | ||
|
|
b2e2ad9a45 | ||
|
|
a07fb2be51 | ||
|
|
7f259f2a79 | ||
|
|
7c0493071f | ||
|
|
c60fe0c6f6 | ||
|
|
8ce34af9f3 | ||
|
|
82761bb875 | ||
|
|
08a10a8af5 | ||
|
|
bd130136bc | ||
|
|
fb04203b72 | ||
|
|
4172c190e5 | ||
|
|
920abd627b | ||
|
|
02b7399f9a | ||
|
|
b8402ed073 | ||
|
|
06c5c4d2a4 | ||
|
|
57a4ec31d1 | ||
|
|
511c9a6d4a | ||
|
|
8ec47111d5 | ||
|
|
8b67274cc0 | ||
|
|
af22fb7a06 | ||
|
|
df5fff5e72 | ||
|
|
d9243d1c0b | ||
|
|
2fb145d39d | ||
|
|
14094aaef7 | ||
|
|
ec752645ee | ||
|
|
ceb2f1da41 | ||
|
|
aab857a66e | ||
|
|
066be0fe30 | ||
|
|
380e87ddfa | ||
|
|
e9a7a2af18 | ||
|
|
a83e7d8c42 | ||
|
|
bf7dd7ac63 | ||
|
|
0fc3370859 | ||
|
|
c416012f97 | ||
|
|
d3a8862bd8 | ||
|
|
08353731ef | ||
|
|
16700244b0 | ||
|
|
49ca223e9c | ||
|
|
38efe632ae | ||
|
|
39a3bb7e44 | ||
|
|
920e8d9145 | ||
|
|
aed6d05d8c | ||
|
|
d85d95a40b | ||
|
|
b5dd54a404 | ||
|
|
f7c0a2ee15 | ||
|
|
874b5bfdbf | ||
|
|
71d09722be | ||
|
|
349d25dccf | ||
|
|
3942914945 | ||
|
|
60c16bbb5d | ||
|
|
70b5f4130e | ||
|
|
17cfecc5c3 | ||
|
|
ebdd18769b | ||
|
|
f974fddd2a | ||
|
|
b1a46da309 | ||
|
|
81879be4be | ||
|
|
0a094d4c1f | ||
|
|
66a96410d4 | ||
|
|
d4b23f08b6 | ||
|
|
d6d956b9d8 | ||
|
|
383b2a48c5 | ||
|
|
ab1c464950 | ||
|
|
f20b5191f2 | ||
|
|
fc113d64f5 | ||
|
|
6f6b12bee7 | ||
|
|
4e6c2867da | ||
|
|
54989e819a | ||
|
|
bf505bb68d | ||
|
|
4072062b72 | ||
|
|
d6ba37dc3c | ||
|
|
a58d21aa28 | ||
|
|
6e8d4129b2 | ||
|
|
2485a8f8d9 | ||
|
|
1ae908f6d5 | ||
|
|
6b923bdff1 | ||
|
|
d39969d1e6 | ||
|
|
eaef5bd133 | ||
|
|
7cc7df8c0e | ||
|
|
551f393da7 | ||
|
|
e81f8373a2 | ||
|
|
dfa83f2c85 | ||
|
|
91bdbc5193 | ||
|
|
707b9ed2d6 | ||
|
|
cd6b846e22 | ||
|
|
807e4ea6ec | ||
|
|
507e8bfac9 | ||
|
|
2ea63a0ea6 | ||
|
|
7988acbff4 | ||
|
|
b8c3740446 | ||
|
|
7bdbd80552 | ||
|
|
577ad2599c | ||
|
|
4d9f8168b8 | ||
|
|
f1d0b451b1 | ||
|
|
ac921d4657 | ||
|
|
f046434f3b | ||
|
|
58b9ee41fa | ||
|
|
d28d7a67f2 | ||
|
|
20370e65d6 | ||
|
|
67626d49c9 | ||
|
|
cd9e179fcb | ||
|
|
0ba28e6153 | ||
|
|
de791765b2 | ||
|
|
e79121acb7 | ||
|
|
4bdec5c1c1 | ||
|
|
fa39d2f2fa | ||
|
|
c55d06ed57 | ||
|
|
3829873552 | ||
|
|
54ebcc5bd8 | ||
|
|
7782500dbb | ||
|
|
86ec6bb2f8 | ||
|
|
02499d672b | ||
|
|
8c2e641ed7 | ||
|
|
29c53082eb | ||
|
|
2fa988fc7b | ||
|
|
72f1d444d3 | ||
|
|
7dcc94202d | ||
|
|
a447ae5eab | ||
|
|
54ad1e4e47 | ||
|
|
39ea91cfc2 | ||
|
|
5ebff5d15e | ||
|
|
731512a947 | ||
|
|
304dbca63d | ||
|
|
18ff0fafe0 | ||
|
|
25de791424 | ||
|
|
6e88c9cfd1 | ||
|
|
9937e88985 | ||
|
|
57f964a139 | ||
|
|
cbd5835112 | ||
|
|
fba32acb73 | ||
|
|
2fdb1f78a2 | ||
|
|
ea2069df51 | ||
|
|
7267fc757d | ||
|
|
ea7d69060d | ||
|
|
6e5e2eb694 | ||
|
|
51466df7b9 | ||
|
|
d6259332d4 | ||
|
|
260229a4d1 | ||
|
|
7776df241c | ||
|
|
e17fdcb077 | ||
|
|
d96629cdf4 | ||
|
|
0c79fcfbd0 | ||
|
|
9125830de6 | ||
|
|
55963d0c9a | ||
|
|
44f7b91826 | ||
|
|
731ea5d50d | ||
|
|
9e517fde00 | ||
|
|
1ff61837ac | ||
|
|
3a8464e4b8 | ||
|
|
39b0b8e2fd | ||
|
|
3a61186491 | ||
|
|
2180e1786c | ||
|
|
8fb5e8ef19 | ||
|
|
a8f54d1851 | ||
|
|
c9721d4d7f | ||
|
|
c848372bbe | ||
|
|
a23daa1547 | ||
|
|
9dba6c806b | ||
|
|
fc635a9340 | ||
|
|
81f738af3f | ||
|
|
f6165d23e4 | ||
|
|
e4a4b6f260 | ||
|
|
0ceee1dc05 | ||
|
|
8a6cf95fad | ||
|
|
37a7031f4e | ||
|
|
8874f3de9d | ||
|
|
3c5d48ea13 | ||
|
|
a0d98b7a39 | ||
|
|
74b75899d3 | ||
|
|
240eca0b68 | ||
|
|
cd54b18de3 | ||
|
|
65e01dbabc | ||
|
|
62276ce63e | ||
|
|
f67fe352cf | ||
|
|
4805797752 | ||
|
|
4c038508f2 | ||
|
|
15db11c0e6 | ||
|
|
97fe505bb4 | ||
|
|
fd45a6d31b | ||
|
|
e1a9ad7f82 | ||
|
|
296affc6e4 | ||
|
|
1889e12b54 | ||
|
|
5e91d919e0 | ||
|
|
5934846852 | ||
|
|
5045dfab74 | ||
|
|
499a7d6a37 | ||
|
|
f72c3fa9a7 | ||
|
|
d0c50632cd | ||
|
|
fffb54e2c6 | ||
|
|
8bf3bd48a6 | ||
|
|
dbe976ad3e | ||
|
|
9a8a6b53ae | ||
|
|
84132b7b2a | ||
|
|
e69a7a1b25 | ||
|
|
7f2bdc217a | ||
|
|
76bb35d5db | ||
|
|
0187f297d1 | ||
|
|
6ff49dc196 | ||
|
|
cd778396ff | ||
|
|
0dcb50d39c | ||
|
|
fd763846e5 | ||
|
|
f4f310cf51 | ||
|
|
0798b72470 | ||
|
|
39a17f8a72 | ||
|
|
78454da3b3 | ||
|
|
e62dc8f3b2 | ||
|
|
e99088348d | ||
|
|
6a12bd7abc | ||
|
|
b39e30fb0c | ||
|
|
92b15395a4 | ||
|
|
7411ff1fca | ||
|
|
f2e7facbc3 | ||
|
|
f1b4f0c463 | ||
|
|
c04e3f80b9 | ||
|
|
717e872fdd | ||
|
|
dbff932d8b | ||
|
|
5c9f463cab | ||
|
|
3a8f47befd | ||
|
|
a3e2a41834 | ||
|
|
b667bd709d | ||
|
|
a4c668e37a | ||
|
|
900bbe724a | ||
|
|
f5a2857620 | ||
|
|
2ef6f7248d | ||
|
|
06b430e57f | ||
|
|
f061dcf8b6 | ||
|
|
99377bdd30 | ||
|
|
c6b5343c9b | ||
|
|
7f4e2a93d0 | ||
|
|
c151f9bc59 | ||
|
|
204bf9acec | ||
|
|
e3bac87016 | ||
|
|
1f09505248 | ||
|
|
7f99013179 | ||
|
|
8d72c2a7b2 | ||
|
|
c722cfec18 | ||
|
|
835af2cae1 | ||
|
|
bd2a4097b2 | ||
|
|
fcc75c6a3f | ||
|
|
e08b234326 | ||
|
|
5bd3df7a0f | ||
|
|
5bbf24bf41 | ||
|
|
ace1dc53b2 | ||
|
|
100480a1d5 | ||
|
|
a89a2df603 | ||
|
|
988ad66a12 | ||
|
|
85d6292b8f | ||
|
|
98ab0950c9 | ||
|
|
a7f9043072 | ||
|
|
6d8b747ff2 | ||
|
|
a17eae4142 | ||
|
|
7b05d70042 | ||
|
|
f328907da4 | ||
|
|
1cea7ba487 | ||
|
|
6848452149 | ||
|
|
f9a1d47f13 | ||
|
|
492dcdca8d | ||
|
|
4ef3a778c1 | ||
|
|
31c5ef1bc3 | ||
|
|
4656e7b0dd | ||
|
|
4216cf2ac1 | ||
|
|
37e4f51668 | ||
|
|
1dae0373c8 | ||
|
|
e928f36456 | ||
|
|
fcb94a1742 | ||
|
|
8ff010ca0f | ||
|
|
241090a82b | ||
|
|
618bef0eb2 | ||
|
|
3b69f5d500 | ||
|
|
b298d46a40 | ||
|
|
75059d1bdc | ||
|
|
15e9a92798 | ||
|
|
bafc30bec6 |
No files matched your search
@@ -0,0 +1,9 @@
|
|||||||
|
binary/
|
||||||
|
deps/
|
||||||
|
docker/
|
||||||
|
docs/
|
||||||
|
examples/
|
||||||
|
platforms/
|
||||||
|
src/
|
||||||
|
test/
|
||||||
|
multilingual/
|
||||||
@@ -5,33 +5,27 @@
|
|||||||
Mongoose is ideal for embedded environments. It has been designed
|
Mongoose is ideal for embedded environments. It has been designed
|
||||||
for connecting devices and bringing them online. On the market since 2004,
|
for connecting devices and bringing them online. On the market since 2004,
|
||||||
used by vast number of open source and
|
used by vast number of open source and
|
||||||
commercial products - it even runs on space stations!
|
commercial products - it even runs on the International Space station!
|
||||||
Mongoose makes embedded network programming fast, robust, and easy.
|
Mongoose makes embedded network programming fast, robust, and easy.
|
||||||
|
|
||||||
If you're looking for a pre-compiled Windows or Mac binary,
|
- [Download Mongoose Source Code here](https://www.cesanta.com/download.html)
|
||||||
- [Download pre-compiled Mongoose web server binary](https://www.cesanta.com/products/binary)
|
|
||||||
|
|
||||||
Alternatively,
|
Looking for a complete IoT firmware solution?
|
||||||
|
|
||||||
- [Download Mongoose Source Code here](http://hubs.ly/H01bWvx0)
|
Check out [Mongoose OS](https://mongoose-os.com) - open source embedded operating system for low-power connected microcontrollers. Secure, designed for Internet of Things, complete environment for prototyping, development and managing.
|
||||||
- [Check our latest releases] (https://github.com/cesanta/mongoose/releases)
|
|
||||||
- [Read User Guide and API reference](https://docs.cesanta.com/mongoose/dev)
|
|
||||||
- [Study mongoose example code](https://github.com/cesanta/mongoose/tree/master/examples)
|
|
||||||
|
|
||||||
If you are looking for a complete solution with firmware and cloud components, check out [Mongoose IoT Platform](https://github.com/cesanta/mongoose-iot).
|
|
||||||
|
|
||||||
# Support
|
# Support
|
||||||
- [Support Forum - Ask your technical questions here] (http://forum.cesanta.com/index.php?p=/categories/mongoose)
|
- [Study mongoose example code](https://github.com/cesanta/mongoose/tree/master/examples)
|
||||||
- [Chat - Visit www.cesanta.com for our live chat] (http://www.cesanta.com)
|
- [Read User Guide and API reference](https://cesanta.com/docs/overview/intro.html)
|
||||||
- [Commercial one-to-one support - Available to all commercial license holders] (https://www.cesanta.com/services-support)
|
- [Support Forum - ask your technical questions here](https://forum.mongoose-os.com/categories/mongoose)
|
||||||
|
- [Commercial licensing and support available](https://www.cesanta.com/licensing.html)
|
||||||
|
- [Check our latest releases](https://github.com/cesanta/mongoose/releases)
|
||||||
|
|
||||||
# Features
|
# Features
|
||||||
|
|
||||||
* Cross-platform: works on Linux/UNIX, MacOS, QNX, eCos, Windows, Android,
|
* Cross-platform: works on Linux/UNIX, MacOS, QNX, eCos, Windows, Android,
|
||||||
iPhone, FreeRTOS (TI CC3200, ESP8266), etc
|
iPhone, FreeRTOS (TI CC3200, ESP8266), etc
|
||||||
* Single-threaded, asynchronous, non-blocking core with simple event-based API
|
* Supported hardware platforms: TI CC3200, TI MSP432, NRF52, STM32, PIC32, ESP8266, ESP32 and more
|
||||||
* Native support for [PicoTCP embedded TCP/IP stack](http://www.picotcp.com),
|
|
||||||
[LWIP embedded TCP/IP stack](https://en.wikipedia.org/wiki/LwIP)
|
|
||||||
* Builtin protocols:
|
* Builtin protocols:
|
||||||
- plain TCP, plain UDP, SSL/TLS (over TCP, one-way or two-way)
|
- plain TCP, plain UDP, SSL/TLS (over TCP, one-way or two-way)
|
||||||
- HTTP client, HTTP server
|
- HTTP client, HTTP server
|
||||||
@@ -39,6 +33,9 @@ If you are looking for a complete solution with firmware and cloud components, c
|
|||||||
- MQTT client, MQTT broker
|
- MQTT client, MQTT broker
|
||||||
- CoAP client, CoAP server
|
- CoAP client, CoAP server
|
||||||
- DNS client, DNS server, async DNS resolver
|
- DNS client, DNS server, async DNS resolver
|
||||||
|
* Single-threaded, asynchronous, non-blocking core with simple event-based API
|
||||||
|
* Native support for [PicoTCP embedded TCP/IP stack](http://www.picotcp.com),
|
||||||
|
[LWIP embedded TCP/IP stack](https://en.wikipedia.org/wiki/LwIP)
|
||||||
* Tiny static and run-time footprint
|
* Tiny static and run-time footprint
|
||||||
* Source code is both ISO C and ISO C++ compliant
|
* Source code is both ISO C and ISO C++ compliant
|
||||||
* Very easy to integrate: just copy
|
* Very easy to integrate: just copy
|
||||||
@@ -48,13 +45,9 @@ If you are looking for a complete solution with firmware and cloud components, c
|
|||||||
|
|
||||||
# Licensing
|
# Licensing
|
||||||
|
|
||||||
Mongoose is released under commercial and [GNU GPL v.2](http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) open source licenses.
|
Mongoose is released under Commercial and [GNU GPL v.2](http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) open source licenses.
|
||||||
|
|
||||||
Commercial Projects:
|
Commercial Projects: [Contact us for commercial license.](https://www.cesanta.com/contact.html)
|
||||||
Once your project becomes commercialised GPLv2 licensing dictates that you need to either open your source fully or purchase a commercial license. Cesanta offer full, royalty-free commercial licenses without any GPL restrictions. If your needs require a custom license, we’d be happy to work on a solution with you. [Contact us for pricing.] (https://www.cesanta.com/contact)
|
|
||||||
|
|
||||||
Prototyping:
|
|
||||||
While your project is still in prototyping stage and not for sale, you can use Mongoose’s open source code without license restrictions.
|
|
||||||
|
|
||||||
# Dashboard Example
|
# Dashboard Example
|
||||||
|
|
||||||
@@ -62,19 +55,14 @@ Mongoose is often used to implement device dashboards and real-time
|
|||||||
data exchange over Websocket. Here is a dashboard example that illustrates
|
data exchange over Websocket. Here is a dashboard example that illustrates
|
||||||
the functionality:
|
the functionality:
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
[Developing a new product? Contact us today to discuss how Mongoose can help
|
[Developing a new product? Contact us today to discuss how Mongoose can help.](https://www.cesanta.com/contact.html)
|
||||||
](https://www.cesanta.com/contact)
|
|
||||||
|
|
||||||
# Contributions
|
# Contributions
|
||||||
|
|
||||||
To submit contributions, sign
|
To submit contributions, sign [Cesanta CLA](https://cesanta.com/cla.html)
|
||||||
[Cesanta CLA](https://docs.cesanta.com/contributors_la.shtml)
|
|
||||||
and send GitHub pull request. You retain the copyright on your contributions.
|
and send GitHub pull request. You retain the copyright on your contributions.
|
||||||
|
|
||||||
## Working with the Source Code
|
# Looking for a pre-compiled Mongoose web server Windows or Mac binary?
|
||||||
|
- [Download pre-compiled Mongoose web server binary.](https://www.cesanta.com/binary.html)
|
||||||
See [tools](https://github.com/cesanta/mongoose/tree/master/tools) directory.
|
|
||||||
|
|
||||||
[](https://github.com/cesanta/mongoose)
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_connect_ws_opt()"
|
|
||||||
decl_name: "mg_connect_ws_opt"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
struct mg_connection *mg_connect_ws_opt(struct mg_mgr *mgr,
|
|
||||||
mg_event_handler_t ev_handler,
|
|
||||||
struct mg_connect_opts opts,
|
|
||||||
const char *url, const char *protocol,
|
|
||||||
const char *extra_headers);
|
|
||||||
---
|
|
||||||
|
|
||||||
Helper function that creates an outbound WebSocket connection
|
|
||||||
|
|
||||||
Mostly identical to `mg_connect_ws`, but allows to provide extra parameters
|
|
||||||
(for example, SSL parameters)
|
|
||||||
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_connect_http_opt()"
|
|
||||||
decl_name: "mg_connect_http_opt"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
struct mg_connection *mg_connect_http_opt(struct mg_mgr *mgr,
|
|
||||||
mg_event_handler_t ev_handler,
|
|
||||||
struct mg_connect_opts opts,
|
|
||||||
const char *url,
|
|
||||||
const char *extra_headers,
|
|
||||||
const char *post_data);
|
|
||||||
---
|
|
||||||
|
|
||||||
Helper function that creates an outbound HTTP connection.
|
|
||||||
|
|
||||||
Mostly identical to mg_connect_http, but allows you to provide extra
|
|
||||||
*parameters
|
|
||||||
(for example, SSL parameters)
|
|
||||||
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_http_parse_header()"
|
|
||||||
decl_name: "mg_http_parse_header"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
int mg_http_parse_header(struct mg_str *hdr, const char *var_name, char *buf,
|
|
||||||
size_t buf_size);
|
|
||||||
---
|
|
||||||
|
|
||||||
Parses the HTTP header `hdr`. Finds variable `var_name` and stores its value
|
|
||||||
in the buffer `buf`, `buf_size`. Returns 0 if variable not found, non-zero
|
|
||||||
otherwise.
|
|
||||||
|
|
||||||
This function is supposed to parse cookies, authentication headers, etc.
|
|
||||||
Example (error handling omitted):
|
|
||||||
|
|
||||||
char user[20];
|
|
||||||
struct mg_str *hdr = mg_get_http_header(hm, "Authorization");
|
|
||||||
mg_http_parse_header(hdr, "username", user, sizeof(user));
|
|
||||||
|
|
||||||
Returns the length of the variable's value. If buffer is not large enough,
|
|
||||||
or variable not found, 0 is returned.
|
|
||||||
|
|
||||||
+12
-12
@@ -1,16 +1,16 @@
|
|||||||
---
|
---
|
||||||
items:
|
items:
|
||||||
- { name: mbuf.h }
|
- { name: mbuf.h }
|
||||||
- { name: net.h }
|
- { name: mg_net.h }
|
||||||
- { name: http.h }
|
- { name: mg_http.h }
|
||||||
- { name: http_server.h }
|
- { name: mg_http_server.h }
|
||||||
- { name: http_client.h }
|
- { name: mg_http_client.h }
|
||||||
- { name: dns.h }
|
- { name: mg_dns.h }
|
||||||
- { name: dns_server.h }
|
- { name: mg_dns_server.h }
|
||||||
- { name: resolv.h }
|
- { name: mg_resolv.h }
|
||||||
- { name: mqtt.h }
|
- { name: mg_mqtt.h }
|
||||||
- { name: mqtt_server.h }
|
- { name: mg_mqtt_server.h }
|
||||||
- { name: coap.h }
|
- { name: mg_coap.h }
|
||||||
- { name: util.h }
|
- { name: mg_util.h }
|
||||||
- { name: uri.h }
|
- { name: mg_uri.h }
|
||||||
---
|
---
|
||||||
@@ -3,9 +3,9 @@ title: "Memory Buffers"
|
|||||||
symbol_kind: "intro"
|
symbol_kind: "intro"
|
||||||
decl_name: "mbuf.h"
|
decl_name: "mbuf.h"
|
||||||
items:
|
items:
|
||||||
- { name: mbuf_init.md }
|
|
||||||
- { name: mbuf_free.md }
|
|
||||||
- { name: mbuf_append.md }
|
- { name: mbuf_append.md }
|
||||||
|
- { name: mbuf_free.md }
|
||||||
|
- { name: mbuf_init.md }
|
||||||
- { name: mbuf_insert.md }
|
- { name: mbuf_insert.md }
|
||||||
- { name: mbuf_remove.md }
|
- { name: mbuf_remove.md }
|
||||||
- { name: mbuf_resize.md }
|
- { name: mbuf_resize.md }
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
---
|
---
|
||||||
title: "CoAP API reference"
|
title: "CoAP API reference"
|
||||||
symbol_kind: "intro"
|
symbol_kind: "intro"
|
||||||
decl_name: "coap.h"
|
decl_name: "mg_coap.h"
|
||||||
items:
|
items:
|
||||||
- { name: mg_set_protocol_coap.md }
|
|
||||||
- { name: mg_coap_add_option.md }
|
- { name: mg_coap_add_option.md }
|
||||||
- { name: mg_coap_free_options.md }
|
|
||||||
- { name: mg_coap_send_message.md }
|
|
||||||
- { name: mg_coap_send_ack.md }
|
|
||||||
- { name: mg_coap_parse.md }
|
|
||||||
- { name: mg_coap_compose.md }
|
- { name: mg_coap_compose.md }
|
||||||
- { name: struct_mg_coap_option.md }
|
- { name: mg_coap_free_options.md }
|
||||||
|
- { name: mg_coap_parse.md }
|
||||||
|
- { name: mg_coap_send_ack.md }
|
||||||
|
- { name: mg_coap_send_message.md }
|
||||||
|
- { name: mg_set_protocol_coap.md }
|
||||||
- { name: struct_mg_coap_message.md }
|
- { name: struct_mg_coap_message.md }
|
||||||
|
- { name: struct_mg_coap_option.md }
|
||||||
---
|
---
|
||||||
|
|
||||||
CoAP message format:
|
CoAP message format:
|
||||||
+2
-1
@@ -9,5 +9,6 @@ signature: |
|
|||||||
---
|
---
|
||||||
|
|
||||||
Adds a new option to mg_coap_message structure.
|
Adds a new option to mg_coap_message structure.
|
||||||
Returns pointer to the newly created option.
|
Returns pointer to the newly created option.
|
||||||
|
Note: options must be freed by using mg_coap_free_options
|
||||||
|
|
||||||
File renamed without changes.
+1
-1
@@ -7,5 +7,5 @@ signature: |
|
|||||||
---
|
---
|
||||||
|
|
||||||
Frees the memory allocated for options.
|
Frees the memory allocated for options.
|
||||||
If the cm paramater doesn't contain any option it does nothing.
|
If the cm parameter doesn't contain any option it does nothing.
|
||||||
|
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,19 +1,19 @@
|
|||||||
---
|
---
|
||||||
title: "DNS API reference"
|
title: "DNS API reference"
|
||||||
symbol_kind: "intro"
|
symbol_kind: "intro"
|
||||||
decl_name: "dns.h"
|
decl_name: "mg_dns.h"
|
||||||
items:
|
items:
|
||||||
- { name: mg_dns_parse_record_data.md }
|
|
||||||
- { name: mg_send_dns_query.md }
|
|
||||||
- { name: mg_dns_insert_header.md }
|
|
||||||
- { name: mg_dns_copy_questions.md }
|
- { name: mg_dns_copy_questions.md }
|
||||||
- { name: mg_dns_encode_record.md }
|
|
||||||
- { name: mg_dns_encode_name.md }
|
- { name: mg_dns_encode_name.md }
|
||||||
- { name: mg_parse_dns.md }
|
- { name: mg_dns_encode_record.md }
|
||||||
|
- { name: mg_dns_insert_header.md }
|
||||||
|
- { name: mg_dns_parse_record_data.md }
|
||||||
- { name: mg_dns_uncompress_name.md }
|
- { name: mg_dns_uncompress_name.md }
|
||||||
|
- { name: mg_parse_dns.md }
|
||||||
|
- { name: mg_send_dns_query.md }
|
||||||
- { name: mg_set_protocol_dns.md }
|
- { name: mg_set_protocol_dns.md }
|
||||||
- { name: struct_mg_dns_resource_record.md }
|
|
||||||
- { name: struct_mg_dns_message.md }
|
- { name: struct_mg_dns_message.md }
|
||||||
|
- { name: struct_mg_dns_resource_record.md }
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
File renamed without changes.
File renamed without changes.
+1
-1
@@ -21,5 +21,5 @@ This function doesn't update the `name` and `rdata` pointers in the `rr`
|
|||||||
struct because they might be invalidated as soon as the IO buffer grows
|
struct because they might be invalidated as soon as the IO buffer grows
|
||||||
again.
|
again.
|
||||||
|
|
||||||
Returns the number of bytes appened or -1 in case of error.
|
Returns the number of bytes appended or -1 in case of error.
|
||||||
|
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: "DNS server API reference"
|
title: "DNS server API reference"
|
||||||
symbol_kind: "intro"
|
symbol_kind: "intro"
|
||||||
decl_name: "dns_server.h"
|
decl_name: "mg_dns_server.h"
|
||||||
items:
|
items:
|
||||||
- { name: mg_dns_create_reply.md }
|
- { name: mg_dns_create_reply.md }
|
||||||
- { name: mg_dns_reply_record.md }
|
- { name: mg_dns_reply_record.md }
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,21 +1,25 @@
|
|||||||
---
|
---
|
||||||
title: "Common API reference"
|
title: "Common API reference"
|
||||||
symbol_kind: "intro"
|
symbol_kind: "intro"
|
||||||
decl_name: "http.h"
|
decl_name: "mg_http.h"
|
||||||
items:
|
items:
|
||||||
- { name: mg_set_protocol_http_websocket.md }
|
|
||||||
- { name: mg_send_websocket_handshake.md }
|
|
||||||
- { name: mg_send_websocket_handshake2.md }
|
|
||||||
- { name: mg_connect_ws.md }
|
- { name: mg_connect_ws.md }
|
||||||
- { name: mg_connect_ws_opt.md }
|
- { name: mg_connect_ws_opt.md }
|
||||||
|
- { name: mg_http_is_authorized.md }
|
||||||
|
- { name: mg_http_send_digest_auth_request.md }
|
||||||
|
- { name: mg_printf_websocket_frame.md }
|
||||||
- { name: mg_send_websocket_frame.md }
|
- { name: mg_send_websocket_frame.md }
|
||||||
- { name: mg_send_websocket_framev.md }
|
- { name: mg_send_websocket_framev.md }
|
||||||
- { name: mg_printf_websocket_frame.md }
|
- { name: mg_send_websocket_handshake.md }
|
||||||
|
- { name: mg_send_websocket_handshake2.md }
|
||||||
|
- { name: mg_send_websocket_handshake3.md }
|
||||||
|
- { name: mg_send_websocket_handshake3v.md }
|
||||||
|
- { name: mg_set_protocol_http_websocket.md }
|
||||||
- { name: mg_url_decode.md }
|
- { name: mg_url_decode.md }
|
||||||
- { name: struct_http_message.md }
|
- { name: struct_http_message.md }
|
||||||
- { name: struct_websocket_message.md }
|
|
||||||
- { name: struct_mg_http_multipart_part.md }
|
- { name: struct_mg_http_multipart_part.md }
|
||||||
- { name: struct_mg_ssi_call_ctx.md }
|
- { name: struct_mg_ssi_call_ctx.md }
|
||||||
|
- { name: struct_websocket_message.md }
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
@@ -4,9 +4,8 @@ decl_name: "mg_connect_ws"
|
|||||||
symbol_kind: "func"
|
symbol_kind: "func"
|
||||||
signature: |
|
signature: |
|
||||||
struct mg_connection *mg_connect_ws(struct mg_mgr *mgr,
|
struct mg_connection *mg_connect_ws(struct mg_mgr *mgr,
|
||||||
mg_event_handler_t event_handler,
|
MG_CB(mg_event_handler_t event_handler,
|
||||||
const char *url, const char *protocol,
|
void *user_data);
|
||||||
const char *extra_headers);
|
|
||||||
---
|
---
|
||||||
|
|
||||||
Helper function that creates an outbound WebSocket connection.
|
Helper function that creates an outbound WebSocket connection.
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
---
|
||||||
|
title: "mg_connect_ws_opt()"
|
||||||
|
decl_name: "mg_connect_ws_opt"
|
||||||
|
symbol_kind: "func"
|
||||||
|
signature: |
|
||||||
|
struct mg_connection *mg_connect_ws_opt(
|
||||||
|
struct mg_mgr *mgr, MG_CB(mg_event_handler_t ev_handler, void *user_data);
|
||||||
|
---
|
||||||
|
|
||||||
|
Helper function that creates an outbound WebSocket connection
|
||||||
|
|
||||||
|
Mostly identical to `mg_connect_ws`, but allows to provide extra parameters
|
||||||
|
(for example, SSL parameters)
|
||||||
|
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
---
|
||||||
|
title: "mg_http_is_authorized()"
|
||||||
|
decl_name: "mg_http_is_authorized"
|
||||||
|
symbol_kind: "func"
|
||||||
|
signature: |
|
||||||
|
int mg_http_is_authorized(struct http_message *hm, struct mg_str path,
|
||||||
|
const char *domain, const char *passwords_file,
|
||||||
|
int flags);
|
||||||
|
---
|
||||||
|
|
||||||
|
Checks whether an http request is authorized. `domain` is the authentication
|
||||||
|
realm, `passwords_file` is a htdigest file (can be created e.g. with
|
||||||
|
`htdigest` utility). If either `domain` or `passwords_file` is NULL, this
|
||||||
|
function always returns 1; otherwise checks the authentication in the
|
||||||
|
http request and returns 1 only if there is a match; 0 otherwise.
|
||||||
|
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
---
|
||||||
|
title: "mg_http_send_digest_auth_request()"
|
||||||
|
decl_name: "mg_http_send_digest_auth_request"
|
||||||
|
symbol_kind: "func"
|
||||||
|
signature: |
|
||||||
|
void mg_http_send_digest_auth_request(struct mg_connection *c,
|
||||||
|
const char *domain);
|
||||||
|
---
|
||||||
|
|
||||||
|
Sends 401 Unauthorized response.
|
||||||
|
|
||||||
File renamed without changes.
File renamed without changes.
+2
-3
@@ -7,7 +7,6 @@ signature: |
|
|||||||
const struct mg_str *strings, int num_strings);
|
const struct mg_str *strings, int num_strings);
|
||||||
---
|
---
|
||||||
|
|
||||||
Sends multiple websocket frames.
|
Like `mg_send_websocket_frame()`, but composes a single frame from multiple
|
||||||
|
buffers.
|
||||||
Like `mg_send_websocket_frame()`, but composes a frame from multiple buffers.
|
|
||||||
|
|
||||||
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,13 @@
|
|||||||
|
---
|
||||||
|
title: "mg_send_websocket_handshake3()"
|
||||||
|
decl_name: "mg_send_websocket_handshake3"
|
||||||
|
symbol_kind: "func"
|
||||||
|
signature: |
|
||||||
|
void mg_send_websocket_handshake3(struct mg_connection *nc, const char *path,
|
||||||
|
const char *host, const char *protocol,
|
||||||
|
const char *extra_headers, const char *user,
|
||||||
|
const char *pass);
|
||||||
|
---
|
||||||
|
|
||||||
|
Like mg_send_websocket_handshake2 but also passes basic auth header
|
||||||
|
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
---
|
||||||
|
title: "mg_send_websocket_handshake3v()"
|
||||||
|
decl_name: "mg_send_websocket_handshake3v"
|
||||||
|
symbol_kind: "func"
|
||||||
|
signature: |
|
||||||
|
void mg_send_websocket_handshake3v(struct mg_connection *nc,
|
||||||
|
const struct mg_str path,
|
||||||
|
const struct mg_str host,
|
||||||
|
const struct mg_str protocol,
|
||||||
|
const struct mg_str extra_headers,
|
||||||
|
const struct mg_str user,
|
||||||
|
const struct mg_str pass);
|
||||||
|
---
|
||||||
|
|
||||||
|
Same as mg_send_websocket_handshake3 but with strings not necessarily
|
||||||
|
NUL-temrinated
|
||||||
|
|
||||||
+23
-15
@@ -12,11 +12,6 @@ The user-defined event handler will receive following extra events:
|
|||||||
- MG_EV_HTTP_REQUEST: HTTP request has arrived. Parsed HTTP request
|
- MG_EV_HTTP_REQUEST: HTTP request has arrived. Parsed HTTP request
|
||||||
is passed as
|
is passed as
|
||||||
`struct http_message` through the handler's `void *ev_data` pointer.
|
`struct http_message` through the handler's `void *ev_data` pointer.
|
||||||
- MG_EV_HTTP_MULTIPART_REQUEST: A multipart POST request has received.
|
|
||||||
This event is sent before body is parsed. After this, the user
|
|
||||||
should expect a sequence of MG_EV_HTTP_PART_BEGIN/DATA/END requests.
|
|
||||||
This is also the last time when headers and other request fields are
|
|
||||||
accessible.
|
|
||||||
- MG_EV_HTTP_REPLY: The HTTP reply has arrived. The parsed HTTP reply is
|
- MG_EV_HTTP_REPLY: The HTTP reply has arrived. The parsed HTTP reply is
|
||||||
passed as `struct http_message` through the handler's `void *ev_data`
|
passed as `struct http_message` through the handler's `void *ev_data`
|
||||||
pointer.
|
pointer.
|
||||||
@@ -38,14 +33,27 @@ The user-defined event handler will receive following extra events:
|
|||||||
handshake. `ev_data` is `NULL`.
|
handshake. `ev_data` is `NULL`.
|
||||||
- MG_EV_WEBSOCKET_FRAME: new WebSocket frame has arrived. `ev_data` is
|
- MG_EV_WEBSOCKET_FRAME: new WebSocket frame has arrived. `ev_data` is
|
||||||
`struct websocket_message *`
|
`struct websocket_message *`
|
||||||
- MG_EV_HTTP_PART_BEGIN: new part of multipart message is started,
|
|
||||||
extra parameters are passed in mg_http_multipart_part
|
When compiled with MG_ENABLE_HTTP_STREAMING_MULTIPART, Mongoose parses
|
||||||
- MG_EV_HTTP_PART_DATA: new portion of data from the multiparted message
|
multipart requests and splits them into separate events:
|
||||||
no additional headers are available, only data and data size
|
- MG_EV_HTTP_MULTIPART_REQUEST: Start of the request.
|
||||||
- MG_EV_HTTP_PART_END: final boundary received, analogue to maybe used to
|
This event is sent before body is parsed. After this, the user
|
||||||
find the end of packet
|
should expect a sequence of PART_BEGIN/DATA/END requests.
|
||||||
Note: Mongoose should be compiled with MG_ENABLE_HTTP_STREAMING_MULTIPART
|
This is also the last time when headers and other request fields are
|
||||||
to enable MG_EV_HTTP_MULTIPART_REQUEST, MG_EV_HTTP_REQUEST_END,
|
accessible.
|
||||||
MG_EV_HTTP_REQUEST_CANCEL, MG_EV_HTTP_PART_BEGIN, MG_EV_HTTP_PART_DATA,
|
- MG_EV_HTTP_PART_BEGIN: Start of a part of a multipart message.
|
||||||
MG_EV_HTTP_PART_END constants
|
Argument: mg_http_multipart_part with var_name and file_name set
|
||||||
|
(if present). No data is passed in this message.
|
||||||
|
- MG_EV_HTTP_PART_DATA: new portion of data from the multipart message.
|
||||||
|
Argument: mg_http_multipart_part. var_name and file_name are preserved,
|
||||||
|
data is available in mg_http_multipart_part.data.
|
||||||
|
- MG_EV_HTTP_PART_END: End of the current part. var_name, file_name are
|
||||||
|
the same, no data in the message. If status is 0, then the part is
|
||||||
|
properly terminated with a boundary, status < 0 means that connection
|
||||||
|
was terminated.
|
||||||
|
- MG_EV_HTTP_MULTIPART_REQUEST_END: End of the multipart request.
|
||||||
|
Argument: mg_http_multipart_part, var_name and file_name are NULL,
|
||||||
|
status = 0 means request was properly closed, < 0 means connection
|
||||||
|
was terminated (note: in this case both PART_END and REQUEST_END are
|
||||||
|
delivered).
|
||||||
|
|
||||||
@@ -13,6 +13,7 @@ Source string is specified by (`src`, `src_len`), and destination is
|
|||||||
(`dst`, `dst_len`). If `is_form_url_encoded` is non-zero, then
|
(`dst`, `dst_len`). If `is_form_url_encoded` is non-zero, then
|
||||||
`+` character is decoded as a blank space character. This function
|
`+` character is decoded as a blank space character. This function
|
||||||
guarantees to NUL-terminate the destination. If destination is too small,
|
guarantees to NUL-terminate the destination. If destination is too small,
|
||||||
then the source string is partially decoded and `-1` is returned. Otherwise,
|
then the source string is partially decoded and `-1` is returned.
|
||||||
|
*Otherwise,
|
||||||
a length of the decoded string is returned, not counting final NUL.
|
a length of the decoded string is returned, not counting final NUL.
|
||||||
|
|
||||||
+1
-3
@@ -5,6 +5,7 @@ symbol_kind: "struct"
|
|||||||
signature: |
|
signature: |
|
||||||
struct http_message {
|
struct http_message {
|
||||||
struct mg_str message; /* Whole message: request line + headers + body */
|
struct mg_str message; /* Whole message: request line + headers + body */
|
||||||
|
struct mg_str body; /* Message body. 0-length for requests with no body */
|
||||||
|
|
||||||
/* HTTP Request line (or HTTP response line) */
|
/* HTTP Request line (or HTTP response line) */
|
||||||
struct mg_str method; /* "GET" */
|
struct mg_str method; /* "GET" */
|
||||||
@@ -28,9 +29,6 @@ signature: |
|
|||||||
/* Headers */
|
/* Headers */
|
||||||
struct mg_str header_names[MG_MAX_HTTP_HEADERS];
|
struct mg_str header_names[MG_MAX_HTTP_HEADERS];
|
||||||
struct mg_str header_values[MG_MAX_HTTP_HEADERS];
|
struct mg_str header_values[MG_MAX_HTTP_HEADERS];
|
||||||
|
|
||||||
/* Message body */
|
|
||||||
struct mg_str body; /* Zero-length for requests with no body */
|
|
||||||
};
|
};
|
||||||
---
|
---
|
||||||
|
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: "Client API reference"
|
title: "Client API reference"
|
||||||
symbol_kind: "intro"
|
symbol_kind: "intro"
|
||||||
decl_name: "http_client.h"
|
decl_name: "mg_http_client.h"
|
||||||
items:
|
items:
|
||||||
- { name: mg_connect_http.md }
|
- { name: mg_connect_http.md }
|
||||||
- { name: mg_connect_http_opt.md }
|
- { name: mg_connect_http_opt.md }
|
||||||
+3
-5
@@ -3,11 +3,9 @@ title: "mg_connect_http()"
|
|||||||
decl_name: "mg_connect_http"
|
decl_name: "mg_connect_http"
|
||||||
symbol_kind: "func"
|
symbol_kind: "func"
|
||||||
signature: |
|
signature: |
|
||||||
struct mg_connection *mg_connect_http(struct mg_mgr *mgr,
|
struct mg_connection *mg_connect_http(
|
||||||
mg_event_handler_t event_handler,
|
struct mg_mgr *mgr,
|
||||||
const char *url,
|
MG_CB(mg_event_handler_t event_handler, void *user_data);
|
||||||
const char *extra_headers,
|
|
||||||
const char *post_data);
|
|
||||||
---
|
---
|
||||||
|
|
||||||
Helper function that creates an outbound HTTP connection.
|
Helper function that creates an outbound HTTP connection.
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
title: "mg_connect_http_opt()"
|
||||||
|
decl_name: "mg_connect_http_opt"
|
||||||
|
symbol_kind: "func"
|
||||||
|
signature: |
|
||||||
|
struct mg_connection *mg_connect_http_opt(
|
||||||
|
struct mg_mgr *mgr, MG_CB(mg_event_handler_t ev_handler, void *user_data);
|
||||||
|
---
|
||||||
|
|
||||||
|
Helper function that creates an outbound HTTP connection.
|
||||||
|
|
||||||
|
Mostly identical to mg_connect_http, but allows you to provide extra
|
||||||
|
*parameters
|
||||||
|
(for example, SSL parameters)
|
||||||
|
|
||||||
+1
-1
@@ -6,7 +6,7 @@ signature: |
|
|||||||
int mg_http_create_digest_auth_header(char *buf, size_t buf_len,
|
int mg_http_create_digest_auth_header(char *buf, size_t buf_len,
|
||||||
const char *method, const char *uri,
|
const char *method, const char *uri,
|
||||||
const char *auth_domain, const char *user,
|
const char *auth_domain, const char *user,
|
||||||
const char *passwd);
|
const char *passwd, const char *nonce);
|
||||||
---
|
---
|
||||||
|
|
||||||
Creates digest authentication header for a client request.
|
Creates digest authentication header for a client request.
|
||||||
@@ -1,24 +1,30 @@
|
|||||||
---
|
---
|
||||||
title: "Server API reference"
|
title: "Server API reference"
|
||||||
symbol_kind: "intro"
|
symbol_kind: "intro"
|
||||||
decl_name: "http_server.h"
|
decl_name: "mg_http_server.h"
|
||||||
items:
|
items:
|
||||||
- { name: mg_parse_http.md }
|
- { name: mg_check_digest_auth.md }
|
||||||
- { name: mg_get_http_header.md }
|
|
||||||
- { name: mg_http_parse_header.md }
|
|
||||||
- { name: mg_parse_multipart.md }
|
|
||||||
- { name: mg_get_http_var.md }
|
|
||||||
- { name: mg_serve_http.md }
|
|
||||||
- { name: mg_http_serve_file.md }
|
|
||||||
- { name: mg_register_http_endpoint.md }
|
|
||||||
- { name: mg_file_upload_handler.md }
|
- { name: mg_file_upload_handler.md }
|
||||||
|
- { name: mg_get_http_basic_auth.md }
|
||||||
|
- { name: mg_get_http_header.md }
|
||||||
|
- { name: mg_get_http_var.md }
|
||||||
- { name: mg_http_check_digest_auth.md }
|
- { name: mg_http_check_digest_auth.md }
|
||||||
- { name: mg_send_http_chunk.md }
|
- { name: mg_http_parse_header.md }
|
||||||
- { name: mg_printf_http_chunk.md }
|
- { name: mg_http_parse_header2.md }
|
||||||
- { name: mg_send_response_line.md }
|
- { name: mg_http_reverse_proxy.md }
|
||||||
|
- { name: mg_http_send_error.md }
|
||||||
- { name: mg_http_send_redirect.md }
|
- { name: mg_http_send_redirect.md }
|
||||||
- { name: mg_send_head.md }
|
- { name: mg_http_serve_file.md }
|
||||||
|
- { name: mg_parse_http.md }
|
||||||
|
- { name: mg_parse_http_basic_auth.md }
|
||||||
|
- { name: mg_parse_multipart.md }
|
||||||
- { name: mg_printf_html_escape.md }
|
- { name: mg_printf_html_escape.md }
|
||||||
|
- { name: mg_printf_http_chunk.md }
|
||||||
|
- { name: mg_register_http_endpoint.md }
|
||||||
|
- { name: mg_send_head.md }
|
||||||
|
- { name: mg_send_http_chunk.md }
|
||||||
|
- { name: mg_send_response_line.md }
|
||||||
|
- { name: mg_serve_http.md }
|
||||||
- { name: mg_fu_fname_fn.md }
|
- { name: mg_fu_fname_fn.md }
|
||||||
- { name: struct_mg_serve_http_opts.md }
|
- { name: struct_mg_serve_http_opts.md }
|
||||||
---
|
---
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
---
|
||||||
|
title: "mg_check_digest_auth()"
|
||||||
|
decl_name: "mg_check_digest_auth"
|
||||||
|
symbol_kind: "func"
|
||||||
|
signature: |
|
||||||
|
int mg_check_digest_auth(struct mg_str method, struct mg_str uri,
|
||||||
|
struct mg_str username, struct mg_str cnonce,
|
||||||
|
struct mg_str response, struct mg_str qop,
|
||||||
|
struct mg_str nc, struct mg_str nonce,
|
||||||
|
struct mg_str auth_domain, FILE *fp);
|
||||||
|
---
|
||||||
|
|
||||||
|
Authenticates given response params against an opened password file.
|
||||||
|
Returns 1 if authenticated, 0 otherwise.
|
||||||
|
|
||||||
|
It's used by mg_http_check_digest_auth().
|
||||||
|
|
||||||
+2
-1
@@ -4,7 +4,8 @@ decl_name: "mg_file_upload_handler"
|
|||||||
symbol_kind: "func"
|
symbol_kind: "func"
|
||||||
signature: |
|
signature: |
|
||||||
void mg_file_upload_handler(struct mg_connection *nc, int ev, void *ev_data,
|
void mg_file_upload_handler(struct mg_connection *nc, int ev, void *ev_data,
|
||||||
mg_fu_fname_fn local_name_fn);
|
mg_fu_fname_fn local_name_fn
|
||||||
|
MG_UD_ARG(void *user_data);
|
||||||
---
|
---
|
||||||
|
|
||||||
File upload handler.
|
File upload handler.
|
||||||
File renamed without changes.
@@ -0,0 +1,14 @@
|
|||||||
|
---
|
||||||
|
title: "mg_get_http_basic_auth()"
|
||||||
|
decl_name: "mg_get_http_basic_auth"
|
||||||
|
symbol_kind: "func"
|
||||||
|
signature: |
|
||||||
|
int mg_get_http_basic_auth(struct http_message *hm, char *user, size_t user_len,
|
||||||
|
char *pass, size_t pass_len);
|
||||||
|
---
|
||||||
|
|
||||||
|
Gets and parses the Authorization: Basic header
|
||||||
|
Returns -1 if no Authorization header is found, or if
|
||||||
|
mg_parse_http_basic_auth
|
||||||
|
fails parsing the resulting header.
|
||||||
|
|
||||||
File renamed without changes.
+2
-1
@@ -12,5 +12,6 @@ Fetches a HTTP form variable.
|
|||||||
Fetches a variable `name` from a `buf` into a buffer specified by `dst`,
|
Fetches a variable `name` from a `buf` into a buffer specified by `dst`,
|
||||||
`dst_len`. The destination is always zero-terminated. Returns the length of
|
`dst_len`. The destination is always zero-terminated. Returns the length of
|
||||||
a fetched variable. If not found, 0 is returned. `buf` must be valid
|
a fetched variable. If not found, 0 is returned. `buf` must be valid
|
||||||
url-encoded buffer. If destination is too small, `-1` is returned.
|
url-encoded buffer. If destination is too small or an error occured,
|
||||||
|
negative number is returned.
|
||||||
|
|
||||||
File renamed without changes.
@@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
title: "mg_http_parse_header()"
|
||||||
|
decl_name: "mg_http_parse_header"
|
||||||
|
symbol_kind: "func"
|
||||||
|
signature: |
|
||||||
|
int mg_http_parse_header(struct mg_str *hdr, const char *var_name, char *buf,
|
||||||
|
size_t buf_size);
|
||||||
|
---
|
||||||
|
|
||||||
|
DEPRECATED: use mg_http_parse_header2() instead.
|
||||||
|
|
||||||
|
Same as mg_http_parse_header2(), but takes buffer as a `char *` (instead of
|
||||||
|
`char **`), and thus it cannot allocate a new buffer if the provided one
|
||||||
|
is not enough, and just returns 0 in that case.
|
||||||
|
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
---
|
||||||
|
title: "mg_http_parse_header2()"
|
||||||
|
decl_name: "mg_http_parse_header2"
|
||||||
|
symbol_kind: "func"
|
||||||
|
signature: |
|
||||||
|
int mg_http_parse_header2(struct mg_str *hdr, const char *var_name, char **buf,
|
||||||
|
size_t buf_size);
|
||||||
|
---
|
||||||
|
|
||||||
|
Parses the HTTP header `hdr`. Finds variable `var_name` and stores its value
|
||||||
|
in the buffer `*buf`, `buf_size`. If the buffer size is not enough,
|
||||||
|
allocates a buffer of required size and writes it to `*buf`, similar to
|
||||||
|
asprintf(). The caller should always check whether the buffer was updated,
|
||||||
|
and free it if so.
|
||||||
|
|
||||||
|
This function is supposed to parse cookies, authentication headers, etc.
|
||||||
|
Example (error handling omitted):
|
||||||
|
|
||||||
|
char user_buf[20];
|
||||||
|
char *user = user_buf;
|
||||||
|
struct mg_str *hdr = mg_get_http_header(hm, "Authorization");
|
||||||
|
mg_http_parse_header2(hdr, "username", &user, sizeof(user_buf));
|
||||||
|
// ... do something useful with user
|
||||||
|
if (user != user_buf) {
|
||||||
|
free(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
Returns the length of the variable's value. If variable is not found, 0 is
|
||||||
|
returned.
|
||||||
|
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
---
|
||||||
|
title: "mg_http_reverse_proxy()"
|
||||||
|
decl_name: "mg_http_reverse_proxy"
|
||||||
|
symbol_kind: "func"
|
||||||
|
signature: |
|
||||||
|
void mg_http_reverse_proxy(struct mg_connection *nc,
|
||||||
|
const struct http_message *hm, struct mg_str mount,
|
||||||
|
struct mg_str upstream);
|
||||||
|
---
|
||||||
|
|
||||||
|
Proxies a given request to a given upstream http server. The path prefix
|
||||||
|
in `mount` will be stripped of the path requested to the upstream server,
|
||||||
|
e.g. if mount is /api and upstream is http://localhost:8001/foo
|
||||||
|
then an incoming request to /api/bar will cause a request to
|
||||||
|
http://localhost:8001/foo/bar
|
||||||
|
|
||||||
|
EXPERIMENTAL API. Please use http_serve_http + url_rewrites if a static
|
||||||
|
mapping is good enough.
|
||||||
|
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
---
|
||||||
|
title: "mg_http_send_error()"
|
||||||
|
decl_name: "mg_http_send_error"
|
||||||
|
symbol_kind: "func"
|
||||||
|
signature: |
|
||||||
|
void mg_http_send_error(struct mg_connection *nc, int code, const char *reason);
|
||||||
|
---
|
||||||
|
|
||||||
|
Sends an error response. If reason is NULL, the message will be inferred
|
||||||
|
from the error code (if supported).
|
||||||
|
|
||||||
+1
-1
@@ -12,7 +12,7 @@ Sends a redirect response.
|
|||||||
`status_code` should be either 301 or 302 and `location` point to the
|
`status_code` should be either 301 or 302 and `location` point to the
|
||||||
new location.
|
new location.
|
||||||
If `extra_headers` is not empty, then `extra_headers` are also sent
|
If `extra_headers` is not empty, then `extra_headers` are also sent
|
||||||
after the reponse line. `extra_headers` must NOT end end with new line.
|
after the response line. `extra_headers` must NOT end end with new line.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,13 @@
|
|||||||
|
---
|
||||||
|
title: "mg_parse_http_basic_auth()"
|
||||||
|
decl_name: "mg_parse_http_basic_auth"
|
||||||
|
symbol_kind: "func"
|
||||||
|
signature: |
|
||||||
|
int mg_parse_http_basic_auth(struct mg_str *hdr, char *user, size_t user_len,
|
||||||
|
char *pass, size_t pass_len);
|
||||||
|
---
|
||||||
|
|
||||||
|
Parses the Authorization: Basic header
|
||||||
|
Returns -1 iif the authorization type is not "Basic" or any other error such
|
||||||
|
as incorrectly encoded base64 user password pair.
|
||||||
|
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
+3
-2
@@ -4,7 +4,8 @@ decl_name: "mg_register_http_endpoint"
|
|||||||
symbol_kind: "func"
|
symbol_kind: "func"
|
||||||
signature: |
|
signature: |
|
||||||
void mg_register_http_endpoint(struct mg_connection *nc, const char *uri_path,
|
void mg_register_http_endpoint(struct mg_connection *nc, const char *uri_path,
|
||||||
mg_event_handler_t handler);
|
MG_CB(mg_event_handler_t handler,
|
||||||
|
void *user_data);
|
||||||
---
|
---
|
||||||
|
|
||||||
Registers a callback for a specified http endpoint
|
Registers a callback for a specified http endpoint
|
||||||
@@ -20,7 +21,7 @@ static void handle_hello1(struct mg_connection *nc, int ev, void *ev_data) {
|
|||||||
nc->flags |= MG_F_SEND_AND_CLOSE;
|
nc->flags |= MG_F_SEND_AND_CLOSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_hello1(struct mg_connection *nc, int ev, void *ev_data) {
|
static void handle_hello2(struct mg_connection *nc, int ev, void *ev_data) {
|
||||||
(void) ev; (void) ev_data;
|
(void) ev; (void) ev_data;
|
||||||
mg_printf(nc, "HTTP/1.0 200 OK\r\n\r\n[I am Hello2]");
|
mg_printf(nc, "HTTP/1.0 200 OK\r\n\r\n[I am Hello2]");
|
||||||
nc->flags |= MG_F_SEND_AND_CLOSE;
|
nc->flags |= MG_F_SEND_AND_CLOSE;
|
||||||
File renamed without changes.
+1
-1
@@ -9,7 +9,7 @@ signature: |
|
|||||||
Sends buffer `buf` of size `len` to the client using chunked HTTP encoding.
|
Sends buffer `buf` of size `len` to the client using chunked HTTP encoding.
|
||||||
This function sends the buffer size as hex number + newline first, then
|
This function sends the buffer size as hex number + newline first, then
|
||||||
the buffer itself, then the newline. For example,
|
the buffer itself, then the newline. For example,
|
||||||
`mg_send_http_chunk(nc, "foo", 3)` whill append the `3\r\nfoo\r\n` string
|
`mg_send_http_chunk(nc, "foo", 3)` will append the `3\r\nfoo\r\n` string
|
||||||
to the `nc->send_mbuf` output IO buffer.
|
to the `nc->send_mbuf` output IO buffer.
|
||||||
|
|
||||||
NOTE: The HTTP header "Transfer-Encoding: chunked" should be sent prior to
|
NOTE: The HTTP header "Transfer-Encoding: chunked" should be sent prior to
|
||||||
+1
-1
@@ -9,7 +9,7 @@ signature: |
|
|||||||
|
|
||||||
Sends the response status line.
|
Sends the response status line.
|
||||||
If `extra_headers` is not NULL, then `extra_headers` are also sent
|
If `extra_headers` is not NULL, then `extra_headers` are also sent
|
||||||
after the reponse line. `extra_headers` must NOT end end with new line.
|
after the response line. `extra_headers` must NOT end end with new line.
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
mg_send_response_line(nc, 200, "Access-Control-Allow-Origin: *");
|
mg_send_response_line(nc, 200, "Access-Control-Allow-Origin: *");
|
||||||
File renamed without changes.
+8
-4
@@ -100,16 +100,19 @@ signature: |
|
|||||||
/* IP ACL. By default, NULL, meaning all IPs are allowed to connect */
|
/* IP ACL. By default, NULL, meaning all IPs are allowed to connect */
|
||||||
const char *ip_acl;
|
const char *ip_acl;
|
||||||
|
|
||||||
|
#if MG_ENABLE_HTTP_URL_REWRITES
|
||||||
/* URL rewrites.
|
/* URL rewrites.
|
||||||
*
|
*
|
||||||
* Comma-separated list of `uri_pattern=file_or_directory_path` rewrites.
|
* Comma-separated list of `uri_pattern=url_file_or_directory_path` rewrites.
|
||||||
* When HTTP request is received, Mongoose constructs a file name from the
|
* When HTTP request is received, Mongoose constructs a file name from the
|
||||||
* requested URI by combining `document_root` and the URI. However, if the
|
* requested URI by combining `document_root` and the URI. However, if the
|
||||||
* rewrite option is used and `uri_pattern` matches requested URI, then
|
* rewrite option is used and `uri_pattern` matches requested URI, then
|
||||||
* `document_root` is ignored. Instead, `file_or_directory_path` is used,
|
* `document_root` is ignored. Instead, `url_file_or_directory_path` is used,
|
||||||
* which should be a full path name or a path relative to the web server's
|
* which should be a full path name or a path relative to the web server's
|
||||||
* current working directory. Note that `uri_pattern`, as all Mongoose
|
* current working directory. It can also be an URI (http:// or https://)
|
||||||
* patterns, is a prefix pattern.
|
* in which case mongoose will behave as a reverse proxy for that destination.
|
||||||
|
*
|
||||||
|
* Note that `uri_pattern`, as all Mongoose patterns, is a prefix pattern.
|
||||||
*
|
*
|
||||||
* If uri_pattern starts with `@` symbol, then Mongoose compares it with the
|
* If uri_pattern starts with `@` symbol, then Mongoose compares it with the
|
||||||
* HOST header of the request. If they are equal, Mongoose sets document root
|
* HOST header of the request. If they are equal, Mongoose sets document root
|
||||||
@@ -123,6 +126,7 @@ signature: |
|
|||||||
* automatically appended to the redirect location.
|
* automatically appended to the redirect location.
|
||||||
*/
|
*/
|
||||||
const char *url_rewrites;
|
const char *url_rewrites;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* DAV document root. If NULL, DAV requests are going to fail. */
|
/* DAV document root. If NULL, DAV requests are going to fail. */
|
||||||
const char *dav_document_root;
|
const char *dav_document_root;
|
||||||
@@ -1,26 +1,28 @@
|
|||||||
---
|
---
|
||||||
title: "MQTT API reference"
|
title: "MQTT API reference"
|
||||||
symbol_kind: "intro"
|
symbol_kind: "intro"
|
||||||
decl_name: "mqtt.h"
|
decl_name: "mg_mqtt.h"
|
||||||
items:
|
items:
|
||||||
- { name: mg_set_protocol_mqtt.md }
|
|
||||||
- { name: mg_send_mqtt_handshake.md }
|
|
||||||
- { name: mg_send_mqtt_handshake_opt.md }
|
|
||||||
- { name: mg_mqtt_publish.md }
|
|
||||||
- { name: mg_mqtt_subscribe.md }
|
|
||||||
- { name: mg_mqtt_unsubscribe.md }
|
|
||||||
- { name: mg_mqtt_disconnect.md }
|
|
||||||
- { name: mg_mqtt_connack.md }
|
- { name: mg_mqtt_connack.md }
|
||||||
- { name: mg_mqtt_puback.md }
|
- { name: mg_mqtt_disconnect.md }
|
||||||
- { name: mg_mqtt_pubrec.md }
|
- { name: mg_mqtt_match_topic_expression.md }
|
||||||
- { name: mg_mqtt_pubrel.md }
|
- { name: mg_mqtt_next_subscribe_topic.md }
|
||||||
- { name: mg_mqtt_pubcomp.md }
|
|
||||||
- { name: mg_mqtt_suback.md }
|
|
||||||
- { name: mg_mqtt_unsuback.md }
|
|
||||||
- { name: mg_mqtt_ping.md }
|
- { name: mg_mqtt_ping.md }
|
||||||
- { name: mg_mqtt_pong.md }
|
- { name: mg_mqtt_pong.md }
|
||||||
- { name: mg_mqtt_next_subscribe_topic.md }
|
- { name: mg_mqtt_puback.md }
|
||||||
- { name: struct_mg_mqtt_topic_expression.md }
|
- { name: mg_mqtt_pubcomp.md }
|
||||||
|
- { name: mg_mqtt_publish.md }
|
||||||
|
- { name: mg_mqtt_pubrec.md }
|
||||||
|
- { name: mg_mqtt_pubrel.md }
|
||||||
|
- { name: mg_mqtt_suback.md }
|
||||||
|
- { name: mg_mqtt_subscribe.md }
|
||||||
|
- { name: mg_mqtt_unsuback.md }
|
||||||
|
- { name: mg_mqtt_unsubscribe.md }
|
||||||
|
- { name: mg_mqtt_vmatch_topic_expression.md }
|
||||||
|
- { name: mg_send_mqtt_handshake.md }
|
||||||
|
- { name: mg_send_mqtt_handshake_opt.md }
|
||||||
|
- { name: mg_set_protocol_mqtt.md }
|
||||||
|
- { name: struct_mg_mqtt_proto_data.md }
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,12 @@
|
|||||||
|
---
|
||||||
|
title: "mg_mqtt_match_topic_expression()"
|
||||||
|
decl_name: "mg_mqtt_match_topic_expression"
|
||||||
|
symbol_kind: "func"
|
||||||
|
signature: |
|
||||||
|
int mg_mqtt_match_topic_expression(struct mg_str exp, struct mg_str topic);
|
||||||
|
---
|
||||||
|
|
||||||
|
Matches a topic against a topic expression
|
||||||
|
|
||||||
|
Returns 1 if it matches; 0 otherwise.
|
||||||
|
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,11 @@
|
|||||||
|
---
|
||||||
|
title: "mg_mqtt_vmatch_topic_expression()"
|
||||||
|
decl_name: "mg_mqtt_vmatch_topic_expression"
|
||||||
|
symbol_kind: "func"
|
||||||
|
signature: |
|
||||||
|
int mg_mqtt_vmatch_topic_expression(const char *exp, struct mg_str topic);
|
||||||
|
---
|
||||||
|
|
||||||
|
Same as `mg_mqtt_match_topic_expression()`, but takes `exp` as a
|
||||||
|
NULL-terminated string.
|
||||||
|
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loaded 100 of 663 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user