summaryrefslogtreecommitdiff
path: root/src/socket.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/socket.c')
-rw-r--r--src/socket.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/socket.c b/src/socket.c
index 4de0118b96..f60479f5cc 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -475,10 +475,12 @@ socket_open(socket_st * hd, const char *hostname, const char *service,
hd->app_proto = NULL;
}
- hd->session = init_tls_session(hostname);
- if (hd->session == NULL && !(flags & SOCKET_FLAG_RAW)) {
- fprintf(stderr, "error initializing session\n");
- exit(1);
+ if (!(flags & SOCKET_FLAG_SKIP_INIT)) {
+ hd->session = init_tls_session(hostname);
+ if (hd->session == NULL) {
+ fprintf(stderr, "error initializing session\n");
+ exit(1);
+ }
}
if (hd->session) {
@@ -489,7 +491,7 @@ socket_open(socket_st * hd, const char *hostname, const char *service,
gnutls_transport_set_int(hd->session, sd);
}
- if (!(flags & SOCKET_FLAG_RAW)) {
+ if (!(flags & SOCKET_FLAG_RAW) && !(flags & SOCKET_FLAG_SKIP_INIT)) {
err = do_handshake(hd);
if (err == GNUTLS_E_PUSH_ERROR) { /* failed connecting */
gnutls_deinit(hd->session);
@@ -517,7 +519,7 @@ socket_open(socket_st * hd, const char *hostname, const char *service,
exit(1);
}
- if (flags & SOCKET_FLAG_RAW)
+ if ((flags & SOCKET_FLAG_RAW) || (flags & SOCKET_FLAG_SKIP_INIT))
hd->secure = 0;
else
hd->secure = 1;