/*
* "$Id: http.c 148 2006-04-25 16:54:17Z njacobs $"
*
* HTTP routines for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2005 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
* copyright law. Distribution and use rights are outlined in the file
* "LICENSE.txt" which should have been included with this file. If this
* file is missing or damaged please contact Easy Software Products
* at:
*
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636 USA
*
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
* This file is subject to the Apple OS-Developed Software exception.
*
* Contents:
*
* httpInitialize() - Initialize the HTTP interface library and set the
* default HTTP proxy (if any).
* httpCheck() - Check to see if there is a pending response from
* the server.
* httpClearCookie() - Clear the cookie value(s).
* httpClose() - Close an HTTP connection...
* httpConnect() - Connect to a HTTP server.
* httpConnectEncrypt() - Connect to a HTTP server using encryption.
* httpEncryption() - Set the required encryption on the link.
* httpReconnect() - Reconnect to a HTTP server...
* httpGetSubField() - Get a sub-field value.
* httpSetField() - Set the value of an HTTP header.
* httpDelete() - Send a DELETE request to the server.
* httpGet() - Send a GET request to the server.
* httpHead() - Send a HEAD request to the server.
* httpOptions() - Send an OPTIONS request to the server.
* httpPost() - Send a POST request to the server.
* httpPut() - Send a PUT request to the server.
* httpTrace() - Send an TRACE request to the server.
* httpFlush() - Flush data from a HTTP connection.
* httpRead() - Read data from a HTTP connection.
* httpSetCookie() - Set the cookie value(s)...
* httpWait() - Wait for data available on a connection.
* httpWrite() - Write data to a HTTP connection.
* httpGets() - Get a line of text from a HTTP connection.
* httpPrintf() - Print a formatted string to a HTTP connection.
* httpUpdate() - Update the current HTTP state for incoming data.
* httpDecode64() - Base64-decode a string.
* httpDecode64_2() - Base64-decode a string.
* httpEncode64() - Base64-encode a string.
* httpEncode64_2() - Base64-encode a string.
* httpGetLength() - Get the amount of data remaining from the
* content-length or transfer-encoding fields.
* http_field() - Return the field index for a field name.
* http_send() - Send a request with all fields and the trailing
* blank line.
* http_wait() - Wait for data available on a connection.
* http_upgrade() - Force upgrade to TLS encryption.
* CDSAReadFunc() - Read function for CDSA decryption code.
* CDSAWriteFunc() - Write function for CDSA encryption code.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Include necessary headers...
*/
#include "http-private.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <ctype.h>
#include "string.h"
#include <fcntl.h>
#include <errno.h>
#include "http.h"
#include "debug.h"
#ifndef WIN32
# include <signal.h>
# include <sys/resource.h>
#endif /* !WIN32 */
/*
* Some operating systems have done away with the Fxxxx constants for
* the fcntl() call; this works around that "feature"...
*/
#ifndef FNONBLK
#endif /* !FNONBLK */
/*
* Local functions...
*/
const char *uri);
#ifdef HAVE_SSL
# ifdef HAVE_CDSASSL
# endif /* HAVE_CDSASSL */
#endif /* HAVE_SSL */
/*
* Local globals...
*/
static const char * const http_fields[] =
{
"Accept-Language",
"Accept-Ranges",
"Authorization",
"Connection",
"Content-Encoding",
"Content-Language",
"Content-Length",
"Content-Location",
"Content-MD5",
"Content-Range",
"Content-Type",
"Content-Version",
"Date",
"Host",
"If-Modified-Since",
"If-Unmodified-since",
"Keep-Alive",
"Last-Modified",
"Link",
"Location",
"Range",
"Referer",
"Retry-After",
"Transfer-Encoding",
"Upgrade",
"User-Agent",
"WWW-Authenticate"
};
{
"Sun",
"Mon",
"Tue",
"Wed",
"Thu",
"Fri",
"Sat"
};
{
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec"
};
void
{
int i, j, ch;
for (i = 0; i < bytes; i += 16) {
for (j = 0; j < 16 && (i + j) < bytes; j ++)
while (j < 16) {
j++;
}
for (j = 0; j < 16 && (i + j) < bytes; j ++) {
ch = '.';
}
}
}
/*
* 'httpInitialize()' - Initialize the HTTP interface library and set the
* default HTTP proxy (if any).
*/
void
httpInitialize(void)
{
#ifdef HAVE_LIBSSL
# ifndef WIN32
# endif /* !WIN32 */
int i; /* Looping var */
#endif /* HAVE_LIBSSL */
#ifdef WIN32
if (!initialized)
#elif defined(HAVE_SIGSET)
#elif defined(HAVE_SIGACTION)
/*
* Ignore SIGPIPE signals...
*/
#else
#endif /* WIN32 */
#ifdef HAVE_GNUTLS
#endif /* HAVE_GNUTLS */
#ifdef HAVE_LIBSSL
/*
* Using the current time is a dubious random seed, but on some systems
* it is the best we can do (on others, this seed isn't even used...)
*/
#ifdef WIN32
#else
#endif /* WIN32 */
for (i = 0; i < sizeof(data); i ++)
#endif /* HAVE_LIBSSL */
}
/*
* 'httpCheck()' - Check to see if there is a pending response from the server.
*/
int /* O - 0 = no data, 1 = data available */
{
}
/*
* 'httpClearCookie()' - Clear the cookie value(s).
*/
void
{
if (!http)
return;
{
}
}
/*
* 'httpClose()' - Close an HTTP connection...
*/
void
{
if (!http)
return;
#ifdef HAVE_SSL
#endif /* HAVE_SSL */
#ifdef WIN32
#else
#endif /* WIN32 */
}
/*
* 'httpConnect()' - Connect to a HTTP server.
*/
http_t * /* O - New HTTP connection */
int port) /* I - Port number */
{
/*
* Set the default encryption status...
*/
if (port == 443)
else
}
/*
* 'httpConnectEncrypt()' - Connect to a HTTP server using encryption.
*/
http_t * /* O - New HTTP connection */
int port, /* I - Port number */
/* I - Type of encryption to use */
{
int i; /* Looping var */
DEBUG_printf(("httpConnectEncrypt(host=\"%s\", port=%d, encrypt=%d)\n",
if (!host)
return (NULL);
/*
* Lookup the host...
*/
{
/*
* This hack to make users that don't have a localhost entry in
* their hosts file or DNS happy...
*/
return (NULL);
return (NULL);
}
/*
* Verify that it is an IPv4, IPv6, or domain address...
*/
#ifdef AF_INET6
#endif /* AF_INET6 */
#ifdef AF_LOCAL
#endif /* AF_LOCAL */
)
return (NULL);
/*
* Allocate memory for the structure...
*/
return (NULL);
/*
* Set the encryption status...
*/
else
/*
* Loop through the addresses we have until one of them connects...
*/
for (i = 0; hostaddr->h_addr_list[i]; i ++)
{
/*
* Load the address...
*/
/*
* Connect to the remote system...
*/
if (!httpReconnect(http))
return (http);
}
/*
* Could not connect to any known address - bail out!
*/
return (NULL);
}
/*
* 'httpEncryption()' - Set the required encryption on the link.
*/
int /* O - -1 on error, 0 on success */
http_encryption_t e) /* I - New encryption preference */
{
#ifdef HAVE_SSL
if (!http)
return (0);
http->encryption = e;
return (httpReconnect(http));
return (http_upgrade(http));
else
return (0);
#else
if (e == HTTP_ENCRYPT_ALWAYS || e == HTTP_ENCRYPT_REQUIRED)
return (-1);
else
return (0);
#endif /* HAVE_SSL */
}
/*
* 'httpReconnect()' - Reconnect to a HTTP server...
*/
int /* O - 0 on success, non-zero on failure */
{
if (!http)
return (-1);
#ifdef HAVE_SSL
#endif /* HAVE_SSL */
/*
* Close any previously open socket...
*/
#ifdef WIN32
#else
#endif /* WIN32 */
/*
* Create the socket and set options to allow reuse.
*/
{
#ifdef WIN32
#else
#endif /* WIN32 */
return (-1);
}
#ifdef FD_CLOEXEC
* other processes... */
#endif /* FD_CLOEXEC */
val = 1;
#ifdef SO_REUSEPORT
val = 1;
#endif /* SO_REUSEPORT */
/*
* Using TCP_NODELAY improves responsiveness, especially on systems
* with a slow loopback interface... Since we write large buffers
* when sending print files and requests, there shouldn't be any
* performance penalty for this...
*/
val = 1;
#ifdef WIN32
#else
#endif /* WIN32 */
/*
* Connect to the server...
*/
#ifdef AF_INET6
else
#endif /* AF_INET6 */
#ifdef AF_LOCAL
else
#endif /* AF_LOCAL */
if (status < 0)
{
#ifdef WIN32
#else
#endif /* WIN32 */
#ifdef WIN32
#else
#endif
return (-1);
}
#ifdef HAVE_SSL
{
/*
* Always do encryption via SSL.
*/
if (http_setup_ssl(http) != 0)
{
#ifdef WIN32
#else
#endif /* WIN32 */
return (-1);
}
}
return (http_upgrade(http));
#endif /* HAVE_SSL */
return (0);
}
/*
* 'httpGetSubField()' - Get a sub-field value.
*/
char * /* O - Value or NULL */
const char *name, /* I - Name of sub-field */
char *value) /* O - Value string */
{
DEBUG_printf(("httpGetSubField(http=%p, field=%d, name=\"%s\", value=%p)\n",
return (NULL);
{
/*
* Skip leading whitespace...
*/
fptr ++;
if (*fptr == ',')
{
fptr ++;
continue;
}
/*
* Get the sub-field name...
*/
*ptr = '\0';
/*
* Skip trailing chars up to the '='...
*/
fptr ++;
if (!*fptr)
break;
if (*fptr != '=')
continue;
/*
* Skip = and leading whitespace...
*/
fptr ++;
fptr ++;
if (*fptr == '\"')
{
/*
* Read quoted string...
*/
*ptr = '\0';
fptr ++;
if (*fptr)
fptr ++;
}
else
{
/*
* Read unquoted string...
*/
*ptr = '\0';
fptr ++;
}
/*
* See if this is the one...
*/
return (value);
}
value[0] = '\0';
return (NULL);
}
/*
* 'httpSetField()' - Set the value of an HTTP header.
*/
void
const char *value) /* I - Value */
{
return;
}
/*
* 'httpDelete()' - Send a DELETE request to the server.
*/
int /* O - Status of call (0 = success) */
const char *uri) /* I - URI to delete */
{
}
/*
* 'httpGet()' - Send a GET request to the server.
*/
int /* O - Status of call (0 = success) */
const char *uri) /* I - URI to get */
{
}
/*
* 'httpHead()' - Send a HEAD request to the server.
*/
int /* O - Status of call (0 = success) */
const char *uri) /* I - URI for head */
{
}
/*
* 'httpOptions()' - Send an OPTIONS request to the server.
*/
int /* O - Status of call (0 = success) */
const char *uri) /* I - URI for options */
{
}
/*
* 'httpPost()' - Send a POST request to the server.
*/
int /* O - Status of call (0 = success) */
const char *uri) /* I - URI for post */
{
}
/*
* 'httpPut()' - Send a PUT request to the server.
*/
int /* O - Status of call (0 = success) */
const char *uri) /* I - URI to put */
{
}
/*
* 'httpTrace()' - Send an TRACE request to the server.
*/
int /* O - Status of call (0 = success) */
const char *uri) /* I - URI for trace */
{
}
/*
* 'httpFlush()' - Flush data from a HTTP connection.
*/
void
{
}
/*
* 'httpRead()' - Read data from a HTTP connection.
*/
int /* O - Number of bytes read */
char *buffer, /* I - Buffer for data */
int length) /* I - Maximum number of bytes */
{
DEBUG_printf(("httpRead(http=%p, buffer=%p, length=%d)\n",
return (-1);
if (length <= 0)
return (0);
http->data_remaining <= 0)
{
DEBUG_puts("httpRead: Getting chunk length...");
{
DEBUG_puts("httpRead: Could not get length!");
return (0);
}
if (http->data_remaining < 0)
{
DEBUG_puts("httpRead: Negative chunk length!");
return (0);
}
}
if (http->data_remaining <= 0)
{
/*
* A zero-length chunk ends a transfer; unless we are reading POST
* data, go idle...
*/
else
/*
* Prevent future reads for this request...
*/
return (0);
}
{
/*
* Buffer small reads for better performance...
*/
return (0);
else
#ifdef HAVE_SSL
else
#endif /* HAVE_SSL */
{
DEBUG_printf(("httpRead: reading %d bytes from socket into buffer...\n",
bytes));
DEBUG_printf(("httpRead: read %d bytes from socket into buffer...\n",
bytes));
#ifdef DEBUG_HTTP
#endif
}
if (bytes > 0)
else if (bytes < 0)
{
#ifdef WIN32
return (-1);
#else
{
return (-1);
}
#endif /* WIN32 */
}
else
{
return (0);
}
}
{
}
#ifdef HAVE_SSL
{
return (0);
}
#endif /* HAVE_SSL */
else
{
return (0);
break;
}
#ifdef DEBUG_HTTP
#endif
if (bytes > 0)
else if (bytes < 0)
{
#ifdef WIN32
#else
bytes = 0;
else
#endif /* WIN32 */
}
else
{
return (0);
}
if (http->data_remaining == 0)
{
{
else
}
}
return (bytes);
}
/*
* 'httpSetCookie()' - Set the cookie value(s)...
*/
void
const char *cookie) /* I - Cookie string */
{
if (!http)
return;
if (cookie)
else
}
/*
* 'httpWait()' - Wait for data available on a connection.
*/
int /* O - 1 if data is available, 0 otherwise */
int msec) /* I - Milliseconds to wait */
{
/*
* First see if there is data in the buffer...
*/
return (0);
return (1);
/*
*/
}
/*
* 'httpWrite()' - Write data to a HTTP connection.
*/
int /* O - Number of bytes written */
const char *buffer, /* I - Buffer for data */
int length) /* I - Number of bytes to write */
{
return (-1);
{
return (-1);
if (length == 0)
{
/*
* A zero-length chunk ends a transfer; unless we are sending POST
* or PUT data, go idle...
*/
else
return (-1);
return (0);
}
}
tbytes = 0;
while (length > 0)
{
#ifdef HAVE_SSL
else
#endif /* HAVE_SSL */
#ifdef DEBUG_HTTP
if (bytes >= 0)
#endif /* DEBUG */
if (bytes < 0)
{
#ifdef WIN32
{
continue;
}
#else
continue;
{
continue;
}
#endif /* WIN32 */
DEBUG_puts("httpWrite: error writing data...\n");
return (-1);
}
}
return (-1);
{
/*
* Finished with the transfer; unless we are sending POST or PUT
* data, go idle...
*/
else
}
return (tbytes);
}
/*
* 'httpGets()' - Get a line of text from a HTTP connection.
*/
char * /* O - Line or NULL */
int length, /* I - Max length of buffer */
{
return (NULL);
/*
* Pre-scan the buffer and see if there is a newline in there...
*/
#ifdef WIN32
WSASetLastError(0);
#else
errno = 0;
#endif /* WIN32 */
do
{
if (*bufptr == 0x0a)
break;
else
bufptr ++;
{
/*
* No newline; see if there is more data to be read...
*/
return (NULL);
#ifdef HAVE_SSL
else
#endif /* HAVE_SSL */
#ifdef DEBUG_HTTP
#endif
if (bytes < 0)
{
/*
* Nope, can't get a line this time...
*/
#ifdef WIN32
{
continue;
}
#else
continue;
{
continue;
}
#endif /* WIN32 */
return (NULL);
}
else if (bytes == 0)
{
return (NULL);
}
/*
* Yup, update the amount used and the end pointer...
*/
}
}
/*
* Read a line from the buffer...
*/
bytes = 0;
length --;
{
bytes ++;
if (*bufptr == 0x0a)
{
bufptr ++;
break;
}
else if (*bufptr == 0x0d)
bufptr ++;
else
}
if (bytes > 0)
{
*lineptr = '\0';
return (line);
}
DEBUG_puts("httpGets: No new line available!");
return (NULL);
}
/*
* 'httpPrintf()' - Print a formatted string to a HTTP connection.
*/
int /* O - Number of bytes written */
const char *format, /* I - printf-style format string */
...) /* I - Additional args as needed */
{
{
#ifdef HAVE_SSL
else
#endif /* HAVE_SSL */
#ifdef DEBUG_HTTP
if (nbytes >= 0)
#endif
if (nbytes < 0)
{
nbytes = 0;
#ifdef WIN32
{
continue;
}
#else
continue;
{
continue;
}
#endif /* WIN32 */
return (-1);
}
}
return (bytes);
}
/*
*/
{
return (datetime);
}
/*
*/
time_t /* O - UNIX time */
{
int i; /* Looping var */
return (0);
for (i = 0; i < 12; i ++)
break;
if (i >= 12)
return (0);
}
/*
* 'httpUpdate()' - Update the current HTTP state for incoming data.
*/
http_status_t /* O - HTTP status */
{
/*
* If we haven't issued any commands, then there is nothing to "update"...
*/
return (HTTP_CONTINUE);
/*
* Grab all of the lines we can from the connection...
*/
line[0] = '\0';
{
if (line[0] == '\0')
{
/*
* Blank line means the start of the data section (if any). Return
* the result code, too...
*
* If we get status 100 (HTTP_CONTINUE), then we *don't* change states.
* Instead, we just return HTTP_CONTINUE to the caller and keep on
* tryin'...
*/
http->digest_tries = 0;
#ifdef HAVE_SSL
{
if (http_setup_ssl(http) != 0)
{
# ifdef WIN32
# else
# endif /* WIN32 */
return (HTTP_ERROR);
}
return (HTTP_CONTINUE);
}
#endif /* HAVE_SSL */
{
case HTTP_GET :
case HTTP_POST :
case HTTP_POST_RECV :
case HTTP_PUT :
case HTTP_POST_SEND :
break;
default :
break;
}
}
{
/*
* Got the beginning of a response...
*/
return (HTTP_ERROR);
}
{
/*
* Got a value...
*/
*value++ = '\0';
value ++;
/*
* Be tolerants of servers that send unknown attribute fields...
*/
{
/*
* "Expect: 100-continue" or similar...
*/
}
{
/*
* "Cookie: name=value[; name=value ...]" - replaces previous cookies...
*/
}
{
continue;
}
else
}
else
{
return (HTTP_ERROR);
}
}
/*
* See if there was an error...
*/
{
return (HTTP_ERROR);
}
/*
* If we haven't already returned, then there is nothing new...
*/
return (HTTP_CONTINUE);
}
/*
* 'httpDecode64()' - Base64-decode a string.
*/
char * /* O - Decoded string */
const char *in) /* I - String to read from */
{
/*
* Use the old maximum buffer size for binary compatibility...
*/
outlen = 512;
}
/*
* 'httpDecode64_2()' - Base64-decode a string.
*/
char * /* O - Decoded string */
int *outlen, /* IO - Size of output string */
const char *in) /* I - String to read from */
{
/*
* Range check input...
*/
return (NULL);
/*
* Convert from base-64 to bytes...
*/
{
/*
* Decode this character into a number from 0 to 63...
*/
else if (*in == '+')
base64 = 62;
else if (*in == '/')
base64 = 63;
else if (*in == '=')
break;
else
continue;
/*
* Store the result in the appropriate chars...
*/
switch (pos)
{
case 0 :
pos ++;
break;
case 1 :
pos ++;
break;
case 2 :
pos ++;
break;
case 3 :
pos = 0;
break;
}
}
*outptr = '\0';
/*
* Return the decoded string and size...
*/
return (out);
}
/*
* 'httpEncode64()' - Base64-encode a string.
*/
char * /* O - Encoded string */
const char *in) /* I - String to read from */
{
}
/*
* 'httpEncode64_2()' - Base64-encode a string.
*/
char * /* O - Encoded string */
int outlen, /* I - Size of output string */
const char *in, /* I - String to read from */
int inlen) /* I - Size of input string */
{
{
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
"0123456789"
"+/"
};
/*
* Range check input...
*/
return (NULL);
/*
* Convert bytes to base-64...
*/
{
/*
* Encode the up to 3 characters as 4 Base64 numbers...
*/
in ++;
inlen --;
if (inlen <= 0)
{
*outptr ++ = '=';
*outptr ++ = '=';
break;
}
in ++;
inlen --;
if (inlen <= 0)
{
*outptr ++ = '=';
break;
}
}
*outptr = '\0';
/*
* Return the encoded string...
*/
return (out);
}
/*
* 'httpGetLength()' - Get the amount of data remaining from the
* content-length or transfer-encoding fields.
*/
int /* O - Content length */
{
{
DEBUG_puts("httpGetLength: chunked request!");
http->data_remaining = 0;
}
else
{
/*
* The following is a hack for HTTP servers that don't send a
* content-length or transfer-encoding field...
*
* If there is no content-length then the connection must close
* after the transfer is complete...
*/
else
}
return (http->data_remaining);
}
/*
* 'http_field()' - Return the field index for a field name.
*/
static http_field_t /* O - Field index */
{
int i; /* Looping var */
for (i = 0; i < HTTP_FIELD_MAX; i ++)
return ((http_field_t)i);
return (HTTP_FIELD_UNKNOWN);
}
/*
* 'http_send()' - Send a request with all fields and the trailing blank line.
*/
static int /* O - 0 on success, non-zero on error */
const char *uri) /* I - URI */
{
int i; /* Looping var */
static const char * const codes[] =
{ /* Request code strings */
NULL,
"OPTIONS",
"GET",
NULL,
"HEAD",
"POST",
NULL,
NULL,
"PUT",
NULL,
"DELETE",
"TRACE",
"CLOSE"
};
/* Hex digits */
DEBUG_printf(("http_send(http=%p, request=HTTP_%s, uri=\"%s\")\n",
return (-1);
/*
* Encode the URI as needed...
*/
{
*ptr ++ = '%';
}
else
*ptr = '\0';
/*
* See if we had an error the last time around; if so, reconnect...
*/
/*
* Send the request header...
*/
#ifdef HAVE_SSL
{
}
#endif /* HAVE_SSL */
{
return (-1);
}
for (i = 0; i < HTTP_FIELD_MAX; i ++)
{
{
return (-1);
}
}
{
return (-1);
}
return (0);
}
/*
* 'http_wait()' - Wait for data available on a connection.
*/
static int /* O - 1 if data is available, 0 otherwise */
int msec) /* I - Milliseconds to wait */
{
#ifndef WIN32
#endif /* !WIN32 */
/*
*/
#ifdef HAVE_SSL
{
# ifdef HAVE_LIBSSL
return (1);
# elif defined(HAVE_GNUTLS)
return (1);
# elif defined(HAVE_CDSASSL)
return;
# endif /* HAVE_LIBSSL */
}
#endif /* HAVE_SSL */
/*
* Then try doing a select() to poll the socket...
*/
{
#ifdef WIN32
/*
* Windows has a fixed-size select() structure, different (surprise,
* surprise!) from all UNIX implementations. Just allocate this
* fixed structure...
*/
#else
/*
* Allocate the select() input set based upon the max number of file
* descriptors available for this process...
*/
#endif /* WIN32 */
return (0);
}
do
{
if (msec >= 0)
{
}
else
}
#ifdef WIN32
#else
#endif /* WIN32 */
return (nfds > 0);
}
#ifdef HAVE_SSL
/*
* 'http_upgrade()' - Force upgrade to TLS encryption.
*/
static int /* O - Status of connection */
{
/*
* Copy the HTTP data to a local variable so we can do the OPTIONS
* request without interfering with the existing request data...
*/
/*
* Send an OPTIONS request to the server, requiring SSL or TLS
* encryption on the link...
*/
{
/*
* Wait for the secure connection...
*/
}
/*
* Copy the HTTP data back over, if any...
*/
/*
* See if we actually went secure...
*/
{
/*
* Server does not support HTTP upgrade...
*/
DEBUG_puts("Server does not support HTTP upgrade!");
# ifdef WIN32
# else
# endif
return (-1);
}
else
return (ret);
}
/*
*/
static int /* O - Status of connection */
{
# ifdef HAVE_LIBSSL
# elif defined(HAVE_GNUTLS)
/* TLS credentials */
# elif defined(HAVE_CDSASSL)
# endif /* HAVE_LIBSSL */
# ifdef HAVE_LIBSSL
{
# ifdef DEBUG
while ((error = ERR_get_error()) != 0)
# endif /* DEBUG */
# ifdef WIN32
# else
# endif /* WIN32 */
return (HTTP_ERROR);
}
# elif defined(HAVE_GNUTLS)
{
return (-1);
}
malloc(sizeof(gnutls_certificate_client_credentials));
if (credentials == NULL)
{
return (-1);
}
{
return (-1);
}
# elif defined(HAVE_CDSASSL)
if (!error)
if (!error)
if (!error)
if (!error)
if (!error)
if (error != 0)
{
return (-1);
}
# endif /* HAVE_CDSASSL */
return (0);
}
/*
*/
static void
{
# ifdef HAVE_LIBSSL
# elif defined(HAVE_GNUTLS)
/* TLS credentials */
# elif defined(HAVE_CDSASSL)
# endif /* HAVE_LIBSSL */
}
/*
*/
static int /* O - Bytes read */
char *buf, /* I - Buffer to store data */
int len) /* I - Length of buffer */
{
# if defined(HAVE_LIBSSL)
# elif defined(HAVE_GNUTLS)
# elif defined(HAVE_CDSASSL)
if (error == 0)
return (processed);
else
{
return (-1);
}
# endif /* HAVE_LIBSSL */
}
/*
*/
static int /* O - Bytes written */
const char *buf, /* I - Buffer holding data */
int len) /* I - Length of buffer */
{
# if defined(HAVE_LIBSSL)
# elif defined(HAVE_GNUTLS)
# elif defined(HAVE_CDSASSL)
if (error == 0)
return (processed);
else
{
return (-1);
}
# endif /* HAVE_LIBSSL */
}
# if defined(HAVE_CDSASSL)
/*
* 'CDSAReadFunc()' - Read function for CDSA decryption code.
*/
static OSStatus /* O - -1 on error, 0 on success */
void *data, /* I - Data buffer */
{
#ifdef DEBUG_HTTP
#endif
if (bytes >= 0)
{
*dataLength = bytes;
return (0);
}
else
return (-1);
}
/*
* 'CDSAWriteFunc()' - Write function for CDSA encryption code.
*/
static OSStatus /* O - -1 on error, 0 on success */
const void *data, /* I - Data buffer */
{
if (bytes >= 0)
{
*dataLength = bytes;
return (0);
}
else
return (-1);
}
# endif /* HAVE_CDSASSL */
#endif /* HAVE_SSL */
/*
* End of "$Id: http.c 148 2006-04-25 16:54:17Z njacobs $"
*/