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
afaba7ee
Commit
afaba7ee
authored
Mar 09, 2014
by
Sergey Lyubka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Lua calls, birth_time fixed
parent
40f257ef
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
7 deletions
+6
-7
mongoose.c
mongoose.c
+6
-7
No files found.
mongoose.c
View file @
afaba7ee
...
...
@@ -1178,7 +1178,6 @@ struct connection {
struct
mg_server
*
server
;
union
endpoint
endpoint
;
enum
endpoint_type
endpoint_type
;
time_t
birth_time
;
char
*
path_info
;
char
*
request
;
int64_t
num_bytes_sent
;
// Total number of bytes sent
...
...
@@ -3866,8 +3865,8 @@ static void prepare_lua_environment(struct mg_connection *ri, lua_State *L) {
luaL_newmetatable
(
L
,
"luasocket"
);
lua_pushliteral
(
L
,
"__index"
);
lua_newtable
(
L
);
luaL_register
(
L
,
NULL
,
luasocket_methods
);
//
luaL_newlib(L, luasocket_methods);
//
luaL_register(L, NULL, luasocket_methods);
luaL_newlib
(
L
,
luasocket_methods
);
lua_rawset
(
L
,
-
3
);
lua_pop
(
L
,
1
);
lua_register
(
L
,
"connect"
,
lsp_connect
);
...
...
@@ -3962,7 +3961,7 @@ static void handle_lsp_request(struct connection *conn, const char *path,
// We're not sending HTTP headers here, Lua page must do it.
prepare_lua_environment
(
&
conn
->
mg_conn
,
L
);
lua_pushcclosure
(
L
,
&
lua_error_handler
,
0
);
lua_
pushvalue
(
L
,
LUA_GLOBALSINDEX
);
lua_
rawgeti
(
L
,
LUA_REGISTRYINDEX
,
LUA_RIDX_GLOBALS
);
lsp
(
conn
,
p
,
(
int
)
st
->
st_size
,
L
);
close_local_endpoint
(
conn
);
}
...
...
@@ -4375,7 +4374,6 @@ struct mg_connection *mg_connect(struct mg_server *server, const char *host,
conn
->
endpoint_type
=
EP_CLIENT
;
//conn->handler = handler;
conn
->
mg_conn
.
server_param
=
server
->
ns_server
.
server_data
;
conn
->
birth_time
=
time
(
NULL
);
conn
->
ns_conn
->
flags
=
NSF_CONNECTING
;
return
&
conn
->
mg_conn
;
...
...
@@ -4397,10 +4395,11 @@ static void log_access(const struct connection *conn, const char *path) {
const
struct
mg_connection
*
c
=
&
conn
->
mg_conn
;
FILE
*
fp
=
(
path
==
NULL
)
?
NULL
:
fopen
(
path
,
"a+"
);
char
date
[
64
],
user
[
100
];
time_t
now
;
if
(
fp
==
NULL
)
return
;
strftime
(
date
,
sizeof
(
date
),
"%d/%b/%Y:%H:%M:%S %z"
,
localtime
(
&
conn
->
birth_time
));
now
=
time
(
NULL
);
strftime
(
date
,
sizeof
(
date
),
"%d/%b/%Y:%H:%M:%S %z"
,
localtime
(
&
now
));
flockfile
(
fp
);
mg_parse_header
(
mg_get_header
(
&
conn
->
mg_conn
,
"Authorization"
),
"username"
,
...
...
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