projects
/
yaz-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Link SSL with libyaz.la and yaz-client only.
[yaz-moved-to-github.git]
/
src
/
tcpip.c
diff --git
a/src/tcpip.c
b/src/tcpip.c
index
b1f9fa9
..
b992319
100644
(file)
--- a/
src/tcpip.c
+++ b/
src/tcpip.c
@@
-1,8
+1,6
@@
-/*
- * Copyright (C) 1995-2007, Index Data ApS
+/* This file is part of the YAZ toolkit.
+ * Copyright (C) 1995-2008 Index Data
* See the file LICENSE for details.
* See the file LICENSE for details.
- *
- * $Id: tcpip.c,v 1.35 2007-10-07 08:53:26 adam Exp $
*/
/**
* \file tcpip.c
*/
/**
* \file tcpip.c
@@
-46,9
+44,6
@@
#if HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#if HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
-#if HAVE_SYS_SELECT_H
-#include <sys/select.h>
-#endif
#if HAVE_SYS_WAIT_H
#include <sys/wait.h>
#endif
#if HAVE_SYS_WAIT_H
#include <sys/wait.h>
#endif
@@
-104,7
+99,7
@@
typedef struct tcpip_state
int written; /* -1 if we aren't writing */
int towrite; /* to verify against user input */
int written; /* -1 if we aren't writing */
int towrite; /* to verify against user input */
- int (*complete)(const unsigned char *buf, int len); /* length/comple. */
+ int (*complete)(const char *buf, int len); /* length/complete. */
#if HAVE_GETADDRINFO
struct addrinfo *ai;
#else
#if HAVE_GETADDRINFO
struct addrinfo *ai;
#else
@@
-227,7
+222,7
@@
COMSTACK yaz_tcpip_create(int s, int flags, int protocol,
if (connect_host)
{
tcpip_state *sp = (tcpip_state *) p->cprivate;
if (connect_host)
{
tcpip_state *sp = (tcpip_state *) p->cprivate;
- sp->connect_request_buf = xmalloc(strlen(connect_host) + 30);
+ sp->connect_request_buf = (char *) xmalloc(strlen(connect_host) + 30);
sprintf(sp->connect_request_buf, "CONNECT %s HTTP/1.0\r\n\r\n",
connect_host);
sp->connect_request_len = strlen(sp->connect_request_buf);
sprintf(sp->connect_request_buf, "CONNECT %s HTTP/1.0\r\n\r\n",
connect_host);
sp->connect_request_len = strlen(sp->connect_request_buf);
@@
-409,8
+404,7
@@
int tcpip_more(COMSTACK h)
{
tcpip_state *sp = (tcpip_state *)h->cprivate;
{
tcpip_state *sp = (tcpip_state *)h->cprivate;
- return sp->altlen && (*sp->complete)((unsigned char *) sp->altbuf,
- sp->altlen);
+ return sp->altlen && (*sp->complete)(sp->altbuf, sp->altlen);
}
/*
}
/*
@@
-724,7
+718,15
@@
int tcpip_listen(COMSTACK h, char *raddr, int *addrlen,
)
h->cerrno = CSNODATA;
else
)
h->cerrno = CSNODATA;
else
+ {
+#ifdef WIN32
+ shutdown(h->iofile, SD_RECEIVE);
+#else
+ shutdown(h->iofile, SHUT_RD);
+#endif
+ listen(h->iofile, SOMAXCONN);
h->cerrno = CSYSERR;
h->cerrno = CSYSERR;
+ }
return -1;
}
if (addrlen && (size_t) (*addrlen) >= sizeof(struct sockaddr_in))
return -1;
}
if (addrlen && (size_t) (*addrlen) >= sizeof(struct sockaddr_in))
@@
-824,9
+826,9
@@
COMSTACK tcpip_accept(COMSTACK h)
state->ssl = SSL_new (state->ctx);
SSL_set_fd (state->ssl, cnew->iofile);
}
state->ssl = SSL_new (state->ctx);
SSL_set_fd (state->ssl, cnew->iofile);
}
+#endif
state->connect_request_buf = 0;
state->connect_response_buf = 0;
state->connect_request_buf = 0;
state->connect_response_buf = 0;
-#endif
h = cnew;
}
if (h->state == CS_ST_ACCEPT)
h = cnew;
}
if (h->state == CS_ST_ACCEPT)
@@
-895,7
+897,7
@@
int tcpip_get(COMSTACK h, char **buf, int *bufsize)
sp->altsize = tmpi;
}
h->io_pending = 0;
sp->altsize = tmpi;
}
h->io_pending = 0;
- while (!(berlen = (*sp->complete)((unsigned char *)*buf, hasread)))
+ while (!(berlen = (*sp->complete)(*buf, hasread)))
{
if (!*bufsize)
{
{
if (!*bufsize)
{
@@
-1026,7
+1028,7
@@
int ssl_get(COMSTACK h, char **buf, int *bufsize)
sp->altsize = tmpi;
}
h->io_pending = 0;
sp->altsize = tmpi;
}
h->io_pending = 0;
- while (!(berlen = (*sp->complete)((unsigned char *)*buf, hasread)))
+ while (!(berlen = (*sp->complete)(*buf, hasread)))
{
if (!*bufsize)
{
{
if (!*bufsize)
{