Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
mongoose
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ganil-acq
GANILinux
linux-service
library
mongoose
Commits
ceca52de
Commit
ceca52de
authored
10 years ago
by
Sergey Lyubka
Browse files
Options
Downloads
Patches
Plain Diff
Moved file send_file example to separate dir
parent
8a369105
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
examples/send_file/Makefile
+19
-0
19 additions, 0 deletions
examples/send_file/Makefile
examples/send_file/send_file.c
+7
-2
7 additions, 2 deletions
examples/send_file/send_file.c
with
26 additions
and
2 deletions
examples/send_file/Makefile
0 → 100644
+
19
−
0
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
*
This diff is collapsed.
Click to expand it.
examples/file.c
→
examples/
send_file/send_
file.c
+
7
−
2
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
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment