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
791ad496
Commit
791ad496
authored
May 19, 2013
by
Sergey Lyubka
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #172 from jwang11/master
Securely close SSL connection by standard SSL_shutdown
parents
add079a9
063b26fe
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
5 deletions
+10
-5
mongoose.c
mongoose.c
+10
-5
No files found.
mongoose.c
View file @
791ad496
...
@@ -341,6 +341,7 @@ struct ssl_func {
...
@@ -341,6 +341,7 @@ struct ssl_func {
#define SSLv23_client_method (* (SSL_METHOD * (*)(void)) ssl_sw[17].ptr)
#define SSLv23_client_method (* (SSL_METHOD * (*)(void)) ssl_sw[17].ptr)
#define SSL_pending (* (int (*)(SSL *)) ssl_sw[18].ptr)
#define SSL_pending (* (int (*)(SSL *)) ssl_sw[18].ptr)
#define SSL_CTX_set_verify (* (void (*)(SSL_CTX *, int, int)) ssl_sw[19].ptr)
#define SSL_CTX_set_verify (* (void (*)(SSL_CTX *, int, int)) ssl_sw[19].ptr)
#define SSL_shutdown (* (int (*)(SSL *)) ssl_sw[20].ptr)
#define CRYPTO_num_locks (* (int (*)(void)) crypto_sw[0].ptr)
#define CRYPTO_num_locks (* (int (*)(void)) crypto_sw[0].ptr)
#define CRYPTO_set_locking_callback \
#define CRYPTO_set_locking_callback \
...
@@ -375,6 +376,7 @@ static struct ssl_func ssl_sw[] = {
...
@@ -375,6 +376,7 @@ static struct ssl_func ssl_sw[] = {
{
"SSLv23_client_method"
,
NULL
},
{
"SSLv23_client_method"
,
NULL
},
{
"SSL_pending"
,
NULL
},
{
"SSL_pending"
,
NULL
},
{
"SSL_CTX_set_verify"
,
NULL
},
{
"SSL_CTX_set_verify"
,
NULL
},
{
"SSL_shutdown"
,
NULL
},
{
NULL
,
NULL
}
{
NULL
,
NULL
}
};
};
...
@@ -4646,17 +4648,20 @@ static void close_socket_gracefully(struct mg_connection *conn) {
...
@@ -4646,17 +4648,20 @@ static void close_socket_gracefully(struct mg_connection *conn) {
static
void
close_connection
(
struct
mg_connection
*
conn
)
{
static
void
close_connection
(
struct
mg_connection
*
conn
)
{
conn
->
must_close
=
1
;
conn
->
must_close
=
1
;
if
(
conn
->
client
.
sock
!=
INVALID_SOCKET
)
{
close_socket_gracefully
(
conn
);
conn
->
client
.
sock
=
INVALID_SOCKET
;
}
#ifndef NO_SSL
#ifndef NO_SSL
// Must be done AFTER socket is closed
if
(
conn
->
ssl
!=
NULL
)
{
if
(
conn
->
ssl
!=
NULL
)
{
// Run SSL_shutdown twice to ensure completly close SSL connection
SSL_shutdown
(
conn
->
ssl
);
SSL_shutdown
(
conn
->
ssl
);
SSL_free
(
conn
->
ssl
);
SSL_free
(
conn
->
ssl
);
conn
->
ssl
=
NULL
;
conn
->
ssl
=
NULL
;
}
}
#endif
#endif
if
(
conn
->
client
.
sock
!=
INVALID_SOCKET
)
{
close_socket_gracefully
(
conn
);
conn
->
client
.
sock
=
INVALID_SOCKET
;
}
}
}
void
mg_close_connection
(
struct
mg_connection
*
conn
)
{
void
mg_close_connection
(
struct
mg_connection
*
conn
)
{
...
...
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