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
a50a52ca
Commit
a50a52ca
authored
Dec 04, 2013
by
Sergey Lyubka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed #259
parent
50371ef3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
10 deletions
+8
-10
upload.c
build/src/upload.c
+4
-5
mongoose.c
mongoose.c
+4
-5
No files found.
build/src/upload.c
View file @
a50a52ca
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
FILE
*
mg_upload
(
struct
mg_connection
*
conn
,
const
char
*
destination_dir
,
FILE
*
mg_upload
(
struct
mg_connection
*
conn
,
const
char
*
destination_dir
,
char
*
path
,
int
path_len
)
{
char
*
path
,
int
path_len
)
{
const
char
*
content_type_header
,
*
boundary_start
;
const
char
*
content_type_header
,
*
boundary_start
;
char
*
buf
,
fname
[
1024
],
boundary
[
100
],
*
s
;
char
*
buf
,
fname
[
1024
],
boundary
[
100
],
*
s
,
*
p
;
int
bl
,
n
,
i
,
j
,
headers_len
,
boundary_len
,
eof
,
buf_len
,
to_read
,
len
=
0
;
int
bl
,
n
,
i
,
j
,
headers_len
,
boundary_len
,
eof
,
buf_len
,
to_read
,
len
=
0
;
FILE
*
fp
;
FILE
*
fp
;
...
@@ -89,10 +89,9 @@ FILE *mg_upload(struct mg_connection *conn, const char *destination_dir,
...
@@ -89,10 +89,9 @@ FILE *mg_upload(struct mg_connection *conn, const char *destination_dir,
fp
=
NULL
;
fp
=
NULL
;
// Construct destination file name. Do not allow paths to have slashes.
// Construct destination file name. Do not allow paths to have slashes.
if
((
s
=
strrchr
(
fname
,
'/'
))
==
NULL
&&
(
s
=
strrchr
(
fname
,
'\\'
))
==
NULL
)
{
s
=
fname
;
s
=
fname
;
}
if
((
p
=
strrchr
(
fname
,
'/'
))
!=
NULL
&&
p
>
s
)
s
=
p
;
if
((
p
=
strrchr
(
fname
,
'\\'
))
!=
NULL
&&
p
>
s
)
s
=
p
;
// Open file in binary mode. TODO: set an exclusive lock.
// Open file in binary mode. TODO: set an exclusive lock.
snprintf
(
path
,
path_len
,
"%s/%s"
,
destination_dir
,
s
);
snprintf
(
path
,
path_len
,
"%s/%s"
,
destination_dir
,
s
);
...
...
mongoose.c
View file @
a50a52ca
...
@@ -3402,7 +3402,7 @@ done:
...
@@ -3402,7 +3402,7 @@ done:
FILE
*
mg_upload
(
struct
mg_connection
*
conn
,
const
char
*
destination_dir
,
FILE
*
mg_upload
(
struct
mg_connection
*
conn
,
const
char
*
destination_dir
,
char
*
path
,
int
path_len
)
{
char
*
path
,
int
path_len
)
{
const
char
*
content_type_header
,
*
boundary_start
;
const
char
*
content_type_header
,
*
boundary_start
;
char
*
buf
,
fname
[
1024
],
boundary
[
100
],
*
s
;
char
*
buf
,
fname
[
1024
],
boundary
[
100
],
*
s
,
*
p
;
int
bl
,
n
,
i
,
j
,
headers_len
,
boundary_len
,
eof
,
buf_len
,
to_read
,
len
=
0
;
int
bl
,
n
,
i
,
j
,
headers_len
,
boundary_len
,
eof
,
buf_len
,
to_read
,
len
=
0
;
FILE
*
fp
;
FILE
*
fp
;
...
@@ -3488,10 +3488,9 @@ FILE *mg_upload(struct mg_connection *conn, const char *destination_dir,
...
@@ -3488,10 +3488,9 @@ FILE *mg_upload(struct mg_connection *conn, const char *destination_dir,
fp
=
NULL
;
fp
=
NULL
;
// Construct destination file name. Do not allow paths to have slashes.
// Construct destination file name. Do not allow paths to have slashes.
if
((
s
=
strrchr
(
fname
,
'/'
))
==
NULL
&&
(
s
=
strrchr
(
fname
,
'\\'
))
==
NULL
)
{
s
=
fname
;
s
=
fname
;
}
if
((
p
=
strrchr
(
fname
,
'/'
))
!=
NULL
&&
p
>
s
)
s
=
p
;
if
((
p
=
strrchr
(
fname
,
'\\'
))
!=
NULL
&&
p
>
s
)
s
=
p
;
// Open file in binary mode. TODO: set an exclusive lock.
// Open file in binary mode. TODO: set an exclusive lock.
snprintf
(
path
,
path_len
,
"%s/%s"
,
destination_dir
,
s
);
snprintf
(
path
,
path_len
,
"%s/%s"
,
destination_dir
,
s
);
...
...
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