Publish mongoose src and tests

CL: Mongoose Web Server: Publish sources and tests

Resolves https://github.com/cesanta/mongoose/issues/745

PUBLISHED_FROM=7ecd7a3c518cfa614a6ba0838678dcb91b75a8c0
This commit is contained in:
Dmitry Frank authored and Cesanta Bot committed 2018-02-02 15:49:55 +00:00
1 parent 0ab1c7ef76
commit 8742fac5d8
94 files changed
+24967

No files matched your search

+6
View File
@@ -0,0 +1,6 @@
CFLAGS = -I ..
dump.cgi: dump.cgi.o
$(CC) -o dump.cgi dump.cgi.o -L .. -lccgi
dump.cgi.o: dump.cgi.c
+9
View File
@@ -0,0 +1,9 @@
dump.html is a sample web form that POSTs to dump.cgi.
dump.cgi displays all the form data and uploads
files to /tmp/cgi-upload-*
To build dump.cgi: make
Install dump.cgi and dump.html on a web server and
browse dump.html.
+34
View File
@@ -0,0 +1,34 @@
#include <stdio.h>
#include <ccgi.h>
int
main(int argc, char **argv, char **env) {
CGI_varlist *vl;
const char *name;
CGI_value *value;
int i;
fputs("Content-type: text/plain\r\n\r\n", stdout);
fputs("Environment:\r\n", stdout);
for (i = 0; env[i] != 0; i++) {
fputs(env[i], stdout);
fputs("\r\n", stdout);
}
if ((vl = CGI_get_all("/tmp/cgi-upload-XXXXXX")) == 0) {
fputs("CGI_get_all() failed\r\n", stdout);
return 0;
}
fputs("\r\nCGI Variables:\r\n", stdout);
for (name = CGI_first_name(vl); name != 0;
name = CGI_next_name(vl))
{
value = CGI_lookup_all(vl, 0);
for (i = 0; value[i] != 0; i++) {
printf("%s [%d] >>%s<<\r\n", name, i, value[i]);
}
}
CGI_free_varlist(vl);
return 0;
}
+73
View File
@@ -0,0 +1,73 @@
<html>
<head>
<title>C CGI Test Form</title>
<style>
.middle {
vertical-align: middle;
}
</style>
</head>
<body>
<h2>C CGI Library Test Form</h2>
<form method="POST"
action="dump.cgi?qvar1=q+val+1&amp;qvar2=q+val+2&amp;qvar3=q+val+3"
enctype="multipart/form-data">
<p>
Text Input: <input type="text" name="textvar1" />
</p>
<p>
File Uploads:
</p>
<p>
File 1:<input type="file" name="upload1" /><br />
File 2:<input type="file" name="upload2" />
</p>
<p>
Check Boxes:
cb1<input type="checkbox" name="cbvar1" value="cb #1" checked="checked" />
cb2<input type="checkbox" name="cbvar1" value="cb #2" />
cb3<input type="checkbox" name="cbvar1" value="cb #3" checked="checked" />
cb4<input type="checkbox" name="cbvar1" value="cb #4" />
</p>
<p>
Radio Buttons:
rb1<input type="radio" name="rbvar1" value="rb #1" />
rb2<input type="radio" name="rbvar1" value="rb #2" />
rb3<input type="radio" name="rbvar1" value="rb #3" checked="checked" />
rb4<input type="radio" name="rbvar1" value="rb #4" />
NONE: <input type="radio" name="rbvar1" value="none" />
</p>
<p>
Selection:
<select class="middle" multiple name="selvar1">
<option value="sel val #1" selected="selected">Select Value 1</option>
<option value="sel val #2">Select Value 2</option>
<option value="sel val #3" selected="selected">Select Value 3</option>
<option value="sel val #4" selected="selected">Select Value 4</option>
<option value="sel val #5">Select Value 5</option>
<option value="sel val #6">Select Value 6</option>
<option value="sel val #7" selected="selected">Select Value 7</option>
</select>
</p>
<p>
Text Area:
<textarea class="middle" name="textarea1" rows="10" cols="40">Initial Line 1
Initial Line 2</textarea>
</p>
<p>
<input type="submit" name="submitbutton" value="Submit Form" />
<input type="hidden" name="hidden"
value="This is three&#13;&#10;lines of hidden&#13;&#10;form data" />
</p>
</form>
</body>
</html>