mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-25 12:04:47 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1b82aa02aa | ||
|
|
e565a7e73d | ||
|
|
59c4dfa33b | ||
|
|
1a8e3c2e31 | ||
|
|
226917e1cd | ||
|
|
fe813ee247 | ||
|
|
4cd830a0bf | ||
|
|
1259ca9ac9 | ||
|
|
d0857fe36c | ||
|
|
56a7438114 | ||
|
|
09df542db8 | ||
|
|
1df102ab93 | ||
|
|
02b3b780bb | ||
|
|
f84f3da012 | ||
|
|
c65c8fdaaa | ||
|
|
b484123f1b | ||
|
|
b60119790e | ||
|
|
216427cea0 | ||
|
|
c53e2fcc14 | ||
|
|
9fd80fd136 | ||
|
|
5fc284722f | ||
|
|
ad6e395da0 | ||
|
|
6c79a406cd | ||
|
|
456e8bd249 | ||
|
|
de95f28598 | ||
|
|
43405afdb2 | ||
|
|
97f95e17db | ||
|
|
6725d61b3f | ||
|
|
ebda2cb100 | ||
|
|
bb72b2494d | ||
|
|
3b0a509cae | ||
|
|
2f981f9383 | ||
|
|
fc3c08e411 | ||
|
|
ff811f287a | ||
|
|
8ebb3bc37b | ||
|
|
f7ff571c5f | ||
|
|
6a82cbee71 | ||
|
|
b0585bd0a9 | ||
|
|
6ad4d242c2 | ||
|
|
030b1d9826 | ||
|
|
f6ffa7b3b9 | ||
|
|
137efe2233 | ||
|
|
62411d039e | ||
|
|
54b1716e77 | ||
|
|
9f7aba8039 | ||
|
|
a176b8d566 | ||
|
|
26a97ec36c | ||
|
|
f29807aad8 | ||
|
|
92d3c7a4cd | ||
|
|
af3a0f6af0 | ||
|
|
ce6164ca20 | ||
|
|
e9fc3fcecf | ||
|
|
25a1a24890 | ||
|
|
bf7fc1d5a9 | ||
|
|
2126b49ab3 | ||
|
|
ae6767b1d2 | ||
|
|
133629dbee | ||
|
|
fb0a9bc7e3 | ||
|
|
2a3492766f | ||
|
|
2ec7e5653e | ||
|
|
30bfb245f5 | ||
|
|
84d89bc4f5 | ||
|
|
7f55fabfec | ||
|
|
9e0f04dc8b | ||
|
|
574c2954b3 | ||
|
|
9d38e26b81 | ||
|
|
4e75a0c81e | ||
|
|
d311e967fa | ||
|
|
d0a6c111cb | ||
|
|
aa6d8b4662 | ||
|
|
3f5fd89fd7 | ||
|
|
f43a5a005c | ||
|
|
755bf3c412 | ||
|
|
84f3fb0ba5 | ||
|
|
f2df6c114d | ||
|
|
f93659e303 | ||
|
|
226404d39c | ||
|
|
c1bcc143b9 | ||
|
|
5ca9062d45 | ||
|
|
0b209eaabb | ||
|
|
47ef191ea2 | ||
|
|
25e76d761e | ||
|
|
9731a51dae | ||
|
|
81220fa590 | ||
|
|
24e8c4d81a | ||
|
|
013520b0c0 | ||
|
|
f012bcb027 | ||
|
|
922e1ce529 | ||
|
|
7a707cc64b | ||
|
|
1967acfef2 | ||
|
|
e24cb04003 | ||
|
|
67974746ff | ||
|
|
8d916d41d7 | ||
|
|
08444e3942 | ||
|
|
9c41a0cd26 | ||
|
|
2c50069d98 | ||
|
|
31059f6728 | ||
|
|
2000752b2c | ||
|
|
dd34830443 | ||
|
|
c58f4ee51b | ||
|
|
00f7e8cb2a | ||
|
|
439904e27f | ||
|
|
4d6590ece2 | ||
|
|
9b0c4b970d | ||
|
|
a80ce1b12a | ||
|
|
57dd74c180 | ||
|
|
90c67e4226 | ||
|
|
093cd6a6a3 | ||
|
|
975db86306 | ||
|
|
eba688e11b | ||
|
|
05b44204d5 | ||
|
|
0bb017c1d5 | ||
|
|
a6efd0b335 | ||
|
|
c3d237e9c6 | ||
|
|
09d28f5570 | ||
|
|
ba02937ec6 | ||
|
|
3d78b14deb | ||
|
|
f558551d1d | ||
|
|
12fe66370f | ||
|
|
423aaa492c | ||
|
|
2016586475 | ||
|
|
bf88167152 | ||
|
|
52be84f04e | ||
|
|
03d187b147 | ||
|
|
3329047579 | ||
|
|
86c70e5abb | ||
|
|
b17f4108ea | ||
|
|
4e523cc455 | ||
|
|
49c9be9159 | ||
|
|
f1bfe0760f | ||
|
|
35f02fdaad | ||
|
|
6ac09966ba | ||
|
|
af9a7617f5 | ||
|
|
42c89732c8 | ||
|
|
054475ddbf | ||
|
|
126d556d6a | ||
|
|
529a302e77 | ||
|
|
acbf978452 | ||
|
|
90b22716ea | ||
|
|
fb90c504a6 | ||
|
|
65fd834654 | ||
|
|
a84acf5b8b | ||
|
|
e9505db146 | ||
|
|
4fb49b011e | ||
|
|
6742991469 | ||
|
|
2430cc5aac | ||
|
|
54590aaf26 | ||
|
|
7c5e67b272 | ||
|
|
c62c8ea4dd | ||
|
|
383653d608 | ||
|
|
001dc3f33d | ||
|
|
37d45b3fbb | ||
|
|
f72b8c6034 | ||
|
|
c11e5a9383 | ||
|
|
b5147a149e | ||
|
|
655529f30b | ||
|
|
fd5319e0ce | ||
|
|
f8c84ca672 | ||
|
|
1b81ac8916 | ||
|
|
c64e2ebb16 | ||
|
|
3771f2c088 | ||
|
|
6d398bd5c7 | ||
|
|
5c355a5ff3 | ||
|
|
d2f8b346e6 | ||
|
|
5cdaa931f9 | ||
|
|
693863a51e | ||
|
|
a204c80308 | ||
|
|
7d620965e2 | ||
|
|
0149654791 | ||
|
|
f08d280429 | ||
|
|
6fbb749431 | ||
|
|
bc7178e5f7 | ||
|
|
61070d136d | ||
|
|
ea85f93e37 | ||
|
|
46029c501a | ||
|
|
78e1fdd1c9 | ||
|
|
9ef5c7c667 | ||
|
|
cdf279e438 | ||
|
|
cdd192abe4 | ||
|
|
9af6f4b02e | ||
|
|
d86ceecd8c | ||
|
|
8f693b92a7 | ||
|
|
6b1ff37cf3 | ||
|
|
c490ff8ae7 | ||
|
|
f73ebbf689 | ||
|
|
1928ba9c1f | ||
|
|
ad3655fb92 | ||
|
|
29e0158689 | ||
|
|
aaf55b6da0 | ||
|
|
90a131bd29 | ||
|
|
8652006aea | ||
|
|
2139fbc4b7 | ||
|
|
2b48e8b03a | ||
|
|
a7afea0963 | ||
|
|
9d1e61de93 | ||
|
|
9b6b1a68f4 | ||
|
|
c7bd63ef53 | ||
|
|
40b3382023 | ||
|
|
a70c5e726d | ||
|
|
409fdaec59 | ||
|
|
372aa369c4 | ||
|
|
eb94704d8d | ||
|
|
894a168833 | ||
|
|
f3eb466af3 | ||
|
|
df848973dc | ||
|
|
f37e5ecc38 | ||
|
|
6316609a5f | ||
|
|
dca08d32bd | ||
|
|
2b287f50f1 | ||
|
|
acf58972f7 | ||
|
|
5bf5516b29 | ||
|
|
40b99e3751 | ||
|
|
28a56370d4 | ||
|
|
e3589577ed | ||
|
|
38beb4cbc0 | ||
|
|
167af7f160 | ||
|
|
7d91885413 | ||
|
|
0de83157dc | ||
|
|
cc9639b3cb | ||
|
|
cb0ac1868f | ||
|
|
e653147119 | ||
|
|
f3d15a0440 | ||
|
|
0bc736d384 | ||
|
|
3bf7b817f6 | ||
|
|
477e48bf54 | ||
|
|
913e730ec2 | ||
|
|
bd64043377 | ||
|
|
9f827feeaa | ||
|
|
714b7a8145 | ||
|
|
7ba6fda236 | ||
|
|
fc9c454518 | ||
|
|
1c456fc2df | ||
|
|
9b37ac384f | ||
|
|
99b279d5e5 | ||
|
|
4d07a99ee2 | ||
|
|
f6f0e49de4 | ||
|
|
07568a8f06 | ||
|
|
71e9019211 | ||
|
|
0937213f4b | ||
|
|
6c42350fcf | ||
|
|
453d4be4d0 | ||
|
|
104c4fab19 | ||
|
|
fd5eb2d3f9 | ||
|
|
8b770d2a0d | ||
|
|
b739aa89f1 | ||
|
|
11c07470bb | ||
|
|
76865cbe14 | ||
|
|
b7ce8213d7 | ||
|
|
86f43cd8d6 | ||
|
|
2407509ce0 | ||
|
|
47ce072af7 | ||
|
|
c2c6ff11ed | ||
|
|
9b18a6350a | ||
|
|
a36050ab4b | ||
|
|
568484f079 | ||
|
|
3ea4f1fda8 | ||
|
|
5366844581 | ||
|
|
e52a6184c4 | ||
|
|
b40b1232cc | ||
|
|
3a46055e52 | ||
|
|
2af5d07467 | ||
|
|
c2176f969b | ||
|
|
9346122c29 | ||
|
|
b98556a4dc | ||
|
|
55d102e450 | ||
|
|
dfc22af10f | ||
|
|
2d585474c1 | ||
|
|
53ee984eb7 | ||
|
|
bdb747f9de | ||
|
|
299075c930 | ||
|
|
b0e0247b21 | ||
|
|
35abd695cd | ||
|
|
df2ffd1187 | ||
|
|
b378082ec4 | ||
|
|
fb4fae9174 | ||
|
|
cddff2b1b8 | ||
|
|
d6dbf831f7 | ||
|
|
7e1d4325ec | ||
|
|
2a2c17a232 | ||
|
|
d130c6f42d | ||
|
|
a09238debd | ||
|
|
328a87b02a | ||
|
|
529faa1172 | ||
|
|
8e5efd4804 | ||
|
|
32406b678b | ||
|
|
55e2077a46 | ||
|
|
a771d6a19d | ||
|
|
0d5d7bb26f | ||
|
|
3808dd3222 | ||
|
|
8fc94e12af | ||
|
|
824e33ef8a | ||
|
|
655f9a9f79 | ||
|
|
6ac6aa521c | ||
|
|
3982e065c8 | ||
|
|
497b8027f5 | ||
|
|
89757388c7 | ||
|
|
77fae5c562 | ||
|
|
80fcba91c8 | ||
|
|
39d64be581 | ||
|
|
2bfd30ab4b | ||
|
|
60004eb209 | ||
|
|
db11897d71 | ||
|
|
5e466f9037 | ||
|
|
6b2698a503 | ||
|
|
4788db7e00 | ||
|
|
d9680df510 | ||
|
|
f20ee1f305 | ||
|
|
302bf865f9 | ||
|
|
03929dcdaa | ||
|
|
89af2e9638 | ||
|
|
015586950f | ||
|
|
9df261a0eb | ||
|
|
a2a3c84450 | ||
|
|
6611348ebf | ||
|
|
e69ee90acf | ||
|
|
8f3554d08a | ||
|
|
b6ee9e637b | ||
|
|
f46453f80f | ||
|
|
3deafaea7f | ||
|
|
a15d518571 | ||
|
|
886a29d659 | ||
|
|
e69de57def | ||
|
|
9d68e20dcc | ||
|
|
c0a8546330 | ||
|
|
4c0002e28a | ||
|
|
7c37d75bf4 | ||
|
|
879261981f | ||
|
|
838b0bcd27 | ||
|
|
736b8ad7b7 | ||
|
|
db27fae40e | ||
|
|
594111a255 | ||
|
|
53a46a2739 | ||
|
|
eef7a55904 | ||
|
|
a68fa5e6e0 | ||
|
|
7c0d126edc | ||
|
|
1a5e3d3151 | ||
|
|
95ff6c56af | ||
|
|
e2ef392633 | ||
|
|
dbc2356768 | ||
|
|
47e5e984df | ||
|
|
0f32f50c50 | ||
|
|
606cc1f538 | ||
|
|
2bb11888d5 | ||
|
|
09b1d6aa72 | ||
|
|
72f0489ec2 | ||
|
|
7b39973065 | ||
|
|
30b64483fd | ||
|
|
5369fb0376 | ||
|
|
5fe34fd6c3 | ||
|
|
0fbdda4d2e | ||
|
|
a98e980c8f | ||
|
|
2b836504ab | ||
|
|
0de3f0d985 | ||
|
|
151e375091 | ||
|
|
c44549bfa5 | ||
|
|
d6852f5e74 | ||
|
|
9173034b96 | ||
|
|
2888ab1f52 | ||
|
|
26b5416641 | ||
|
|
8bcac7e955 | ||
|
|
ea25e8129c | ||
|
|
26cb44f9d9 | ||
|
|
7a37a44433 | ||
|
|
a752f3f8c7 | ||
|
|
946e07644c | ||
|
|
497b26a249 | ||
|
|
79aad7fabf | ||
|
|
7851930ac3 | ||
|
|
758572872d | ||
|
|
111551477a | ||
|
|
31c9e3fb7e | ||
|
|
7061b7202f | ||
|
|
d88b6a3c95 | ||
|
|
cea2a62ee0 | ||
|
|
35a8b8e8e8 | ||
|
|
1b8624f135 | ||
|
|
e217066bf6 | ||
|
|
5430408218 | ||
|
|
d2744063a0 | ||
|
|
03356616ef | ||
|
|
6ce2e48dd3 | ||
|
|
16a7ba6bf0 | ||
|
|
e9d122f231 | ||
|
|
0ae5c61759 | ||
|
|
691460c5fc | ||
|
|
ab1c924388 | ||
|
|
05050eba38 | ||
|
|
912dd518bf | ||
|
|
e0395a9907 | ||
|
|
0051f23e12 | ||
|
|
a9bb8fa9fc | ||
|
|
09f5d2fdae | ||
|
|
006a9d914c | ||
|
|
9009cbc528 | ||
|
|
a1862986b8 | ||
|
|
cc2989a848 | ||
|
|
4deb95776f | ||
|
|
f195b27884 | ||
|
|
5036a71334 | ||
|
|
531c47b47c | ||
|
|
4dbb2da78f | ||
|
|
41c1e0f08d | ||
|
|
e7b1905e49 | ||
|
|
e00265f855 | ||
|
|
cd36708b6d | ||
|
|
5bd22cb5e4 | ||
|
|
bc00d5159a | ||
|
|
bcb0874477 | ||
|
|
5326e8d212 | ||
|
|
4528cc28ef | ||
|
|
381d7cce54 | ||
|
|
2594e7b37a | ||
|
|
4356b953ca | ||
|
|
e788853156 | ||
|
|
91ed6de166 | ||
|
|
cf3aafc32e | ||
|
|
c2d7ff8179 | ||
|
|
e5eaa1c633 | ||
|
|
6366c832b0 | ||
|
|
f326cbedbe | ||
|
|
5b272c2b5c | ||
|
|
452bcc68a4 | ||
|
|
829827d46f | ||
|
|
ff9d0e462e | ||
|
|
e84ea91a4a | ||
|
|
2dcb10ef36 | ||
|
|
99fa7f0851 | ||
|
|
1b5cc341a5 | ||
|
|
d50dc288cd | ||
|
|
060bb29cdc | ||
|
|
366426e8bb | ||
|
|
e710df4c80 | ||
|
|
79e5841483 | ||
|
|
374ab4ecf0 | ||
|
|
56980be48c | ||
|
|
602c5c0866 | ||
|
|
7ce5009de1 | ||
|
|
51e3a1304b | ||
|
|
d5a1d5a5e8 | ||
|
|
ae5f6c0920 | ||
|
|
0a9303bb07 | ||
|
|
42bc7b1f47 | ||
|
|
4844ed60bd | ||
|
|
41f5daeb47 | ||
|
|
a3f8f33d50 | ||
|
|
fd8db5c53a | ||
|
|
a2f027e798 | ||
|
|
dad5c8fe87 | ||
|
|
98783a41ba | ||
|
|
1517d2985a | ||
|
|
acc0564957 | ||
|
|
421bc126b5 | ||
|
|
ed1a98c381 | ||
|
|
457d76b049 | ||
|
|
6827972f71 | ||
|
|
7eb998891e | ||
|
|
582fde5c6e | ||
|
|
d327ee9834 | ||
|
|
31cf6f8969 | ||
|
|
86b1053678 | ||
|
|
6678e36278 | ||
|
|
5118355732 | ||
|
|
5b4b7f7dc5 | ||
|
|
7614a8101f | ||
|
|
3c851bcfc3 | ||
|
|
01691dafa0 | ||
|
|
8e52075636 | ||
|
|
7200f079bf | ||
|
|
d155db81de | ||
|
|
25e3bbf039 | ||
|
|
eecf3d854b | ||
|
|
7c2499fc06 | ||
|
|
1aa605c620 | ||
|
|
66287ad6c1 | ||
|
|
9a19485454 | ||
|
|
7d67d578fd | ||
|
|
960d3c7880 | ||
|
|
9eabf3fa81 | ||
|
|
89beadd2ce | ||
|
|
6ecb6c1500 | ||
|
|
51bc5f70c5 | ||
|
|
be62ac9c14 | ||
|
|
161c34384d | ||
|
|
89784ab90a | ||
|
|
d83e547fa9 | ||
|
|
30d86928d5 | ||
|
|
12c32d09fb | ||
|
|
ae6fd6aa35 | ||
|
|
72d3a49352 | ||
|
|
87b62390b7 | ||
|
|
6c93446a1f | ||
|
|
83c106a857 | ||
|
|
facb2846fd | ||
|
|
596c70d3dc | ||
|
|
7beff0201d | ||
|
|
a4c9d1ecb7 | ||
|
|
b7a79a556a | ||
|
|
03ab9e4e0d | ||
|
|
7e855f5c8f | ||
|
|
9e510d5831 | ||
|
|
1689a0d56b | ||
|
|
9ff774e7df | ||
|
|
c78ad0b574 | ||
|
|
117aeaa15d | ||
|
|
e135743efa | ||
|
|
2c1324dc0a | ||
|
|
c7e09bd7b4 | ||
|
|
86824795a0 | ||
|
|
1b0636c2d2 | ||
|
|
2f9d2bbdf6 | ||
|
|
21a1b2c15c | ||
|
|
bdef3d6afd | ||
|
|
a882aab30e | ||
|
|
788b577d65 | ||
|
|
71a22adc06 | ||
|
|
7d1ef2ffe8 | ||
|
|
55f5f74658 | ||
|
|
e1fd82bc46 | ||
|
|
49b8480bfb | ||
|
|
b2ab484883 | ||
|
|
4c3b97be7d | ||
|
|
60e1b64455 | ||
|
|
6bcd02bb1c | ||
|
|
66f302a613 | ||
|
|
1716af6c72 | ||
|
|
749326c83a | ||
|
|
9657577c00 | ||
|
|
9f5216d259 | ||
|
|
c8826e8f9c | ||
|
|
25bc13ef1e | ||
|
|
4d123a15f9 | ||
|
|
2cf1b09767 | ||
|
|
abfd81cb9d | ||
|
|
3895678bee | ||
|
|
e0a1feafe0 | ||
|
|
c75eb24eb8 | ||
|
|
c3aae185df | ||
|
|
2e87783246 | ||
|
|
fbab767b9f | ||
|
|
7bc38b5eaa | ||
|
|
b93456f512 | ||
|
|
ddb700eee5 | ||
|
|
1052ee0766 | ||
|
|
29534218d7 | ||
|
|
d7abd53062 | ||
|
|
aede72fa37 | ||
|
|
b0a5165b44 | ||
|
|
4919f792f2 | ||
|
|
d5927f5d50 | ||
|
|
e68330e045 | ||
|
|
b5d5b3763f | ||
|
|
b6a6687c1e | ||
|
|
3843b670a5 | ||
|
|
249efdd378 | ||
|
|
18ce1669fc | ||
|
|
e8d3b8030e | ||
|
|
a752abf318 | ||
|
|
d3ebcaf5d2 | ||
|
|
0abb8322d9 | ||
|
|
99ed58ec4d | ||
|
|
04450ec659 | ||
|
|
82a378e519 | ||
|
|
29d31ba919 | ||
|
|
4519ea568d | ||
|
|
9f88f31f01 | ||
|
|
4bdea2b467 | ||
|
|
2252a74cd7 | ||
|
|
d1fa7b88e0 | ||
|
|
9ecf42578c | ||
|
|
754fc25924 | ||
|
|
d9551c75b1 | ||
|
|
8d45cf6972 | ||
|
|
f176e1ae59 | ||
|
|
fa8f62fb5d | ||
|
|
0c142f20d7 | ||
|
|
b641fc6b79 | ||
|
|
1252a61479 | ||
|
|
5f631c0b96 | ||
|
|
348c579521 | ||
|
|
7ce9cdf0b9 | ||
|
|
09beadb98a | ||
|
|
5b265a76bd | ||
|
|
c5a4a1c6f2 | ||
|
|
88ada54045 | ||
|
|
c5b1c08d05 | ||
|
|
a0765ade6b | ||
|
|
54250f5fbf | ||
|
|
f3f397f31e | ||
|
|
d806ed5d5f | ||
|
|
37e9a2ee95 | ||
|
|
7ad6a08002 | ||
|
|
90686ee5c9 | ||
|
|
85c5577955 | ||
|
|
30d4a1ad0f | ||
|
|
1b551741b8 | ||
|
|
369f44adfa | ||
|
|
763f4551d5 | ||
|
|
42d7865e14 | ||
|
|
cf62702f08 | ||
|
|
14ccd78782 | ||
|
|
6c4b5efd98 | ||
|
|
05a43c563c | ||
|
|
94d2e86b60 | ||
|
|
d1b8f9e01f | ||
|
|
228acefa36 | ||
|
|
d1d8a77bf6 | ||
|
|
7ea3293aba | ||
|
|
082a498afd | ||
|
|
866c987409 | ||
|
|
1d0e65d17a | ||
|
|
136a37ef73 | ||
|
|
0ce49b5c71 | ||
|
|
490ad3834b | ||
|
|
bcc62c96c8 | ||
|
|
15d6cb3065 | ||
|
|
a490660b38 | ||
|
|
72019b7427 | ||
|
|
21c0024a2f | ||
|
|
d7a02d13e4 | ||
|
|
cb220837b9 | ||
|
|
ddaae51d42 | ||
|
|
629e55f97d | ||
|
|
909ebad276 | ||
|
|
cb7743fa39 | ||
|
|
6197842bca | ||
|
|
77d461dcbf | ||
|
|
47b6060910 | ||
|
|
47d3fe5af6 | ||
|
|
6691a2fdad | ||
|
|
746f56f42a | ||
|
|
87de05881c | ||
|
|
f2fba1d200 | ||
|
|
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 | ||
|
|
12339bbf4c |
No files matched your search
@@ -0,0 +1,6 @@
|
|||||||
|
BasedOnStyle: Google
|
||||||
|
AllowShortFunctionsOnASingleLine: false
|
||||||
|
SpaceAfterCStyleCast: true
|
||||||
|
PointerBindsToType: false
|
||||||
|
DerivePointerBinding: false
|
||||||
|
IncludeBlocks: Preserve
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
- My goal is: _describe_
|
||||||
|
- My actions were: _describe_
|
||||||
|
- My expectation was: _describe_
|
||||||
|
- The result I saw: _provide logs or description_
|
||||||
|
- My question is: _your question_
|
||||||
|
|
||||||
|
# Environment
|
||||||
|
|
||||||
|
- mongoose version: _X.Y_
|
||||||
|
- Compiler/IDE and SDK: ZZZ version _X.Y_
|
||||||
|
- Target hardware/board: _?_
|
||||||
|
- Connectivity chip/module: _?_
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
name: CIFuzz
|
||||||
|
on: [pull_request]
|
||||||
|
jobs:
|
||||||
|
Fuzzing:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Build Fuzzers
|
||||||
|
id: build
|
||||||
|
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
|
||||||
|
with:
|
||||||
|
oss-fuzz-project-name: 'mongoose'
|
||||||
|
dry-run: false
|
||||||
|
language: c++
|
||||||
|
- name: Run Fuzzers
|
||||||
|
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
|
||||||
|
with:
|
||||||
|
oss-fuzz-project-name: 'mongoose'
|
||||||
|
fuzz-seconds: 600
|
||||||
|
dry-run: false
|
||||||
|
language: c++
|
||||||
|
- name: Upload Crash
|
||||||
|
uses: actions/upload-artifact@v1
|
||||||
|
if: failure() && steps.build.outcome == 'success'
|
||||||
|
with:
|
||||||
|
name: artifacts
|
||||||
|
path: ./out/artifacts
|
||||||
@@ -0,0 +1,211 @@
|
|||||||
|
name: build
|
||||||
|
on: [push, pull_request]
|
||||||
|
jobs:
|
||||||
|
linux:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Install packages
|
||||||
|
run: sudo apt-get install libmbedtls-dev
|
||||||
|
- name: gcc
|
||||||
|
run: make test test++ IPV6=0 CC=gcc
|
||||||
|
- name: clang
|
||||||
|
run: make test test++ IPV6=0 CC=clang
|
||||||
|
- name: openssl
|
||||||
|
run: make test SSL=OPENSSL IPV6=0
|
||||||
|
- name: unamalgamated
|
||||||
|
run: make unamalgamated
|
||||||
|
examples:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Install packages
|
||||||
|
run: sudo apt-get install libmbedtls-dev
|
||||||
|
- name: examples
|
||||||
|
run: make clean examples
|
||||||
|
macos:
|
||||||
|
runs-on: macos-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Install packages
|
||||||
|
run: HOMEBREW_NO_AUTO_UPDATE=1 brew install jq mbedtls openssl
|
||||||
|
- name: make
|
||||||
|
run: make test++ upload-coverage IPV6=0
|
||||||
|
- name: openssl
|
||||||
|
run: make test SSL=OPENSSL IPV6=0 OPENSSL=`echo /usr/local/Cellar/openssl*/*`
|
||||||
|
- name: exports
|
||||||
|
run: make mg_prefix
|
||||||
|
windows:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: vc98
|
||||||
|
run: make vc98
|
||||||
|
- name: vc2017
|
||||||
|
run: make vc2017
|
||||||
|
- name: mingw
|
||||||
|
run: make mingw
|
||||||
|
- name: mingw++
|
||||||
|
run: make mingw++
|
||||||
|
arm:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: arm
|
||||||
|
run: make arm
|
||||||
|
esp32:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: esp32
|
||||||
|
run: make -C examples/esp32 build
|
||||||
|
esp8266:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: esp8266
|
||||||
|
run: make -C examples/esp8266 build
|
||||||
|
stm32-freertos-tcp:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: stm32-freertos-tcp
|
||||||
|
run: make -C examples/stm32/stm32-freertos-tcp build
|
||||||
|
stm32-nucleo-f746z:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: stm32-nucleo-f746z
|
||||||
|
run: make -C examples/stm32/stm32-nucleo-f746z build
|
||||||
|
stm32-nucleo-f429z:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: stm32-nucleo-f429z
|
||||||
|
run: make -C examples/stm32/stm32-nucleo-f429z build
|
||||||
|
stm32-nucleo-h743z:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: stm32-nucleo-h743z
|
||||||
|
run: make -C examples/stm32/stm32-nucleo-h743z build
|
||||||
|
nxp-mimxrt1020-azurertos:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: nxp-mimxrt1020-azurertos
|
||||||
|
run: make -C examples/nxp/nxp-mimxrt1020-azurertos build
|
||||||
|
nxp-frdmk66f-freertos:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: nxp-frdmk66f-freertos
|
||||||
|
run: make -C examples/nxp/nxp-frdmk66f-freertos build
|
||||||
|
nxp-lpcxpresso54s018m-freertos:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: nxp-lpcxpresso54s018m-freertos
|
||||||
|
run: make -C examples/nxp/nxp-lpcxpresso54s018m-freertos build
|
||||||
|
nxp-mimxrt1020-freertos:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: nxp-mimxrt1020-freertos
|
||||||
|
run: make -C examples/nxp/nxp-mimxrt1020-freertos build
|
||||||
|
nxp-evkbimxrt1050-lwip-freertos:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: nxp-evkbimxrt1050-lwip-freertos
|
||||||
|
run: make -C examples/nxp/nxp-evkbimxrt1050-lwip-freertos build
|
||||||
|
nxp-evkmimxrt1020-lwip-freertos:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: nxp-evkmimxrt1020-lwip-freertos
|
||||||
|
run: make -C examples/nxp/nxp-evkmimxrt1020-lwip-freertos build
|
||||||
|
nxp-evkmimxrt1024-lwip-freertos:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: nxp-evkmimxrt1024-lwip-freertos
|
||||||
|
run: make -C examples/nxp/nxp-evkmimxrt1024-lwip-freertos build
|
||||||
|
nxp-evkmimxrt1060-lwip-freertos:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: nxp-evkmimxrt1060-lwip-freertos
|
||||||
|
run: make -C examples/nxp/nxp-evkmimxrt1060-lwip-freertos build
|
||||||
|
nxp-evkmimxrt1064-lwip-freertos:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: nxp-evkmimxrt1064-lwip-freertos
|
||||||
|
run: make -C examples/nxp/nxp-evkmimxrt1064-lwip-freertos build
|
||||||
|
nxp-evkmimxrt1160-cm7-lwip-freertos:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: nxp-evkmimxrt1160-cm7-lwip-freertos
|
||||||
|
run: make -C examples/nxp/nxp-evkmimxrt1160-cm7-lwip-freertos build
|
||||||
|
nxp-evkmimxrt1170-cm4-lwip-freertos:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: nxp-evkmimxrt1170-cm4-lwip-freertos
|
||||||
|
run: make -C examples/nxp/nxp-evkmimxrt1170-cm4-lwip-freertos build
|
||||||
|
nxp-evkmimxrt1170-cm7-lwip-freertos:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: nxp-evkmimxrt1170-cm7-lwip-freertos
|
||||||
|
run: make -C examples/nxp/nxp-evkmimxrt1170-cm7-lwip-freertos build
|
||||||
|
nxp-frdmk64f-lwip-freertos:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: nxp-frdmk64f-lwip-freertos
|
||||||
|
run: make -C examples/nxp/nxp-frdmk64f-lwip-freertos build
|
||||||
|
nxp-frdmk66f-lwip-freertos:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: nxp-frdmk66f-lwip-freertos
|
||||||
|
run: make -C examples/nxp/nxp-frdmk66f-lwip-freertos build
|
||||||
|
nxp-lpcxpresso54018-lwip-freertos:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: nxp-lpcxpresso54018-lwip-freertos
|
||||||
|
run: make -C examples/nxp/nxp-lpcxpresso54018-lwip-freertos build
|
||||||
|
nxp-lpcxpresso54608-lwip-freertos:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: nxp-lpcxpresso54608-lwip-freertos
|
||||||
|
run: make -C examples/nxp/nxp-lpcxpresso54608-lwip-freertos build
|
||||||
|
nxp-lpcxpresso54618-lwip-freertos:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: nxp-lpcxpresso54618-lwip-freertos
|
||||||
|
run: make -C examples/nxp/nxp-lpcxpresso54618-lwip-freertos build
|
||||||
|
nxp-lpcxpresso54628-lwip-freertos:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: nxp-lpcxpresso54628-lwip-freertos
|
||||||
|
run: make -C examples/nxp/nxp-lpcxpresso54628-lwip-freertos build
|
||||||
|
nxp-twrk65f180m-lwip-freertos:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: nxp-twrk65f180m-lwip-freertos
|
||||||
|
run: make -C examples/nxp/nxp-twrk65f180m-lwip-freertos build
|
||||||
|
nxp-twrkv58f220m-lwip-freertos:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: nxp-twrkv58f220m-lwip-freertos
|
||||||
|
run: make -C examples/nxp/nxp-twrkv58f220m-lwip-freertos build
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
binary/
|
|
||||||
deps/
|
|
||||||
docker/
|
|
||||||
docs/
|
|
||||||
examples/
|
|
||||||
platforms/
|
|
||||||
src/
|
|
||||||
test/
|
|
||||||
multilingual/
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
Copyright (c) 2004-2013 Sergey Lyubka <valenok@gmail.com>
|
Copyright (c) 2004-2013 Sergey Lyubka
|
||||||
Copyright (c) 2013-2018 Cesanta Software Limited
|
Copyright (c) 2013-2021 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
|
||||||
@@ -13,4 +13,4 @@ warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|||||||
See the GNU General Public License for more details.
|
See the GNU General Public License for more details.
|
||||||
|
|
||||||
Alternatively, you can license this software under a commercial
|
Alternatively, you can license this software under a commercial
|
||||||
license, as set out in <https://www.cesanta.com/license>.
|
license, as set out in <https://mongoose.ws/licensing/>.
|
||||||
@@ -0,0 +1,132 @@
|
|||||||
|
SRCS = mongoose.c test/unit_test.c test/packed_fs.c
|
||||||
|
HDRS = $(wildcard src/*.h)
|
||||||
|
DEFS ?= -DMG_MAX_HTTP_HEADERS=7 -DMG_ENABLE_LINES -DMG_ENABLE_PACKED_FS=1
|
||||||
|
WARN ?= -W -Wall -Werror -Wshadow -Wdouble-promotion -fno-common -Wconversion -Wundef
|
||||||
|
OPTS ?= -O3 -g3
|
||||||
|
INCS ?= -Isrc -I.
|
||||||
|
CFLAGS ?= $(OPTS) $(WARN) $(INCS) $(DEFS) $(TFLAGS) $(EXTRA)
|
||||||
|
SSL ?= MBEDTLS
|
||||||
|
CWD ?= $(realpath $(CURDIR))
|
||||||
|
DOCKER ?= docker run --rm -e Tmp=. -e WINEDEBUG=-all -v $(CWD):$(CWD) -w $(CWD)
|
||||||
|
VCFLAGS = /nologo /W3 /O2 /I. $(DEFS) $(TFLAGS)
|
||||||
|
IPV6 ?= 1
|
||||||
|
ASAN_OPTIONS ?=
|
||||||
|
EXAMPLES := $(wildcard examples/*)
|
||||||
|
PREFIX ?= /usr/local
|
||||||
|
VERSION ?= $(shell cut -d'"' -f2 src/version.h)
|
||||||
|
.PHONY: examples test
|
||||||
|
|
||||||
|
ifeq "$(SSL)" "MBEDTLS"
|
||||||
|
MBEDTLS ?= /usr
|
||||||
|
CFLAGS += -DMG_ENABLE_MBEDTLS=1 -I$(MBEDTLS)/include -I/usr/include
|
||||||
|
LDFLAGS ?= -L$(MBEDTLS)/lib -lmbedtls -lmbedcrypto -lmbedx509
|
||||||
|
endif
|
||||||
|
ifeq "$(SSL)" "OPENSSL"
|
||||||
|
OPENSSL ?= /usr
|
||||||
|
CFLAGS += -DMG_ENABLE_OPENSSL=1 -I$(OPENSSL)/include
|
||||||
|
LDFLAGS ?= -L$(OPENSSL)/lib -lssl -lcrypto
|
||||||
|
endif
|
||||||
|
|
||||||
|
all: mg_prefix unamalgamated unpacked test test++ arm examples vc98 vc2017 mingw mingw++ linux linux++ fuzz
|
||||||
|
|
||||||
|
examples:
|
||||||
|
@for X in $(EXAMPLES); do $(MAKE) -C $$X example || break; done
|
||||||
|
|
||||||
|
test/packed_fs.c: Makefile src/fs.h src/ssi.h test/fuzz.c test/data/a.txt
|
||||||
|
$(CC) $(CFLAGS) test/pack.c -o pack
|
||||||
|
./pack $? > $@
|
||||||
|
|
||||||
|
# Check that all external (exported) symbols have "mg_" prefix
|
||||||
|
mg_prefix: mongoose.c mongoose.h
|
||||||
|
$(CC) mongoose.c $(CFLAGS) -c -o /tmp/x.o && nm /tmp/x.o | grep ' T' | grep -v 'mg_' ; test $$? = 1
|
||||||
|
|
||||||
|
# C++ build
|
||||||
|
test++: CC = g++
|
||||||
|
test++: WARN += -Wno-shadow -Wno-missing-field-initializers -Wno-deprecated
|
||||||
|
test++: test
|
||||||
|
|
||||||
|
# Make sure we can build from an unamalgamated sources
|
||||||
|
unamalgamated: $(HDRS) Makefile test/packed_fs.c
|
||||||
|
$(CC) src/*.c test/packed_fs.c test/unit_test.c $(CFLAGS) $(LDFLAGS) -g -o unit_test
|
||||||
|
|
||||||
|
unpacked:
|
||||||
|
$(CC) -I. mongoose.c test/unit_test.c -o unit_test
|
||||||
|
|
||||||
|
fuzzer: mongoose.c mongoose.h Makefile test/fuzz.c
|
||||||
|
clang mongoose.c test/fuzz.c $(WARN) $(INCS) -DMG_ENABLE_LINES -DMG_ENABLE_LOG=0 -fsanitize=fuzzer,signed-integer-overflow,address -g -o $@
|
||||||
|
|
||||||
|
fuzz: fuzzer
|
||||||
|
$(RUN) ./fuzzer
|
||||||
|
|
||||||
|
# make CC=/usr/local/opt/llvm\@8/bin/clang ASAN_OPTIONS=detect_leaks=1
|
||||||
|
test: CFLAGS += -DMG_ENABLE_IPV6=$(IPV6) -fsanitize=address,undefined
|
||||||
|
test: mongoose.h Makefile $(SRCS)
|
||||||
|
$(CC) $(SRCS) $(CFLAGS) -coverage $(LDFLAGS) -g -o unit_test
|
||||||
|
ASAN_OPTIONS=$(ASAN_OPTIONS) $(RUN) ./unit_test
|
||||||
|
|
||||||
|
coverage: test
|
||||||
|
gcov -l -n *.gcno | sed '/^$$/d' | sed 'N;s/\n/ /'
|
||||||
|
gcov mongoose.gcno >/dev/null
|
||||||
|
|
||||||
|
upload-coverage: coverage
|
||||||
|
curl -s https://codecov.io/bash | /bin/bash
|
||||||
|
|
||||||
|
infer:
|
||||||
|
infer run -- cc test/unit_test.c -c -W -Wall -Werror -Isrc -I. -O2 -DMG_ENABLE_MBEDTLS=1 -DMG_ENABLE_LINES -I/usr/local/Cellar/mbedtls/2.23.0/include -DMG_ENABLE_IPV6=1 -g -o /dev/null
|
||||||
|
|
||||||
|
arm: mongoose.h $(SRCS)
|
||||||
|
$(DOCKER) mdashnet/armgcc arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb $(SRCS) test/mongoose_custom.c -Itest -DMG_ARCH=MG_ARCH_CUSTOM $(OPTS) $(WARN) $(INCS) $(DEFS) -o unit_test -nostartfiles --specs nosys.specs -e 0
|
||||||
|
|
||||||
|
riscv: mongoose.h $(SRCS)
|
||||||
|
$(DOCKER) mdashnet/riscv riscv-none-elf-gcc -march=rv32imc -mabi=ilp32 $(SRCS) test/mongoose_custom.c -Itest -DMG_ARCH=MG_ARCH_CUSTOM $(OPTS) $(WARN) $(INCS) $(DEFS) -o unit_test
|
||||||
|
|
||||||
|
#vc98: VCFLAGS += -DMG_ENABLE_IPV6=1
|
||||||
|
vc98: Makefile mongoose.h $(SRCS)
|
||||||
|
$(DOCKER) mdashnet/vc98 wine cl $(SRCS) $(VCFLAGS) ws2_32.lib /Fe$@.exe
|
||||||
|
$(DOCKER) mdashnet/vc98 wine $@.exe
|
||||||
|
|
||||||
|
#vc2017: VCFLAGS += -DMG_ENABLE_IPV6=1
|
||||||
|
vc2017: Makefile mongoose.h $(SRCS)
|
||||||
|
$(DOCKER) mdashnet/vc2017 wine64 cl $(SRCS) $(VCFLAGS) ws2_32.lib /Fe$@.exe
|
||||||
|
$(DOCKER) mdashnet/vc2017 wine64 $@.exe
|
||||||
|
|
||||||
|
mingw: Makefile mongoose.h $(SRCS)
|
||||||
|
$(DOCKER) mdashnet/mingw i686-w64-mingw32-gcc $(SRCS) -W -Wall -Werror -I. $(DEFS) -lwsock32 -o test.exe
|
||||||
|
$(DOCKER) mdashnet/vc98 wine test.exe
|
||||||
|
|
||||||
|
mingw++: Makefile mongoose.h $(SRCS)
|
||||||
|
$(DOCKER) mdashnet/mingw i686-w64-mingw32-g++ $(SRCS) -W -Wall -Werror -I. $(DEFS) -lwsock32 -o test.exe
|
||||||
|
# Note: for some reason, a binary built with mingw g++, fails to run
|
||||||
|
|
||||||
|
#linux: CFLAGS += -DMG_ENABLE_IPV6=$(IPV6)
|
||||||
|
linux: CFLAGS += -fsanitize=address,undefined
|
||||||
|
linux: Makefile mongoose.h $(SRCS)
|
||||||
|
$(DOCKER) mdashnet/cc2 gcc $(SRCS) $(CFLAGS) $(LDFLAGS) -o unit_test_gcc
|
||||||
|
$(DOCKER) mdashnet/cc2 ./unit_test_gcc
|
||||||
|
|
||||||
|
linux++: CC = g++
|
||||||
|
linux++: WARN += -Wno-missing-field-initializers
|
||||||
|
linux++: linux
|
||||||
|
|
||||||
|
linux-libs: CFLAGS += -fPIC
|
||||||
|
linux-libs: mongoose.o
|
||||||
|
$(CC) mongoose.o $(LDFLAGS) -shared -o libmongoose.so.$(VERSION)
|
||||||
|
$(AR) rcs libmongoose.a mongoose.o
|
||||||
|
|
||||||
|
install: linux-libs
|
||||||
|
install -Dm644 libmongoose.a libmongoose.so.$(VERSION) $(DESTDIR)$(PREFIX)/lib
|
||||||
|
ln -s libmongoose.so.$(VERSION) $(DESTDIR)$(PREFIX)/lib/libmongoose.so
|
||||||
|
install -Dm644 mongoose.h $(DESTDIR)$(PREFIX)/include/mongoose.h
|
||||||
|
|
||||||
|
uninstall:
|
||||||
|
rm -rf $(DESTDIR)$(PREFIX)/lib/libmongoose.a $(DESTDIR)$(PREFIX)/lib/libmongoose.so.$(VERSION) $(DESTDIR)$(PREFIX)/include/mongoose.h $(DESTDIR)$(PREFIX)/lib/libmongoose.so
|
||||||
|
|
||||||
|
mongoose.c: Makefile $(wildcard src/*)
|
||||||
|
(cat src/license.h; echo; echo '#include "mongoose.h"' ; (for F in src/*.c ; do echo; echo '#ifdef MG_ENABLE_LINES'; echo "#line 1 \"$$F\""; echo '#endif'; cat $$F | sed -e 's,#include ".*,,'; done))> $@
|
||||||
|
|
||||||
|
mongoose.h: $(HDRS) Makefile
|
||||||
|
(cat src/license.h; echo; echo '#ifndef MONGOOSE_H'; echo '#define MONGOOSE_H'; echo; cat src/version.h ; echo; echo '#ifdef __cplusplus'; echo 'extern "C" {'; echo '#endif'; cat src/arch.h src/arch_*.h src/config.h src/str.h src/log.h src/timer.h src/fs.h src/util.h src/url.h src/iobuf.h src/base64.h src/md5.h src/sha1.h src/event.h src/net.h src/http.h src/ssi.h src/tls.h src/tls_mbed.h src/tls_openssl.h src/ws.h src/sntp.h src/mqtt.h src/dns.h | sed -e 's,#include ".*,,' -e 's,^#pragma once,,'; echo; echo '#ifdef __cplusplus'; echo '}'; echo '#endif'; echo '#endif // MONGOOSE_H')> $@
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf $(PROG) *.o *.dSYM unit_test* ut fuzzer *.gcov *.gcno *.gcda *.obj *.exe *.ilk *.pdb slow-unit* _CL_* infer-out data.txt crash-* test/packed_fs.c pack
|
||||||
|
@for X in $(EXAMPLES); do $(MAKE) -C $$X clean; done
|
||||||
@@ -1,68 +1,84 @@
|
|||||||
# Mongoose - Embedded Web Server / Embedded Networking Library
|
# Mongoose - Embedded Web Server / Embedded Networking Library
|
||||||
|
|
||||||

|
[](https://opensource.org/licenses/gpl-2.0.php)
|
||||||
|
[](https://github.com/cesanta/mongoose/actions)
|
||||||
|
[](https://codecov.io/gh/cesanta/mongoose)
|
||||||
|
[](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:mongoose)
|
||||||
|
[](https://gitter.im/cesanta/mongoose)
|
||||||
|
|
||||||
Mongoose is ideal for embedded environments. It has been designed
|
Mongoose is a networking library for C/C++. It implements event-driven
|
||||||
for connecting devices and bringing them online. On the market since 2004,
|
non-blocking APIs for TCP, UDP, HTTP, WebSocket, MQTT. It is designed for
|
||||||
used by vast number of open source and
|
connecting devices and bringing them online. On the market since 2004, used by
|
||||||
commercial products - it even runs on the International Space station!
|
vast number of open source and commercial products - it even runs on the
|
||||||
Mongoose makes embedded network programming fast, robust, and easy.
|
International Space Station! Mongoose makes embedded network programming fast,
|
||||||
|
robust, and easy. Features include:
|
||||||
|
|
||||||
- [Download Mongoose Source Code here](https://www.cesanta.com/download.html)
|
- Cross-platform: works on Linux/UNIX, MacOS, Windows, Android, FreeRTOS, etc.
|
||||||
|
- Supported embedded architectures: ESP32, NRF52, STM32, NXP, and more
|
||||||
|
- Built-in protocols: plain TCP/UDP, HTTP, MQTT, Websocket
|
||||||
|
- SSL/TLS support: mbedTLS, OpenSSL or custom (via API)
|
||||||
|
- Asynchronous DNS resolver
|
||||||
|
- Tiny static and run-time footprint
|
||||||
|
- Source code is both ISO C and ISO C++ compliant
|
||||||
|
- Works with any network stack with socket API, like LwIP or FreeRTOS-Plus-TCP
|
||||||
|
- Very easy to integrate: just copy `mongoose.c` and `mongoose.h` files to your build tree
|
||||||
|
- Detailed [documentation](https://mongoose.ws/documentation/) and
|
||||||
|
[tutorials](https://mongoose.ws/tutorials/)
|
||||||
|
|
||||||
Looking for a complete IoT firmware solution?
|
|
||||||
|
|
||||||
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.
|
# Commercial use
|
||||||
|
- Mongoose is used by hundreds of businesses, from Fortune500 giants like
|
||||||
|
Siemens, Schneider Electric, Broadcom, Bosch, Google, Samsung, Qualcomm, Caterpillar to the small businesses
|
||||||
|
- Used to solve a wide range of business needs, like implementing Web UI
|
||||||
|
interface on devices, RESTful API services, telemetry data exchange, remote
|
||||||
|
control for a product, remote software updates, remote monitoring, and others
|
||||||
|
- Deployed to hundreds of millions devices in production environment worldwide
|
||||||
|
- See [Case Studies](https://mongoose.ws/case-studies/) from our respected
|
||||||
|
customers like [Schneider Electric](https://mongoose.ws/case-studies/schneider-electric/) (industrial automation), [Broadcom](https://mongoose.ws/case-studies/broadcom/) (semiconductors), [Pilz](https://mongoose.ws/case-studies/pilz/) (industrial automation), and others
|
||||||
|
- See [Testimonials](https://mongoose.ws/testimonials/) from engineers that integrated Mongoose in their commercial products
|
||||||
|
- We provide [Evaluation and Commercial licensing](https://mongoose.ws/licensing/), [support](https://mongoose.ws/support/), consultancy and integration
|
||||||
|
assistance - don't hesitate to [contact us](https://mongoose.ws/contact/)
|
||||||
|
|
||||||
# Support
|
|
||||||
- [Study mongoose example code](https://github.com/cesanta/mongoose/tree/master/examples)
|
|
||||||
- [Read User Guide and API reference](https://cesanta.com/docs/overview/intro.html)
|
|
||||||
- [Support Forum - ask your technical questions here](https://community.mongoose-os.com/)
|
|
||||||
- [Commercial licensing and support available](https://www.cesanta.com/licensing.html)
|
|
||||||
- [Check our latest releases](https://github.com/cesanta/mongoose/releases)
|
|
||||||
|
|
||||||
# Features
|
# Security
|
||||||
|
|
||||||
* Cross-platform: works on Linux/UNIX, MacOS, QNX, eCos, Windows, Android,
|
We take security seriously:
|
||||||
iPhone, FreeRTOS (TI CC3200, ESP8266), etc
|
1. Mongoose repository runs a
|
||||||
* Supported hardware platforms: TI CC3200, TI MSP432, NRF52, STM32, PIC32, ESP8266, ESP32 and more
|
[continuous integration test powered by GitHub](https://github.com/cesanta/mongoose/actions),
|
||||||
* Builtin protocols:
|
which runs through hundreds of unit tests on every commit to the repository.
|
||||||
- plain TCP, plain UDP, SSL/TLS (over TCP, one-way or two-way)
|
Our [unit tests](https://github.com/cesanta/mongoose/tree/master/test)
|
||||||
- HTTP client, HTTP server
|
are built with modern address sanitizer technologies, which help to find
|
||||||
- WebSocket client, WebSocket server
|
security vulnerabilities early
|
||||||
- MQTT client, MQTT broker
|
2. Mongoose repository is integrated into Google's
|
||||||
- CoAP client, CoAP server
|
[oss-fuzz continuous fuzzer](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:mongoose)
|
||||||
- DNS client, DNS server, async DNS resolver
|
which scans for potential vulnerabilities continuously
|
||||||
* Single-threaded, asynchronous, non-blocking core with simple event-based API
|
3. We receive periodic vulnerability reports from the independent security
|
||||||
* Native support for [PicoTCP embedded TCP/IP stack](http://www.picotcp.com),
|
groups like
|
||||||
[LWIP embedded TCP/IP stack](https://en.wikipedia.org/wiki/LwIP)
|
[Cisco Talos](https://www.cisco.com/c/en/us/products/security/talos.html),
|
||||||
* Tiny static and run-time footprint
|
[Microsoft Security Response Center](https://www.microsoft.com/en-us/msrc),
|
||||||
* Source code is both ISO C and ISO C++ compliant
|
[MITRE Corporation](https://www.mitre.org/),
|
||||||
* Very easy to integrate: just copy
|
[Compass Security](https://www.compass-security.com/en/) and others.
|
||||||
[mongoose.c](https://raw.githubusercontent.com/cesanta/mongoose/master/mongoose.c) and
|
In case of the vulnerability found, we act according to the industry best
|
||||||
[mongoose.h](https://raw.githubusercontent.com/cesanta/mongoose/master/mongoose.h)
|
practice: hold on to the publication, fix the software and notify all our
|
||||||
files to your build tree
|
customers that have an appropriate subscription
|
||||||
|
4. Some of our customers (for example NASA)
|
||||||
|
have specific security requirements and run independent security audits,
|
||||||
|
of which we get notified and in case of any issue, act similar to (3).
|
||||||
|
|
||||||
# Licensing
|
# Supplement software
|
||||||
|
|
||||||
Mongoose is released under Commercial and [GNU GPL v.2](http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) open source licenses.
|
This software is often used together with Mongoose:
|
||||||
|
- [mjson](https://github.com/cesanta/mjson) - a JSON parser, emitter and
|
||||||
|
JSON-RPC engine. Used to implement
|
||||||
|
RESTful APIs that use JSON, or implement data exchange (e.g. over MQTT
|
||||||
|
or Websocket) that use JSON for data encapsulation
|
||||||
|
- [elk](https://github.com/cesanta/elk) - a tiny JavaScript engine.
|
||||||
|
Used to implement scripting support
|
||||||
|
|
||||||
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.html)
|
|
||||||
|
|
||||||
# Contributions
|
# Contributions
|
||||||
|
|
||||||
To submit contributions, sign [Cesanta CLA](https://cesanta.com/cla.html)
|
Contributions are welcome! Please follow the guidelines below:
|
||||||
and send GitHub pull request.
|
|
||||||
|
|
||||||
# Looking for a pre-compiled Mongoose web server Windows or Mac binary?
|
- Sign [Cesanta CLA](https://cesanta.com/cla.html) and send GitHub pull request
|
||||||
- [Download pre-compiled Mongoose web server binary.](https://www.cesanta.com/binary.html)
|
- Make sure that PRs have only one commit, and deal with one issue only
|
||||||
+3552
File diff suppressed because it is too large.
Load diff
@@ -1,16 +0,0 @@
|
|||||||
---
|
|
||||||
items:
|
|
||||||
- { name: mbuf.h }
|
|
||||||
- { name: mg_net.h }
|
|
||||||
- { name: mg_http.h }
|
|
||||||
- { name: mg_http_server.h }
|
|
||||||
- { name: mg_http_client.h }
|
|
||||||
- { name: mg_dns.h }
|
|
||||||
- { name: mg_dns_server.h }
|
|
||||||
- { name: mg_resolv.h }
|
|
||||||
- { name: mg_mqtt.h }
|
|
||||||
- { name: mg_mqtt_server.h }
|
|
||||||
- { name: mg_coap.h }
|
|
||||||
- { name: mg_util.h }
|
|
||||||
- { name: mg_uri.h }
|
|
||||||
---
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mbuf.h"
|
|
||||||
symbol_kind: "intro"
|
|
||||||
decl_name: "mbuf.h"
|
|
||||||
items:
|
|
||||||
- { name: mbuf_append.md }
|
|
||||||
- { name: mbuf_append_and_free.md }
|
|
||||||
- { name: mbuf_clear.md }
|
|
||||||
- { name: mbuf_free.md }
|
|
||||||
- { name: mbuf_init.md }
|
|
||||||
- { name: mbuf_insert.md }
|
|
||||||
- { name: mbuf_move.md }
|
|
||||||
- { name: mbuf_remove.md }
|
|
||||||
- { name: mbuf_resize.md }
|
|
||||||
- { name: mbuf_trim.md }
|
|
||||||
- { name: struct_mbuf.md }
|
|
||||||
---
|
|
||||||
|
|
||||||
Mbufs are mutable/growing memory buffers, like C++ strings.
|
|
||||||
Mbuf can append data to the end of a buffer or insert data into arbitrary
|
|
||||||
position in the middle of a buffer. The buffer grows automatically when
|
|
||||||
needed.
|
|
||||||
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mbuf_append()"
|
|
||||||
decl_name: "mbuf_append"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
size_t mbuf_append(struct mbuf *, const void *data, size_t data_size);
|
|
||||||
---
|
|
||||||
|
|
||||||
Appends data to the Mbuf.
|
|
||||||
|
|
||||||
Returns the number of bytes appended or 0 if out of memory.
|
|
||||||
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
---
|
|
||||||
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.
|
|
||||||
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mbuf_clear()"
|
|
||||||
decl_name: "mbuf_clear"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
void mbuf_clear(struct mbuf *);
|
|
||||||
---
|
|
||||||
|
|
||||||
Removes all the data from mbuf (if any).
|
|
||||||
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mbuf_free()"
|
|
||||||
decl_name: "mbuf_free"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
void mbuf_free(struct mbuf *);
|
|
||||||
---
|
|
||||||
|
|
||||||
Frees the space allocated for the mbuffer and resets the mbuf structure.
|
|
||||||
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mbuf_init()"
|
|
||||||
decl_name: "mbuf_init"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
void mbuf_init(struct mbuf *, size_t initial_capacity);
|
|
||||||
---
|
|
||||||
|
|
||||||
Initialises an Mbuf.
|
|
||||||
`initial_capacity` specifies the initial capacity of the mbuf.
|
|
||||||
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mbuf_insert()"
|
|
||||||
decl_name: "mbuf_insert"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
size_t mbuf_insert(struct mbuf *, size_t, const void *, size_t);
|
|
||||||
---
|
|
||||||
|
|
||||||
Inserts data at a specified offset in the Mbuf.
|
|
||||||
|
|
||||||
Existing data will be shifted forwards and the buffer will
|
|
||||||
be grown if necessary.
|
|
||||||
Returns the number of bytes inserted.
|
|
||||||
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
---
|
|
||||||
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,10 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mbuf_remove()"
|
|
||||||
decl_name: "mbuf_remove"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
void mbuf_remove(struct mbuf *, size_t data_size);
|
|
||||||
---
|
|
||||||
|
|
||||||
Removes `data_size` bytes from the beginning of the buffer.
|
|
||||||
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mbuf_resize()"
|
|
||||||
decl_name: "mbuf_resize"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
void mbuf_resize(struct mbuf *, size_t new_size);
|
|
||||||
---
|
|
||||||
|
|
||||||
Resizes an Mbuf.
|
|
||||||
|
|
||||||
If `new_size` is smaller than buffer's `len`, the
|
|
||||||
resize is not performed.
|
|
||||||
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mbuf_trim()"
|
|
||||||
decl_name: "mbuf_trim"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
void mbuf_trim(struct mbuf *);
|
|
||||||
---
|
|
||||||
|
|
||||||
Shrinks an Mbuf by resizing its `size` to `len`.
|
|
||||||
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
---
|
|
||||||
title: "struct mbuf"
|
|
||||||
decl_name: "struct mbuf"
|
|
||||||
symbol_kind: "struct"
|
|
||||||
signature: |
|
|
||||||
struct mbuf {
|
|
||||||
char *buf; /* Buffer pointer */
|
|
||||||
size_t len; /* Data length. Data is located between offset 0 and len. */
|
|
||||||
size_t size; /* Buffer size allocated by realloc(1). Must be >= len */
|
|
||||||
};
|
|
||||||
---
|
|
||||||
|
|
||||||
Memory buffer descriptor
|
|
||||||
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
---
|
|
||||||
title: "CoAP API reference"
|
|
||||||
symbol_kind: "intro"
|
|
||||||
decl_name: "mg_coap.h"
|
|
||||||
items:
|
|
||||||
- { name: mg_coap_add_option.md }
|
|
||||||
- { name: mg_coap_compose.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_option.md }
|
|
||||||
---
|
|
||||||
|
|
||||||
CoAP message format:
|
|
||||||
|
|
||||||
```
|
|
||||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
|
|
||||||
|Ver| T | TKL | Code | Message ID | Token (if any, TKL bytes) ...
|
|
||||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
|
|
||||||
| Options (if any) ... |1 1 1 1 1 1 1 1| Payload (if any) ...
|
|
||||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
|
|
||||||
```
|
|
||||||
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_coap_add_option()"
|
|
||||||
decl_name: "mg_coap_add_option"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
struct mg_coap_option *mg_coap_add_option(struct mg_coap_message *cm,
|
|
||||||
uint32_t number, char *value,
|
|
||||||
size_t len);
|
|
||||||
---
|
|
||||||
|
|
||||||
Adds a new option to mg_coap_message structure.
|
|
||||||
Returns pointer to the newly created option.
|
|
||||||
Note: options must be freed by using mg_coap_free_options
|
|
||||||
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_coap_compose()"
|
|
||||||
decl_name: "mg_coap_compose"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
uint32_t mg_coap_compose(struct mg_coap_message *cm, struct mbuf *io);
|
|
||||||
---
|
|
||||||
|
|
||||||
Composes CoAP message from mg_coap_message structure.
|
|
||||||
This is a helper function.
|
|
||||||
Return value: see `mg_coap_send_message()`
|
|
||||||
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_coap_free_options()"
|
|
||||||
decl_name: "mg_coap_free_options"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
void mg_coap_free_options(struct mg_coap_message *cm);
|
|
||||||
---
|
|
||||||
|
|
||||||
Frees the memory allocated for options.
|
|
||||||
If the cm parameter doesn't contain any option it does nothing.
|
|
||||||
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_coap_parse()"
|
|
||||||
decl_name: "mg_coap_parse"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
uint32_t mg_coap_parse(struct mbuf *io, struct mg_coap_message *cm);
|
|
||||||
---
|
|
||||||
|
|
||||||
Parses CoAP message and fills mg_coap_message and returns cm->flags.
|
|
||||||
This is a helper function.
|
|
||||||
|
|
||||||
NOTE: usually CoAP works over UDP, so lack of data means format error.
|
|
||||||
But, in theory, it is possible to use CoAP over TCP (according to RFC)
|
|
||||||
|
|
||||||
The caller has to check results and treat COAP_NOT_ENOUGH_DATA according to
|
|
||||||
underlying protocol:
|
|
||||||
|
|
||||||
- in case of UDP COAP_NOT_ENOUGH_DATA means COAP_FORMAT_ERROR,
|
|
||||||
- in case of TCP client can try to receive more data
|
|
||||||
|
|
||||||
Return value: see `mg_coap_send_message()`
|
|
||||||
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_coap_send_ack()"
|
|
||||||
decl_name: "mg_coap_send_ack"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
uint32_t mg_coap_send_ack(struct mg_connection *nc, uint16_t msg_id);
|
|
||||||
---
|
|
||||||
|
|
||||||
Composes CoAP acknowledgement from `mg_coap_message`
|
|
||||||
and sends it into `nc` connection.
|
|
||||||
Return value: see `mg_coap_send_message()`
|
|
||||||
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_coap_send_message()"
|
|
||||||
decl_name: "mg_coap_send_message"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
uint32_t mg_coap_send_message(struct mg_connection *nc,
|
|
||||||
struct mg_coap_message *cm);
|
|
||||||
---
|
|
||||||
|
|
||||||
Composes a CoAP message from `mg_coap_message`
|
|
||||||
and sends it into `nc` connection.
|
|
||||||
Returns 0 on success. On error, it is a bitmask:
|
|
||||||
|
|
||||||
- `#define MG_COAP_ERROR 0x10000`
|
|
||||||
- `#define MG_COAP_FORMAT_ERROR (MG_COAP_ERROR | 0x20000)`
|
|
||||||
- `#define MG_COAP_IGNORE (MG_COAP_ERROR | 0x40000)`
|
|
||||||
- `#define MG_COAP_NOT_ENOUGH_DATA (MG_COAP_ERROR | 0x80000)`
|
|
||||||
- `#define MG_COAP_NETWORK_ERROR (MG_COAP_ERROR | 0x100000)`
|
|
||||||
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_set_protocol_coap()"
|
|
||||||
decl_name: "mg_set_protocol_coap"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
int mg_set_protocol_coap(struct mg_connection *nc);
|
|
||||||
---
|
|
||||||
|
|
||||||
Sets CoAP protocol handler - triggers CoAP specific events.
|
|
||||||
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
---
|
|
||||||
title: "struct mg_coap_message"
|
|
||||||
decl_name: "struct mg_coap_message"
|
|
||||||
symbol_kind: "struct"
|
|
||||||
signature: |
|
|
||||||
struct mg_coap_message {
|
|
||||||
uint32_t flags;
|
|
||||||
uint8_t msg_type;
|
|
||||||
uint8_t code_class;
|
|
||||||
uint8_t code_detail;
|
|
||||||
uint16_t msg_id;
|
|
||||||
struct mg_str token;
|
|
||||||
struct mg_coap_option *options;
|
|
||||||
struct mg_str payload;
|
|
||||||
struct mg_coap_option *optiomg_tail;
|
|
||||||
};
|
|
||||||
---
|
|
||||||
|
|
||||||
CoAP message. See RFC 7252 for details.
|
|
||||||
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
---
|
|
||||||
title: "struct mg_coap_option"
|
|
||||||
decl_name: "struct mg_coap_option"
|
|
||||||
symbol_kind: "struct"
|
|
||||||
signature: |
|
|
||||||
struct mg_coap_option {
|
|
||||||
struct mg_coap_option *next;
|
|
||||||
uint32_t number;
|
|
||||||
struct mg_str value;
|
|
||||||
};
|
|
||||||
---
|
|
||||||
|
|
||||||
CoAP options.
|
|
||||||
Use mg_coap_add_option and mg_coap_free_options
|
|
||||||
for creation and destruction.
|
|
||||||
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
---
|
|
||||||
title: "DNS API reference"
|
|
||||||
symbol_kind: "intro"
|
|
||||||
decl_name: "mg_dns.h"
|
|
||||||
items:
|
|
||||||
- { name: mg_dns_copy_questions.md }
|
|
||||||
- { name: mg_dns_encode_name.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_parse_dns.md }
|
|
||||||
- { name: mg_send_dns_query.md }
|
|
||||||
- { name: mg_set_protocol_dns.md }
|
|
||||||
- { name: struct_mg_dns_message.md }
|
|
||||||
- { name: struct_mg_dns_resource_record.md }
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_dns_copy_questions()"
|
|
||||||
decl_name: "mg_dns_copy_questions"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
int mg_dns_copy_questions(struct mbuf *io, struct mg_dns_message *msg);
|
|
||||||
---
|
|
||||||
|
|
||||||
Appends already encoded questions from an existing message.
|
|
||||||
|
|
||||||
This is useful when generating a DNS reply message which includes
|
|
||||||
all question records.
|
|
||||||
|
|
||||||
Returns the number of appended bytes.
|
|
||||||
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_dns_encode_name()"
|
|
||||||
decl_name: "mg_dns_encode_name"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
int mg_dns_encode_name(struct mbuf *io, const char *name, size_t len);
|
|
||||||
---
|
|
||||||
|
|
||||||
Encodes a DNS name.
|
|
||||||
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_dns_encode_record()"
|
|
||||||
decl_name: "mg_dns_encode_record"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
int mg_dns_encode_record(struct mbuf *io, struct mg_dns_resource_record *rr,
|
|
||||||
const char *name, size_t nlen, const void *rdata,
|
|
||||||
size_t rlen);
|
|
||||||
---
|
|
||||||
|
|
||||||
Encodes and appends a DNS resource record to an IO buffer.
|
|
||||||
|
|
||||||
The record metadata is taken from the `rr` parameter, while the name and data
|
|
||||||
are taken from the parameters, encoded in the appropriate format depending on
|
|
||||||
record type and stored in the IO buffer. The encoded values might contain
|
|
||||||
offsets within the IO buffer. It's thus important that the IO buffer doesn't
|
|
||||||
get trimmed while a sequence of records are encoded while preparing a DNS
|
|
||||||
reply.
|
|
||||||
|
|
||||||
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
|
|
||||||
again.
|
|
||||||
|
|
||||||
Returns the number of bytes appended or -1 in case of error.
|
|
||||||
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_dns_insert_header()"
|
|
||||||
decl_name: "mg_dns_insert_header"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
int mg_dns_insert_header(struct mbuf *io, size_t pos,
|
|
||||||
struct mg_dns_message *msg);
|
|
||||||
---
|
|
||||||
|
|
||||||
Inserts a DNS header to an IO buffer.
|
|
||||||
|
|
||||||
Returns the number of bytes inserted.
|
|
||||||
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_dns_parse_record_data()"
|
|
||||||
decl_name: "mg_dns_parse_record_data"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
int mg_dns_parse_record_data(struct mg_dns_message *msg,
|
|
||||||
struct mg_dns_resource_record *rr, void *data,
|
|
||||||
size_t data_len);
|
|
||||||
---
|
|
||||||
|
|
||||||
Parses the record data from a DNS resource record.
|
|
||||||
|
|
||||||
- A: struct in_addr *ina
|
|
||||||
- AAAA: struct in6_addr *ina
|
|
||||||
- CNAME: char buffer
|
|
||||||
|
|
||||||
Returns -1 on error.
|
|
||||||
|
|
||||||
TODO(mkm): MX
|
|
||||||
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_dns_uncompress_name()"
|
|
||||||
decl_name: "mg_dns_uncompress_name"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
size_t mg_dns_uncompress_name(struct mg_dns_message *msg, struct mg_str *name,
|
|
||||||
char *dst, int dst_len);
|
|
||||||
---
|
|
||||||
|
|
||||||
Uncompresses a DNS compressed name.
|
|
||||||
|
|
||||||
The containing DNS message is required because of the compressed encoding
|
|
||||||
and reference suffixes present elsewhere in the packet.
|
|
||||||
|
|
||||||
If the name is less than `dst_len` characters long, the remainder
|
|
||||||
of `dst` is terminated with `\0` characters. Otherwise, `dst` is not
|
|
||||||
terminated.
|
|
||||||
|
|
||||||
If `dst_len` is 0 `dst` can be NULL.
|
|
||||||
Returns the uncompressed name length.
|
|
||||||
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_parse_dns()"
|
|
||||||
decl_name: "mg_parse_dns"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
int mg_parse_dns(const char *buf, int len, struct mg_dns_message *msg);
|
|
||||||
---
|
|
||||||
|
|
||||||
Low-level: parses a DNS response.
|
|
||||||
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_send_dns_query()"
|
|
||||||
decl_name: "mg_send_dns_query"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
void mg_send_dns_query(struct mg_connection *nc, const char *name,
|
|
||||||
int query_type);
|
|
||||||
---
|
|
||||||
|
|
||||||
Sends a DNS query to the remote end.
|
|
||||||
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_set_protocol_dns()"
|
|
||||||
decl_name: "mg_set_protocol_dns"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
void mg_set_protocol_dns(struct mg_connection *nc);
|
|
||||||
---
|
|
||||||
|
|
||||||
Attaches a built-in DNS event handler to the given listening connection.
|
|
||||||
|
|
||||||
The DNS event handler parses the incoming UDP packets, treating them as DNS
|
|
||||||
requests. If an incoming packet gets successfully parsed by the DNS event
|
|
||||||
handler, a user event handler will receive an `MG_DNS_REQUEST` event, with
|
|
||||||
`ev_data` pointing to the parsed `struct mg_dns_message`.
|
|
||||||
|
|
||||||
See
|
|
||||||
[captive_dns_server](https://github.com/cesanta/mongoose/tree/master/examples/captive_dns_server)
|
|
||||||
example on how to handle DNS request and send DNS reply.
|
|
||||||
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
---
|
|
||||||
title: "struct mg_dns_message"
|
|
||||||
decl_name: "struct mg_dns_message"
|
|
||||||
symbol_kind: "struct"
|
|
||||||
signature: |
|
|
||||||
struct mg_dns_message {
|
|
||||||
struct mg_str pkt; /* packet body */
|
|
||||||
uint16_t flags;
|
|
||||||
uint16_t transaction_id;
|
|
||||||
int num_questions;
|
|
||||||
int num_answers;
|
|
||||||
struct mg_dns_resource_record questions[MG_MAX_DNS_QUESTIONS];
|
|
||||||
struct mg_dns_resource_record answers[MG_MAX_DNS_ANSWERS];
|
|
||||||
};
|
|
||||||
---
|
|
||||||
|
|
||||||
DNS message (request and response).
|
|
||||||
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
---
|
|
||||||
title: "struct mg_dns_resource_record"
|
|
||||||
decl_name: "struct mg_dns_resource_record"
|
|
||||||
symbol_kind: "struct"
|
|
||||||
signature: |
|
|
||||||
struct mg_dns_resource_record {
|
|
||||||
struct mg_str name; /* buffer with compressed name */
|
|
||||||
int rtype;
|
|
||||||
int rclass;
|
|
||||||
int ttl;
|
|
||||||
enum mg_dns_resource_record_kind kind;
|
|
||||||
struct mg_str rdata; /* protocol data (can be a compressed name) */
|
|
||||||
};
|
|
||||||
---
|
|
||||||
|
|
||||||
DNS resource record.
|
|
||||||
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
---
|
|
||||||
title: "DNS server API reference"
|
|
||||||
symbol_kind: "intro"
|
|
||||||
decl_name: "mg_dns_server.h"
|
|
||||||
items:
|
|
||||||
- { name: mg_dns_create_reply.md }
|
|
||||||
- { name: mg_dns_reply_record.md }
|
|
||||||
- { name: mg_dns_send_reply.md }
|
|
||||||
---
|
|
||||||
|
|
||||||
Disabled by default; enable with `-DMG_ENABLE_DNS_SERVER`.
|
|
||||||
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_dns_create_reply()"
|
|
||||||
decl_name: "mg_dns_create_reply"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
struct mg_dns_reply mg_dns_create_reply(struct mbuf *io,
|
|
||||||
struct mg_dns_message *msg);
|
|
||||||
---
|
|
||||||
|
|
||||||
Creates a DNS reply.
|
|
||||||
|
|
||||||
The reply will be based on an existing query message `msg`.
|
|
||||||
The query body will be appended to the output buffer.
|
|
||||||
"reply + recursion allowed" will be added to the message flags and the
|
|
||||||
message's num_answers will be set to 0.
|
|
||||||
|
|
||||||
Answer records can be appended with `mg_dns_send_reply` or by lower
|
|
||||||
level function defined in the DNS API.
|
|
||||||
|
|
||||||
In order to send a reply use `mg_dns_send_reply`.
|
|
||||||
It's possible to use a connection's send buffer as reply buffer,
|
|
||||||
and it will work for both UDP and TCP connections.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
```c
|
|
||||||
reply = mg_dns_create_reply(&nc->send_mbuf, msg);
|
|
||||||
for (i = 0; i < msg->num_questions; i++) {
|
|
||||||
rr = &msg->questions[i];
|
|
||||||
if (rr->rtype == MG_DNS_A_RECORD) {
|
|
||||||
mg_dns_reply_record(&reply, rr, 3600, &dummy_ip_addr, 4);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mg_dns_send_reply(nc, &reply);
|
|
||||||
```
|
|
||||||
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_dns_reply_record()"
|
|
||||||
decl_name: "mg_dns_reply_record"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
int mg_dns_reply_record(struct mg_dns_reply *reply,
|
|
||||||
struct mg_dns_resource_record *question,
|
|
||||||
const char *name, int rtype, int ttl, const void *rdata,
|
|
||||||
size_t rdata_len);
|
|
||||||
---
|
|
||||||
|
|
||||||
Appends a DNS reply record to the IO buffer and to the DNS message.
|
|
||||||
|
|
||||||
The message's num_answers field will be incremented. It's the caller's duty
|
|
||||||
to ensure num_answers is properly initialised.
|
|
||||||
|
|
||||||
Returns -1 on error.
|
|
||||||
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_dns_send_reply()"
|
|
||||||
decl_name: "mg_dns_send_reply"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
void mg_dns_send_reply(struct mg_connection *nc, struct mg_dns_reply *r);
|
|
||||||
---
|
|
||||||
|
|
||||||
Sends a DNS reply through a connection.
|
|
||||||
|
|
||||||
The DNS data is stored in an IO buffer pointed by reply structure in `r`.
|
|
||||||
This function mutates the content of that buffer in order to ensure that
|
|
||||||
the DNS header reflects the size and flags of the message, that might have
|
|
||||||
been updated either with `mg_dns_reply_record` or by direct manipulation of
|
|
||||||
`r->message`.
|
|
||||||
|
|
||||||
Once sent, the IO buffer will be trimmed unless the reply IO buffer
|
|
||||||
is the connection's send buffer and the connection is not in UDP mode.
|
|
||||||
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
---
|
|
||||||
title: "Common API reference"
|
|
||||||
symbol_kind: "intro"
|
|
||||||
decl_name: "mg_http.h"
|
|
||||||
items:
|
|
||||||
- { name: mg_connect_ws.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_framev.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: struct_http_message.md }
|
|
||||||
- { name: struct_mg_http_multipart_part.md }
|
|
||||||
- { name: struct_mg_ssi_call_ctx.md }
|
|
||||||
- { name: struct_websocket_message.md }
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_connect_ws()"
|
|
||||||
decl_name: "mg_connect_ws"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
struct mg_connection *mg_connect_ws(struct mg_mgr *mgr,
|
|
||||||
MG_CB(mg_event_handler_t event_handler,
|
|
||||||
void *user_data);
|
|
||||||
---
|
|
||||||
|
|
||||||
Helper function that creates an outbound WebSocket connection.
|
|
||||||
|
|
||||||
`url` is a URL to connect to. It must be properly URL-encoded, e.g. have
|
|
||||||
no spaces, etc. By default, `mg_connect_ws()` sends Connection and
|
|
||||||
Host headers. `extra_headers` is an extra HTTP header to send, e.g.
|
|
||||||
`"User-Agent: my-app\r\n"`.
|
|
||||||
If `protocol` is not NULL, then a `Sec-WebSocket-Protocol` header is sent.
|
|
||||||
|
|
||||||
Examples:
|
|
||||||
|
|
||||||
```c
|
|
||||||
nc1 = mg_connect_ws(mgr, ev_handler_1, "ws://echo.websocket.org", NULL,
|
|
||||||
NULL);
|
|
||||||
nc2 = mg_connect_ws(mgr, ev_handler_1, "wss://echo.websocket.org", NULL,
|
|
||||||
NULL);
|
|
||||||
nc3 = mg_connect_ws(mgr, ev_handler_1, "ws://api.cesanta.com",
|
|
||||||
"clubby.cesanta.com", NULL);
|
|
||||||
```
|
|
||||||
|
|
||||||
@@ -1,14 +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_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)
|
|
||||||
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
---
|
|
||||||
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.
|
|
||||||
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
---
|
|
||||||
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.
|
|
||||||
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_printf_websocket_frame()"
|
|
||||||
decl_name: "mg_printf_websocket_frame"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
void mg_printf_websocket_frame(struct mg_connection *nc, int op_and_flags,
|
|
||||||
const char *fmt, ...);
|
|
||||||
---
|
|
||||||
|
|
||||||
Sends WebSocket frame to the remote end.
|
|
||||||
|
|
||||||
Like `mg_send_websocket_frame()`, but allows to create formatted messages
|
|
||||||
with `printf()`-like semantics.
|
|
||||||
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_send_websocket_frame()"
|
|
||||||
decl_name: "mg_send_websocket_frame"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
void mg_send_websocket_frame(struct mg_connection *nc, int op_and_flags,
|
|
||||||
const void *data, size_t data_len);
|
|
||||||
---
|
|
||||||
|
|
||||||
Send WebSocket frame to the remote end.
|
|
||||||
|
|
||||||
`op_and_flags` specifies the frame's type. It's one of:
|
|
||||||
|
|
||||||
- WEBSOCKET_OP_CONTINUE
|
|
||||||
- WEBSOCKET_OP_TEXT
|
|
||||||
- WEBSOCKET_OP_BINARY
|
|
||||||
- WEBSOCKET_OP_CLOSE
|
|
||||||
- WEBSOCKET_OP_PING
|
|
||||||
- WEBSOCKET_OP_PONG
|
|
||||||
|
|
||||||
Orred with one of the flags:
|
|
||||||
|
|
||||||
- WEBSOCKET_DONT_FIN: Don't set the FIN flag on the frame to be sent.
|
|
||||||
|
|
||||||
`data` and `data_len` contain frame data.
|
|
||||||
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_send_websocket_framev()"
|
|
||||||
decl_name: "mg_send_websocket_framev"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
void mg_send_websocket_framev(struct mg_connection *nc, int op_and_flags,
|
|
||||||
const struct mg_str *strings, int num_strings);
|
|
||||||
---
|
|
||||||
|
|
||||||
Like `mg_send_websocket_frame()`, but composes a single frame from multiple
|
|
||||||
buffers.
|
|
||||||
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_send_websocket_handshake()"
|
|
||||||
decl_name: "mg_send_websocket_handshake"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
void mg_send_websocket_handshake(struct mg_connection *nc, const char *uri,
|
|
||||||
const char *extra_headers);
|
|
||||||
---
|
|
||||||
|
|
||||||
Send websocket handshake to the server.
|
|
||||||
|
|
||||||
`nc` must be a valid connection, connected to a server. `uri` is an URI
|
|
||||||
to fetch, extra_headers` is extra HTTP headers to send or `NULL`.
|
|
||||||
|
|
||||||
This function is intended to be used by websocket client.
|
|
||||||
|
|
||||||
Note that the Host header is mandatory in HTTP/1.1 and must be
|
|
||||||
included in `extra_headers`. `mg_send_websocket_handshake2` offers
|
|
||||||
a better API for that.
|
|
||||||
|
|
||||||
Deprecated in favour of `mg_send_websocket_handshake2`
|
|
||||||
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_send_websocket_handshake2()"
|
|
||||||
decl_name: "mg_send_websocket_handshake2"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
void mg_send_websocket_handshake2(struct mg_connection *nc, const char *path,
|
|
||||||
const char *host, const char *protocol,
|
|
||||||
const char *extra_headers);
|
|
||||||
---
|
|
||||||
|
|
||||||
Send websocket handshake to the server.
|
|
||||||
|
|
||||||
`nc` must be a valid connection, connected to a server. `uri` is an URI
|
|
||||||
to fetch, `host` goes into the `Host` header, `protocol` goes into the
|
|
||||||
`Sec-WebSocket-Proto` header (NULL to omit), extra_headers` is extra HTTP
|
|
||||||
headers to send or `NULL`.
|
|
||||||
|
|
||||||
This function is intended to be used by websocket client.
|
|
||||||
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
---
|
|
||||||
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
|
|
||||||
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
---
|
|
||||||
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
|
|
||||||
|
|
||||||
@@ -1,61 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_set_protocol_http_websocket()"
|
|
||||||
decl_name: "mg_set_protocol_http_websocket"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
void mg_set_protocol_http_websocket(struct mg_connection *nc);
|
|
||||||
---
|
|
||||||
|
|
||||||
Attaches a built-in HTTP event handler to the given connection.
|
|
||||||
The user-defined event handler will receive following extra events:
|
|
||||||
|
|
||||||
- MG_EV_HTTP_REQUEST: HTTP request has arrived. Parsed HTTP request
|
|
||||||
is passed as
|
|
||||||
`struct http_message` through the handler's `void *ev_data` pointer.
|
|
||||||
- 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`
|
|
||||||
pointer.
|
|
||||||
- MG_EV_HTTP_CHUNK: The HTTP chunked-encoding chunk has arrived.
|
|
||||||
The parsed HTTP reply is passed as `struct http_message` through the
|
|
||||||
handler's `void *ev_data` pointer. `http_message::body` would contain
|
|
||||||
incomplete, reassembled HTTP body.
|
|
||||||
It will grow with every new chunk that arrives, and it can
|
|
||||||
potentially consume a lot of memory. An event handler may process
|
|
||||||
the body as chunks are coming, and signal Mongoose to delete processed
|
|
||||||
body by setting `MG_F_DELETE_CHUNK` in `mg_connection::flags`. When
|
|
||||||
the last zero chunk is received,
|
|
||||||
Mongoose sends `MG_EV_HTTP_REPLY` event with
|
|
||||||
full reassembled body (if handler did not signal to delete chunks) or
|
|
||||||
with empty body (if handler did signal to delete chunks).
|
|
||||||
- MG_EV_WEBSOCKET_HANDSHAKE_REQUEST: server has received the WebSocket
|
|
||||||
handshake request. `ev_data` contains parsed HTTP request.
|
|
||||||
- MG_EV_WEBSOCKET_HANDSHAKE_DONE: server has completed the WebSocket
|
|
||||||
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
|
|
||||||
`struct websocket_message *`
|
|
||||||
|
|
||||||
When compiled with MG_ENABLE_HTTP_STREAMING_MULTIPART, Mongoose parses
|
|
||||||
multipart requests and splits them into separate events:
|
|
||||||
- MG_EV_HTTP_MULTIPART_REQUEST: Start of the request.
|
|
||||||
This event is sent before body is parsed. After this, the user
|
|
||||||
should expect a sequence of PART_BEGIN/DATA/END requests.
|
|
||||||
This is also the last time when headers and other request fields are
|
|
||||||
accessible.
|
|
||||||
- MG_EV_HTTP_PART_BEGIN: Start of a part of a multipart message.
|
|
||||||
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).
|
|
||||||
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_url_decode()"
|
|
||||||
decl_name: "mg_url_decode"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
int mg_url_decode(const char *src, int src_len, char *dst, int dst_len,
|
|
||||||
int is_form_url_encoded);
|
|
||||||
---
|
|
||||||
|
|
||||||
Decodes a URL-encoded string.
|
|
||||||
|
|
||||||
Source string is specified by (`src`, `src_len`), and destination is
|
|
||||||
(`dst`, `dst_len`). If `is_form_url_encoded` is non-zero, then
|
|
||||||
`+` character is decoded as a blank space character. This function
|
|
||||||
guarantees to NUL-terminate the destination. If destination is too small,
|
|
||||||
then the source string is partially decoded and `-1` is returned.
|
|
||||||
*Otherwise,
|
|
||||||
a length of the decoded string is returned, not counting final NUL.
|
|
||||||
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
---
|
|
||||||
title: "struct http_message"
|
|
||||||
decl_name: "struct http_message"
|
|
||||||
symbol_kind: "struct"
|
|
||||||
signature: |
|
|
||||||
struct http_message {
|
|
||||||
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) */
|
|
||||||
struct mg_str method; /* "GET" */
|
|
||||||
struct mg_str uri; /* "/my_file.html" */
|
|
||||||
struct mg_str proto; /* "HTTP/1.1" -- for both request and response */
|
|
||||||
|
|
||||||
/* For responses, code and response status message are set */
|
|
||||||
int resp_code;
|
|
||||||
struct mg_str resp_status_msg;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Query-string part of the URI. For example, for HTTP request
|
|
||||||
* GET /foo/bar?param1=val1¶m2=val2
|
|
||||||
* | uri | query_string |
|
|
||||||
*
|
|
||||||
* Note that question mark character doesn't belong neither to the uri,
|
|
||||||
* nor to the query_string
|
|
||||||
*/
|
|
||||||
struct mg_str query_string;
|
|
||||||
|
|
||||||
/* Headers */
|
|
||||||
struct mg_str header_names[MG_MAX_HTTP_HEADERS];
|
|
||||||
struct mg_str header_values[MG_MAX_HTTP_HEADERS];
|
|
||||||
};
|
|
||||||
---
|
|
||||||
|
|
||||||
HTTP message
|
|
||||||
|
|
||||||
@@ -1,24 +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;
|
|
||||||
/*
|
|
||||||
* 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
|
|
||||||
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
---
|
|
||||||
title: "struct mg_ssi_call_ctx"
|
|
||||||
decl_name: "struct mg_ssi_call_ctx"
|
|
||||||
symbol_kind: "struct"
|
|
||||||
signature: |
|
|
||||||
struct mg_ssi_call_ctx {
|
|
||||||
struct http_message *req; /* The request being processed. */
|
|
||||||
struct mg_str file; /* Filesystem path of the file being processed. */
|
|
||||||
struct mg_str arg; /* The argument passed to the tag: <!-- call arg -->. */
|
|
||||||
};
|
|
||||||
---
|
|
||||||
|
|
||||||
SSI call context
|
|
||||||
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
---
|
|
||||||
title: "struct websocket_message"
|
|
||||||
decl_name: "struct websocket_message"
|
|
||||||
symbol_kind: "struct"
|
|
||||||
signature: |
|
|
||||||
struct websocket_message {
|
|
||||||
unsigned char *data;
|
|
||||||
size_t size;
|
|
||||||
unsigned char flags;
|
|
||||||
};
|
|
||||||
---
|
|
||||||
|
|
||||||
WebSocket message
|
|
||||||
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
---
|
|
||||||
title: "Client API reference"
|
|
||||||
symbol_kind: "intro"
|
|
||||||
decl_name: "mg_http_client.h"
|
|
||||||
items:
|
|
||||||
- { name: mg_connect_http.md }
|
|
||||||
- { name: mg_connect_http_opt.md }
|
|
||||||
- { name: mg_http_create_digest_auth_header.md }
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_connect_http()"
|
|
||||||
decl_name: "mg_connect_http"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
struct mg_connection *mg_connect_http(
|
|
||||||
struct mg_mgr *mgr,
|
|
||||||
MG_CB(mg_event_handler_t event_handler, void *user_data);
|
|
||||||
---
|
|
||||||
|
|
||||||
Helper function that creates an outbound HTTP connection.
|
|
||||||
|
|
||||||
`url` is the URL to fetch. It must be properly URL-encoded, e.g. have
|
|
||||||
no spaces, etc. By default, `mg_connect_http()` sends the Connection and
|
|
||||||
Host headers. `extra_headers` is an extra HTTP header to send, e.g.
|
|
||||||
`"User-Agent: my-app\r\n"`.
|
|
||||||
If `post_data` is NULL, then a GET request is created. Otherwise, a POST
|
|
||||||
request is created with the specified POST data. Note that if the data being
|
|
||||||
posted is a form submission, the `Content-Type` header should be set
|
|
||||||
accordingly (see example below).
|
|
||||||
|
|
||||||
Examples:
|
|
||||||
|
|
||||||
```c
|
|
||||||
nc1 = mg_connect_http(mgr, ev_handler_1, "http://www.google.com", NULL,
|
|
||||||
NULL);
|
|
||||||
nc2 = mg_connect_http(mgr, ev_handler_1, "https://github.com", NULL, NULL);
|
|
||||||
nc3 = mg_connect_http(
|
|
||||||
mgr, ev_handler_1, "my_server:8000/form_submit/",
|
|
||||||
"Content-Type: application/x-www-form-urlencoded\r\n",
|
|
||||||
"var_1=value_1&var_2=value_2");
|
|
||||||
```
|
|
||||||
|
|
||||||
@@ -1,15 +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_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,13 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_http_create_digest_auth_header()"
|
|
||||||
decl_name: "mg_http_create_digest_auth_header"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
int mg_http_create_digest_auth_header(char *buf, size_t buf_len,
|
|
||||||
const char *method, const char *uri,
|
|
||||||
const char *auth_domain, const char *user,
|
|
||||||
const char *passwd, const char *nonce);
|
|
||||||
---
|
|
||||||
|
|
||||||
Creates digest authentication header for a client request.
|
|
||||||
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
---
|
|
||||||
title: "Server API reference"
|
|
||||||
symbol_kind: "intro"
|
|
||||||
decl_name: "mg_http_server.h"
|
|
||||||
items:
|
|
||||||
- { name: mg_check_digest_auth.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_parse_header.md }
|
|
||||||
- { name: mg_http_parse_header2.md }
|
|
||||||
- { name: mg_http_reverse_proxy.md }
|
|
||||||
- { name: mg_http_send_error.md }
|
|
||||||
- { name: mg_http_send_redirect.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_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: struct_mg_serve_http_opts.md }
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
---
|
|
||||||
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().
|
|
||||||
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_file_upload_handler()"
|
|
||||||
decl_name: "mg_file_upload_handler"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
void mg_file_upload_handler(struct mg_connection *nc, int ev, void *ev_data,
|
|
||||||
mg_fu_fname_fn local_name_fn
|
|
||||||
MG_UD_ARG(void *user_data);
|
|
||||||
---
|
|
||||||
|
|
||||||
File upload handler.
|
|
||||||
This handler can be used to implement file uploads with minimum code.
|
|
||||||
This handler will process MG_EV_HTTP_PART_* events and store file data into
|
|
||||||
a local file.
|
|
||||||
`local_name_fn` will be invoked with whatever name was provided by the client
|
|
||||||
and will expect the name of the local file to open. A return value of NULL
|
|
||||||
will abort file upload (client will get a "403 Forbidden" response). If
|
|
||||||
non-null, the returned string must be heap-allocated and will be freed by
|
|
||||||
the caller.
|
|
||||||
Exception: it is ok to return the same string verbatim.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
```c
|
|
||||||
struct mg_str upload_fname(struct mg_connection *nc, struct mg_str fname) {
|
|
||||||
// Just return the same filename. Do not actually do this except in test!
|
|
||||||
// fname is user-controlled and needs to be sanitized.
|
|
||||||
return fname;
|
|
||||||
}
|
|
||||||
void ev_handler(struct mg_connection *nc, int ev, void *ev_data) {
|
|
||||||
switch (ev) {
|
|
||||||
...
|
|
||||||
case MG_EV_HTTP_PART_BEGIN:
|
|
||||||
case MG_EV_HTTP_PART_DATA:
|
|
||||||
case MG_EV_HTTP_PART_END:
|
|
||||||
mg_file_upload_handler(nc, ev, ev_data, upload_fname);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_fu_fname_fn"
|
|
||||||
decl_name: "mg_fu_fname_fn"
|
|
||||||
symbol_kind: "typedef"
|
|
||||||
signature: |
|
|
||||||
typedef struct mg_str (*mg_fu_fname_fn)(struct mg_connection *nc,
|
|
||||||
struct mg_str fname);
|
|
||||||
---
|
|
||||||
|
|
||||||
Callback prototype for `mg_file_upload_handler()`.
|
|
||||||
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
---
|
|
||||||
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.
|
|
||||||
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_get_http_header()"
|
|
||||||
decl_name: "mg_get_http_header"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
struct mg_str *mg_get_http_header(struct http_message *hm, const char *name);
|
|
||||||
---
|
|
||||||
|
|
||||||
Searches and returns the header `name` in parsed HTTP message `hm`.
|
|
||||||
If header is not found, NULL is returned. Example:
|
|
||||||
|
|
||||||
struct mg_str *host_hdr = mg_get_http_header(hm, "Host");
|
|
||||||
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_get_http_var()"
|
|
||||||
decl_name: "mg_get_http_var"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
int mg_get_http_var(const struct mg_str *buf, const char *name, char *dst,
|
|
||||||
size_t dst_len);
|
|
||||||
---
|
|
||||||
|
|
||||||
Fetches a HTTP form variable.
|
|
||||||
|
|
||||||
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
|
|
||||||
a fetched variable. If not found, 0 is returned. `buf` must be valid
|
|
||||||
url-encoded buffer. If destination is too small or an error occured,
|
|
||||||
negative number is returned.
|
|
||||||
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_http_check_digest_auth()"
|
|
||||||
decl_name: "mg_http_check_digest_auth"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
int mg_http_check_digest_auth(struct http_message *hm, const char *auth_domain,
|
|
||||||
FILE *fp);
|
|
||||||
---
|
|
||||||
|
|
||||||
Authenticates a HTTP request against an opened password file.
|
|
||||||
Returns 1 if authenticated, 0 otherwise.
|
|
||||||
|
|
||||||
@@ -1,15 +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);
|
|
||||||
---
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
---
|
|
||||||
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.
|
|
||||||
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
---
|
|
||||||
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.
|
|
||||||
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
---
|
|
||||||
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,20 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_http_send_redirect()"
|
|
||||||
decl_name: "mg_http_send_redirect"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
void mg_http_send_redirect(struct mg_connection *nc, int status_code,
|
|
||||||
const struct mg_str location,
|
|
||||||
const struct mg_str extra_headers);
|
|
||||||
---
|
|
||||||
|
|
||||||
Sends a redirect response.
|
|
||||||
`status_code` should be either 301 or 302 and `location` point to the
|
|
||||||
new location.
|
|
||||||
If `extra_headers` is not empty, then `extra_headers` are also sent
|
|
||||||
after the response line. `extra_headers` must NOT end end with new line.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
mg_http_send_redirect(nc, 302, mg_mk_str("/login"), mg_mk_str(NULL));
|
|
||||||
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_http_serve_file()"
|
|
||||||
decl_name: "mg_http_serve_file"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
void mg_http_serve_file(struct mg_connection *nc, struct http_message *hm,
|
|
||||||
const char *path, const struct mg_str mime_type,
|
|
||||||
const struct mg_str extra_headers);
|
|
||||||
---
|
|
||||||
|
|
||||||
Serves a specific file with a given MIME type and optional extra headers.
|
|
||||||
|
|
||||||
Example code snippet:
|
|
||||||
|
|
||||||
```c
|
|
||||||
static void ev_handler(struct mg_connection *nc, int ev, void *ev_data) {
|
|
||||||
switch (ev) {
|
|
||||||
case MG_EV_HTTP_REQUEST: {
|
|
||||||
struct http_message *hm = (struct http_message *) ev_data;
|
|
||||||
mg_http_serve_file(nc, hm, "file.txt",
|
|
||||||
mg_mk_str("text/plain"), mg_mk_str(""));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
...
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_parse_http()"
|
|
||||||
decl_name: "mg_parse_http"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
int mg_parse_http(const char *s, int n, struct http_message *hm, int is_req);
|
|
||||||
---
|
|
||||||
|
|
||||||
Parses a HTTP message.
|
|
||||||
|
|
||||||
`is_req` should be set to 1 if parsing a request, 0 if reply.
|
|
||||||
|
|
||||||
Returns the number of bytes parsed. If HTTP message is
|
|
||||||
incomplete `0` is returned. On parse error, a negative number is returned.
|
|
||||||
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
---
|
|
||||||
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.
|
|
||||||
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_parse_multipart()"
|
|
||||||
decl_name: "mg_parse_multipart"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
size_t mg_parse_multipart(const char *buf, size_t buf_len, char *var_name,
|
|
||||||
size_t var_name_len, char *file_name,
|
|
||||||
size_t file_name_len, const char **chunk,
|
|
||||||
size_t *chunk_len);
|
|
||||||
---
|
|
||||||
|
|
||||||
Parses the buffer `buf`, `buf_len` that contains multipart form data chunks.
|
|
||||||
Stores the chunk name in a `var_name`, `var_name_len` buffer.
|
|
||||||
If a chunk is an uploaded file, then `file_name`, `file_name_len` is
|
|
||||||
filled with an uploaded file name. `chunk`, `chunk_len`
|
|
||||||
points to the chunk data.
|
|
||||||
|
|
||||||
Return: number of bytes to skip to the next chunk or 0 if there are
|
|
||||||
no more chunks.
|
|
||||||
|
|
||||||
Usage example:
|
|
||||||
|
|
||||||
```c
|
|
||||||
static void ev_handler(struct mg_connection *nc, int ev, void *ev_data) {
|
|
||||||
switch(ev) {
|
|
||||||
case MG_EV_HTTP_REQUEST: {
|
|
||||||
struct http_message *hm = (struct http_message *) ev_data;
|
|
||||||
char var_name[100], file_name[100];
|
|
||||||
const char *chunk;
|
|
||||||
size_t chunk_len, n1, n2;
|
|
||||||
|
|
||||||
n1 = n2 = 0;
|
|
||||||
while ((n2 = mg_parse_multipart(hm->body.p + n1,
|
|
||||||
hm->body.len - n1,
|
|
||||||
var_name, sizeof(var_name),
|
|
||||||
file_name, sizeof(file_name),
|
|
||||||
&chunk, &chunk_len)) > 0) {
|
|
||||||
printf("var: %s, file_name: %s, size: %d, chunk: [%.*s]\n",
|
|
||||||
var_name, file_name, (int) chunk_len,
|
|
||||||
(int) chunk_len, chunk);
|
|
||||||
n1 += n2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
```
|
|
||||||
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_printf_html_escape()"
|
|
||||||
decl_name: "mg_printf_html_escape"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
void mg_printf_html_escape(struct mg_connection *nc, const char *fmt, ...);
|
|
||||||
---
|
|
||||||
|
|
||||||
Sends a printf-formatted HTTP chunk, escaping HTML tags.
|
|
||||||
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_printf_http_chunk()"
|
|
||||||
decl_name: "mg_printf_http_chunk"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
void mg_printf_http_chunk(struct mg_connection *nc, const char *fmt, ...);
|
|
||||||
---
|
|
||||||
|
|
||||||
Sends a printf-formatted HTTP chunk.
|
|
||||||
Functionality is similar to `mg_send_http_chunk()`.
|
|
||||||
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_register_http_endpoint()"
|
|
||||||
decl_name: "mg_register_http_endpoint"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
void mg_register_http_endpoint(struct mg_connection *nc, const char *uri_path,
|
|
||||||
MG_CB(mg_event_handler_t handler,
|
|
||||||
void *user_data);
|
|
||||||
---
|
|
||||||
|
|
||||||
Registers a callback for a specified http endpoint
|
|
||||||
Note: if callback is registered it is called instead of the
|
|
||||||
callback provided in mg_bind
|
|
||||||
|
|
||||||
Example code snippet:
|
|
||||||
|
|
||||||
```c
|
|
||||||
static void handle_hello1(struct mg_connection *nc, int ev, void *ev_data) {
|
|
||||||
(void) ev; (void) ev_data;
|
|
||||||
mg_printf(nc, "HTTP/1.0 200 OK\r\n\r\n[I am Hello1]");
|
|
||||||
nc->flags |= MG_F_SEND_AND_CLOSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void handle_hello2(struct mg_connection *nc, int ev, void *ev_data) {
|
|
||||||
(void) ev; (void) ev_data;
|
|
||||||
mg_printf(nc, "HTTP/1.0 200 OK\r\n\r\n[I am Hello2]");
|
|
||||||
nc->flags |= MG_F_SEND_AND_CLOSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void init() {
|
|
||||||
nc = mg_bind(&mgr, local_addr, cb1);
|
|
||||||
mg_register_http_endpoint(nc, "/hello1", handle_hello1);
|
|
||||||
mg_register_http_endpoint(nc, "/hello1/hello2", handle_hello2);
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_send_head()"
|
|
||||||
decl_name: "mg_send_head"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
void mg_send_head(struct mg_connection *n, int status_code,
|
|
||||||
int64_t content_length, const char *extra_headers);
|
|
||||||
---
|
|
||||||
|
|
||||||
Sends the response line and headers.
|
|
||||||
This function sends the response line with the `status_code`, and
|
|
||||||
automatically
|
|
||||||
sends one header: either "Content-Length" or "Transfer-Encoding".
|
|
||||||
If `content_length` is negative, then "Transfer-Encoding: chunked" header
|
|
||||||
is sent, otherwise, "Content-Length" header is sent.
|
|
||||||
|
|
||||||
NOTE: If `Transfer-Encoding` is `chunked`, then message body must be sent
|
|
||||||
using `mg_send_http_chunk()` or `mg_printf_http_chunk()` functions.
|
|
||||||
Otherwise, `mg_send()` or `mg_printf()` must be used.
|
|
||||||
Extra headers could be set through `extra_headers`. Note `extra_headers`
|
|
||||||
must NOT be terminated by a new line.
|
|
||||||
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_send_http_chunk()"
|
|
||||||
decl_name: "mg_send_http_chunk"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
void mg_send_http_chunk(struct mg_connection *nc, const char *buf, size_t len);
|
|
||||||
---
|
|
||||||
|
|
||||||
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
|
|
||||||
the buffer itself, then the newline. For example,
|
|
||||||
`mg_send_http_chunk(nc, "foo", 3)` will append the `3\r\nfoo\r\n` string
|
|
||||||
to the `nc->send_mbuf` output IO buffer.
|
|
||||||
|
|
||||||
NOTE: The HTTP header "Transfer-Encoding: chunked" should be sent prior to
|
|
||||||
using this function.
|
|
||||||
|
|
||||||
NOTE: do not forget to send an empty chunk at the end of the response,
|
|
||||||
to tell the client that everything was sent. Example:
|
|
||||||
|
|
||||||
```
|
|
||||||
mg_printf_http_chunk(nc, "%s", "my response!");
|
|
||||||
mg_send_http_chunk(nc, "", 0); // Tell the client we're finished
|
|
||||||
```
|
|
||||||
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_send_response_line()"
|
|
||||||
decl_name: "mg_send_response_line"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
void mg_send_response_line(struct mg_connection *nc, int status_code,
|
|
||||||
const char *extra_headers);
|
|
||||||
---
|
|
||||||
|
|
||||||
Sends the response status line.
|
|
||||||
If `extra_headers` is not NULL, then `extra_headers` are also sent
|
|
||||||
after the response line. `extra_headers` must NOT end end with new line.
|
|
||||||
Example:
|
|
||||||
|
|
||||||
mg_send_response_line(nc, 200, "Access-Control-Allow-Origin: *");
|
|
||||||
|
|
||||||
Will result in:
|
|
||||||
|
|
||||||
HTTP/1.1 200 OK\r\n
|
|
||||||
Access-Control-Allow-Origin: *\r\n
|
|
||||||
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_serve_http()"
|
|
||||||
decl_name: "mg_serve_http"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
void mg_serve_http(struct mg_connection *nc, struct http_message *hm,
|
|
||||||
struct mg_serve_http_opts opts);
|
|
||||||
---
|
|
||||||
|
|
||||||
Serves given HTTP request according to the `options`.
|
|
||||||
|
|
||||||
Example code snippet:
|
|
||||||
|
|
||||||
```c
|
|
||||||
static void ev_handler(struct mg_connection *nc, int ev, void *ev_data) {
|
|
||||||
struct http_message *hm = (struct http_message *) ev_data;
|
|
||||||
struct mg_serve_http_opts opts = { .document_root = "/var/www" }; // C99
|
|
||||||
|
|
||||||
switch (ev) {
|
|
||||||
case MG_EV_HTTP_REQUEST:
|
|
||||||
mg_serve_http(nc, hm, opts);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
@@ -1,165 +0,0 @@
|
|||||||
---
|
|
||||||
title: "struct mg_serve_http_opts"
|
|
||||||
decl_name: "struct mg_serve_http_opts"
|
|
||||||
symbol_kind: "struct"
|
|
||||||
signature: |
|
|
||||||
struct mg_serve_http_opts {
|
|
||||||
/* Path to web root directory */
|
|
||||||
const char *document_root;
|
|
||||||
|
|
||||||
/* List of index files. Default is "" */
|
|
||||||
const char *index_files;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Leave as NULL to disable authentication.
|
|
||||||
* To enable directory protection with authentication, set this to ".htpasswd"
|
|
||||||
* Then, creating ".htpasswd" file in any directory automatically protects
|
|
||||||
* it with digest authentication.
|
|
||||||
* Use `mongoose` web server binary, or `htdigest` Apache utility to
|
|
||||||
* create/manipulate passwords file.
|
|
||||||
* Make sure `auth_domain` is set to a valid domain name.
|
|
||||||
*/
|
|
||||||
const char *per_directory_auth_file;
|
|
||||||
|
|
||||||
/* Authorization domain (domain name of this web server) */
|
|
||||||
const char *auth_domain;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Leave as NULL to disable authentication.
|
|
||||||
* Normally, only selected directories in the document root are protected.
|
|
||||||
* If absolutely every access to the web server needs to be authenticated,
|
|
||||||
* regardless of the URI, set this option to the path to the passwords file.
|
|
||||||
* Format of that file is the same as ".htpasswd" file. Make sure that file
|
|
||||||
* is located outside document root to prevent people fetching it.
|
|
||||||
*/
|
|
||||||
const char *global_auth_file;
|
|
||||||
|
|
||||||
/* Set to "no" to disable directory listing. Enabled by default. */
|
|
||||||
const char *enable_directory_listing;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* SSI files pattern. If not set, "**.shtml$|**.shtm$" is used.
|
|
||||||
*
|
|
||||||
* All files that match ssi_pattern are treated as SSI.
|
|
||||||
*
|
|
||||||
* Server Side Includes (SSI) is a simple interpreted server-side scripting
|
|
||||||
* language which is most commonly used to include the contents of a file
|
|
||||||
* into a web page. It can be useful when it is desirable to include a common
|
|
||||||
* piece of code throughout a website, for example, headers and footers.
|
|
||||||
*
|
|
||||||
* In order for a webpage to recognize an SSI-enabled HTML file, the
|
|
||||||
* filename should end with a special extension, by default the extension
|
|
||||||
* should be either .shtml or .shtm
|
|
||||||
*
|
|
||||||
* Unknown SSI directives are silently ignored by Mongoose. Currently,
|
|
||||||
* the following SSI directives are supported:
|
|
||||||
* <!--#include FILE_TO_INCLUDE -->
|
|
||||||
* <!--#exec "COMMAND_TO_EXECUTE" -->
|
|
||||||
* <!--#call COMMAND -->
|
|
||||||
*
|
|
||||||
* Note that <!--#include ...> directive supports three path
|
|
||||||
*specifications:
|
|
||||||
*
|
|
||||||
* <!--#include virtual="path" --> Path is relative to web server root
|
|
||||||
* <!--#include abspath="path" --> Path is absolute or relative to the
|
|
||||||
* web server working dir
|
|
||||||
* <!--#include file="path" -->, Path is relative to current document
|
|
||||||
* <!--#include "path" -->
|
|
||||||
*
|
|
||||||
* The include directive may be used to include the contents of a file or
|
|
||||||
* the result of running a CGI script.
|
|
||||||
*
|
|
||||||
* The exec directive is used to execute
|
|
||||||
* a command on a server, and show command's output. Example:
|
|
||||||
*
|
|
||||||
* <!--#exec "ls -l" -->
|
|
||||||
*
|
|
||||||
* The call directive is a way to invoke a C handler from the HTML page.
|
|
||||||
* On each occurence of <!--#call COMMAND OPTIONAL_PARAMS> directive,
|
|
||||||
* Mongoose calls a registered event handler with MG_EV_SSI_CALL event,
|
|
||||||
* and event parameter will point to the COMMAND OPTIONAL_PARAMS string.
|
|
||||||
* An event handler can output any text, for example by calling
|
|
||||||
* `mg_printf()`. This is a flexible way of generating a web page on
|
|
||||||
* server side by calling a C event handler. Example:
|
|
||||||
*
|
|
||||||
* <!--#call foo --> ... <!--#call bar -->
|
|
||||||
*
|
|
||||||
* In the event handler:
|
|
||||||
* case MG_EV_SSI_CALL: {
|
|
||||||
* const char *param = (const char *) ev_data;
|
|
||||||
* if (strcmp(param, "foo") == 0) {
|
|
||||||
* mg_printf(c, "hello from foo");
|
|
||||||
* } else if (strcmp(param, "bar") == 0) {
|
|
||||||
* mg_printf(c, "hello from bar");
|
|
||||||
* }
|
|
||||||
* break;
|
|
||||||
* }
|
|
||||||
*/
|
|
||||||
const char *ssi_pattern;
|
|
||||||
|
|
||||||
/* IP ACL. By default, NULL, meaning all IPs are allowed to connect */
|
|
||||||
const char *ip_acl;
|
|
||||||
|
|
||||||
#if MG_ENABLE_HTTP_URL_REWRITES
|
|
||||||
/* URL 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
|
|
||||||
* requested URI by combining `document_root` and the URI. However, if the
|
|
||||||
* rewrite option is used and `uri_pattern` matches requested URI, then
|
|
||||||
* `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
|
|
||||||
* current working directory. It can also be an URI (http:// or https://)
|
|
||||||
* 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
|
|
||||||
* HOST header of the request. If they are equal, Mongoose sets document root
|
|
||||||
* to `file_or_directory_path`, implementing virtual hosts support.
|
|
||||||
* Example: `@foo.com=/document/root/for/foo.com`
|
|
||||||
*
|
|
||||||
* If `uri_pattern` starts with `%` symbol, then Mongoose compares it with
|
|
||||||
* the listening port. If they match, then Mongoose issues a 301 redirect.
|
|
||||||
* For example, to redirect all HTTP requests to the
|
|
||||||
* HTTPS port, do `%80=https://my.site.com`. Note that the request URI is
|
|
||||||
* automatically appended to the redirect location.
|
|
||||||
*/
|
|
||||||
const char *url_rewrites;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* DAV document root. If NULL, DAV requests are going to fail. */
|
|
||||||
const char *dav_document_root;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* DAV passwords file. If NULL, DAV requests are going to fail.
|
|
||||||
* If passwords file is set to "-", then DAV auth is disabled.
|
|
||||||
*/
|
|
||||||
const char *dav_auth_file;
|
|
||||||
|
|
||||||
/* Glob pattern for the files to hide. */
|
|
||||||
const char *hidden_file_pattern;
|
|
||||||
|
|
||||||
/* Set to non-NULL to enable CGI, e.g. **.cgi$|**.php$" */
|
|
||||||
const char *cgi_file_pattern;
|
|
||||||
|
|
||||||
/* If not NULL, ignore CGI script hashbang and use this interpreter */
|
|
||||||
const char *cgi_interpreter;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Comma-separated list of Content-Type overrides for path suffixes, e.g.
|
|
||||||
* ".txt=text/plain; charset=utf-8,.c=text/plain"
|
|
||||||
*/
|
|
||||||
const char *custom_mime_types;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Extra HTTP headers to add to each server response.
|
|
||||||
* Example: to enable CORS, set this to "Access-Control-Allow-Origin: *".
|
|
||||||
*/
|
|
||||||
const char *extra_headers;
|
|
||||||
};
|
|
||||||
---
|
|
||||||
|
|
||||||
This structure defines how `mg_serve_http()` works.
|
|
||||||
Best practice is to set only required settings, and leave the rest as NULL.
|
|
||||||
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
---
|
|
||||||
title: "MQTT API reference"
|
|
||||||
symbol_kind: "intro"
|
|
||||||
decl_name: "mg_mqtt.h"
|
|
||||||
items:
|
|
||||||
- { name: mg_mqtt_connack.md }
|
|
||||||
- { name: mg_mqtt_disconnect.md }
|
|
||||||
- { name: mg_mqtt_match_topic_expression.md }
|
|
||||||
- { name: mg_mqtt_next_subscribe_topic.md }
|
|
||||||
- { name: mg_mqtt_ping.md }
|
|
||||||
- { name: mg_mqtt_pong.md }
|
|
||||||
- { name: mg_mqtt_puback.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 }
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_mqtt_connack()"
|
|
||||||
decl_name: "mg_mqtt_connack"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
void mg_mqtt_connack(struct mg_connection *nc, uint8_t return_code);
|
|
||||||
---
|
|
||||||
|
|
||||||
Sends a CONNACK command with a given `return_code`.
|
|
||||||
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_mqtt_disconnect()"
|
|
||||||
decl_name: "mg_mqtt_disconnect"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
void mg_mqtt_disconnect(struct mg_connection *nc);
|
|
||||||
---
|
|
||||||
|
|
||||||
Sends a DISCONNECT command.
|
|
||||||
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
---
|
|
||||||
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.
|
|
||||||
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_mqtt_next_subscribe_topic()"
|
|
||||||
decl_name: "mg_mqtt_next_subscribe_topic"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
int mg_mqtt_next_subscribe_topic(struct mg_mqtt_message *msg,
|
|
||||||
struct mg_str *topic, uint8_t *qos, int pos);
|
|
||||||
---
|
|
||||||
|
|
||||||
Extracts the next topic expression from a SUBSCRIBE command payload.
|
|
||||||
|
|
||||||
The topic expression name will point to a string in the payload buffer.
|
|
||||||
Returns the pos of the next topic expression or -1 when the list
|
|
||||||
of topics is exhausted.
|
|
||||||
|
|
||||||
Loaded 100 of 1169 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user