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
3fbfa33b
Commit
3fbfa33b
authored
Oct 13, 2015
by
Sergey Lyubka
Committed by
Maxim Ignatenko
Oct 13, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor nitpicks for big_upload
PUBLISHED_FROM=55d4270916f32ce4645965fbd7a031d7f8e1907b
parent
179aa750
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
12 deletions
+8
-12
Makefile
examples/big_upload/Makefile
+1
-8
big_upload.c
examples/big_upload/big_upload.c
+7
-4
No files found.
examples/big_upload/Makefile
View file @
3fbfa33b
PROG
=
big_upload
PROG
=
big_upload
CFLAGS
=
-W
-Wall
-pthread
-I
../..
-g
-O0
$(CFLAGS_EXTRA)
include
../examples.mk
SOURCES
=
$(PROG)
.c ../../mongoose.c
$(PROG)
:
$(SOURCES)
$(CC)
-o
$(PROG)
$(SOURCES)
$(CFLAGS)
clean
:
rm
-rf
$(PROG)
*
.exe
*
.dSYM
*
.obj
*
.exp .
*
o
*
.lib
examples/big_upload/big_upload.c
View file @
3fbfa33b
// Copyright (c) 2015 Cesanta Software Limited
// All rights reserved
//
// This example demonstrates how to handle very large requests without keeping
// This example demonstrates how to handle very large requests without keeping
// them in memory.
// them in memory.
...
@@ -49,9 +52,9 @@ static void handle_recv(struct mg_connection *nc) {
...
@@ -49,9 +52,9 @@ static void handle_recv(struct mg_connection *nc) {
// This is the request that we don't want to buffer in memory.
// This is the request that we don't want to buffer in memory.
if
(
hm
.
body
.
len
==
(
size_t
)
~
0
||
hm
.
body
.
len
==
0
)
{
if
(
hm
.
body
.
len
==
(
size_t
)
~
0
||
hm
.
body
.
len
==
0
)
{
mg_printf
(
nc
,
mg_printf
(
nc
,
"%s"
,
"HTTP/1.1 411 Content-Length required
\r\n
"
"HTTP/1.1 411 Content-Length required
\r\n
"
"Content-Leng
ht
: 0
\r\n\r\n
"
);
"Content-Leng
th
: 0
\r\n\r\n
"
);
nc
->
flags
|=
MG_F_SEND_AND_CLOSE
;
nc
->
flags
|=
MG_F_SEND_AND_CLOSE
;
return
;
return
;
}
}
...
@@ -66,9 +69,9 @@ static void handle_recv(struct mg_connection *nc) {
...
@@ -66,9 +69,9 @@ static void handle_recv(struct mg_connection *nc) {
data
->
bytes_left
=
hm
.
body
.
len
;
data
->
bytes_left
=
hm
.
body
.
len
;
data
->
fp
=
tmpfile
();
data
->
fp
=
tmpfile
();
if
(
data
->
fp
==
NULL
)
{
if
(
data
->
fp
==
NULL
)
{
mg_printf
(
nc
,
mg_printf
(
nc
,
"%s"
,
"HTTP/1.1 500 Failed to open a file
\r\n
"
"HTTP/1.1 500 Failed to open a file
\r\n
"
"Content-Leng
ht
: 0
\r\n\r\n
"
);
"Content-Leng
th
: 0
\r\n\r\n
"
);
nc
->
flags
|=
MG_F_SEND_AND_CLOSE
;
nc
->
flags
|=
MG_F_SEND_AND_CLOSE
;
return
;
return
;
}
}
...
...
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