Loading lib/gtls.c +2 −3 Original line number Diff line number Diff line Loading @@ -452,13 +452,12 @@ Curl_gtls_connect(struct connectdata *conn, /* return number of sent (non-SSL) bytes */ int Curl_gtls_send(struct connectdata *conn, ssize_t Curl_gtls_send(struct connectdata *conn, int sockindex, void *mem, size_t len) { int rc; rc = gnutls_record_send(conn->ssl[sockindex].session, mem, len); ssize_t rc = gnutls_record_send(conn->ssl[sockindex].session, mem, len); if(rc < 0 ) { if(rc == GNUTLS_E_AGAIN) Loading lib/gtls.h +3 −3 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2006, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms Loading @@ -32,7 +32,7 @@ void Curl_gtls_close_all(struct SessionHandle *data); void Curl_gtls_close(struct connectdata *conn); /* close a SSL connection */ /* return number of sent (non-SSL) bytes */ int Curl_gtls_send(struct connectdata *conn, int sockindex, ssize_t Curl_gtls_send(struct connectdata *conn, int sockindex, void *mem, size_t len); ssize_t Curl_gtls_recv(struct connectdata *conn, /* connection data */ int num, /* socketindex */ Loading lib/krb4.h +3 −2 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2006, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms Loading Loading @@ -53,6 +53,7 @@ int Curl_sec_read_msg (struct connectdata *conn, char *, int); int Curl_sec_vfprintf(struct connectdata *, FILE *, const char *, va_list); int Curl_sec_fprintf2(struct connectdata *conn, FILE *f, const char *fmt, ...); int Curl_sec_vfprintf2(struct connectdata *conn, FILE *, const char *, va_list); ssize_t Curl_sec_send(struct connectdata *conn, int, char *, int); int Curl_sec_write(struct connectdata *conn, int, char *, int); void Curl_sec_end (struct connectdata *); Loading lib/security.c +7 −0 Original line number Diff line number Diff line Loading @@ -278,6 +278,13 @@ Curl_sec_write(struct connectdata *conn, int fd, char *buffer, int length) return tx; } ssize_t Curl_sec_send(struct connectdata *conn, int num, char *buffer, int length) { curl_socket_t fd = conn->sock[num]; return (ssize_t)Curl_sec_write(conn, fd, buffer, length); } int Curl_sec_putc(struct connectdata *conn, int c, FILE *F) { Loading lib/sendf.c +42 −36 Original line number Diff line number Diff line Loading @@ -53,7 +53,7 @@ #ifdef HAVE_KRB4 #include "krb4.h" #else #define Curl_sec_write(a,b,c,d) -1 #define Curl_sec_send(a,b,c,d) -1 #define Curl_sec_read(a,b,c,d) -1 #endif Loading Loading @@ -313,35 +313,13 @@ CURLcode Curl_sendf(curl_socket_t sockfd, struct connectdata *conn, return res; } /* * Curl_write() is an internal write function that sends plain (binary) data * to the server. Works with plain sockets, SSL or kerberos. */ CURLcode Curl_write(struct connectdata *conn, curl_socket_t sockfd, static ssize_t Curl_plain_send(struct connectdata *conn, int num, void *mem, size_t len, ssize_t *written) size_t len) { ssize_t bytes_written; CURLcode retcode; int num = (sockfd == conn->sock[SECONDARYSOCKET]); if (conn->ssl[num].use) { /* only TRUE if SSL enabled */ bytes_written = Curl_ssl_send(conn, num, mem, len); } #ifdef USE_LIBSSH2 else if (conn->protocol & PROT_SCP) { bytes_written = Curl_scp_send(conn, num, mem, len); } #endif /* !USE_LIBSSH2 */ else { if(conn->sec_complete) /* only TRUE if krb4 enabled */ bytes_written = Curl_sec_write(conn, sockfd, mem, len); else bytes_written = swrite(sockfd, mem, len); curl_socket_t sockfd = conn->sock[num]; ssize_t bytes_written = swrite(sockfd, mem, len); if(-1 == bytes_written) { int err = Curl_sockerrno(); Loading @@ -351,10 +329,9 @@ CURLcode Curl_write(struct connectdata *conn, /* This is how Windows does it */ (WSAEWOULDBLOCK == err) #else /* As pointed out by Christophe Demory on March 11 2003, errno may be EWOULDBLOCK or on some systems EAGAIN when it returned due to its inability to send off data without blocking. We therefor treat both error codes the same here */ /* errno may be EWOULDBLOCK or on some systems EAGAIN when it returned due to its inability to send off data without blocking. We therefor treat both error codes the same here */ (EWOULDBLOCK == err) || (EAGAIN == err) || (EINTR == err) #endif ) Loading @@ -364,7 +341,36 @@ CURLcode Curl_write(struct connectdata *conn, failf(conn->data, "Send failure: %s", Curl_strerror(conn, err)); } return bytes_written; } /* * Curl_write() is an internal write function that sends data to the * server. Works with plain sockets, SCP, SSL or kerberos. */ CURLcode Curl_write(struct connectdata *conn, curl_socket_t sockfd, void *mem, size_t len, ssize_t *written) { ssize_t bytes_written; CURLcode retcode; int num = (sockfd == conn->sock[SECONDARYSOCKET]); if (conn->ssl[num].use) /* only TRUE if SSL enabled */ bytes_written = Curl_ssl_send(conn, num, mem, len); #ifdef USE_LIBSSH2 else if (conn->protocol & PROT_SCP) bytes_written = Curl_scp_send(conn, num, mem, len); #endif /* !USE_LIBSSH2 */ else if(conn->sec_complete) /* only TRUE if krb4 enabled */ bytes_written = Curl_sec_send(conn, num, mem, len); else bytes_written = Curl_plain_send(conn, num, mem, len); *written = bytes_written; retcode = (-1 != bytes_written)?CURLE_OK:CURLE_SEND_ERROR; Loading Loading
lib/gtls.c +2 −3 Original line number Diff line number Diff line Loading @@ -452,13 +452,12 @@ Curl_gtls_connect(struct connectdata *conn, /* return number of sent (non-SSL) bytes */ int Curl_gtls_send(struct connectdata *conn, ssize_t Curl_gtls_send(struct connectdata *conn, int sockindex, void *mem, size_t len) { int rc; rc = gnutls_record_send(conn->ssl[sockindex].session, mem, len); ssize_t rc = gnutls_record_send(conn->ssl[sockindex].session, mem, len); if(rc < 0 ) { if(rc == GNUTLS_E_AGAIN) Loading
lib/gtls.h +3 −3 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2006, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms Loading @@ -32,7 +32,7 @@ void Curl_gtls_close_all(struct SessionHandle *data); void Curl_gtls_close(struct connectdata *conn); /* close a SSL connection */ /* return number of sent (non-SSL) bytes */ int Curl_gtls_send(struct connectdata *conn, int sockindex, ssize_t Curl_gtls_send(struct connectdata *conn, int sockindex, void *mem, size_t len); ssize_t Curl_gtls_recv(struct connectdata *conn, /* connection data */ int num, /* socketindex */ Loading
lib/krb4.h +3 −2 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2006, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms Loading Loading @@ -53,6 +53,7 @@ int Curl_sec_read_msg (struct connectdata *conn, char *, int); int Curl_sec_vfprintf(struct connectdata *, FILE *, const char *, va_list); int Curl_sec_fprintf2(struct connectdata *conn, FILE *f, const char *fmt, ...); int Curl_sec_vfprintf2(struct connectdata *conn, FILE *, const char *, va_list); ssize_t Curl_sec_send(struct connectdata *conn, int, char *, int); int Curl_sec_write(struct connectdata *conn, int, char *, int); void Curl_sec_end (struct connectdata *); Loading
lib/security.c +7 −0 Original line number Diff line number Diff line Loading @@ -278,6 +278,13 @@ Curl_sec_write(struct connectdata *conn, int fd, char *buffer, int length) return tx; } ssize_t Curl_sec_send(struct connectdata *conn, int num, char *buffer, int length) { curl_socket_t fd = conn->sock[num]; return (ssize_t)Curl_sec_write(conn, fd, buffer, length); } int Curl_sec_putc(struct connectdata *conn, int c, FILE *F) { Loading
lib/sendf.c +42 −36 Original line number Diff line number Diff line Loading @@ -53,7 +53,7 @@ #ifdef HAVE_KRB4 #include "krb4.h" #else #define Curl_sec_write(a,b,c,d) -1 #define Curl_sec_send(a,b,c,d) -1 #define Curl_sec_read(a,b,c,d) -1 #endif Loading Loading @@ -313,35 +313,13 @@ CURLcode Curl_sendf(curl_socket_t sockfd, struct connectdata *conn, return res; } /* * Curl_write() is an internal write function that sends plain (binary) data * to the server. Works with plain sockets, SSL or kerberos. */ CURLcode Curl_write(struct connectdata *conn, curl_socket_t sockfd, static ssize_t Curl_plain_send(struct connectdata *conn, int num, void *mem, size_t len, ssize_t *written) size_t len) { ssize_t bytes_written; CURLcode retcode; int num = (sockfd == conn->sock[SECONDARYSOCKET]); if (conn->ssl[num].use) { /* only TRUE if SSL enabled */ bytes_written = Curl_ssl_send(conn, num, mem, len); } #ifdef USE_LIBSSH2 else if (conn->protocol & PROT_SCP) { bytes_written = Curl_scp_send(conn, num, mem, len); } #endif /* !USE_LIBSSH2 */ else { if(conn->sec_complete) /* only TRUE if krb4 enabled */ bytes_written = Curl_sec_write(conn, sockfd, mem, len); else bytes_written = swrite(sockfd, mem, len); curl_socket_t sockfd = conn->sock[num]; ssize_t bytes_written = swrite(sockfd, mem, len); if(-1 == bytes_written) { int err = Curl_sockerrno(); Loading @@ -351,10 +329,9 @@ CURLcode Curl_write(struct connectdata *conn, /* This is how Windows does it */ (WSAEWOULDBLOCK == err) #else /* As pointed out by Christophe Demory on March 11 2003, errno may be EWOULDBLOCK or on some systems EAGAIN when it returned due to its inability to send off data without blocking. We therefor treat both error codes the same here */ /* errno may be EWOULDBLOCK or on some systems EAGAIN when it returned due to its inability to send off data without blocking. We therefor treat both error codes the same here */ (EWOULDBLOCK == err) || (EAGAIN == err) || (EINTR == err) #endif ) Loading @@ -364,7 +341,36 @@ CURLcode Curl_write(struct connectdata *conn, failf(conn->data, "Send failure: %s", Curl_strerror(conn, err)); } return bytes_written; } /* * Curl_write() is an internal write function that sends data to the * server. Works with plain sockets, SCP, SSL or kerberos. */ CURLcode Curl_write(struct connectdata *conn, curl_socket_t sockfd, void *mem, size_t len, ssize_t *written) { ssize_t bytes_written; CURLcode retcode; int num = (sockfd == conn->sock[SECONDARYSOCKET]); if (conn->ssl[num].use) /* only TRUE if SSL enabled */ bytes_written = Curl_ssl_send(conn, num, mem, len); #ifdef USE_LIBSSH2 else if (conn->protocol & PROT_SCP) bytes_written = Curl_scp_send(conn, num, mem, len); #endif /* !USE_LIBSSH2 */ else if(conn->sec_complete) /* only TRUE if krb4 enabled */ bytes_written = Curl_sec_send(conn, num, mem, len); else bytes_written = Curl_plain_send(conn, num, mem, len); *written = bytes_written; retcode = (-1 != bytes_written)?CURLE_OK:CURLE_SEND_ERROR; Loading