/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2011 Index Data
+ * Copyright (C) 1995-2012 Index Data
* See the file LICENSE for details.
*/
/**
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;
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;
#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;