hostname and large file support added
This commit is contained in:
parent
31b8eea041
commit
1b1f143cd6
@ -13,12 +13,15 @@ AC_CANONICAL_TARGET
|
|||||||
|
|
||||||
dnl Checks for programs.
|
dnl Checks for programs.
|
||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
|
|
||||||
|
dnl Check for AIX weirdos
|
||||||
|
AC_AIX
|
||||||
|
|
||||||
|
AC_SYS_LARGEFILE
|
||||||
dnl The install stuff has already been taken care of by the automake stuff
|
dnl The install stuff has already been taken care of by the automake stuff
|
||||||
dnl AC_PROG_INSTALL
|
dnl AC_PROG_INSTALL
|
||||||
AC_PROG_MAKE_SET
|
AC_PROG_MAKE_SET
|
||||||
|
|
||||||
dnl Check for AIX weirdos
|
|
||||||
AC_AIX
|
|
||||||
|
|
||||||
dnl **********************************************************************
|
dnl **********************************************************************
|
||||||
dnl Checks for libraries.
|
dnl Checks for libraries.
|
||||||
|
75
largefile.m4
Normal file
75
largefile.m4
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
#serial 12
|
||||||
|
|
||||||
|
dnl By default, many hosts won't let programs access large files;
|
||||||
|
dnl one must use special compiler options to get large-file access to work.
|
||||||
|
dnl For more details about this brain damage please see:
|
||||||
|
dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html
|
||||||
|
|
||||||
|
dnl Written by Paul Eggert <eggert@twinsun.com>.
|
||||||
|
|
||||||
|
dnl Internal subroutine of AC_SYS_LARGEFILE.
|
||||||
|
dnl AC_SYS_LARGEFILE_TEST_INCLUDES
|
||||||
|
AC_DEFUN(AC_SYS_LARGEFILE_TEST_INCLUDES,
|
||||||
|
[[#include <sys/types.h>
|
||||||
|
int a[(off_t) 9223372036854775807 == 9223372036854775807 ? 1 : -1];
|
||||||
|
]])
|
||||||
|
|
||||||
|
dnl Internal subroutine of AC_SYS_LARGEFILE.
|
||||||
|
dnl AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE, CACHE-VAR, COMMENT, INCLUDES, FUNCTION-BODY)
|
||||||
|
AC_DEFUN(AC_SYS_LARGEFILE_MACRO_VALUE,
|
||||||
|
[AC_CACHE_CHECK([for $1 value needed for large files], $3,
|
||||||
|
[$3=no
|
||||||
|
AC_TRY_COMPILE(AC_SYS_LARGEFILE_TEST_INCLUDES
|
||||||
|
$5
|
||||||
|
,
|
||||||
|
[$6],
|
||||||
|
,
|
||||||
|
[AC_TRY_COMPILE([#define $1 $2]
|
||||||
|
AC_SYS_LARGEFILE_TEST_INCLUDES
|
||||||
|
$5
|
||||||
|
,
|
||||||
|
[$6],
|
||||||
|
[$3=$2])])])
|
||||||
|
if test "[$]$3" != no; then
|
||||||
|
AC_DEFINE_UNQUOTED([$1], [$]$3, [$4])
|
||||||
|
fi])
|
||||||
|
|
||||||
|
AC_DEFUN(AC_SYS_LARGEFILE,
|
||||||
|
[AC_ARG_ENABLE(largefile,
|
||||||
|
[ --disable-largefile omit support for large files])
|
||||||
|
if test "$enable_largefile" != no; then
|
||||||
|
|
||||||
|
AC_CACHE_CHECK([for special C compiler options needed for large files],
|
||||||
|
ac_cv_sys_largefile_CC,
|
||||||
|
[ac_cv_sys_largefile_CC=no
|
||||||
|
if test "$GCC" != yes; then
|
||||||
|
# IRIX 6.2 and later do not support large files by default,
|
||||||
|
# so use the C compiler's -n32 option if that helps.
|
||||||
|
AC_TRY_COMPILE(AC_SYS_LARGEFILE_TEST_INCLUDES, , ,
|
||||||
|
[ac_save_CC="$CC"
|
||||||
|
CC="$CC -n32"
|
||||||
|
AC_TRY_COMPILE(AC_SYS_LARGEFILE_TEST_INCLUDES, ,
|
||||||
|
ac_cv_sys_largefile_CC=' -n32')
|
||||||
|
CC="$ac_save_CC"])
|
||||||
|
fi])
|
||||||
|
if test "$ac_cv_sys_largefile_CC" != no; then
|
||||||
|
CC="$CC$ac_cv_sys_largefile_CC"
|
||||||
|
fi
|
||||||
|
|
||||||
|
AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, 64,
|
||||||
|
ac_cv_sys_file_offset_bits,
|
||||||
|
[Number of bits in a file offset, on hosts where this is settable.])
|
||||||
|
AC_SYS_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE, 1,
|
||||||
|
ac_cv_sys_largefile_source,
|
||||||
|
[Define to make ftello visible on some hosts (e.g. HP-UX 10.20).],
|
||||||
|
[#include <stdio.h>], [return !ftello;])
|
||||||
|
AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1,
|
||||||
|
ac_cv_sys_large_files,
|
||||||
|
[Define for large files, on AIX-style hosts.])
|
||||||
|
dnl lftp does not need ftello, and _XOPEN_SOURCE=500 makes resolv.h fail.
|
||||||
|
dnl AC_SYS_LARGEFILE_MACRO_VALUE(_XOPEN_SOURCE, 500,
|
||||||
|
dnl ac_cv_sys_xopen_source,
|
||||||
|
dnl [Define to make ftello visible on some hosts (e.g. glibc 2.1.3).],
|
||||||
|
dnl [#include <stdio.h>], [return !ftello;])
|
||||||
|
fi
|
||||||
|
])
|
@ -69,7 +69,7 @@
|
|||||||
#include "urldata.h"
|
#include "urldata.h"
|
||||||
#include "sendf.h"
|
#include "sendf.h"
|
||||||
|
|
||||||
#ifndef HAVE_INET_NTOA_R_DECL
|
#if defined(HAVE_INET_NTOA_R) && !defined(HAVE_INET_NTOA_R_DECL)
|
||||||
#include "inet_ntoa_r.h"
|
#include "inet_ntoa_r.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
22
lib/http.c
22
lib/http.c
@ -38,12 +38,6 @@
|
|||||||
* ------------------------------------------------------------
|
* ------------------------------------------------------------
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef NEED_REENTRANT
|
|
||||||
#define _REENTRANT /* Necessary to use in Solaris, since the silly guys at Sun
|
|
||||||
made the localtime_r() prototype dependent on it (or
|
|
||||||
_POSIX_C_SOURCE or _POSIX_PTHREAD_SEMANTICS). */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* -- WIN32 approved -- */
|
/* -- WIN32 approved -- */
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -57,6 +51,12 @@
|
|||||||
|
|
||||||
#include "setup.h"
|
#include "setup.h"
|
||||||
|
|
||||||
|
#ifdef NEED_REENTRANT
|
||||||
|
#define _REENTRANT /* Necessary to use in Solaris, since the silly guys at Sun
|
||||||
|
made the localtime_r() prototype dependent on it (or
|
||||||
|
_POSIX_C_SOURCE or _POSIX_PTHREAD_SEMANTICS). */
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__)
|
#if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__)
|
||||||
#include <winsock.h>
|
#include <winsock.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
@ -378,7 +378,7 @@ CURLcode http(struct connectdata *conn)
|
|||||||
#ifdef HAVE_LOCALTIME_R
|
#ifdef HAVE_LOCALTIME_R
|
||||||
/* thread-safe version */
|
/* thread-safe version */
|
||||||
struct tm keeptime;
|
struct tm keeptime;
|
||||||
thistime = localtime_r(&data->timevalue, &keeptime);
|
thistime = (struct tm *)localtime_r(&data->timevalue, &keeptime);
|
||||||
#else
|
#else
|
||||||
thistime = localtime(&data->timevalue);
|
thistime = localtime(&data->timevalue);
|
||||||
#endif
|
#endif
|
||||||
@ -492,13 +492,19 @@ CURLcode http(struct connectdata *conn)
|
|||||||
actually set your own */
|
actually set your own */
|
||||||
sendf(data->firstsocket, data,
|
sendf(data->firstsocket, data,
|
||||||
"Content-Length: %d\r\n",
|
"Content-Length: %d\r\n",
|
||||||
strlen(data->postfields));
|
(data->postfieldsize?data->postfieldsize:
|
||||||
|
strlen(data->postfields)) );
|
||||||
|
|
||||||
if(!checkheaders(data, "Content-Type:"))
|
if(!checkheaders(data, "Content-Type:"))
|
||||||
sendf(data->firstsocket, data,
|
sendf(data->firstsocket, data,
|
||||||
"Content-Type: application/x-www-form-urlencoded\r\n");
|
"Content-Type: application/x-www-form-urlencoded\r\n");
|
||||||
|
|
||||||
/* and here comes the actual data */
|
/* and here comes the actual data */
|
||||||
|
if(data->postfieldsize) {
|
||||||
|
ssend(data->firstsocket, data, "\r\n", 2);
|
||||||
|
ssend(data->firstsocket, data, data->postfields, data->postfieldsize);
|
||||||
|
ssend(data->firstsocket, data, "\r\n", 2);
|
||||||
|
}
|
||||||
sendf(data->firstsocket, data,
|
sendf(data->firstsocket, data,
|
||||||
"\r\n"
|
"\r\n"
|
||||||
"%s\r\n",
|
"%s\r\n",
|
||||||
|
@ -82,7 +82,7 @@
|
|||||||
#include <sys/sockio.h>
|
#include <sys/sockio.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef HAVE_INET_NTOA_R_DECL
|
#if defined(HAVE_INET_NTOA_R) && !defined(HAVE_INET_NTOA_R_DECL)
|
||||||
#include "inet_ntoa_r.h"
|
#include "inet_ntoa_r.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
20
lib/sendf.c
20
lib/sendf.c
@ -84,7 +84,6 @@ void failf(struct UrlData *data, char *fmt, ...)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* sendf() sends the formated data to the server */
|
/* sendf() sends the formated data to the server */
|
||||||
|
|
||||||
int sendf(int fd, struct UrlData *data, char *fmt, ...)
|
int sendf(int fd, struct UrlData *data, char *fmt, ...)
|
||||||
{
|
{
|
||||||
size_t bytes_written;
|
size_t bytes_written;
|
||||||
@ -110,6 +109,25 @@ int sendf(int fd, struct UrlData *data, char *fmt, ...)
|
|||||||
return(bytes_written);
|
return(bytes_written);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ssend() sends plain (binary) data to the server */
|
||||||
|
size_t ssend(int fd, struct UrlData *data, void *mem, size_t len)
|
||||||
|
{
|
||||||
|
size_t bytes_written;
|
||||||
|
|
||||||
|
if(data->bits.verbose)
|
||||||
|
fprintf(data->err, "> [binary output]\n");
|
||||||
|
#ifndef USE_SSLEAY
|
||||||
|
bytes_written = swrite(fd, mem, len);
|
||||||
|
#else
|
||||||
|
if (data->use_ssl) {
|
||||||
|
bytes_written = SSL_write(data->ssl, mem, len);
|
||||||
|
} else {
|
||||||
|
bytes_written = swrite(fd, mem, len);
|
||||||
|
}
|
||||||
|
#endif /* USE_SSLEAY */
|
||||||
|
return bytes_written;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -40,7 +40,8 @@
|
|||||||
* ------------------------------------------------------------
|
* ------------------------------------------------------------
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int sendf(int fd, struct UrlData *, char *fmt, ...);
|
size_t sendf(int fd, struct UrlData *, char *fmt, ...);
|
||||||
|
size_t ssend(int fd, struct UrlData *, void *fmt, size_t len);
|
||||||
void infof(struct UrlData *, char *fmt, ...);
|
void infof(struct UrlData *, char *fmt, ...);
|
||||||
void failf(struct UrlData *, char *fmt, ...);
|
void failf(struct UrlData *, char *fmt, ...);
|
||||||
|
|
||||||
|
@ -421,6 +421,9 @@ CURLcode curl_setopt(CURL *curl, CURLoption option, ...)
|
|||||||
case CURLOPT_POSTFIELDS:
|
case CURLOPT_POSTFIELDS:
|
||||||
data->postfields = va_arg(param, char *);
|
data->postfields = va_arg(param, char *);
|
||||||
break;
|
break;
|
||||||
|
case CURLOPT_POSTFIELDSIZE:
|
||||||
|
data->postfieldsize = va_arg(param, long);
|
||||||
|
break;
|
||||||
case CURLOPT_REFERER:
|
case CURLOPT_REFERER:
|
||||||
data->referer = va_arg(param, char *);
|
data->referer = va_arg(param, char *);
|
||||||
data->bits.http_set_referer = (data->referer && *data->referer)?1:0;
|
data->bits.http_set_referer = (data->referer && *data->referer)?1:0;
|
||||||
|
@ -345,6 +345,9 @@ struct UrlData {
|
|||||||
char *range; /* range, if used. See README for detailed specification on
|
char *range; /* range, if used. See README for detailed specification on
|
||||||
this syntax. */
|
this syntax. */
|
||||||
char *postfields; /* if POST, set the fields' values here */
|
char *postfields; /* if POST, set the fields' values here */
|
||||||
|
long postfieldsize; /* if POST, this might have a size to use instead of
|
||||||
|
strlen(), and then the data *may* be binary (contain
|
||||||
|
zero bytes) */
|
||||||
|
|
||||||
bool free_referer; /* set TRUE if 'referer' points to a string we
|
bool free_referer; /* set TRUE if 'referer' points to a string we
|
||||||
allocated */
|
allocated */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user