X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Ftcpip.c;h=603f3315ca3ea1a54819d50888da4585b69833d9;hb=8fba4cf2cac1cc543aa4c1063c78b449ebac44a7;hp=b9466d69379fb450eb45e2998924415aec6d3006;hpb=896b145fa7a02199bfc3e8aa824c018b9d7cbf98;p=yaz-moved-to-github.git diff --git a/src/tcpip.c b/src/tcpip.c index b9466d6..603f331 100644 --- a/src/tcpip.c +++ b/src/tcpip.c @@ -434,7 +434,12 @@ void *tcpip_straddr(COMSTACK h, const char *str) const char *port = "210"; struct addrinfo *ai = 0; if (h->protocol == PROTO_HTTP) - port = "80"; + { + if (h->type == ssl_type) + port = "443"; + else + port = "80"; + } if (!tcpip_init()) return 0; @@ -466,7 +471,12 @@ void *tcpip_straddr(COMSTACK h, const char *str) tcpip_state *sp = (tcpip_state *)h->cprivate; int port = 210; if (h->protocol == PROTO_HTTP) - port = 80; + { + if (h->type == ssl_type) + port = 443; + else + port = 80; + } if (!tcpip_init()) return 0; @@ -1159,7 +1169,12 @@ int ssl_get(COMSTACK h, char **buf, int *bufsize) #if HAVE_GNUTLS_H res = gnutls_record_recv(sp->session, *buf + hasread, CS_TCPIP_BUFCHUNK); - if (res < 0) + if (res == 0) + { + TRC(fprintf(stderr, "gnutls_record_recv returned 0\n")); + return 0; + } + else if (res < 0) { if (ssl_check_error(h, sp, res)) break;