Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mongoose
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
esp
mongoose
Commits
70154f6c
Commit
70154f6c
authored
Oct 01, 2013
by
Sergey Lyubka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved mod_lua.c to src/lua.c
parent
d3577b78
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
409 additions
and
15 deletions
+409
-15
Makefile
build/Makefile
+3
-3
internal.h
build/src/internal.h
+6
-0
lua.c
build/src/lua.c
+3
-2
mongoose.c
build/src/mongoose.c
+0
-4
mongoose.c
mongoose.c
+395
-4
unit_test.c
test/unit_test.c
+2
-2
No files found.
build/Makefile
View file @
70154f6c
...
...
@@ -21,13 +21,13 @@
PROG
=
mongoose
EXE_SUFFIX
=
CFLAGS
=
-std
=
c99
-O2
-W
-Wall
-pedantic
-pthread
-pipe
-I
..
$(CFLAGS_EXTRA)
CFLAGS
=
-std
=
c99
-O2
-W
-Wall
-pedantic
-pthread
-pipe
-I
.
-I
.
.
$(CFLAGS_EXTRA)
VERSION
=
$(
shell
perl
-lne
\
'print $$1 if /define\s+MONGOOSE_VERSION\s+"(\S+
)
"/'
../mongoose.c
)
# The order in which files are listed is important
SOURCES
=
src/internal.h src/string.c src/parse_date.c src/options.c
\
src/crypto.c src/auth.c src/mongoose.c
src/crypto.c src/auth.c src/mongoose.c
src/lua.c
TINY_SOURCES
=
../mongoose.c main.c
LUA_SOURCES
=
$(TINY_SOURCES)
sqlite3.c lsqlite3.c lua_5.2.1.c
...
...
@@ -60,7 +60,7 @@ endif
all
:
@
echo
"make (unix|windows|macos)"
../mongoose.c
:
mod_lua.c
../mongoose.h Makefile $(SOURCES)
../mongoose.c
:
../mongoose.h Makefile $(SOURCES)
cat
$(SOURCES)
|
sed
'/#include "internal.h"/d'
>
$@
unix_unit_test
:
$(LUA_SOURCES) Makefile ../test/unit_test.c
...
...
build/src/internal.h
View file @
70154f6c
...
...
@@ -460,3 +460,9 @@ struct de {
static
FILE
*
mg_fopen
(
const
char
*
path
,
const
char
*
mode
);
static
int
mg_stat
(
const
char
*
path
,
struct
file
*
filep
);
#ifdef USE_LUA
#include "lua_5.2.1.h"
static
int
handle_lsp_request
(
struct
mg_connection
*
,
const
char
*
,
struct
file
*
,
struct
lua_State
*
);
#endif
build/
mod_
lua.c
→
build/
src/
lua.c
View file @
70154f6c
#include "
lua_5.2.1
.h"
#include "
internal
.h"
#ifdef USE_LUA
#ifdef _WIN32
static
void
*
mmap
(
void
*
addr
,
int64_t
len
,
int
prot
,
int
flags
,
int
fd
,
int
offset
)
{
...
...
@@ -20,7 +21,6 @@ static void *mmap(void *addr, int64_t len, int prot, int flags, int fd,
static
const
char
*
LUASOCKET
=
"luasocket"
;
// Forward declarations
static
void
handle_request
(
struct
mg_connection
*
);
static
int
handle_lsp_request
(
struct
mg_connection
*
,
const
char
*
,
struct
file
*
,
struct
lua_State
*
);
...
...
@@ -387,3 +387,4 @@ static int handle_lsp_request(struct mg_connection *conn, const char *path,
return
error
;
}
#endif // USE_LUA
build/src/mongoose.c
View file @
70154f6c
...
...
@@ -2842,10 +2842,6 @@ static uint32_t get_remote_ip(const struct mg_connection *conn) {
return
ntohl
(
*
(
uint32_t
*
)
&
conn
->
client
.
rsa
.
sin
.
sin_addr
);
}
#ifdef USE_LUA
#include "build/mod_lua.c"
#endif // USE_LUA
FILE
*
mg_upload
(
struct
mg_connection
*
conn
,
const
char
*
destination_dir
,
char
*
path
,
int
path_len
)
{
const
char
*
content_type_header
,
*
boundary_start
;
...
...
mongoose.c
View file @
70154f6c
This diff is collapsed.
Click to expand it.
test/unit_test.c
View file @
70154f6c
...
...
@@ -222,7 +222,7 @@ static int event_handler(struct mg_event *event) {
if
(
!
strcmp
(
ri
->
uri
,
"/upload"
))
{
test_upload
(
event
->
conn
,
"lua_5.2.1.h"
,
"./f1.txt"
);
test_upload
(
event
->
conn
,
"
mod_lua
.c"
,
"./f2.txt"
);
test_upload
(
event
->
conn
,
"
lsqlite3
.c"
,
"./f2.txt"
);
ASSERT
(
mg_upload
(
event
->
conn
,
"."
,
NULL
,
0
)
==
NULL
);
mg_printf
(
event
->
conn
,
"HTTP/1.0 200 OK
\r\n
"
...
...
@@ -330,7 +330,7 @@ static void test_mg_upload(void) {
// Upload two files
ASSERT
((
file_data
=
read_file
(
"lua_5.2.1.h"
,
&
file_len
))
!=
NULL
);
ASSERT
((
file2_data
=
read_file
(
"
mod_lua
.c"
,
&
file2_len
))
!=
NULL
);
ASSERT
((
file2_data
=
read_file
(
"
lsqlite3
.c"
,
&
file2_len
))
!=
NULL
);
post_data
=
NULL
;
post_data_len
=
alloc_printf
(
&
post_data
,
0
,
// First file
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment