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
5e5033a0
Commit
5e5033a0
authored
Sep 16, 2013
by
Sergey Lyubka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for the issue 156
parent
411a2699
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
mongoose.c
mongoose.c
+10
-10
No files found.
mongoose.c
View file @
5e5033a0
...
...
@@ -1041,7 +1041,7 @@ static void change_slashes_to_backslashes(char *path) {
// Encode 'path' which is assumed UTF-8 string, into UNICODE string.
// wbuf and wbuf_len is a target buffer and its length.
static
void
to_unicode
(
const
char
*
path
,
wchar_t
*
wbuf
,
size_t
wbuf_len
)
{
char
buf
[
PATH_MAX
],
buf2
[
PATH_MAX
];
char
buf
[
PATH_MAX
*
2
],
buf2
[
PATH_MAX
*
2
];
mg_strlcpy
(
buf
,
path
,
sizeof
(
buf
));
change_slashes_to_backslashes
(
buf
);
...
...
@@ -1125,11 +1125,11 @@ static int path_cannot_disclose_cgi(const char *path) {
static
int
mg_stat
(
struct
mg_connection
*
conn
,
const
char
*
path
,
struct
file
*
filep
)
{
wchar_t
wbuf
[
PATH_MAX
];
wchar_t
wbuf
[
PATH_MAX
]
=
L"
\\\\
?
\\
"
;
WIN32_FILE_ATTRIBUTE_DATA
info
;
if
(
!
is_file_in_memory
(
conn
,
path
,
filep
))
{
to_unicode
(
path
,
wbuf
,
ARRAY_SIZE
(
wbuf
)
);
to_unicode
(
path
,
wbuf
+
4
,
ARRAY_SIZE
(
wbuf
)
-
4
);
if
(
GetFileAttributesExW
(
wbuf
,
GetFileExInfoStandard
,
&
info
)
!=
0
)
{
filep
->
size
=
MAKEUQUAD
(
info
.
nFileSizeLow
,
info
.
nFileSizeHigh
);
filep
->
modification_time
=
SYS2UNIX_TIME
(
...
...
@@ -1673,8 +1673,7 @@ int mg_printf(struct mg_connection *conn, const char *fmt, ...) {
return
mg_vprintf
(
conn
,
fmt
,
ap
);
}
int
mg_chunked_printf
(
struct
mg_connection
*
conn
,
const
char
*
fmt
,
...)
{
static
int
mg_chunked_printf
(
struct
mg_connection
*
conn
,
const
char
*
fmt
,
...)
{
char
mem
[
MG_BUF_LEN
],
*
buf
=
mem
;
int
len
;
...
...
@@ -2634,8 +2633,9 @@ void mg_url_encode(const char *src, char *dst, size_t dst_len) {
*
dst
=
'\0'
;
}
static
void
print_dir_entry
(
struct
de
*
de
)
{
char
size
[
64
],
mod
[
64
],
href
[
PATH_MAX
];
static
void
print_dir_entry
(
const
struct
de
*
de
)
{
char
size
[
64
],
mod
[
64
],
href
[
PATH_MAX
*
3
];
const
char
*
slash
=
de
->
file
.
is_directory
?
"/"
:
""
;
if
(
de
->
file
.
is_directory
)
{
mg_snprintf
(
de
->
conn
,
size
,
sizeof
(
size
),
"%s"
,
"[DIRECTORY]"
);
...
...
@@ -2661,8 +2661,7 @@ static void print_dir_entry(struct de *de) {
de
->
conn
->
num_bytes_sent
+=
mg_chunked_printf
(
de
->
conn
,
"<tr><td><a href=
\"
%s%s%s
\"
>%s%s</a></td>"
"<td> %s</td><td> %s</td></tr>
\n
"
,
de
->
conn
->
request_info
.
uri
,
href
,
de
->
file
.
is_directory
?
"/"
:
""
,
de
->
file_name
,
de
->
file
.
is_directory
?
"/"
:
""
,
mod
,
size
);
de
->
conn
->
request_info
.
uri
,
href
,
slash
,
de
->
file_name
,
slash
,
mod
,
size
);
}
// This function is called from send_directory() and used for
...
...
@@ -2864,7 +2863,8 @@ static void handle_directory_request(struct mg_connection *conn,
}
free
(
data
.
entries
);
conn
->
num_bytes_sent
+=
mg_chunked_printf
(
conn
,
"%s"
,
"</table></body></html>"
);
conn
->
num_bytes_sent
+=
mg_chunked_printf
(
conn
,
"%s"
,
"</table></body></html>"
);
conn
->
num_bytes_sent
+=
mg_write
(
conn
,
"0
\r\n\r\n
"
,
5
);
conn
->
status_code
=
200
;
}
...
...
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