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
27c66563
Commit
27c66563
authored
Mar 04, 2014
by
Sergey Lyubka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SSL_accept fixes
parent
ffe83051
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
6 deletions
+10
-6
mongoose.c
mongoose.c
+10
-6
No files found.
mongoose.c
View file @
27c66563
...
...
@@ -658,7 +658,7 @@ static void ns_read_from_socket(struct ns_connection *conn) {
int
ssl_err
=
SSL_get_error
(
conn
->
ssl
,
res
);
DBG
((
"%p res %d %d"
,
conn
,
res
,
ssl_err
));
if
(
res
==
1
)
{
conn
->
flags
|
=
NSF_SSL_HANDSHAKE_DONE
;
conn
->
flags
=
NSF_SSL_HANDSHAKE_DONE
;
}
else
if
(
res
==
0
||
ssl_err
==
2
||
ssl_err
==
3
)
{
return
;
// Call us again
}
else
{
...
...
@@ -680,8 +680,15 @@ static void ns_read_from_socket(struct ns_connection *conn) {
if
(
conn
->
flags
&
NSF_SSL_HANDSHAKE_DONE
)
{
n
=
SSL_read
(
conn
->
ssl
,
buf
,
sizeof
(
buf
));
}
else
{
if
(
SSL_accept
(
conn
->
ssl
)
==
1
)
{
int
res
=
SSL_accept
(
conn
->
ssl
);
int
ssl_err
=
SSL_get_error
(
conn
->
ssl
,
res
);
DBG
((
"%p res %d %d"
,
conn
,
res
,
ssl_err
));
if
(
res
==
1
)
{
conn
->
flags
|=
NSF_SSL_HANDSHAKE_DONE
;
}
else
if
(
res
==
0
||
ssl_err
==
2
||
ssl_err
==
3
)
{
return
;
// Call us again
}
else
{
conn
->
flags
|=
NSF_CLOSE_IMMEDIATELY
;
}
return
;
}
...
...
@@ -842,10 +849,6 @@ struct ns_connection *ns_connect(struct ns_server *server, const char *host,
struct
ns_connection
*
conn
=
NULL
;
int
connect_ret_val
;
#ifndef NS_ENABLE_SSL
if
(
use_ssl
)
return
0
;
#endif
if
(
host
==
NULL
||
(
he
=
gethostbyname
(
host
))
==
NULL
||
(
sock
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
))
==
INVALID_SOCKET
)
{
DBG
((
"gethostbyname(%s) failed: %s"
,
host
,
strerror
(
errno
)));
...
...
@@ -859,6 +862,7 @@ struct ns_connection *ns_connect(struct ns_server *server, const char *host,
connect_ret_val
=
connect
(
sock
,
(
struct
sockaddr
*
)
&
sin
,
sizeof
(
sin
));
if
(
ns_is_error
(
connect_ret_val
))
{
closesocket
(
sock
);
return
NULL
;
}
else
if
((
conn
=
(
struct
ns_connection
*
)
NS_MALLOC
(
sizeof
(
*
conn
)))
==
NULL
)
{
...
...
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