mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-25 12:04:47 +00:00
Compare commits
442
Commits
6.7
..
mongoose-os
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
afcb4d9df7 | ||
|
|
44b15b76f7 | ||
|
|
a1fcbb0718 | ||
|
|
0c4d364cee | ||
|
|
def2f39724 | ||
|
|
311fdb8bac | ||
|
|
38f694d071 | ||
|
|
da1e5438bd | ||
|
|
e3a140c9a7 | ||
|
|
a350208f35 | ||
|
|
6fa305e36d | ||
|
|
edd38f6ccd | ||
|
|
abced77c24 | ||
|
|
4699e90e99 | ||
|
|
e9853be8f7 | ||
|
|
fd062b530c | ||
|
|
2fbfe61c37 | ||
|
|
70034b5873 | ||
|
|
d6c9d3c181 | ||
|
|
34d4fb8cf0 | ||
|
|
be64f81eee | ||
|
|
9fe1c93c9b | ||
|
|
a4b6d58b24 | ||
|
|
86f391c701 | ||
|
|
36de38bd11 | ||
|
|
a308872c88 | ||
|
|
a369160296 | ||
|
|
0a09b46c94 | ||
|
|
b0a1cd7b0d | ||
|
|
73a2b92278 | ||
|
|
c3bb5bd89e | ||
|
|
d22ff2fce7 | ||
|
|
fee2980d95 | ||
|
|
d6693ed360 | ||
|
|
4880069775 | ||
|
|
5d217a1262 | ||
|
|
f778d22eac | ||
|
|
3aa76dcaec | ||
|
|
4680573a6b | ||
|
|
95fcb261eb | ||
|
|
5867c67da2 | ||
|
|
80d74e9e34 | ||
|
|
43a0b500f5 | ||
|
|
3d53ed17fb | ||
|
|
4ea452307e | ||
|
|
e61f20f1ed | ||
|
|
ca11f5ab49 | ||
|
|
000d24d31a | ||
|
|
ef92f2e9c5 | ||
|
|
4e89eac8dd | ||
|
|
b015e33ea5 | ||
|
|
96e762d4a1 | ||
|
|
359060a151 | ||
|
|
af1aff7fbb | ||
|
|
517ef216c1 | ||
|
|
734c13cdf5 | ||
|
|
1bf3ad2426 | ||
|
|
884b9a4813 | ||
|
|
7153690016 | ||
|
|
f00b3a2b3a | ||
|
|
c2b5e4f3b8 | ||
|
|
bc15e9ce9a | ||
|
|
70dc6d8dc9 | ||
|
|
10b11b03a8 | ||
|
|
cb602f178c | ||
|
|
464113c5ae | ||
|
|
c34f6c54e7 | ||
|
|
8fb58ebbca | ||
|
|
dce60c6dbb | ||
|
|
f668d08804 | ||
|
|
c41a22195c | ||
|
|
900c05213b | ||
|
|
c5850e4b05 | ||
|
|
ff4649fe42 | ||
|
|
1a38e91042 | ||
|
|
b6196371bb | ||
|
|
d5beb7ba3f | ||
|
|
19acf23c49 | ||
|
|
5cd3291fec | ||
|
|
b3e0f780c3 | ||
|
|
2bdbfc27f6 | ||
|
|
3fc61a3edc | ||
|
|
12339bbf4c | ||
|
|
1fb9f922b0 | ||
|
|
b93bc02ab0 | ||
|
|
747e393a54 | ||
|
|
4e8660a21f | ||
|
|
3fe77fa9a6 | ||
|
|
b4fbaf7c13 | ||
|
|
9884241df8 | ||
|
|
63d7a4fa45 | ||
|
|
8f4b6c41a2 | ||
|
|
4493d65ec9 | ||
|
|
e5910da300 | ||
|
|
c277a1d878 | ||
|
|
7820ad3a59 | ||
|
|
23533b83a4 | ||
|
|
ab650ec5c9 | ||
|
|
8f36597048 | ||
|
|
d0213ee90a | ||
|
|
1e9fabe1ca | ||
|
|
148d3f0562 | ||
|
|
c3057df3f5 | ||
|
|
0b2e474d52 | ||
|
|
95a36b1759 | ||
|
|
86ffa3a3ea | ||
|
|
69e2b2985d | ||
|
|
c431904b56 | ||
|
|
c2a10601b9 | ||
|
|
e9a8e5468d | ||
|
|
22e602debb | ||
|
|
455cec67a5 | ||
|
|
e2dfac946d | ||
|
|
c198d2e5f1 | ||
|
|
9a70abef24 | ||
|
|
53e1c469a2 | ||
|
|
139c2061a8 | ||
|
|
15b361fbac | ||
|
|
3130e59244 | ||
|
|
93286836f9 | ||
|
|
91b57aa9a8 | ||
|
|
220231e647 | ||
|
|
c438bb0bc5 | ||
|
|
95afa323c0 | ||
|
|
bc56353a79 | ||
|
|
1ffccdb7b2 | ||
|
|
e79fe4b8f0 | ||
|
|
aaf1fc3a4a | ||
|
|
8b42353039 | ||
|
|
05c687e251 | ||
|
|
492b8f6950 | ||
|
|
8ccee82059 | ||
|
|
b99a94a652 | ||
|
|
41e5d7e471 | ||
|
|
1adea37c45 | ||
|
|
98f6c8aa4f | ||
|
|
341ae53e85 | ||
|
|
291fc024cd | ||
|
|
f63d833a33 | ||
|
|
ab035901f8 | ||
|
|
20f54059ad | ||
|
|
563c31303e | ||
|
|
421e099f2b | ||
|
|
955d4a3129 | ||
|
|
b84981ad03 | ||
|
|
777b8e94e2 | ||
|
|
6df642623a | ||
|
|
0a3e186f11 | ||
|
|
c2d83a9db0 | ||
|
|
f33d3a4e02 | ||
|
|
86b8a56b05 | ||
|
|
ac6ec15aed | ||
|
|
31632c6361 | ||
|
|
98c99279c3 | ||
|
|
cdb8d7b692 | ||
|
|
93ac3e19f0 | ||
|
|
6a51af9efe | ||
|
|
9d73b3470b | ||
|
|
1c8449cea6 | ||
|
|
3bbbd41196 | ||
|
|
339bbee0df | ||
|
|
9ba6eb716d | ||
|
|
d949c19c7e | ||
|
|
1299d6118f | ||
|
|
244ff92e78 | ||
|
|
53f34dea04 | ||
|
|
1f5c3fac31 | ||
|
|
7014258c8d | ||
|
|
1614e7ba8d | ||
|
|
43b5a4e735 | ||
|
|
43191db63e | ||
|
|
e89be2e944 | ||
|
|
c2fbff6d0e | ||
|
|
b8eca17c55 | ||
|
|
4650e491df | ||
|
|
3e33e57707 | ||
|
|
c80f4c5313 | ||
|
|
132ecbec2f | ||
|
|
0a90cab44a | ||
|
|
d16dbc197f | ||
|
|
127f27e375 | ||
|
|
6523cc4da0 | ||
|
|
2516da1c89 | ||
|
|
0ae2b82b60 | ||
|
|
dab526936f | ||
|
|
780077d118 | ||
|
|
ad8f1d88d4 | ||
|
|
a3c4a48ef7 | ||
|
|
84a11fe3b1 | ||
|
|
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 |
No files matched your search
@@ -0,0 +1,6 @@
|
|||||||
|
BasedOnStyle: Google
|
||||||
|
AllowShortFunctionsOnASingleLine: false
|
||||||
|
SpaceAfterCStyleCast: true
|
||||||
|
PointerBindsToType: false
|
||||||
|
DerivePointerBinding: false
|
||||||
|
IncludeBlocks: Preserve
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
binary/
|
||||||
|
deps/
|
||||||
|
docker/
|
||||||
|
docs/
|
||||||
|
examples/
|
||||||
|
platforms/
|
||||||
|
src/
|
||||||
|
test/
|
||||||
|
multilingual/
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
People who have agreed to the
|
|
||||||
[Cesanta CLA](https://docs.cesanta.com/contributors_la.shtml)
|
|
||||||
can make contributions. Note that the CLA isn't a copyright
|
|
||||||
_assigment_ but rather a copyright _license_.
|
|
||||||
You retain the copyright on your contributions.
|
|
||||||
|
|
||||||
We follow the Google C/C++ style guide: https://google.github.io/styleguide/cppguide.html
|
|
||||||
We'd appreciate if your contribution follows the same style guide.
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
Copyright (c) 2004-2013 Sergey Lyubka <valenok@gmail.com>
|
Copyright (c) 2004-2013 Sergey Lyubka
|
||||||
Copyright (c) 2013-2016 Cesanta Software Limited
|
Copyright (c) 2013-2020 Cesanta Software Limited
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
This software is dual-licensed: you can redistribute it and/or modify
|
This software is dual-licensed: you can redistribute it and/or modify
|
||||||
|
|||||||
@@ -2,71 +2,11 @@
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
Mongoose is ideal for embedded environments. It has been designed
|
This branch is only for use by [Mongoose OS](https://github.com/cesanta/mongoose-os),
|
||||||
for connecting devices and bringing them online. On the market since 2004,
|
for other projects please use the master branch.
|
||||||
used by vast number of open source and
|
|
||||||
commercial products - it even runs on the International Space station!
|
|
||||||
Mongoose makes embedded network programming fast, robust, and easy.
|
|
||||||
|
|
||||||
- [Download Mongoose Source Code here](https://www.cesanta.com)
|
|
||||||
|
|
||||||
Looking for a complete IoT firmware solution?
|
|
||||||
|
|
||||||
Check out [Mongoose OS](https://mongoose-iot.com) - open source embedded operating system for low-power connected microcontrollers. Secure, designed for Internet of Things, complete environment for prototyping, development and managing.
|
|
||||||
|
|
||||||
# Support
|
|
||||||
- [Study mongoose example code](https://github.com/cesanta/mongoose/tree/master/examples)
|
|
||||||
- [Read User Guide and API reference](https://docs.cesanta.com/mongoose)
|
|
||||||
- [Support Forum - ask your technical questions here] (http://forum.cesanta.com/index.php?p=/categories/mongoose)
|
|
||||||
- [Commercial licensing and support available] (https://www.cesanta.com/services-support)
|
|
||||||
- [Check our latest releases] (https://github.com/cesanta/mongoose/releases)
|
|
||||||
|
|
||||||
# Features
|
|
||||||
|
|
||||||
* Cross-platform: works on Linux/UNIX, MacOS, QNX, eCos, Windows, Android,
|
|
||||||
iPhone, FreeRTOS (TI CC3200, ESP8266), etc
|
|
||||||
* Supported hardware platforms: TI CC3200, TI MSP432, NRF52, STM32, PIC32, ESP8266, ESP32 and more
|
|
||||||
* Builtin protocols:
|
|
||||||
- plain TCP, plain UDP, SSL/TLS (over TCP, one-way or two-way)
|
|
||||||
- HTTP client, HTTP server
|
|
||||||
- WebSocket client, WebSocket server
|
|
||||||
- MQTT client, MQTT broker
|
|
||||||
- CoAP client, CoAP server
|
|
||||||
- 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
|
|
||||||
* Source code is both ISO C and ISO C++ compliant
|
|
||||||
* Very easy to integrate: just copy
|
|
||||||
[mongoose.c](https://raw.githubusercontent.com/cesanta/mongoose/master/mongoose.c) and
|
|
||||||
[mongoose.h](https://raw.githubusercontent.com/cesanta/mongoose/master/mongoose.h)
|
|
||||||
files to your build tree
|
|
||||||
|
|
||||||
# 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: [Contact us for commercial license.] (https://www.cesanta.com/contact)
|
Commercial Projects: [Contact us for commercial license.](https://www.cesanta.com/contact.html)
|
||||||
|
|
||||||
# Dashboard Example
|
|
||||||
|
|
||||||
Mongoose is often used to implement device dashboards and real-time
|
|
||||||
data exchange over Websocket. Here is a dashboard example that illustrates
|
|
||||||
the functionality:
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
[Developing a new product? Contact us today to discuss how Mongoose can help.
|
|
||||||
](https://www.cesanta.com/contact)
|
|
||||||
|
|
||||||
# Contributions
|
|
||||||
|
|
||||||
To submit contributions, sign
|
|
||||||
[Cesanta CLA](https://docs.cesanta.com/contributors_la.shtml)
|
|
||||||
and send GitHub pull request. You retain the copyright on your contributions.
|
|
||||||
|
|
||||||
# Looking for a pre-compiled Mongoose web server Windows or Mac binary?
|
|
||||||
- [Download pre-compiled Mongoose web server binary.](https://www.cesanta.com/products/binary)
|
|
||||||
|
|
||||||
[](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,16 +0,0 @@
|
|||||||
---
|
|
||||||
title: "struct mg_http_multipart_part"
|
|
||||||
decl_name: "struct mg_http_multipart_part"
|
|
||||||
symbol_kind: "struct"
|
|
||||||
signature: |
|
|
||||||
struct mg_http_multipart_part {
|
|
||||||
const char *file_name;
|
|
||||||
const char *var_name;
|
|
||||||
struct mg_str data;
|
|
||||||
int status; /* <0 on error */
|
|
||||||
void *user_data;
|
|
||||||
};
|
|
||||||
---
|
|
||||||
|
|
||||||
HTTP multipart part
|
|
||||||
|
|
||||||
@@ -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 }
|
||||||
---
|
---
|
||||||
@@ -1,12 +1,15 @@
|
|||||||
---
|
---
|
||||||
title: "Memory Buffers"
|
title: "mbuf.h"
|
||||||
symbol_kind: "intro"
|
symbol_kind: "intro"
|
||||||
decl_name: "mbuf.h"
|
decl_name: "mbuf.h"
|
||||||
items:
|
items:
|
||||||
- { name: mbuf_append.md }
|
- { name: mbuf_append.md }
|
||||||
|
- { name: mbuf_append_and_free.md }
|
||||||
|
- { name: mbuf_clear.md }
|
||||||
- { name: mbuf_free.md }
|
- { name: mbuf_free.md }
|
||||||
- { name: mbuf_init.md }
|
- { name: mbuf_init.md }
|
||||||
- { name: mbuf_insert.md }
|
- { name: mbuf_insert.md }
|
||||||
|
- { name: mbuf_move.md }
|
||||||
- { name: mbuf_remove.md }
|
- { name: mbuf_remove.md }
|
||||||
- { name: mbuf_resize.md }
|
- { name: mbuf_resize.md }
|
||||||
- { name: mbuf_trim.md }
|
- { name: mbuf_trim.md }
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
---
|
||||||
|
title: "mbuf_append_and_free()"
|
||||||
|
decl_name: "mbuf_append_and_free"
|
||||||
|
symbol_kind: "func"
|
||||||
|
signature: |
|
||||||
|
size_t mbuf_append_and_free(struct mbuf *, void *data, size_t data_size);
|
||||||
|
---
|
||||||
|
|
||||||
|
Appends data to the Mbuf and frees it (data must be heap-allocated).
|
||||||
|
|
||||||
|
Returns the number of bytes appended or 0 if out of memory.
|
||||||
|
data is freed irrespective of return value.
|
||||||
|
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
title: "mbuf_clear()"
|
||||||
|
decl_name: "mbuf_clear"
|
||||||
|
symbol_kind: "func"
|
||||||
|
signature: |
|
||||||
|
void mbuf_clear(struct mbuf *);
|
||||||
|
---
|
||||||
|
|
||||||
|
Removes all the data from mbuf (if any).
|
||||||
|
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
title: "mbuf_move()"
|
||||||
|
decl_name: "mbuf_move"
|
||||||
|
symbol_kind: "func"
|
||||||
|
signature: |
|
||||||
|
void mbuf_move(struct mbuf *from, struct mbuf *to);
|
||||||
|
---
|
||||||
|
|
||||||
|
Moves the state from one mbuf to the other.
|
||||||
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
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_coap_add_option.md }
|
- { name: mg_coap_add_option.md }
|
||||||
- { name: mg_coap_compose.md }
|
- { name: mg_coap_compose.md }
|
||||||
File renamed without changes.
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,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
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_copy_questions.md }
|
- { name: mg_dns_copy_questions.md }
|
||||||
- { name: mg_dns_encode_name.md }
|
- { name: mg_dns_encode_name.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,16 +1,19 @@
|
|||||||
---
|
---
|
||||||
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_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_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_send_websocket_handshake.md }
|
- { name: mg_send_websocket_handshake.md }
|
||||||
- { name: mg_send_websocket_handshake2.md }
|
- { name: mg_send_websocket_handshake2.md }
|
||||||
- { name: mg_send_websocket_handshake3.md }
|
- { name: mg_send_websocket_handshake3.md }
|
||||||
|
- { name: mg_send_websocket_handshake3v.md }
|
||||||
- { name: mg_set_protocol_http_websocket.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 }
|
||||||
@@ -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.
File renamed without changes.
@@ -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
|
||||||
|
|
||||||
+3
-1
@@ -30,7 +30,9 @@ The user-defined event handler will receive following extra events:
|
|||||||
- MG_EV_WEBSOCKET_HANDSHAKE_REQUEST: server has received the WebSocket
|
- MG_EV_WEBSOCKET_HANDSHAKE_REQUEST: server has received the WebSocket
|
||||||
handshake request. `ev_data` contains parsed HTTP request.
|
handshake request. `ev_data` contains parsed HTTP request.
|
||||||
- MG_EV_WEBSOCKET_HANDSHAKE_DONE: server has completed the WebSocket
|
- MG_EV_WEBSOCKET_HANDSHAKE_DONE: server has completed the WebSocket
|
||||||
handshake. `ev_data` is `NULL`.
|
handshake. `ev_data` is a `struct http_message` containing the
|
||||||
|
client's request (server mode) or server's response (client).
|
||||||
|
In client mode handler can examine `resp_code`, which should be 101.
|
||||||
- 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 *`
|
||||||
|
|
||||||
@@ -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.
|
||||||
|
|
||||||
+6
-2
@@ -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" */
|
||||||
@@ -29,8 +30,11 @@ signature: |
|
|||||||
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 */
|
* Value of the Content-Length header if present,
|
||||||
|
* otherwise MG_HTTP_CONTENT_LENGTH_UNKNOWN.
|
||||||
|
*/
|
||||||
|
size_t content_length;
|
||||||
};
|
};
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
---
|
||||||
|
title: "struct mg_http_multipart_part"
|
||||||
|
decl_name: "struct mg_http_multipart_part"
|
||||||
|
symbol_kind: "struct"
|
||||||
|
signature: |
|
||||||
|
struct mg_http_multipart_part {
|
||||||
|
const char *file_name;
|
||||||
|
const char *var_name;
|
||||||
|
struct mg_str data;
|
||||||
|
int status; /* <0 on error */
|
||||||
|
void *user_data;
|
||||||
|
/*
|
||||||
|
* User handler can indicate how much of the data was consumed
|
||||||
|
* by setting this variable. By default, it is assumed that all
|
||||||
|
* data has been consumed by the handler.
|
||||||
|
* If not all data was consumed, user's handler will be invoked again later
|
||||||
|
* with the remainder.
|
||||||
|
*/
|
||||||
|
size_t num_data_consumed;
|
||||||
|
};
|
||||||
|
---
|
||||||
|
|
||||||
|
HTTP multipart part
|
||||||
|
|
||||||
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,14 +1,16 @@
|
|||||||
---
|
---
|
||||||
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_check_digest_auth.md }
|
||||||
- { name: mg_file_upload_handler.md }
|
- { name: mg_file_upload_handler.md }
|
||||||
- { name: mg_get_http_basic_auth.md }
|
- { name: mg_get_http_basic_auth.md }
|
||||||
- { name: mg_get_http_header.md }
|
- { name: mg_get_http_header.md }
|
||||||
- { name: mg_get_http_var.md }
|
- { name: mg_get_http_var.md }
|
||||||
- { name: mg_http_check_digest_auth.md }
|
- { name: mg_http_check_digest_auth.md }
|
||||||
- { name: mg_http_parse_header.md }
|
- { name: mg_http_parse_header.md }
|
||||||
|
- { name: mg_http_parse_header2.md }
|
||||||
- { name: mg_http_reverse_proxy.md }
|
- { name: mg_http_reverse_proxy.md }
|
||||||
- { name: mg_http_send_error.md }
|
- { name: mg_http_send_error.md }
|
||||||
- { name: mg_http_send_redirect.md }
|
- { name: mg_http_send_redirect.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.
File renamed without changes.
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.
|
||||||
|
|
||||||
File renamed without changes.
File renamed without changes.
+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.
File renamed without changes.
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.
File renamed without changes.
@@ -1,10 +1,11 @@
|
|||||||
---
|
---
|
||||||
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_mqtt_connack.md }
|
- { name: mg_mqtt_connack.md }
|
||||||
- { name: mg_mqtt_disconnect.md }
|
- { name: mg_mqtt_disconnect.md }
|
||||||
|
- { name: mg_mqtt_match_topic_expression.md }
|
||||||
- { name: mg_mqtt_next_subscribe_topic.md }
|
- { name: mg_mqtt_next_subscribe_topic.md }
|
||||||
- { name: mg_mqtt_ping.md }
|
- { name: mg_mqtt_ping.md }
|
||||||
- { name: mg_mqtt_pong.md }
|
- { name: mg_mqtt_pong.md }
|
||||||
@@ -17,6 +18,7 @@ items:
|
|||||||
- { name: mg_mqtt_subscribe.md }
|
- { name: mg_mqtt_subscribe.md }
|
||||||
- { name: mg_mqtt_unsuback.md }
|
- { name: mg_mqtt_unsuback.md }
|
||||||
- { name: mg_mqtt_unsubscribe.md }
|
- { name: mg_mqtt_unsubscribe.md }
|
||||||
|
- { name: mg_mqtt_vmatch_topic_expression.md }
|
||||||
- { name: mg_send_mqtt_handshake.md }
|
- { name: mg_send_mqtt_handshake.md }
|
||||||
- { name: mg_send_mqtt_handshake_opt.md }
|
- { name: mg_send_mqtt_handshake_opt.md }
|
||||||
- { name: mg_set_protocol_mqtt.md }
|
- { name: mg_set_protocol_mqtt.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.
Loaded 100 of 442 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user