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
ceca52de
Commit
ceca52de
authored
Sep 09, 2014
by
Sergey Lyubka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved file send_file example to separate dir
parent
8a369105
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
2 deletions
+26
-2
Makefile
examples/send_file/Makefile
+19
-0
send_file.c
examples/send_file/send_file.c
+7
-2
No files found.
examples/send_file/Makefile
0 → 100644
View file @
ceca52de
# Copyright (c) 2014 Cesanta Software
# All rights reserved
PROG
=
send_file
CFLAGS
=
-W
-Wall
-I
../..
$(CFLAGS_EXTRA)
SOURCES
=
$(PROG)
.c ../../mongoose.c
all
:
$(PROG)
./
$(PROG)
$(PROG)
:
$(SOURCES) Makefile
$(CC)
-o
$(PROG)
$(SOURCES)
$(CFLAGS)
win
:
wine cl
$(SOURCES)
/MD /nologo /DNDEBUG /O1 /I../.. /Fe
$(PROG)
.exe
wine
$(PROG)
.exe
clean
:
rm
-rf
$(PROG)
*
.exe
*
.dSYM
*
.obj
*
.exp .
*
o
*
.lib
*
.gc
*
examples/file.c
→
examples/
send_file/send_
file.c
View file @
ceca52de
// Copyright (c) 2014 Cesanta Software
// All rights reserved
//
// This example demostrates how to send arbitrary files to the client.
#include "mongoose.h"
static
int
ev_handler
(
struct
mg_connection
*
conn
,
enum
mg_event
ev
)
{
switch
(
ev
)
{
case
MG_REQUEST
:
mg_send_file
(
conn
,
"
file.c"
);
mg_send_file
(
conn
,
"
send_file.c"
);
// Also could be a directory, or CGI file
return
MG_MORE
;
// It is important to return MG_MORE after mg_send_file!
case
MG_AUTH
:
return
MG_TRUE
;
default:
return
MG_FALSE
;
...
...
@@ -19,4 +24,4 @@ int main(void) {
mg_destroy_server
(
&
server
);
return
0
;
}
\ No newline at end of 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