un-nest curl
This commit is contained in:
1
curl-8.15.0/tests/libtest/.deps/libtests.Po
Normal file
1
curl-8.15.0/tests/libtest/.deps/libtests.Po
Normal file
@@ -0,0 +1 @@
|
||||
# dummy
|
||||
62
curl-8.15.0/tests/libtest/CMakeLists.txt
Normal file
62
curl-8.15.0/tests/libtest/CMakeLists.txt
Normal file
@@ -0,0 +1,62 @@
|
||||
#***************************************************************************
|
||||
# _ _ ____ _
|
||||
# Project ___| | | | _ \| |
|
||||
# / __| | | | |_) | |
|
||||
# | (__| |_| | _ <| |___
|
||||
# \___|\___/|_| \_\_____|
|
||||
#
|
||||
# Copyright (C) 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
|
||||
# are also available at https://curl.se/docs/copyright.html.
|
||||
#
|
||||
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
# copies of the Software, and permit persons to whom the Software is
|
||||
# furnished to do so, under the terms of the COPYING file.
|
||||
#
|
||||
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
# KIND, either express or implied.
|
||||
#
|
||||
# SPDX-License-Identifier: curl
|
||||
#
|
||||
###########################################################################
|
||||
|
||||
# Get BUNDLE, FIRST_C, FIRST_H, UTILS_C, UTILS_H, CURLX_C, TESTS_C variables
|
||||
curl_transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
|
||||
include("${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
|
||||
|
||||
if(LIB_SELECTED STREQUAL LIB_STATIC)
|
||||
set(CURLX_C "") # Already exported from the libcurl static build. Skip them.
|
||||
endif()
|
||||
|
||||
add_custom_command(OUTPUT "lib1521.c"
|
||||
COMMAND ${PERL_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/mk-lib1521.pl" < "${PROJECT_SOURCE_DIR}/include/curl/curl.h" "lib1521.c"
|
||||
DEPENDS
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/mk-lib1521.pl"
|
||||
"${PROJECT_SOURCE_DIR}/include/curl/curl.h"
|
||||
VERBATIM)
|
||||
|
||||
list(APPEND TESTS_C "lib1521.c")
|
||||
|
||||
add_custom_command(OUTPUT "${BUNDLE}.c"
|
||||
COMMAND ${PERL_EXECUTABLE} "${PROJECT_SOURCE_DIR}/scripts/mk-unity.pl"
|
||||
--include ${UTILS_C} ${CURLX_C} --test ${TESTS_C} > "${BUNDLE}.c"
|
||||
DEPENDS
|
||||
"${PROJECT_SOURCE_DIR}/scripts/mk-unity.pl" "${CMAKE_CURRENT_SOURCE_DIR}/Makefile.inc"
|
||||
${FIRST_C} ${UTILS_C} ${CURLX_C} ${TESTS_C}
|
||||
VERBATIM)
|
||||
|
||||
add_executable(${BUNDLE} EXCLUDE_FROM_ALL "${BUNDLE}.c")
|
||||
add_dependencies(testdeps ${BUNDLE})
|
||||
target_link_libraries(${BUNDLE} ${LIB_SELECTED} ${CURL_LIBS})
|
||||
target_include_directories(${BUNDLE} PRIVATE
|
||||
"${PROJECT_BINARY_DIR}/lib" # for "curl_config.h"
|
||||
"${PROJECT_SOURCE_DIR}/lib" # for "curl_setup.h", curlx
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}" # for the generated bundle source to find included test sources
|
||||
)
|
||||
set_property(TARGET ${BUNDLE} APPEND PROPERTY COMPILE_DEFINITIONS "${CURL_DEBUG_MACROS}")
|
||||
set_property(TARGET ${BUNDLE} APPEND PROPERTY COMPILE_DEFINITIONS "CURL_NO_OLDIES" "CURL_DISABLE_DEPRECATION")
|
||||
set_target_properties(${BUNDLE} PROPERTIES OUTPUT_NAME "${BUNDLE}" PROJECT_LABEL "Test ${BUNDLE}" UNITY_BUILD OFF C_CLANG_TIDY "")
|
||||
|
||||
curl_add_clang_tidy_test_target("${BUNDLE}-clang-tidy" ${BUNDLE} ${FIRST_C} ${UTILS_C} ${TESTS_C})
|
||||
836
curl-8.15.0/tests/libtest/Makefile
Normal file
836
curl-8.15.0/tests/libtest/Makefile
Normal file
@@ -0,0 +1,836 @@
|
||||
# Makefile.in generated by automake 1.16.5 from Makefile.am.
|
||||
# tests/libtest/Makefile. Generated from Makefile.in by configure.
|
||||
|
||||
# Copyright (C) 1994-2021 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
|
||||
#***************************************************************************
|
||||
# _ _ ____ _
|
||||
# Project ___| | | | _ \| |
|
||||
# / __| | | | |_) | |
|
||||
# | (__| |_| | _ <| |___
|
||||
# \___|\___/|_| \_\_____|
|
||||
#
|
||||
# Copyright (C) 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
|
||||
# are also available at https://curl.se/docs/copyright.html.
|
||||
#
|
||||
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
# copies of the Software, and permit persons to whom the Software is
|
||||
# furnished to do so, under the terms of the COPYING file.
|
||||
#
|
||||
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
# KIND, either express or implied.
|
||||
#
|
||||
# SPDX-License-Identifier: curl
|
||||
#
|
||||
###########################################################################
|
||||
# Shared between CMakeLists.txt and Makefile.am
|
||||
|
||||
|
||||
am__is_gnu_make = { \
|
||||
if test -z '$(MAKELEVEL)'; then \
|
||||
false; \
|
||||
elif test -n '$(MAKE_HOST)'; then \
|
||||
true; \
|
||||
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
|
||||
true; \
|
||||
else \
|
||||
false; \
|
||||
fi; \
|
||||
}
|
||||
am__make_running_with_option = \
|
||||
case $${target_option-} in \
|
||||
?) ;; \
|
||||
*) echo "am__make_running_with_option: internal error: invalid" \
|
||||
"target option '$${target_option-}' specified" >&2; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
has_opt=no; \
|
||||
sane_makeflags=$$MAKEFLAGS; \
|
||||
if $(am__is_gnu_make); then \
|
||||
sane_makeflags=$$MFLAGS; \
|
||||
else \
|
||||
case $$MAKEFLAGS in \
|
||||
*\\[\ \ ]*) \
|
||||
bs=\\; \
|
||||
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
|
||||
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
|
||||
esac; \
|
||||
fi; \
|
||||
skip_next=no; \
|
||||
strip_trailopt () \
|
||||
{ \
|
||||
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
|
||||
}; \
|
||||
for flg in $$sane_makeflags; do \
|
||||
test $$skip_next = yes && { skip_next=no; continue; }; \
|
||||
case $$flg in \
|
||||
*=*|--*) continue;; \
|
||||
-*I) strip_trailopt 'I'; skip_next=yes;; \
|
||||
-*I?*) strip_trailopt 'I';; \
|
||||
-*O) strip_trailopt 'O'; skip_next=yes;; \
|
||||
-*O?*) strip_trailopt 'O';; \
|
||||
-*l) strip_trailopt 'l'; skip_next=yes;; \
|
||||
-*l?*) strip_trailopt 'l';; \
|
||||
-[dEDm]) skip_next=yes;; \
|
||||
-[JT]) skip_next=yes;; \
|
||||
esac; \
|
||||
case $$flg in \
|
||||
*$$target_option*) has_opt=yes; break;; \
|
||||
esac; \
|
||||
done; \
|
||||
test $$has_opt = yes
|
||||
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
|
||||
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
|
||||
pkgdatadir = $(datadir)/curl
|
||||
pkgincludedir = $(includedir)/curl
|
||||
pkglibdir = $(libdir)/curl
|
||||
pkglibexecdir = $(libexecdir)/curl
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = x86_64-pc-linux-gnu
|
||||
host_triplet = x86_64-pc-linux-gnu
|
||||
am__append_1 = -DCURL_STATICLIB
|
||||
#am__append_2 = -DDEBUGBUILD
|
||||
#am__append_3 = -DCURLDEBUG
|
||||
noinst_PROGRAMS = $(am__EXEEXT_1)
|
||||
subdir = tests/libtest
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/curl-amissl.m4 \
|
||||
$(top_srcdir)/m4/curl-compilers.m4 \
|
||||
$(top_srcdir)/m4/curl-confopts.m4 \
|
||||
$(top_srcdir)/m4/curl-functions.m4 \
|
||||
$(top_srcdir)/m4/curl-gnutls.m4 \
|
||||
$(top_srcdir)/m4/curl-mbedtls.m4 \
|
||||
$(top_srcdir)/m4/curl-openssl.m4 \
|
||||
$(top_srcdir)/m4/curl-override.m4 \
|
||||
$(top_srcdir)/m4/curl-reentrant.m4 \
|
||||
$(top_srcdir)/m4/curl-rustls.m4 \
|
||||
$(top_srcdir)/m4/curl-schannel.m4 \
|
||||
$(top_srcdir)/m4/curl-sysconfig.m4 \
|
||||
$(top_srcdir)/m4/curl-wolfssl.m4 $(top_srcdir)/m4/libtool.m4 \
|
||||
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
|
||||
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
|
||||
$(top_srcdir)/m4/xc-am-iface.m4 \
|
||||
$(top_srcdir)/m4/xc-cc-check.m4 \
|
||||
$(top_srcdir)/m4/xc-lt-iface.m4 \
|
||||
$(top_srcdir)/m4/xc-val-flgs.m4 \
|
||||
$(top_srcdir)/m4/zz40-xc-ovr.m4 \
|
||||
$(top_srcdir)/m4/zz50-xc-ovr.m4 \
|
||||
$(top_srcdir)/m4/zz60-xc-ovr.m4 $(top_srcdir)/acinclude.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/lib/curl_config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
am__EXEEXT_1 = libtests$(EXEEXT)
|
||||
PROGRAMS = $(noinst_PROGRAMS)
|
||||
libtests_SOURCES = libtests.c
|
||||
libtests_OBJECTS = libtests.$(OBJEXT)
|
||||
libtests_LDADD = $(LDADD)
|
||||
libtests_DEPENDENCIES = $(top_builddir)/lib/libcurl.la
|
||||
AM_V_lt = $(am__v_lt_$(V))
|
||||
am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_lt_0 = --silent
|
||||
am__v_lt_1 =
|
||||
AM_V_P = $(am__v_P_$(V))
|
||||
am__v_P_ = $(am__v_P_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_P_0 = false
|
||||
am__v_P_1 = :
|
||||
AM_V_GEN = $(am__v_GEN_$(V))
|
||||
am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_GEN_0 = @echo " GEN " $@;
|
||||
am__v_GEN_1 =
|
||||
AM_V_at = $(am__v_at_$(V))
|
||||
am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_at_0 = @
|
||||
am__v_at_1 =
|
||||
DEFAULT_INCLUDES =
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
am__maybe_remake_depfiles = depfiles
|
||||
am__depfiles_remade = ./$(DEPDIR)/libtests.Po
|
||||
am__mv = mv -f
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
|
||||
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
|
||||
$(AM_CFLAGS) $(CFLAGS)
|
||||
AM_V_CC = $(am__v_CC_$(V))
|
||||
am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_CC_0 = @echo " CC " $@;
|
||||
am__v_CC_1 =
|
||||
CCLD = $(CC)
|
||||
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
AM_V_CCLD = $(am__v_CCLD_$(V))
|
||||
am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_CCLD_0 = @echo " CCLD " $@;
|
||||
am__v_CCLD_1 =
|
||||
SOURCES = libtests.c
|
||||
DIST_SOURCES = libtests.c
|
||||
am__can_run_installinfo = \
|
||||
case $$AM_UPDATE_INFO_DIR in \
|
||||
n|no|NO) false;; \
|
||||
*) (install-info --version) >/dev/null 2>&1;; \
|
||||
esac
|
||||
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
|
||||
# Read a list of newline-separated strings from the standard input,
|
||||
# and print each of them once, without duplicates. Input order is
|
||||
# *not* preserved.
|
||||
am__uniquify_input = $(AWK) '\
|
||||
BEGIN { nonempty = 0; } \
|
||||
{ items[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in items) print i; }; } \
|
||||
'
|
||||
# Make sure the list of sources is unique. This is necessary because,
|
||||
# e.g., the same source file might be shared among _SOURCES variables
|
||||
# for different programs/libraries.
|
||||
am__define_uniq_tagged_files = \
|
||||
list='$(am__tagged_files)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | $(am__uniquify_input)`
|
||||
am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.inc \
|
||||
$(top_srcdir)/depcomp
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = ${SHELL} '/home/teknari/Sync/Programming/VibeCoding/nostr_core_lib/curl-8.15.0/missing' aclocal-1.16
|
||||
AMTAR = $${TAR-tar}
|
||||
AM_DEFAULT_VERBOSITY = 0
|
||||
APXS =
|
||||
AR = /usr/bin/ar
|
||||
AR_FLAGS = cr
|
||||
AS = as
|
||||
AUTOCONF = ${SHELL} '/home/teknari/Sync/Programming/VibeCoding/nostr_core_lib/curl-8.15.0/missing' autoconf
|
||||
AUTOHEADER = ${SHELL} '/home/teknari/Sync/Programming/VibeCoding/nostr_core_lib/curl-8.15.0/missing' autoheader
|
||||
AUTOMAKE = ${SHELL} '/home/teknari/Sync/Programming/VibeCoding/nostr_core_lib/curl-8.15.0/missing' automake-1.16
|
||||
AWK = mawk
|
||||
BLANK_AT_MAKETIME =
|
||||
CADDY =
|
||||
CC = gcc
|
||||
CCDEPMODE = depmode=gcc3
|
||||
CFLAGS = -Werror-implicit-function-declaration -O2 -Wno-system-headers
|
||||
CFLAG_CURL_SYMBOL_HIDING = -fvisibility=hidden
|
||||
CONFIGURE_OPTIONS = " '--disable-shared' '--enable-static' '--with-openssl=/home/teknari/Sync/Programming/VibeCoding/nostr_core_lib/curl-8.15.0/../openssl-install' '--without-libpsl' '--without-brotli' '--disable-ldap' '--disable-ldaps' '--disable-rtsp' '--disable-proxy' '--disable-dict' '--disable-telnet' '--disable-tftp' '--disable-pop3' '--disable-imap' '--disable-smb' '--disable-smtp' '--disable-gopher' '--disable-manual' '--prefix=/home/teknari/Sync/Programming/VibeCoding/nostr_core_lib/curl-8.15.0/../curl-install'"
|
||||
CPP = gcc -E
|
||||
CPPFLAGS = -D_GNU_SOURCE -isystem /home/teknari/Sync/Programming/VibeCoding/nostr_core_lib/openssl-install/include
|
||||
CSCOPE = cscope
|
||||
CTAGS = ctags
|
||||
CURLVERSION = 8.15.0
|
||||
CURL_CA_BUNDLE = /etc/ssl/certs/ca-certificates.crt
|
||||
CURL_CA_EMBED =
|
||||
CURL_CFLAG_EXTRAS =
|
||||
CURL_CPP = gcc -E -D_GNU_SOURCE -isystem /home/teknari/Sync/Programming/VibeCoding/nostr_core_lib/openssl-install/include
|
||||
CURL_LIBCURL_VERSIONED_SYMBOLS_PREFIX =
|
||||
CURL_LIBCURL_VERSIONED_SYMBOLS_SONAME = 4
|
||||
CURL_NETWORK_AND_TIME_LIBS =
|
||||
CYGPATH_W = echo
|
||||
DEFS = -DHAVE_CONFIG_H
|
||||
DEPDIR = .deps
|
||||
DLLTOOL = false
|
||||
DSYMUTIL =
|
||||
DUMPBIN =
|
||||
ECHO_C =
|
||||
ECHO_N = -n
|
||||
ECHO_T =
|
||||
EGREP = /usr/bin/grep -E
|
||||
ENABLE_SHARED = no
|
||||
ENABLE_STATIC = yes
|
||||
ETAGS = etags
|
||||
EXEEXT =
|
||||
FGREP = /usr/bin/grep -F
|
||||
FILECMD = file
|
||||
FISH_FUNCTIONS_DIR =
|
||||
GCOV =
|
||||
GREP = /usr/bin/grep
|
||||
HAVE_LIBZ = 1
|
||||
HTTPD =
|
||||
HTTPD_NGHTTPX =
|
||||
INSTALL = /usr/bin/install -c
|
||||
INSTALL_DATA = ${INSTALL} -m 644
|
||||
INSTALL_PROGRAM = ${INSTALL}
|
||||
INSTALL_SCRIPT = ${INSTALL}
|
||||
INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
|
||||
LCOV =
|
||||
LD = /usr/bin/ld -m elf_x86_64
|
||||
LDFLAGS = -L/home/teknari/Sync/Programming/VibeCoding/nostr_core_lib/openssl-install/lib64
|
||||
LIBCURL_PC_CFLAGS = -DCURL_STATICLIB
|
||||
LIBCURL_PC_CFLAGS_PRIVATE = -DCURL_STATICLIB
|
||||
LIBCURL_PC_LDFLAGS_PRIVATE = -L/home/teknari/Sync/Programming/VibeCoding/nostr_core_lib/openssl-install/lib64
|
||||
LIBCURL_PC_LIBS = -lssl -lcrypto -lssl -lcrypto -lz
|
||||
LIBCURL_PC_LIBS_PRIVATE = -lssl -lcrypto -lssl -lcrypto -lz
|
||||
LIBCURL_PC_REQUIRES = zlib,openssl
|
||||
LIBCURL_PC_REQUIRES_PRIVATE = zlib,openssl
|
||||
LIBOBJS =
|
||||
|
||||
# Prevent LIBS from being used for all link targets
|
||||
LIBS = $(BLANK_AT_MAKETIME)
|
||||
LIBTOOL = $(SHELL) $(top_builddir)/libtool
|
||||
LIPO =
|
||||
LN_S = ln -s
|
||||
LTLIBOBJS =
|
||||
LT_SYS_LIBRARY_PATH =
|
||||
MAINT = #
|
||||
MAKEINFO = ${SHELL} '/home/teknari/Sync/Programming/VibeCoding/nostr_core_lib/curl-8.15.0/missing' makeinfo
|
||||
MANIFEST_TOOL = :
|
||||
MKDIR_P = /usr/bin/mkdir -p
|
||||
NM = /usr/bin/nm -B
|
||||
NMEDIT =
|
||||
OBJDUMP = objdump
|
||||
OBJEXT = o
|
||||
OTOOL =
|
||||
OTOOL64 =
|
||||
PACKAGE = curl
|
||||
PACKAGE_BUGREPORT = a suitable curl mailing list: https://curl.se/mail/
|
||||
PACKAGE_NAME = curl
|
||||
PACKAGE_STRING = curl -
|
||||
PACKAGE_TARNAME = curl
|
||||
PACKAGE_URL =
|
||||
PACKAGE_VERSION = -
|
||||
PATH_SEPARATOR = :
|
||||
PERL = /usr/bin/perl
|
||||
PKGCONFIG = no
|
||||
RANLIB = ranlib
|
||||
RC =
|
||||
SED = /usr/bin/sed
|
||||
SET_MAKE =
|
||||
SHELL = /bin/bash
|
||||
SSL_BACKENDS = OpenSSL v3+
|
||||
STRIP = strip
|
||||
SUPPORT_FEATURES = alt-svc AsynchDNS HSTS IPv6 Largefile libz NTLM SSL threadsafe TLS-SRP UnixSockets
|
||||
SUPPORT_PROTOCOLS = FILE FTP FTPS HTTP HTTPS IPFS IPNS MQTT WS WSS
|
||||
TEST_NGHTTPX = nghttpx
|
||||
VERSION = -
|
||||
VERSIONNUM = 080f00
|
||||
VSFTPD =
|
||||
ZLIB_LIBS = -lz
|
||||
ZSH_FUNCTIONS_DIR =
|
||||
abs_builddir = /home/teknari/Sync/Programming/VibeCoding/nostr_core_lib/curl-8.15.0/tests/libtest
|
||||
abs_srcdir = /home/teknari/Sync/Programming/VibeCoding/nostr_core_lib/curl-8.15.0/tests/libtest
|
||||
abs_top_builddir = /home/teknari/Sync/Programming/VibeCoding/nostr_core_lib/curl-8.15.0
|
||||
abs_top_srcdir = /home/teknari/Sync/Programming/VibeCoding/nostr_core_lib/curl-8.15.0
|
||||
ac_ct_AR =
|
||||
ac_ct_CC = gcc
|
||||
ac_ct_DUMPBIN =
|
||||
am__include = include
|
||||
am__leading_dot = .
|
||||
am__quote =
|
||||
am__tar = $${TAR-tar} chof - "$$tardir"
|
||||
am__untar = $${TAR-tar} xf -
|
||||
bindir = ${exec_prefix}/bin
|
||||
build = x86_64-pc-linux-gnu
|
||||
build_alias =
|
||||
build_cpu = x86_64
|
||||
build_os = linux-gnu
|
||||
build_vendor = pc
|
||||
builddir = .
|
||||
datadir = ${datarootdir}
|
||||
datarootdir = ${prefix}/share
|
||||
docdir = ${datarootdir}/doc/${PACKAGE_TARNAME}
|
||||
dvidir = ${docdir}
|
||||
exec_prefix = ${prefix}
|
||||
host = x86_64-pc-linux-gnu
|
||||
host_alias =
|
||||
host_cpu = x86_64
|
||||
host_os = linux-gnu
|
||||
host_vendor = pc
|
||||
htmldir = ${docdir}
|
||||
includedir = ${prefix}/include
|
||||
infodir = ${datarootdir}/info
|
||||
install_sh = ${SHELL} /home/teknari/Sync/Programming/VibeCoding/nostr_core_lib/curl-8.15.0/install-sh
|
||||
libdir = ${exec_prefix}/lib
|
||||
libexecdir = ${exec_prefix}/libexec
|
||||
libext = a
|
||||
localedir = ${datarootdir}/locale
|
||||
localstatedir = ${prefix}/var
|
||||
mandir = ${datarootdir}/man
|
||||
mkdir_p = $(MKDIR_P)
|
||||
oldincludedir = /usr/include
|
||||
pdfdir = ${docdir}
|
||||
prefix = /home/teknari/Sync/Programming/VibeCoding/nostr_core_lib/curl-8.15.0/../curl-install
|
||||
program_transform_name = s,x,x,
|
||||
psdir = ${docdir}
|
||||
runstatedir = ${localstatedir}/run
|
||||
sbindir = ${exec_prefix}/sbin
|
||||
sharedstatedir = ${prefix}/com
|
||||
srcdir = .
|
||||
sysconfdir = ${prefix}/etc
|
||||
target_alias =
|
||||
top_build_prefix = ../../
|
||||
top_builddir = ../..
|
||||
top_srcdir = ../..
|
||||
|
||||
#***************************************************************************
|
||||
# _ _ ____ _
|
||||
# Project ___| | | | _ \| |
|
||||
# / __| | | | |_) | |
|
||||
# | (__| |_| | _ <| |___
|
||||
# \___|\___/|_| \_\_____|
|
||||
#
|
||||
# Copyright (C) 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
|
||||
# are also available at https://curl.se/docs/copyright.html.
|
||||
#
|
||||
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
# copies of the Software, and permit persons to whom the Software is
|
||||
# furnished to do so, under the terms of the COPYING file.
|
||||
#
|
||||
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
# KIND, either express or implied.
|
||||
#
|
||||
# SPDX-License-Identifier: curl
|
||||
#
|
||||
###########################################################################
|
||||
AUTOMAKE_OPTIONS = foreign nostdinc
|
||||
|
||||
# Specify our include paths here, and do it relative to $(top_srcdir) and
|
||||
# $(top_builddir), to ensure that these paths which belong to the library
|
||||
# being currently built and tested are searched before the library which
|
||||
# might possibly already be installed in the system.
|
||||
#
|
||||
# $(top_srcdir)/include is for libcurl's external include files
|
||||
# $(top_builddir)/lib is for libcurl's generated lib/curl_config.h file
|
||||
# $(top_srcdir)/lib for libcurl's lib/curl_setup.h and other "borrowed" files
|
||||
# $(srcdir) for the generated bundle source to find included test sources
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/lib \
|
||||
-I$(top_srcdir)/lib -I$(srcdir) $(am__append_1) \
|
||||
$(am__append_2) $(am__append_3) -DCURL_NO_OLDIES \
|
||||
-DCURL_DISABLE_DEPRECATION
|
||||
BUNDLE = libtests
|
||||
|
||||
# Files referenced from the bundle source
|
||||
FIRST_C = first.c
|
||||
FIRST_H = first.h
|
||||
|
||||
# Common files used by test programs
|
||||
UTILS_C = memptr.c testutil.c testtrace.c
|
||||
UTILS_H = testutil.h testtrace.h unitcheck.h
|
||||
CURLX_C = \
|
||||
../../lib/curlx/warnless.c \
|
||||
../../lib/curlx/multibyte.c \
|
||||
../../lib/curlx/timediff.c \
|
||||
../../lib/curlx/timeval.c \
|
||||
../../lib/curl_threads.c \
|
||||
../../lib/curlx/version_win32.c \
|
||||
../../lib/curlx/wait.c
|
||||
|
||||
|
||||
# All libtest programs
|
||||
TESTS_C = \
|
||||
lib500.c lib501.c lib502.c lib503.c lib504.c lib505.c lib506.c lib507.c \
|
||||
lib508.c lib509.c lib510.c lib511.c lib512.c lib513.c lib514.c lib515.c \
|
||||
lib516.c lib517.c lib518.c lib519.c lib520.c lib521.c lib523.c lib524.c \
|
||||
lib525.c lib526.c lib530.c \
|
||||
lib533.c lib536.c lib537.c lib539.c lib540.c lib541.c \
|
||||
lib542.c lib543.c lib544.c lib547.c lib549.c \
|
||||
lib552.c lib553.c lib554.c lib555.c lib556.c lib557.c lib558.c lib559.c \
|
||||
lib560.c lib562.c lib564.c lib566.c lib567.c \
|
||||
lib568.c lib569.c lib570.c lib571.c lib572.c lib573.c lib574.c lib575.c \
|
||||
lib576.c lib578.c lib579.c lib582.c lib583.c \
|
||||
lib586.c lib589.c lib590.c lib591.c \
|
||||
lib597.c lib598.c lib599.c \
|
||||
lib643.c \
|
||||
lib650.c lib651.c lib652.c lib653.c lib654.c lib655.c lib658.c lib659.c \
|
||||
lib661.c lib666.c lib667.c lib668.c \
|
||||
lib670.c lib674.c lib676.c lib677.c lib678.c \
|
||||
lib694.c lib695.c \
|
||||
lib751.c lib753.c \
|
||||
lib1156.c \
|
||||
lib1301.c lib1308.c \
|
||||
lib1485.c \
|
||||
lib1500.c lib1501.c lib1502.c lib1506.c \
|
||||
lib1507.c lib1508.c lib1509.c lib1510.c lib1511.c lib1512.c lib1513.c \
|
||||
lib1514.c lib1515.c lib1517.c lib1518.c lib1520.c \
|
||||
lib1522.c lib1523.c lib1525.c lib1526.c lib1527.c lib1528.c \
|
||||
lib1529.c lib1530.c lib1531.c lib1532.c lib1533.c lib1534.c lib1535.c \
|
||||
lib1536.c lib1537.c lib1538.c lib1540.c lib1541.c lib1542.c \
|
||||
lib1545.c lib1550.c lib1551.c \
|
||||
lib1552.c lib1553.c lib1554.c lib1555.c lib1556.c lib1557.c lib1558.c \
|
||||
lib1559.c lib1560.c lib1564.c lib1565.c \
|
||||
lib1567.c lib1568.c lib1569.c lib1571.c \
|
||||
lib1576.c \
|
||||
lib1591.c lib1592.c lib1593.c lib1594.c lib1597.c \
|
||||
lib1598.c lib1599.c \
|
||||
lib1662.c \
|
||||
lib1900.c lib1901.c lib1903.c lib1905.c lib1906.c lib1907.c \
|
||||
lib1908.c lib1910.c lib1911.c lib1912.c lib1913.c \
|
||||
lib1915.c lib1916.c lib1918.c lib1919.c \
|
||||
lib1933.c lib1934.c lib1935.c lib1936.c lib1937.c lib1938.c lib1939.c \
|
||||
lib1940.c lib1945.c \
|
||||
lib1947.c lib1948.c \
|
||||
lib1955.c lib1956.c lib1957.c lib1958.c lib1959.c lib1960.c \
|
||||
lib1964.c lib1970.c \
|
||||
lib1971.c lib1972.c lib1973.c lib1974.c lib1975.c lib1977.c lib1978.c \
|
||||
lib2023.c lib2032.c lib2082.c \
|
||||
lib2301.c lib2302.c lib2304.c lib2306.c lib2308.c lib2309.c \
|
||||
lib2402.c lib2404.c lib2405.c \
|
||||
lib2502.c \
|
||||
lib2700.c \
|
||||
lib3010.c lib3025.c lib3026.c lib3027.c \
|
||||
lib3100.c lib3101.c lib3102.c lib3103.c lib3104.c lib3105.c \
|
||||
lib3207.c lib3208.c
|
||||
|
||||
|
||||
# Get BUNDLE, FIRST_C, FIRST_H, UTILS_C, UTILS_H, CURLX_C, TESTS_C variables
|
||||
EXTRA_DIST = CMakeLists.txt $(FIRST_C) $(FIRST_H) $(UTILS_C) $(UTILS_H) $(TESTS_C) \
|
||||
test307.pl test610.pl test613.pl test1013.pl test1022.pl mk-lib1521.pl
|
||||
|
||||
# These are part of the libcurl static lib. Add them here when linking shared.
|
||||
#curlx_c_lib = $(CURLX_C)
|
||||
curlx_c_lib =
|
||||
LDADD = $(top_builddir)/lib/libcurl.la
|
||||
CLEANFILES = $(BUNDLE).c lib1521.c
|
||||
CHECKSRC = $(CS_$(V))
|
||||
CS_0 = @echo " RUN " $@;
|
||||
CS_1 =
|
||||
CS_ = $(CS_0)
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .lo .o .obj
|
||||
$(srcdir)/Makefile.in: # $(srcdir)/Makefile.am $(srcdir)/Makefile.inc $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tests/libtest/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --foreign tests/libtest/Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
|
||||
esac;
|
||||
$(srcdir)/Makefile.inc $(am__empty):
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: # $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): # $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
|
||||
clean-noinstPROGRAMS:
|
||||
@list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \
|
||||
echo " rm -f" $$list; \
|
||||
rm -f $$list || exit $$?; \
|
||||
test -n "$(EXEEXT)" || exit 0; \
|
||||
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
|
||||
echo " rm -f" $$list; \
|
||||
rm -f $$list
|
||||
|
||||
libtests$(EXEEXT): $(libtests_OBJECTS) $(libtests_DEPENDENCIES) $(EXTRA_libtests_DEPENDENCIES)
|
||||
@rm -f libtests$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(libtests_OBJECTS) $(libtests_LDADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
include ./$(DEPDIR)/libtests.Po # am--include-marker
|
||||
|
||||
$(am__depfiles_remade):
|
||||
@$(MKDIR_P) $(@D)
|
||||
@echo '# dummy' >$@-t && $(am__mv) $@-t $@
|
||||
|
||||
am--depfiles: $(am__depfiles_remade)
|
||||
|
||||
.c.o:
|
||||
$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
|
||||
$(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
|
||||
$(am__mv) $$depbase.Tpo $$depbase.Po
|
||||
# $(AM_V_CC)source='$<' object='$@' libtool=no \
|
||||
# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
|
||||
# $(AM_V_CC_no)$(COMPILE) -c -o $@ $<
|
||||
|
||||
.c.obj:
|
||||
$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
|
||||
$(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
|
||||
$(am__mv) $$depbase.Tpo $$depbase.Po
|
||||
# $(AM_V_CC)source='$<' object='$@' libtool=no \
|
||||
# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
|
||||
# $(AM_V_CC_no)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
|
||||
|
||||
.c.lo:
|
||||
$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
|
||||
$(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
|
||||
$(am__mv) $$depbase.Tpo $$depbase.Plo
|
||||
# $(AM_V_CC)source='$<' object='$@' libtool=yes \
|
||||
# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
|
||||
# $(AM_V_CC_no)$(LTCOMPILE) -c -o $@ $<
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
ID: $(am__tagged_files)
|
||||
$(am__define_uniq_tagged_files); mkid -fID $$unique
|
||||
tags: tags-am
|
||||
TAGS: tags
|
||||
|
||||
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
$(am__define_uniq_tagged_files); \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
if test $$# -gt 0; then \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
"$$@" $$unique; \
|
||||
else \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$unique; \
|
||||
fi; \
|
||||
fi
|
||||
ctags: ctags-am
|
||||
|
||||
CTAGS: ctags
|
||||
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
|
||||
$(am__define_uniq_tagged_files); \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
cscopelist: cscopelist-am
|
||||
|
||||
cscopelist-am: $(am__tagged_files)
|
||||
list='$(am__tagged_files)'; \
|
||||
case "$(srcdir)" in \
|
||||
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
|
||||
*) sdir=$(subdir)/$(srcdir) ;; \
|
||||
esac; \
|
||||
for i in $$list; do \
|
||||
if test -f "$$i"; then \
|
||||
echo "$(subdir)/$$i"; \
|
||||
else \
|
||||
echo "$$sdir/$$i"; \
|
||||
fi; \
|
||||
done >> $(top_builddir)/cscope.files
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
distdir: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) distdir-am
|
||||
|
||||
distdir-am: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
#all-local:
|
||||
all-am: Makefile $(PROGRAMS) all-local
|
||||
installdirs:
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
if test -z '$(STRIP)'; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
install; \
|
||||
else \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
|
||||
fi
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic clean-libtool clean-local clean-noinstPROGRAMS \
|
||||
mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -f ./$(DEPDIR)/libtests.Po
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -f ./$(DEPDIR)/libtests.Po
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
|
||||
mostlyclean-libtool
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am:
|
||||
|
||||
.MAKE: install-am install-strip
|
||||
|
||||
.PHONY: CTAGS GTAGS TAGS all all-am all-local am--depfiles check \
|
||||
check-am clean clean-generic clean-libtool clean-local \
|
||||
clean-noinstPROGRAMS cscopelist-am ctags ctags-am distclean \
|
||||
distclean-compile distclean-generic distclean-libtool \
|
||||
distclean-tags distdir dvi dvi-am html html-am info info-am \
|
||||
install install-am install-data install-data-am install-dvi \
|
||||
install-dvi-am install-exec install-exec-am install-html \
|
||||
install-html-am install-info install-info-am install-man \
|
||||
install-pdf install-pdf-am install-ps install-ps-am \
|
||||
install-strip installcheck installcheck-am installdirs \
|
||||
maintainer-clean maintainer-clean-generic mostlyclean \
|
||||
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
|
||||
pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am
|
||||
|
||||
.PRECIOUS: Makefile
|
||||
|
||||
$(BUNDLE).c: $(top_srcdir)/scripts/mk-unity.pl Makefile.inc $(FIRST_C) $(UTILS_C) $(curlx_c_lib) $(TESTS_C) lib1521.c
|
||||
/usr/bin/perl $(top_srcdir)/scripts/mk-unity.pl --include $(UTILS_C) $(curlx_c_lib) --test $(TESTS_C) lib1521.c > $(BUNDLE).c
|
||||
|
||||
lib1521.c: $(top_srcdir)/tests/libtest/mk-lib1521.pl $(top_srcdir)/include/curl/curl.h
|
||||
/usr/bin/perl $(top_srcdir)/tests/libtest/mk-lib1521.pl < $(top_srcdir)/include/curl/curl.h lib1521.c
|
||||
|
||||
# ignore generated C files since they play by slightly different rules!
|
||||
checksrc: lib1521.c
|
||||
$(CHECKSRC)(/usr/bin/perl $(top_srcdir)/scripts/checksrc.pl -D$(srcdir) \
|
||||
-W$(srcdir)/$(BUNDLE).c \
|
||||
$(srcdir)/*.[ch])
|
||||
|
||||
all-local: checksrc
|
||||
|
||||
clean-local:
|
||||
rm -f $(BUNDLE)
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
95
curl-8.15.0/tests/libtest/Makefile.am
Normal file
95
curl-8.15.0/tests/libtest/Makefile.am
Normal file
@@ -0,0 +1,95 @@
|
||||
#***************************************************************************
|
||||
# _ _ ____ _
|
||||
# Project ___| | | | _ \| |
|
||||
# / __| | | | |_) | |
|
||||
# | (__| |_| | _ <| |___
|
||||
# \___|\___/|_| \_\_____|
|
||||
#
|
||||
# Copyright (C) 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
|
||||
# are also available at https://curl.se/docs/copyright.html.
|
||||
#
|
||||
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
# copies of the Software, and permit persons to whom the Software is
|
||||
# furnished to do so, under the terms of the COPYING file.
|
||||
#
|
||||
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
# KIND, either express or implied.
|
||||
#
|
||||
# SPDX-License-Identifier: curl
|
||||
#
|
||||
###########################################################################
|
||||
AUTOMAKE_OPTIONS = foreign nostdinc
|
||||
|
||||
# Specify our include paths here, and do it relative to $(top_srcdir) and
|
||||
# $(top_builddir), to ensure that these paths which belong to the library
|
||||
# being currently built and tested are searched before the library which
|
||||
# might possibly already be installed in the system.
|
||||
#
|
||||
# $(top_srcdir)/include is for libcurl's external include files
|
||||
# $(top_builddir)/lib is for libcurl's generated lib/curl_config.h file
|
||||
# $(top_srcdir)/lib for libcurl's lib/curl_setup.h and other "borrowed" files
|
||||
# $(srcdir) for the generated bundle source to find included test sources
|
||||
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/include \
|
||||
-I$(top_builddir)/lib \
|
||||
-I$(top_srcdir)/lib \
|
||||
-I$(srcdir)
|
||||
|
||||
# Get BUNDLE, FIRST_C, FIRST_H, UTILS_C, UTILS_H, CURLX_C, TESTS_C variables
|
||||
include Makefile.inc
|
||||
|
||||
EXTRA_DIST = CMakeLists.txt $(FIRST_C) $(FIRST_H) $(UTILS_C) $(UTILS_H) $(TESTS_C) \
|
||||
test307.pl test610.pl test613.pl test1013.pl test1022.pl mk-lib1521.pl
|
||||
|
||||
CFLAGS += @CURL_CFLAG_EXTRAS@
|
||||
|
||||
# Prevent LIBS from being used for all link targets
|
||||
LIBS = $(BLANK_AT_MAKETIME)
|
||||
|
||||
if USE_CPPFLAG_CURL_STATICLIB
|
||||
AM_CPPFLAGS += -DCURL_STATICLIB
|
||||
endif
|
||||
if DEBUGBUILD
|
||||
AM_CPPFLAGS += -DDEBUGBUILD
|
||||
endif
|
||||
if CURLDEBUG
|
||||
AM_CPPFLAGS += -DCURLDEBUG
|
||||
endif
|
||||
AM_CPPFLAGS += -DCURL_NO_OLDIES -DCURL_DISABLE_DEPRECATION
|
||||
|
||||
if USE_CPPFLAG_CURL_STATICLIB
|
||||
curlx_c_lib =
|
||||
else
|
||||
# These are part of the libcurl static lib. Add them here when linking shared.
|
||||
curlx_c_lib = $(CURLX_C)
|
||||
endif
|
||||
$(BUNDLE).c: $(top_srcdir)/scripts/mk-unity.pl Makefile.inc $(FIRST_C) $(UTILS_C) $(curlx_c_lib) $(TESTS_C) lib1521.c
|
||||
@PERL@ $(top_srcdir)/scripts/mk-unity.pl --include $(UTILS_C) $(curlx_c_lib) --test $(TESTS_C) lib1521.c > $(BUNDLE).c
|
||||
|
||||
noinst_PROGRAMS = $(BUNDLE)
|
||||
LDADD = $(top_builddir)/lib/libcurl.la
|
||||
CLEANFILES = $(BUNDLE).c lib1521.c
|
||||
|
||||
lib1521.c: $(top_srcdir)/tests/libtest/mk-lib1521.pl $(top_srcdir)/include/curl/curl.h
|
||||
@PERL@ $(top_srcdir)/tests/libtest/mk-lib1521.pl < $(top_srcdir)/include/curl/curl.h lib1521.c
|
||||
|
||||
CHECKSRC = $(CS_$(V))
|
||||
CS_0 = @echo " RUN " $@;
|
||||
CS_1 =
|
||||
CS_ = $(CS_0)
|
||||
|
||||
# ignore generated C files since they play by slightly different rules!
|
||||
checksrc: lib1521.c
|
||||
$(CHECKSRC)(@PERL@ $(top_srcdir)/scripts/checksrc.pl -D$(srcdir) \
|
||||
-W$(srcdir)/$(BUNDLE).c \
|
||||
$(srcdir)/*.[ch])
|
||||
|
||||
if NOT_CURL_CI
|
||||
all-local: checksrc
|
||||
endif
|
||||
|
||||
clean-local:
|
||||
rm -f $(BUNDLE)
|
||||
836
curl-8.15.0/tests/libtest/Makefile.in
Normal file
836
curl-8.15.0/tests/libtest/Makefile.in
Normal file
@@ -0,0 +1,836 @@
|
||||
# Makefile.in generated by automake 1.16.5 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2021 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
#***************************************************************************
|
||||
# _ _ ____ _
|
||||
# Project ___| | | | _ \| |
|
||||
# / __| | | | |_) | |
|
||||
# | (__| |_| | _ <| |___
|
||||
# \___|\___/|_| \_\_____|
|
||||
#
|
||||
# Copyright (C) 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
|
||||
# are also available at https://curl.se/docs/copyright.html.
|
||||
#
|
||||
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
# copies of the Software, and permit persons to whom the Software is
|
||||
# furnished to do so, under the terms of the COPYING file.
|
||||
#
|
||||
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
# KIND, either express or implied.
|
||||
#
|
||||
# SPDX-License-Identifier: curl
|
||||
#
|
||||
###########################################################################
|
||||
# Shared between CMakeLists.txt and Makefile.am
|
||||
|
||||
VPATH = @srcdir@
|
||||
am__is_gnu_make = { \
|
||||
if test -z '$(MAKELEVEL)'; then \
|
||||
false; \
|
||||
elif test -n '$(MAKE_HOST)'; then \
|
||||
true; \
|
||||
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
|
||||
true; \
|
||||
else \
|
||||
false; \
|
||||
fi; \
|
||||
}
|
||||
am__make_running_with_option = \
|
||||
case $${target_option-} in \
|
||||
?) ;; \
|
||||
*) echo "am__make_running_with_option: internal error: invalid" \
|
||||
"target option '$${target_option-}' specified" >&2; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
has_opt=no; \
|
||||
sane_makeflags=$$MAKEFLAGS; \
|
||||
if $(am__is_gnu_make); then \
|
||||
sane_makeflags=$$MFLAGS; \
|
||||
else \
|
||||
case $$MAKEFLAGS in \
|
||||
*\\[\ \ ]*) \
|
||||
bs=\\; \
|
||||
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
|
||||
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
|
||||
esac; \
|
||||
fi; \
|
||||
skip_next=no; \
|
||||
strip_trailopt () \
|
||||
{ \
|
||||
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
|
||||
}; \
|
||||
for flg in $$sane_makeflags; do \
|
||||
test $$skip_next = yes && { skip_next=no; continue; }; \
|
||||
case $$flg in \
|
||||
*=*|--*) continue;; \
|
||||
-*I) strip_trailopt 'I'; skip_next=yes;; \
|
||||
-*I?*) strip_trailopt 'I';; \
|
||||
-*O) strip_trailopt 'O'; skip_next=yes;; \
|
||||
-*O?*) strip_trailopt 'O';; \
|
||||
-*l) strip_trailopt 'l'; skip_next=yes;; \
|
||||
-*l?*) strip_trailopt 'l';; \
|
||||
-[dEDm]) skip_next=yes;; \
|
||||
-[JT]) skip_next=yes;; \
|
||||
esac; \
|
||||
case $$flg in \
|
||||
*$$target_option*) has_opt=yes; break;; \
|
||||
esac; \
|
||||
done; \
|
||||
test $$has_opt = yes
|
||||
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
|
||||
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
@USE_CPPFLAG_CURL_STATICLIB_TRUE@am__append_1 = -DCURL_STATICLIB
|
||||
@DEBUGBUILD_TRUE@am__append_2 = -DDEBUGBUILD
|
||||
@CURLDEBUG_TRUE@am__append_3 = -DCURLDEBUG
|
||||
noinst_PROGRAMS = $(am__EXEEXT_1)
|
||||
subdir = tests/libtest
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/curl-amissl.m4 \
|
||||
$(top_srcdir)/m4/curl-compilers.m4 \
|
||||
$(top_srcdir)/m4/curl-confopts.m4 \
|
||||
$(top_srcdir)/m4/curl-functions.m4 \
|
||||
$(top_srcdir)/m4/curl-gnutls.m4 \
|
||||
$(top_srcdir)/m4/curl-mbedtls.m4 \
|
||||
$(top_srcdir)/m4/curl-openssl.m4 \
|
||||
$(top_srcdir)/m4/curl-override.m4 \
|
||||
$(top_srcdir)/m4/curl-reentrant.m4 \
|
||||
$(top_srcdir)/m4/curl-rustls.m4 \
|
||||
$(top_srcdir)/m4/curl-schannel.m4 \
|
||||
$(top_srcdir)/m4/curl-sysconfig.m4 \
|
||||
$(top_srcdir)/m4/curl-wolfssl.m4 $(top_srcdir)/m4/libtool.m4 \
|
||||
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
|
||||
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
|
||||
$(top_srcdir)/m4/xc-am-iface.m4 \
|
||||
$(top_srcdir)/m4/xc-cc-check.m4 \
|
||||
$(top_srcdir)/m4/xc-lt-iface.m4 \
|
||||
$(top_srcdir)/m4/xc-val-flgs.m4 \
|
||||
$(top_srcdir)/m4/zz40-xc-ovr.m4 \
|
||||
$(top_srcdir)/m4/zz50-xc-ovr.m4 \
|
||||
$(top_srcdir)/m4/zz60-xc-ovr.m4 $(top_srcdir)/acinclude.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/lib/curl_config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
am__EXEEXT_1 = libtests$(EXEEXT)
|
||||
PROGRAMS = $(noinst_PROGRAMS)
|
||||
libtests_SOURCES = libtests.c
|
||||
libtests_OBJECTS = libtests.$(OBJEXT)
|
||||
libtests_LDADD = $(LDADD)
|
||||
libtests_DEPENDENCIES = $(top_builddir)/lib/libcurl.la
|
||||
AM_V_lt = $(am__v_lt_@AM_V@)
|
||||
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
|
||||
am__v_lt_0 = --silent
|
||||
am__v_lt_1 =
|
||||
AM_V_P = $(am__v_P_@AM_V@)
|
||||
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
|
||||
am__v_P_0 = false
|
||||
am__v_P_1 = :
|
||||
AM_V_GEN = $(am__v_GEN_@AM_V@)
|
||||
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
|
||||
am__v_GEN_0 = @echo " GEN " $@;
|
||||
am__v_GEN_1 =
|
||||
AM_V_at = $(am__v_at_@AM_V@)
|
||||
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
|
||||
am__v_at_0 = @
|
||||
am__v_at_1 =
|
||||
DEFAULT_INCLUDES =
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
am__maybe_remake_depfiles = depfiles
|
||||
am__depfiles_remade = ./$(DEPDIR)/libtests.Po
|
||||
am__mv = mv -f
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
|
||||
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
|
||||
$(AM_CFLAGS) $(CFLAGS)
|
||||
AM_V_CC = $(am__v_CC_@AM_V@)
|
||||
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
|
||||
am__v_CC_0 = @echo " CC " $@;
|
||||
am__v_CC_1 =
|
||||
CCLD = $(CC)
|
||||
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
|
||||
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
|
||||
am__v_CCLD_0 = @echo " CCLD " $@;
|
||||
am__v_CCLD_1 =
|
||||
SOURCES = libtests.c
|
||||
DIST_SOURCES = libtests.c
|
||||
am__can_run_installinfo = \
|
||||
case $$AM_UPDATE_INFO_DIR in \
|
||||
n|no|NO) false;; \
|
||||
*) (install-info --version) >/dev/null 2>&1;; \
|
||||
esac
|
||||
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
|
||||
# Read a list of newline-separated strings from the standard input,
|
||||
# and print each of them once, without duplicates. Input order is
|
||||
# *not* preserved.
|
||||
am__uniquify_input = $(AWK) '\
|
||||
BEGIN { nonempty = 0; } \
|
||||
{ items[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in items) print i; }; } \
|
||||
'
|
||||
# Make sure the list of sources is unique. This is necessary because,
|
||||
# e.g., the same source file might be shared among _SOURCES variables
|
||||
# for different programs/libraries.
|
||||
am__define_uniq_tagged_files = \
|
||||
list='$(am__tagged_files)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | $(am__uniquify_input)`
|
||||
am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.inc \
|
||||
$(top_srcdir)/depcomp
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||
APXS = @APXS@
|
||||
AR = @AR@
|
||||
AR_FLAGS = @AR_FLAGS@
|
||||
AS = @AS@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
BLANK_AT_MAKETIME = @BLANK_AT_MAKETIME@
|
||||
CADDY = @CADDY@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@ @CURL_CFLAG_EXTRAS@
|
||||
CFLAG_CURL_SYMBOL_HIDING = @CFLAG_CURL_SYMBOL_HIDING@
|
||||
CONFIGURE_OPTIONS = @CONFIGURE_OPTIONS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CSCOPE = @CSCOPE@
|
||||
CTAGS = @CTAGS@
|
||||
CURLVERSION = @CURLVERSION@
|
||||
CURL_CA_BUNDLE = @CURL_CA_BUNDLE@
|
||||
CURL_CA_EMBED = @CURL_CA_EMBED@
|
||||
CURL_CFLAG_EXTRAS = @CURL_CFLAG_EXTRAS@
|
||||
CURL_CPP = @CURL_CPP@
|
||||
CURL_LIBCURL_VERSIONED_SYMBOLS_PREFIX = @CURL_LIBCURL_VERSIONED_SYMBOLS_PREFIX@
|
||||
CURL_LIBCURL_VERSIONED_SYMBOLS_SONAME = @CURL_LIBCURL_VERSIONED_SYMBOLS_SONAME@
|
||||
CURL_NETWORK_AND_TIME_LIBS = @CURL_NETWORK_AND_TIME_LIBS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
ENABLE_SHARED = @ENABLE_SHARED@
|
||||
ENABLE_STATIC = @ENABLE_STATIC@
|
||||
ETAGS = @ETAGS@
|
||||
EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
FILECMD = @FILECMD@
|
||||
FISH_FUNCTIONS_DIR = @FISH_FUNCTIONS_DIR@
|
||||
GCOV = @GCOV@
|
||||
GREP = @GREP@
|
||||
HAVE_LIBZ = @HAVE_LIBZ@
|
||||
HTTPD = @HTTPD@
|
||||
HTTPD_NGHTTPX = @HTTPD_NGHTTPX@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LCOV = @LCOV@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBCURL_PC_CFLAGS = @LIBCURL_PC_CFLAGS@
|
||||
LIBCURL_PC_CFLAGS_PRIVATE = @LIBCURL_PC_CFLAGS_PRIVATE@
|
||||
LIBCURL_PC_LDFLAGS_PRIVATE = @LIBCURL_PC_LDFLAGS_PRIVATE@
|
||||
LIBCURL_PC_LIBS = @LIBCURL_PC_LIBS@
|
||||
LIBCURL_PC_LIBS_PRIVATE = @LIBCURL_PC_LIBS_PRIVATE@
|
||||
LIBCURL_PC_REQUIRES = @LIBCURL_PC_REQUIRES@
|
||||
LIBCURL_PC_REQUIRES_PRIVATE = @LIBCURL_PC_REQUIRES_PRIVATE@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
|
||||
# Prevent LIBS from being used for all link targets
|
||||
LIBS = $(BLANK_AT_MAKETIME)
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MANIFEST_TOOL = @MANIFEST_TOOL@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
NM = @NM@
|
||||
NMEDIT = @NMEDIT@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
OTOOL = @OTOOL@
|
||||
OTOOL64 = @OTOOL64@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
PERL = @PERL@
|
||||
PKGCONFIG = @PKGCONFIG@
|
||||
RANLIB = @RANLIB@
|
||||
RC = @RC@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
SSL_BACKENDS = @SSL_BACKENDS@
|
||||
STRIP = @STRIP@
|
||||
SUPPORT_FEATURES = @SUPPORT_FEATURES@
|
||||
SUPPORT_PROTOCOLS = @SUPPORT_PROTOCOLS@
|
||||
TEST_NGHTTPX = @TEST_NGHTTPX@
|
||||
VERSION = @VERSION@
|
||||
VERSIONNUM = @VERSIONNUM@
|
||||
VSFTPD = @VSFTPD@
|
||||
ZLIB_LIBS = @ZLIB_LIBS@
|
||||
ZSH_FUNCTIONS_DIR = @ZSH_FUNCTIONS_DIR@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_AR = @ac_ct_AR@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
libext = @libext@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
runstatedir = @runstatedir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
|
||||
#***************************************************************************
|
||||
# _ _ ____ _
|
||||
# Project ___| | | | _ \| |
|
||||
# / __| | | | |_) | |
|
||||
# | (__| |_| | _ <| |___
|
||||
# \___|\___/|_| \_\_____|
|
||||
#
|
||||
# Copyright (C) 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
|
||||
# are also available at https://curl.se/docs/copyright.html.
|
||||
#
|
||||
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
# copies of the Software, and permit persons to whom the Software is
|
||||
# furnished to do so, under the terms of the COPYING file.
|
||||
#
|
||||
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
# KIND, either express or implied.
|
||||
#
|
||||
# SPDX-License-Identifier: curl
|
||||
#
|
||||
###########################################################################
|
||||
AUTOMAKE_OPTIONS = foreign nostdinc
|
||||
|
||||
# Specify our include paths here, and do it relative to $(top_srcdir) and
|
||||
# $(top_builddir), to ensure that these paths which belong to the library
|
||||
# being currently built and tested are searched before the library which
|
||||
# might possibly already be installed in the system.
|
||||
#
|
||||
# $(top_srcdir)/include is for libcurl's external include files
|
||||
# $(top_builddir)/lib is for libcurl's generated lib/curl_config.h file
|
||||
# $(top_srcdir)/lib for libcurl's lib/curl_setup.h and other "borrowed" files
|
||||
# $(srcdir) for the generated bundle source to find included test sources
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/lib \
|
||||
-I$(top_srcdir)/lib -I$(srcdir) $(am__append_1) \
|
||||
$(am__append_2) $(am__append_3) -DCURL_NO_OLDIES \
|
||||
-DCURL_DISABLE_DEPRECATION
|
||||
BUNDLE = libtests
|
||||
|
||||
# Files referenced from the bundle source
|
||||
FIRST_C = first.c
|
||||
FIRST_H = first.h
|
||||
|
||||
# Common files used by test programs
|
||||
UTILS_C = memptr.c testutil.c testtrace.c
|
||||
UTILS_H = testutil.h testtrace.h unitcheck.h
|
||||
CURLX_C = \
|
||||
../../lib/curlx/warnless.c \
|
||||
../../lib/curlx/multibyte.c \
|
||||
../../lib/curlx/timediff.c \
|
||||
../../lib/curlx/timeval.c \
|
||||
../../lib/curl_threads.c \
|
||||
../../lib/curlx/version_win32.c \
|
||||
../../lib/curlx/wait.c
|
||||
|
||||
|
||||
# All libtest programs
|
||||
TESTS_C = \
|
||||
lib500.c lib501.c lib502.c lib503.c lib504.c lib505.c lib506.c lib507.c \
|
||||
lib508.c lib509.c lib510.c lib511.c lib512.c lib513.c lib514.c lib515.c \
|
||||
lib516.c lib517.c lib518.c lib519.c lib520.c lib521.c lib523.c lib524.c \
|
||||
lib525.c lib526.c lib530.c \
|
||||
lib533.c lib536.c lib537.c lib539.c lib540.c lib541.c \
|
||||
lib542.c lib543.c lib544.c lib547.c lib549.c \
|
||||
lib552.c lib553.c lib554.c lib555.c lib556.c lib557.c lib558.c lib559.c \
|
||||
lib560.c lib562.c lib564.c lib566.c lib567.c \
|
||||
lib568.c lib569.c lib570.c lib571.c lib572.c lib573.c lib574.c lib575.c \
|
||||
lib576.c lib578.c lib579.c lib582.c lib583.c \
|
||||
lib586.c lib589.c lib590.c lib591.c \
|
||||
lib597.c lib598.c lib599.c \
|
||||
lib643.c \
|
||||
lib650.c lib651.c lib652.c lib653.c lib654.c lib655.c lib658.c lib659.c \
|
||||
lib661.c lib666.c lib667.c lib668.c \
|
||||
lib670.c lib674.c lib676.c lib677.c lib678.c \
|
||||
lib694.c lib695.c \
|
||||
lib751.c lib753.c \
|
||||
lib1156.c \
|
||||
lib1301.c lib1308.c \
|
||||
lib1485.c \
|
||||
lib1500.c lib1501.c lib1502.c lib1506.c \
|
||||
lib1507.c lib1508.c lib1509.c lib1510.c lib1511.c lib1512.c lib1513.c \
|
||||
lib1514.c lib1515.c lib1517.c lib1518.c lib1520.c \
|
||||
lib1522.c lib1523.c lib1525.c lib1526.c lib1527.c lib1528.c \
|
||||
lib1529.c lib1530.c lib1531.c lib1532.c lib1533.c lib1534.c lib1535.c \
|
||||
lib1536.c lib1537.c lib1538.c lib1540.c lib1541.c lib1542.c \
|
||||
lib1545.c lib1550.c lib1551.c \
|
||||
lib1552.c lib1553.c lib1554.c lib1555.c lib1556.c lib1557.c lib1558.c \
|
||||
lib1559.c lib1560.c lib1564.c lib1565.c \
|
||||
lib1567.c lib1568.c lib1569.c lib1571.c \
|
||||
lib1576.c \
|
||||
lib1591.c lib1592.c lib1593.c lib1594.c lib1597.c \
|
||||
lib1598.c lib1599.c \
|
||||
lib1662.c \
|
||||
lib1900.c lib1901.c lib1903.c lib1905.c lib1906.c lib1907.c \
|
||||
lib1908.c lib1910.c lib1911.c lib1912.c lib1913.c \
|
||||
lib1915.c lib1916.c lib1918.c lib1919.c \
|
||||
lib1933.c lib1934.c lib1935.c lib1936.c lib1937.c lib1938.c lib1939.c \
|
||||
lib1940.c lib1945.c \
|
||||
lib1947.c lib1948.c \
|
||||
lib1955.c lib1956.c lib1957.c lib1958.c lib1959.c lib1960.c \
|
||||
lib1964.c lib1970.c \
|
||||
lib1971.c lib1972.c lib1973.c lib1974.c lib1975.c lib1977.c lib1978.c \
|
||||
lib2023.c lib2032.c lib2082.c \
|
||||
lib2301.c lib2302.c lib2304.c lib2306.c lib2308.c lib2309.c \
|
||||
lib2402.c lib2404.c lib2405.c \
|
||||
lib2502.c \
|
||||
lib2700.c \
|
||||
lib3010.c lib3025.c lib3026.c lib3027.c \
|
||||
lib3100.c lib3101.c lib3102.c lib3103.c lib3104.c lib3105.c \
|
||||
lib3207.c lib3208.c
|
||||
|
||||
|
||||
# Get BUNDLE, FIRST_C, FIRST_H, UTILS_C, UTILS_H, CURLX_C, TESTS_C variables
|
||||
EXTRA_DIST = CMakeLists.txt $(FIRST_C) $(FIRST_H) $(UTILS_C) $(UTILS_H) $(TESTS_C) \
|
||||
test307.pl test610.pl test613.pl test1013.pl test1022.pl mk-lib1521.pl
|
||||
|
||||
# These are part of the libcurl static lib. Add them here when linking shared.
|
||||
@USE_CPPFLAG_CURL_STATICLIB_FALSE@curlx_c_lib = $(CURLX_C)
|
||||
@USE_CPPFLAG_CURL_STATICLIB_TRUE@curlx_c_lib =
|
||||
LDADD = $(top_builddir)/lib/libcurl.la
|
||||
CLEANFILES = $(BUNDLE).c lib1521.c
|
||||
CHECKSRC = $(CS_$(V))
|
||||
CS_0 = @echo " RUN " $@;
|
||||
CS_1 =
|
||||
CS_ = $(CS_0)
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .lo .o .obj
|
||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/Makefile.inc $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tests/libtest/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --foreign tests/libtest/Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
|
||||
esac;
|
||||
$(srcdir)/Makefile.inc $(am__empty):
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
|
||||
clean-noinstPROGRAMS:
|
||||
@list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \
|
||||
echo " rm -f" $$list; \
|
||||
rm -f $$list || exit $$?; \
|
||||
test -n "$(EXEEXT)" || exit 0; \
|
||||
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
|
||||
echo " rm -f" $$list; \
|
||||
rm -f $$list
|
||||
|
||||
libtests$(EXEEXT): $(libtests_OBJECTS) $(libtests_DEPENDENCIES) $(EXTRA_libtests_DEPENDENCIES)
|
||||
@rm -f libtests$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(libtests_OBJECTS) $(libtests_LDADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests.Po@am__quote@ # am--include-marker
|
||||
|
||||
$(am__depfiles_remade):
|
||||
@$(MKDIR_P) $(@D)
|
||||
@echo '# dummy' >$@-t && $(am__mv) $@-t $@
|
||||
|
||||
am--depfiles: $(am__depfiles_remade)
|
||||
|
||||
.c.o:
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
|
||||
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
|
||||
|
||||
.c.obj:
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
|
||||
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
|
||||
|
||||
.c.lo:
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
|
||||
@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
ID: $(am__tagged_files)
|
||||
$(am__define_uniq_tagged_files); mkid -fID $$unique
|
||||
tags: tags-am
|
||||
TAGS: tags
|
||||
|
||||
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
$(am__define_uniq_tagged_files); \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
if test $$# -gt 0; then \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
"$$@" $$unique; \
|
||||
else \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$unique; \
|
||||
fi; \
|
||||
fi
|
||||
ctags: ctags-am
|
||||
|
||||
CTAGS: ctags
|
||||
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
|
||||
$(am__define_uniq_tagged_files); \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
cscopelist: cscopelist-am
|
||||
|
||||
cscopelist-am: $(am__tagged_files)
|
||||
list='$(am__tagged_files)'; \
|
||||
case "$(srcdir)" in \
|
||||
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
|
||||
*) sdir=$(subdir)/$(srcdir) ;; \
|
||||
esac; \
|
||||
for i in $$list; do \
|
||||
if test -f "$$i"; then \
|
||||
echo "$(subdir)/$$i"; \
|
||||
else \
|
||||
echo "$$sdir/$$i"; \
|
||||
fi; \
|
||||
done >> $(top_builddir)/cscope.files
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
distdir: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) distdir-am
|
||||
|
||||
distdir-am: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
@NOT_CURL_CI_FALSE@all-local:
|
||||
all-am: Makefile $(PROGRAMS) all-local
|
||||
installdirs:
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
if test -z '$(STRIP)'; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
install; \
|
||||
else \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
|
||||
fi
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic clean-libtool clean-local clean-noinstPROGRAMS \
|
||||
mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -f ./$(DEPDIR)/libtests.Po
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -f ./$(DEPDIR)/libtests.Po
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
|
||||
mostlyclean-libtool
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am:
|
||||
|
||||
.MAKE: install-am install-strip
|
||||
|
||||
.PHONY: CTAGS GTAGS TAGS all all-am all-local am--depfiles check \
|
||||
check-am clean clean-generic clean-libtool clean-local \
|
||||
clean-noinstPROGRAMS cscopelist-am ctags ctags-am distclean \
|
||||
distclean-compile distclean-generic distclean-libtool \
|
||||
distclean-tags distdir dvi dvi-am html html-am info info-am \
|
||||
install install-am install-data install-data-am install-dvi \
|
||||
install-dvi-am install-exec install-exec-am install-html \
|
||||
install-html-am install-info install-info-am install-man \
|
||||
install-pdf install-pdf-am install-ps install-ps-am \
|
||||
install-strip installcheck installcheck-am installdirs \
|
||||
maintainer-clean maintainer-clean-generic mostlyclean \
|
||||
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
|
||||
pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am
|
||||
|
||||
.PRECIOUS: Makefile
|
||||
|
||||
$(BUNDLE).c: $(top_srcdir)/scripts/mk-unity.pl Makefile.inc $(FIRST_C) $(UTILS_C) $(curlx_c_lib) $(TESTS_C) lib1521.c
|
||||
@PERL@ $(top_srcdir)/scripts/mk-unity.pl --include $(UTILS_C) $(curlx_c_lib) --test $(TESTS_C) lib1521.c > $(BUNDLE).c
|
||||
|
||||
lib1521.c: $(top_srcdir)/tests/libtest/mk-lib1521.pl $(top_srcdir)/include/curl/curl.h
|
||||
@PERL@ $(top_srcdir)/tests/libtest/mk-lib1521.pl < $(top_srcdir)/include/curl/curl.h lib1521.c
|
||||
|
||||
# ignore generated C files since they play by slightly different rules!
|
||||
checksrc: lib1521.c
|
||||
$(CHECKSRC)(@PERL@ $(top_srcdir)/scripts/checksrc.pl -D$(srcdir) \
|
||||
-W$(srcdir)/$(BUNDLE).c \
|
||||
$(srcdir)/*.[ch])
|
||||
|
||||
@NOT_CURL_CI_TRUE@all-local: checksrc
|
||||
|
||||
clean-local:
|
||||
rm -f $(BUNDLE)
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
98
curl-8.15.0/tests/libtest/Makefile.inc
Normal file
98
curl-8.15.0/tests/libtest/Makefile.inc
Normal file
@@ -0,0 +1,98 @@
|
||||
#***************************************************************************
|
||||
# _ _ ____ _
|
||||
# Project ___| | | | _ \| |
|
||||
# / __| | | | |_) | |
|
||||
# | (__| |_| | _ <| |___
|
||||
# \___|\___/|_| \_\_____|
|
||||
#
|
||||
# Copyright (C) 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
|
||||
# are also available at https://curl.se/docs/copyright.html.
|
||||
#
|
||||
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
# copies of the Software, and permit persons to whom the Software is
|
||||
# furnished to do so, under the terms of the COPYING file.
|
||||
#
|
||||
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
# KIND, either express or implied.
|
||||
#
|
||||
# SPDX-License-Identifier: curl
|
||||
#
|
||||
###########################################################################
|
||||
# Shared between CMakeLists.txt and Makefile.am
|
||||
|
||||
BUNDLE = libtests
|
||||
|
||||
# Files referenced from the bundle source
|
||||
FIRST_C = first.c
|
||||
FIRST_H = first.h
|
||||
|
||||
# Common files used by test programs
|
||||
UTILS_C = memptr.c testutil.c testtrace.c
|
||||
UTILS_H = testutil.h testtrace.h unitcheck.h
|
||||
|
||||
CURLX_C = \
|
||||
../../lib/curlx/warnless.c \
|
||||
../../lib/curlx/multibyte.c \
|
||||
../../lib/curlx/timediff.c \
|
||||
../../lib/curlx/timeval.c \
|
||||
../../lib/curl_threads.c \
|
||||
../../lib/curlx/version_win32.c \
|
||||
../../lib/curlx/wait.c
|
||||
|
||||
# All libtest programs
|
||||
TESTS_C = \
|
||||
lib500.c lib501.c lib502.c lib503.c lib504.c lib505.c lib506.c lib507.c \
|
||||
lib508.c lib509.c lib510.c lib511.c lib512.c lib513.c lib514.c lib515.c \
|
||||
lib516.c lib517.c lib518.c lib519.c lib520.c lib521.c lib523.c lib524.c \
|
||||
lib525.c lib526.c lib530.c \
|
||||
lib533.c lib536.c lib537.c lib539.c lib540.c lib541.c \
|
||||
lib542.c lib543.c lib544.c lib547.c lib549.c \
|
||||
lib552.c lib553.c lib554.c lib555.c lib556.c lib557.c lib558.c lib559.c \
|
||||
lib560.c lib562.c lib564.c lib566.c lib567.c \
|
||||
lib568.c lib569.c lib570.c lib571.c lib572.c lib573.c lib574.c lib575.c \
|
||||
lib576.c lib578.c lib579.c lib582.c lib583.c \
|
||||
lib586.c lib589.c lib590.c lib591.c \
|
||||
lib597.c lib598.c lib599.c \
|
||||
lib643.c \
|
||||
lib650.c lib651.c lib652.c lib653.c lib654.c lib655.c lib658.c lib659.c \
|
||||
lib661.c lib666.c lib667.c lib668.c \
|
||||
lib670.c lib674.c lib676.c lib677.c lib678.c \
|
||||
lib694.c lib695.c \
|
||||
lib751.c lib753.c \
|
||||
lib1156.c \
|
||||
lib1301.c lib1308.c \
|
||||
lib1485.c \
|
||||
lib1500.c lib1501.c lib1502.c lib1506.c \
|
||||
lib1507.c lib1508.c lib1509.c lib1510.c lib1511.c lib1512.c lib1513.c \
|
||||
lib1514.c lib1515.c lib1517.c lib1518.c lib1520.c \
|
||||
lib1522.c lib1523.c lib1525.c lib1526.c lib1527.c lib1528.c \
|
||||
lib1529.c lib1530.c lib1531.c lib1532.c lib1533.c lib1534.c lib1535.c \
|
||||
lib1536.c lib1537.c lib1538.c lib1540.c lib1541.c lib1542.c \
|
||||
lib1545.c lib1550.c lib1551.c \
|
||||
lib1552.c lib1553.c lib1554.c lib1555.c lib1556.c lib1557.c lib1558.c \
|
||||
lib1559.c lib1560.c lib1564.c lib1565.c \
|
||||
lib1567.c lib1568.c lib1569.c lib1571.c \
|
||||
lib1576.c \
|
||||
lib1591.c lib1592.c lib1593.c lib1594.c lib1597.c \
|
||||
lib1598.c lib1599.c \
|
||||
lib1662.c \
|
||||
lib1900.c lib1901.c lib1903.c lib1905.c lib1906.c lib1907.c \
|
||||
lib1908.c lib1910.c lib1911.c lib1912.c lib1913.c \
|
||||
lib1915.c lib1916.c lib1918.c lib1919.c \
|
||||
lib1933.c lib1934.c lib1935.c lib1936.c lib1937.c lib1938.c lib1939.c \
|
||||
lib1940.c lib1945.c \
|
||||
lib1947.c lib1948.c \
|
||||
lib1955.c lib1956.c lib1957.c lib1958.c lib1959.c lib1960.c \
|
||||
lib1964.c lib1970.c \
|
||||
lib1971.c lib1972.c lib1973.c lib1974.c lib1975.c lib1977.c lib1978.c \
|
||||
lib2023.c lib2032.c lib2082.c \
|
||||
lib2301.c lib2302.c lib2304.c lib2306.c lib2308.c lib2309.c \
|
||||
lib2402.c lib2404.c lib2405.c \
|
||||
lib2502.c \
|
||||
lib2700.c \
|
||||
lib3010.c lib3025.c lib3026.c lib3027.c \
|
||||
lib3100.c lib3101.c lib3102.c lib3103.c lib3104.c lib3105.c \
|
||||
lib3207.c lib3208.c
|
||||
178
curl-8.15.0/tests/libtest/first.c
Normal file
178
curl-8.15.0/tests/libtest/first.c
Normal file
@@ -0,0 +1,178 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#ifdef HAVE_LOCALE_H
|
||||
#include <locale.h> /* for setlocale() */
|
||||
#endif
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
int select_wrapper(int nfds, fd_set *rd, fd_set *wr, fd_set *exc,
|
||||
struct timeval *tv)
|
||||
{
|
||||
if(nfds < 0) {
|
||||
SET_SOCKERRNO(SOCKEINVAL);
|
||||
return -1;
|
||||
}
|
||||
#ifdef USE_WINSOCK
|
||||
/*
|
||||
* Winsock select() requires that at least one of the three fd_set
|
||||
* pointers is not NULL and points to a non-empty fdset. IOW Winsock
|
||||
* select() can not be used to sleep without a single fd_set.
|
||||
*/
|
||||
if(!nfds) {
|
||||
Sleep((DWORD)curlx_tvtoms(tv));
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
return select(nfds, rd, wr, exc, tv);
|
||||
}
|
||||
|
||||
char *libtest_arg2 = NULL;
|
||||
char *libtest_arg3 = NULL;
|
||||
char *libtest_arg4 = NULL;
|
||||
int test_argc;
|
||||
char **test_argv;
|
||||
int testnum;
|
||||
|
||||
struct curltime tv_test_start; /* for test timing */
|
||||
|
||||
int unitfail; /* for unittests */
|
||||
|
||||
#ifdef CURLDEBUG
|
||||
static void memory_tracking_init(void)
|
||||
{
|
||||
char *env;
|
||||
/* if CURL_MEMDEBUG is set, this starts memory tracking message logging */
|
||||
env = getenv("CURL_MEMDEBUG");
|
||||
if(env) {
|
||||
/* use the value as file name */
|
||||
curl_dbg_memdebug(env);
|
||||
}
|
||||
/* if CURL_MEMLIMIT is set, this enables fail-on-alloc-number-N feature */
|
||||
env = getenv("CURL_MEMLIMIT");
|
||||
if(env) {
|
||||
char *endptr;
|
||||
long num = strtol(env, &endptr, 10);
|
||||
if((endptr != env) && (endptr == env + strlen(env)) && (num > 0))
|
||||
curl_dbg_memlimit(num);
|
||||
}
|
||||
}
|
||||
#else
|
||||
# define memory_tracking_init() Curl_nop_stmt
|
||||
#endif
|
||||
|
||||
/* returns a hexdump in a static memory area */
|
||||
char *hexdump(const unsigned char *buf, size_t len)
|
||||
{
|
||||
static char dump[200 * 3 + 1];
|
||||
char *p = dump;
|
||||
size_t i;
|
||||
if(len > 200)
|
||||
return NULL;
|
||||
for(i = 0; i < len; i++, p += 3)
|
||||
curl_msnprintf(p, 4, "%02x ", buf[i]);
|
||||
return dump;
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char *URL;
|
||||
CURLcode result;
|
||||
entry_func_t entry_func;
|
||||
char *entry_name;
|
||||
char *env;
|
||||
size_t tmp;
|
||||
|
||||
CURLX_SET_BINMODE(stdout);
|
||||
|
||||
memory_tracking_init();
|
||||
#ifdef _WIN32
|
||||
curlx_now_init();
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Setup proper locale from environment. This is needed to enable locale-
|
||||
* specific behavior by the C library in order to test for undesired side
|
||||
* effects that could cause in libcurl.
|
||||
*/
|
||||
#ifdef HAVE_SETLOCALE
|
||||
setlocale(LC_ALL, "");
|
||||
#endif
|
||||
|
||||
test_argc = argc - 1;
|
||||
test_argv = argv + 1;
|
||||
|
||||
if(argc < 3) {
|
||||
curl_mfprintf(stderr, "Pass testname and URL as arguments please\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
entry_name = argv[1];
|
||||
entry_func = NULL;
|
||||
for(tmp = 0; s_entries[tmp].ptr; ++tmp) {
|
||||
if(strcmp(entry_name, s_entries[tmp].name) == 0) {
|
||||
entry_func = s_entries[tmp].ptr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!entry_func) {
|
||||
curl_mfprintf(stderr, "Test '%s' not found.\n", entry_name);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if(argc > 3)
|
||||
libtest_arg2 = argv[3];
|
||||
|
||||
if(argc > 4)
|
||||
libtest_arg3 = argv[4];
|
||||
|
||||
if(argc > 5)
|
||||
libtest_arg4 = argv[5];
|
||||
|
||||
URL = argv[2]; /* provide this to the rest */
|
||||
|
||||
env = getenv("CURL_TESTNUM");
|
||||
if(env)
|
||||
testnum = atoi(env);
|
||||
else
|
||||
testnum = 0;
|
||||
|
||||
curl_mfprintf(stderr, "URL: %s\n", URL);
|
||||
|
||||
result = entry_func(URL);
|
||||
curl_mfprintf(stderr, "Test ended with result %d\n", result);
|
||||
|
||||
#ifdef _WIN32
|
||||
/* flush buffers of all streams regardless of mode */
|
||||
_flushall();
|
||||
#endif
|
||||
|
||||
/* Regular program status codes are limited to 0..127 and 126 and 127 have
|
||||
* special meanings by the shell, so limit a normal return code to 125 */
|
||||
return (int)result <= 125 ? (int)result : 125;
|
||||
}
|
||||
513
curl-8.15.0/tests/libtest/first.h
Normal file
513
curl-8.15.0/tests/libtest/first.h
Normal file
@@ -0,0 +1,513 @@
|
||||
#ifndef HEADER_LIBTEST_FIRST_H
|
||||
#define HEADER_LIBTEST_FIRST_H
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
/* Now include the curl_setup.h file from libcurl's private libdir (the source
|
||||
version, but that might include "curl_config.h" from the build dir so we
|
||||
need both of them in the include path), so that we get good in-depth
|
||||
knowledge about the system we're building this on */
|
||||
#include "curl_setup.h"
|
||||
|
||||
#include <curl/curl.h>
|
||||
|
||||
typedef CURLcode (*entry_func_t)(char *);
|
||||
|
||||
struct entry_s {
|
||||
const char *name;
|
||||
entry_func_t ptr;
|
||||
};
|
||||
|
||||
extern const struct entry_s s_entries[];
|
||||
|
||||
extern int unitfail; /* for unittests */
|
||||
|
||||
#include <curlx/curlx.h>
|
||||
|
||||
#ifdef HAVE_SYS_SELECT_H
|
||||
/* since so many tests use select(), we can just as well include it here */
|
||||
#include <sys/select.h>
|
||||
#endif
|
||||
|
||||
#include "curl_printf.h"
|
||||
|
||||
/* GCC <4.6 does not support '#pragma GCC diagnostic push' and
|
||||
does not support 'pragma GCC diagnostic' inside functions. */
|
||||
#if (defined(__GNUC__) && \
|
||||
((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6))))
|
||||
#define CURL_GNUC_DIAG
|
||||
#endif
|
||||
|
||||
#define test_setopt(A,B,C) \
|
||||
if((res = curl_easy_setopt((A), (B), (C))) != CURLE_OK) \
|
||||
goto test_cleanup
|
||||
|
||||
#define test_multi_setopt(A,B,C) \
|
||||
if((res = curl_multi_setopt((A), (B), (C))) != CURLE_OK) \
|
||||
goto test_cleanup
|
||||
|
||||
extern char *libtest_arg2; /* set by first.c to the argv[2] or NULL */
|
||||
extern char *libtest_arg3; /* set by first.c to the argv[3] or NULL */
|
||||
extern char *libtest_arg4; /* set by first.c to the argv[4] or NULL */
|
||||
|
||||
/* argc and argv as passed in to the main() function */
|
||||
extern int test_argc;
|
||||
extern char **test_argv;
|
||||
extern int testnum;
|
||||
extern struct curltime tv_test_start; /* for test timing */
|
||||
|
||||
extern int select_wrapper(int nfds, fd_set *rd, fd_set *wr, fd_set *exc,
|
||||
struct timeval *tv);
|
||||
|
||||
extern char *hexdump(const unsigned char *buffer, size_t len);
|
||||
|
||||
/*
|
||||
** TEST_ERR_* values must within the CURLcode range to not cause compiler
|
||||
** errors.
|
||||
|
||||
** For portability reasons TEST_ERR_* values should be less than 127.
|
||||
*/
|
||||
|
||||
#define TEST_ERR_MAJOR_BAD CURLE_OBSOLETE20
|
||||
#define TEST_ERR_RUNS_FOREVER CURLE_OBSOLETE24
|
||||
#define TEST_ERR_EASY_INIT CURLE_OBSOLETE29
|
||||
#define TEST_ERR_MULTI CURLE_OBSOLETE32
|
||||
#define TEST_ERR_NUM_HANDLES CURLE_OBSOLETE34
|
||||
#define TEST_ERR_SELECT CURLE_OBSOLETE40
|
||||
#define TEST_ERR_SUCCESS CURLE_OBSOLETE41
|
||||
#define TEST_ERR_FAILURE CURLE_OBSOLETE44
|
||||
#define TEST_ERR_USAGE CURLE_OBSOLETE46
|
||||
#define TEST_ERR_FOPEN CURLE_OBSOLETE50
|
||||
#define TEST_ERR_FSTAT CURLE_OBSOLETE51
|
||||
#define TEST_ERR_BAD_TIMEOUT CURLE_OBSOLETE57
|
||||
|
||||
/*
|
||||
** Macros for test source code readability/maintainability.
|
||||
**
|
||||
** All of the following macros require that an int data type 'res' variable
|
||||
** exists in scope where macro is used, and that it has been initialized to
|
||||
** zero before the macro is used.
|
||||
**
|
||||
** exe_* and chk_* macros are helper macros not intended to be used from
|
||||
** outside of this header file. Arguments 'Y' and 'Z' of these represent
|
||||
** source code file and line number, while Arguments 'A', 'B', etc, are
|
||||
** the arguments used to actually call a libcurl function.
|
||||
**
|
||||
** All easy_* and multi_* macros call a libcurl function and evaluate if
|
||||
** the function has succeeded or failed. When the function succeeds 'res'
|
||||
** variable is not set nor cleared and program continues normal flow. On
|
||||
** the other hand if function fails 'res' variable is set and a jump to
|
||||
** label 'test_cleanup' is performed.
|
||||
**
|
||||
** Every easy_* and multi_* macros have a res_easy_* and res_multi_* macro
|
||||
** counterpart that operates in the same way with the exception that no
|
||||
** jump takes place in case of failure. res_easy_* and res_multi_* macros
|
||||
** should be immediately followed by checking if 'res' variable has been
|
||||
** set.
|
||||
**
|
||||
** 'res' variable when set will hold a CURLcode, CURLMcode, or any of the
|
||||
** TEST_ERR_* values defined above. It is advisable to return this value
|
||||
** as test result.
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
#define exe_easy_init(A,Y,Z) do { \
|
||||
if(((A) = curl_easy_init()) == NULL) { \
|
||||
curl_mfprintf(stderr, "%s:%d curl_easy_init() failed\n", (Y), (Z)); \
|
||||
res = TEST_ERR_EASY_INIT; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define res_easy_init(A) \
|
||||
exe_easy_init((A), (__FILE__), (__LINE__))
|
||||
|
||||
#define chk_easy_init(A,Y,Z) do { \
|
||||
exe_easy_init((A), (Y), (Z)); \
|
||||
if(res) \
|
||||
goto test_cleanup; \
|
||||
} while(0)
|
||||
|
||||
#define easy_init(A) \
|
||||
chk_easy_init((A), (__FILE__), (__LINE__))
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
#define exe_multi_init(A,Y,Z) do { \
|
||||
if(((A) = curl_multi_init()) == NULL) { \
|
||||
curl_mfprintf(stderr, "%s:%d curl_multi_init() failed\n", (Y), (Z)); \
|
||||
res = TEST_ERR_MULTI; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define res_multi_init(A) \
|
||||
exe_multi_init((A), (__FILE__), (__LINE__))
|
||||
|
||||
#define chk_multi_init(A,Y,Z) do { \
|
||||
exe_multi_init((A), (Y), (Z)); \
|
||||
if(res) \
|
||||
goto test_cleanup; \
|
||||
} while(0)
|
||||
|
||||
#define multi_init(A) \
|
||||
chk_multi_init((A), (__FILE__), (__LINE__))
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
#define exe_easy_setopt(A,B,C,Y,Z) do { \
|
||||
CURLcode ec; \
|
||||
if((ec = curl_easy_setopt((A), (B), (C))) != CURLE_OK) { \
|
||||
curl_mfprintf(stderr, "%s:%d curl_easy_setopt() failed, " \
|
||||
"with code %d (%s)\n", \
|
||||
(Y), (Z), (int)ec, curl_easy_strerror(ec)); \
|
||||
res = ec; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define res_easy_setopt(A, B, C) \
|
||||
exe_easy_setopt((A), (B), (C), (__FILE__), (__LINE__))
|
||||
|
||||
#define chk_easy_setopt(A, B, C, Y, Z) do { \
|
||||
exe_easy_setopt((A), (B), (C), (Y), (Z)); \
|
||||
if(res) \
|
||||
goto test_cleanup; \
|
||||
} while(0)
|
||||
|
||||
#define easy_setopt(A, B, C) \
|
||||
chk_easy_setopt((A), (B), (C), (__FILE__), (__LINE__))
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
#define exe_multi_setopt(A, B, C, Y, Z) do { \
|
||||
CURLMcode ec; \
|
||||
if((ec = curl_multi_setopt((A), (B), (C))) != CURLM_OK) { \
|
||||
curl_mfprintf(stderr, "%s:%d curl_multi_setopt() failed, " \
|
||||
"with code %d (%s)\n", \
|
||||
(Y), (Z), (int)ec, curl_multi_strerror(ec)); \
|
||||
res = TEST_ERR_MULTI; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define res_multi_setopt(A,B,C) \
|
||||
exe_multi_setopt((A), (B), (C), (__FILE__), (__LINE__))
|
||||
|
||||
#define chk_multi_setopt(A,B,C,Y,Z) do { \
|
||||
exe_multi_setopt((A), (B), (C), (Y), (Z)); \
|
||||
if(res) \
|
||||
goto test_cleanup; \
|
||||
} while(0)
|
||||
|
||||
#define multi_setopt(A,B,C) \
|
||||
chk_multi_setopt((A), (B), (C), (__FILE__), (__LINE__))
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
#define exe_multi_add_handle(A,B,Y,Z) do { \
|
||||
CURLMcode ec; \
|
||||
if((ec = curl_multi_add_handle((A), (B))) != CURLM_OK) { \
|
||||
curl_mfprintf(stderr, "%s:%d curl_multi_add_handle() failed, " \
|
||||
"with code %d (%s)\n", \
|
||||
(Y), (Z), (int)ec, curl_multi_strerror(ec)); \
|
||||
res = TEST_ERR_MULTI; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define res_multi_add_handle(A, B) \
|
||||
exe_multi_add_handle((A), (B), (__FILE__), (__LINE__))
|
||||
|
||||
#define chk_multi_add_handle(A, B, Y, Z) do { \
|
||||
exe_multi_add_handle((A), (B), (Y), (Z)); \
|
||||
if(res) \
|
||||
goto test_cleanup; \
|
||||
} while(0)
|
||||
|
||||
#define multi_add_handle(A, B) \
|
||||
chk_multi_add_handle((A), (B), (__FILE__), (__LINE__))
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
#define exe_multi_remove_handle(A,B,Y,Z) do { \
|
||||
CURLMcode ec; \
|
||||
if((ec = curl_multi_remove_handle((A), (B))) != CURLM_OK) { \
|
||||
curl_mfprintf(stderr, "%s:%d curl_multi_remove_handle() failed, " \
|
||||
"with code %d (%s)\n", \
|
||||
(Y), (Z), (int)ec, curl_multi_strerror(ec)); \
|
||||
res = TEST_ERR_MULTI; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define res_multi_remove_handle(A, B) \
|
||||
exe_multi_remove_handle((A), (B), (__FILE__), (__LINE__))
|
||||
|
||||
#define chk_multi_remove_handle(A, B, Y, Z) do { \
|
||||
exe_multi_remove_handle((A), (B), (Y), (Z)); \
|
||||
if(res) \
|
||||
goto test_cleanup; \
|
||||
} while(0)
|
||||
|
||||
|
||||
#define multi_remove_handle(A, B) \
|
||||
chk_multi_remove_handle((A), (B), (__FILE__), (__LINE__))
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
#define exe_multi_perform(A,B,Y,Z) do { \
|
||||
CURLMcode ec; \
|
||||
if((ec = curl_multi_perform((A), (B))) != CURLM_OK) { \
|
||||
curl_mfprintf(stderr, "%s:%d curl_multi_perform() failed, " \
|
||||
"with code %d (%s)\n", \
|
||||
(Y), (Z), (int)ec, curl_multi_strerror(ec)); \
|
||||
res = TEST_ERR_MULTI; \
|
||||
} \
|
||||
else if(*((B)) < 0) { \
|
||||
curl_mfprintf(stderr, "%s:%d curl_multi_perform() succeeded, " \
|
||||
"but returned invalid running_handles value (%d)\n", \
|
||||
(Y), (Z), (int)*((B))); \
|
||||
res = TEST_ERR_NUM_HANDLES; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define res_multi_perform(A, B) \
|
||||
exe_multi_perform((A), (B), (__FILE__), (__LINE__))
|
||||
|
||||
#define chk_multi_perform(A, B, Y, Z) do { \
|
||||
exe_multi_perform((A), (B), (Y), (Z)); \
|
||||
if(res) \
|
||||
goto test_cleanup; \
|
||||
} while(0)
|
||||
|
||||
#define multi_perform(A,B) \
|
||||
chk_multi_perform((A), (B), (__FILE__), (__LINE__))
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
#define exe_multi_fdset(A, B, C, D, E, Y, Z) do { \
|
||||
CURLMcode ec; \
|
||||
if((ec = curl_multi_fdset((A), (B), (C), (D), (E))) != CURLM_OK) { \
|
||||
curl_mfprintf(stderr, "%s:%d curl_multi_fdset() failed, " \
|
||||
"with code %d (%s)\n", \
|
||||
(Y), (Z), (int)ec, curl_multi_strerror(ec)); \
|
||||
res = TEST_ERR_MULTI; \
|
||||
} \
|
||||
else if(*((E)) < -1) { \
|
||||
curl_mfprintf(stderr, "%s:%d curl_multi_fdset() succeeded, " \
|
||||
"but returned invalid max_fd value (%d)\n", \
|
||||
(Y), (Z), (int)*((E))); \
|
||||
res = TEST_ERR_NUM_HANDLES; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define res_multi_fdset(A, B, C, D, E) \
|
||||
exe_multi_fdset((A), (B), (C), (D), (E), (__FILE__), (__LINE__))
|
||||
|
||||
#define chk_multi_fdset(A, B, C, D, E, Y, Z) do { \
|
||||
exe_multi_fdset((A), (B), (C), (D), (E), (Y), (Z)); \
|
||||
if(res) \
|
||||
goto test_cleanup; \
|
||||
} while(0)
|
||||
|
||||
#define multi_fdset(A, B, C, D, E) \
|
||||
chk_multi_fdset((A), (B), (C), (D), (E), (__FILE__), (__LINE__))
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
#define exe_multi_timeout(A,B,Y,Z) do { \
|
||||
CURLMcode ec; \
|
||||
if((ec = curl_multi_timeout((A), (B))) != CURLM_OK) { \
|
||||
curl_mfprintf(stderr, "%s:%d curl_multi_timeout() failed, " \
|
||||
"with code %d (%s)\n", \
|
||||
(Y), (Z), (int)ec, curl_multi_strerror(ec)); \
|
||||
res = TEST_ERR_BAD_TIMEOUT; \
|
||||
} \
|
||||
else if(*((B)) < -1L) { \
|
||||
curl_mfprintf(stderr, "%s:%d curl_multi_timeout() succeeded, " \
|
||||
"but returned invalid timeout value (%ld)\n", \
|
||||
(Y), (Z), (long)*((B))); \
|
||||
res = TEST_ERR_BAD_TIMEOUT; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define res_multi_timeout(A, B) \
|
||||
exe_multi_timeout((A), (B), (__FILE__), (__LINE__))
|
||||
|
||||
#define chk_multi_timeout(A, B, Y, Z) do { \
|
||||
exe_multi_timeout((A), (B), (Y), (Z)); \
|
||||
if(res) \
|
||||
goto test_cleanup; \
|
||||
} while(0)
|
||||
|
||||
#define multi_timeout(A, B) \
|
||||
chk_multi_timeout((A), (B), (__FILE__), (__LINE__))
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
#define exe_multi_poll(A,B,C,D,E,Y,Z) do { \
|
||||
CURLMcode ec; \
|
||||
if((ec = curl_multi_poll((A), (B), (C), (D), (E))) != CURLM_OK) { \
|
||||
curl_mfprintf(stderr, "%s:%d curl_multi_poll() failed, " \
|
||||
"with code %d (%s)\n", \
|
||||
(Y), (Z), (int)ec, curl_multi_strerror(ec)); \
|
||||
res = TEST_ERR_MULTI; \
|
||||
} \
|
||||
else if(*((E)) < 0) { \
|
||||
curl_mfprintf(stderr, "%s:%d curl_multi_poll() succeeded, " \
|
||||
"but returned invalid numfds value (%d)\n", \
|
||||
(Y), (Z), (int)*((E))); \
|
||||
res = TEST_ERR_NUM_HANDLES; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define res_multi_poll(A, B, C, D, E) \
|
||||
exe_multi_poll((A), (B), (C), (D), (E), (__FILE__), (__LINE__))
|
||||
|
||||
#define chk_multi_poll(A, B, C, D, E, Y, Z) do { \
|
||||
exe_multi_poll((A), (B), (C), (D), (E), (Y), (Z)); \
|
||||
if(res) \
|
||||
goto test_cleanup; \
|
||||
} while(0)
|
||||
|
||||
#define multi_poll(A, B, C, D, E) \
|
||||
chk_multi_poll((A), (B), (C), (D), (E), (__FILE__), (__LINE__))
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
#define exe_multi_wakeup(A,Y,Z) do { \
|
||||
CURLMcode ec; \
|
||||
if((ec = curl_multi_wakeup((A))) != CURLM_OK) { \
|
||||
curl_mfprintf(stderr, "%s:%d curl_multi_wakeup() failed, " \
|
||||
"with code %d (%s)\n", \
|
||||
(Y), (Z), (int)ec, curl_multi_strerror(ec)); \
|
||||
res = TEST_ERR_MULTI; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define res_multi_wakeup(A) \
|
||||
exe_multi_wakeup((A), (__FILE__), (__LINE__))
|
||||
|
||||
#define chk_multi_wakeup(A, Y, Z) do { \
|
||||
exe_multi_wakeup((A), (Y), (Z)); \
|
||||
if(res) \
|
||||
goto test_cleanup; \
|
||||
} while(0)
|
||||
|
||||
#define multi_wakeup(A) \
|
||||
chk_multi_wakeup((A), (__FILE__), (__LINE__))
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
#define exe_select_test(A, B, C, D, E, Y, Z) do { \
|
||||
int ec; \
|
||||
if(select_wrapper((A), (B), (C), (D), (E)) == -1) { \
|
||||
ec = SOCKERRNO; \
|
||||
curl_mfprintf(stderr, "%s:%d select() failed, with " \
|
||||
"errno %d (%s)\n", \
|
||||
(Y), (Z), ec, strerror(ec)); \
|
||||
res = TEST_ERR_SELECT; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define res_select_test(A, B, C, D, E) \
|
||||
exe_select_test((A), (B), (C), (D), (E), (__FILE__), (__LINE__))
|
||||
|
||||
#define chk_select_test(A, B, C, D, E, Y, Z) do { \
|
||||
exe_select_test((A), (B), (C), (D), (E), (Y), (Z)); \
|
||||
if(res) \
|
||||
goto test_cleanup; \
|
||||
} while(0)
|
||||
|
||||
#define select_test(A, B, C, D, E) \
|
||||
chk_select_test((A), (B), (C), (D), (E), (__FILE__), (__LINE__))
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
#define start_test_timing() do { \
|
||||
tv_test_start = curlx_now(); \
|
||||
} while(0)
|
||||
|
||||
#define TEST_HANG_TIMEOUT 60 * 1000 /* global default */
|
||||
|
||||
#define exe_test_timedout(T,Y,Z) do { \
|
||||
timediff_t timediff = curlx_timediff(curlx_now(), tv_test_start); \
|
||||
if(timediff > (T)) { \
|
||||
curl_mfprintf(stderr, "%s:%d ABORTING TEST, since it seems " \
|
||||
"that it would have run forever (%ld ms > %ld ms)\n", \
|
||||
(Y), (Z), (long)timediff, (long)(TEST_HANG_TIMEOUT)); \
|
||||
res = TEST_ERR_RUNS_FOREVER; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define res_test_timedout() \
|
||||
exe_test_timedout(TEST_HANG_TIMEOUT, (__FILE__), (__LINE__))
|
||||
|
||||
#define res_test_timedout_custom(T) \
|
||||
exe_test_timedout((T), (__FILE__), (__LINE__))
|
||||
|
||||
#define chk_test_timedout(T, Y, Z) do { \
|
||||
exe_test_timedout(T, Y, Z); \
|
||||
if(res) \
|
||||
goto test_cleanup; \
|
||||
} while(0)
|
||||
|
||||
#define abort_on_test_timeout() \
|
||||
chk_test_timedout(TEST_HANG_TIMEOUT, (__FILE__), (__LINE__))
|
||||
|
||||
#define abort_on_test_timeout_custom(T) \
|
||||
chk_test_timedout((T), (__FILE__), (__LINE__))
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
#define exe_global_init(A,Y,Z) do { \
|
||||
CURLcode ec; \
|
||||
if((ec = curl_global_init((A))) != CURLE_OK) { \
|
||||
curl_mfprintf(stderr, "%s:%d curl_global_init() failed, " \
|
||||
"with code %d (%s)\n", \
|
||||
(Y), (Z), (int)ec, curl_easy_strerror(ec)); \
|
||||
res = ec; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define res_global_init(A) \
|
||||
exe_global_init((A), (__FILE__), (__LINE__))
|
||||
|
||||
#define chk_global_init(A, Y, Z) do { \
|
||||
exe_global_init((A), (Y), (Z)); \
|
||||
if(res) \
|
||||
return res; \
|
||||
} while(0)
|
||||
|
||||
/* global_init() is different than other macros. In case of
|
||||
failure it 'return's instead of going to 'test_cleanup'. */
|
||||
|
||||
#define global_init(A) \
|
||||
chk_global_init((A), (__FILE__), (__LINE__))
|
||||
|
||||
#define NO_SUPPORT_BUILT_IN \
|
||||
{ \
|
||||
(void)URL; \
|
||||
curl_mfprintf(stderr, "Missing support\n"); \
|
||||
return CURLE_UNSUPPORTED_PROTOCOL; \
|
||||
}
|
||||
|
||||
#define NUM_HANDLES 4 /* global default */
|
||||
|
||||
#endif /* HEADER_LIBTEST_FIRST_H */
|
||||
173
curl-8.15.0/tests/libtest/lib1156.c
Normal file
173
curl-8.15.0/tests/libtest/lib1156.c
Normal file
@@ -0,0 +1,173 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
/*
|
||||
Check range/resume returned error codes and data presence.
|
||||
|
||||
The input parameters are:
|
||||
- CURLOPT_RANGE/CURLOPT_RESUME_FROM
|
||||
- CURLOPT_FAILONERROR
|
||||
- Returned http code (2xx/416)
|
||||
- Content-Range header present in reply.
|
||||
|
||||
*/
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
#define F_RESUME (1 << 0) /* resume/range. */
|
||||
#define F_HTTP416 (1 << 1) /* Server returns http code 416. */
|
||||
#define F_FAIL (1 << 2) /* Fail on error. */
|
||||
#define F_CONTENTRANGE (1 << 3) /* Server sends content-range hdr. */
|
||||
#define F_IGNOREBODY (1 << 4) /* Body should be ignored. */
|
||||
|
||||
struct testparams {
|
||||
unsigned int flags; /* ORed flags as above. */
|
||||
CURLcode result; /* Code that should be returned by curl_easy_perform(). */
|
||||
};
|
||||
|
||||
static const struct testparams testparams[] = {
|
||||
{ 0, CURLE_OK },
|
||||
{ F_CONTENTRANGE, CURLE_OK },
|
||||
{ F_FAIL, CURLE_OK },
|
||||
{ F_FAIL | F_CONTENTRANGE, CURLE_OK },
|
||||
{ F_HTTP416, CURLE_OK },
|
||||
{ F_HTTP416 | F_CONTENTRANGE, CURLE_OK },
|
||||
{ F_HTTP416 | F_FAIL | F_IGNOREBODY,
|
||||
CURLE_HTTP_RETURNED_ERROR },
|
||||
{ F_HTTP416 | F_FAIL | F_CONTENTRANGE | F_IGNOREBODY,
|
||||
CURLE_HTTP_RETURNED_ERROR },
|
||||
{ F_RESUME | F_IGNOREBODY,
|
||||
CURLE_RANGE_ERROR },
|
||||
{ F_RESUME | F_CONTENTRANGE, CURLE_OK },
|
||||
{ F_RESUME | F_FAIL | F_IGNOREBODY,
|
||||
CURLE_RANGE_ERROR },
|
||||
{ F_RESUME | F_FAIL | F_CONTENTRANGE, CURLE_OK },
|
||||
{ F_RESUME | F_HTTP416 | F_IGNOREBODY, CURLE_OK },
|
||||
{ F_RESUME | F_HTTP416 | F_CONTENTRANGE | F_IGNOREBODY, CURLE_OK },
|
||||
{ F_RESUME | F_HTTP416 | F_FAIL | F_IGNOREBODY, CURLE_OK },
|
||||
{ F_RESUME | F_HTTP416 | F_FAIL | F_CONTENTRANGE | F_IGNOREBODY,
|
||||
CURLE_OK }
|
||||
};
|
||||
|
||||
static int hasbody;
|
||||
|
||||
static size_t writedata(char *data, size_t size, size_t nmemb, void *userdata)
|
||||
{
|
||||
(void) data;
|
||||
(void) userdata;
|
||||
|
||||
if(size && nmemb)
|
||||
hasbody = 1;
|
||||
return size * nmemb;
|
||||
}
|
||||
|
||||
static int onetest(CURL *curl, const char *url, const struct testparams *p,
|
||||
size_t num)
|
||||
{
|
||||
CURLcode res;
|
||||
unsigned int replyselector;
|
||||
char urlbuf[256];
|
||||
|
||||
replyselector = (p->flags & F_CONTENTRANGE) ? 1 : 0;
|
||||
if(p->flags & F_HTTP416)
|
||||
replyselector += 2;
|
||||
curl_msnprintf(urlbuf, sizeof(urlbuf), "%s%04u", url, replyselector);
|
||||
test_setopt(curl, CURLOPT_URL, urlbuf);
|
||||
test_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
test_setopt(curl, CURLOPT_RESUME_FROM, (p->flags & F_RESUME) ? 3L : 0L);
|
||||
test_setopt(curl, CURLOPT_RANGE, !(p->flags & F_RESUME) ?
|
||||
"3-1000000": (char *) NULL);
|
||||
test_setopt(curl, CURLOPT_FAILONERROR, (p->flags & F_FAIL) ? 1L : 0L);
|
||||
hasbody = 0;
|
||||
res = curl_easy_perform(curl);
|
||||
if(res != p->result) {
|
||||
curl_mprintf("%zd: bad error code (%d): resume=%s, fail=%s, http416=%s, "
|
||||
"content-range=%s, expected=%d\n", num, res,
|
||||
(p->flags & F_RESUME) ? "yes": "no",
|
||||
(p->flags & F_FAIL) ? "yes": "no",
|
||||
(p->flags & F_HTTP416) ? "yes": "no",
|
||||
(p->flags & F_CONTENTRANGE) ? "yes": "no",
|
||||
p->result);
|
||||
return 1;
|
||||
}
|
||||
if(hasbody && (p->flags & F_IGNOREBODY)) {
|
||||
curl_mprintf("body should be ignored and is not: resume=%s, fail=%s, "
|
||||
"http416=%s, content-range=%s\n",
|
||||
(p->flags & F_RESUME) ? "yes": "no",
|
||||
(p->flags & F_FAIL) ? "yes": "no",
|
||||
(p->flags & F_HTTP416) ? "yes": "no",
|
||||
(p->flags & F_CONTENTRANGE) ? "yes": "no");
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
||||
test_cleanup:
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* for debugging: */
|
||||
/* #define SINGLETEST 9 */
|
||||
|
||||
static CURLcode test_lib1156(char *URL)
|
||||
{
|
||||
CURLcode res;
|
||||
CURL *curl;
|
||||
size_t i;
|
||||
int status = 0;
|
||||
|
||||
if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
|
||||
curl_mfprintf(stderr, "curl_global_init() failed\n");
|
||||
return TEST_ERR_MAJOR_BAD;
|
||||
}
|
||||
|
||||
for(i = 0; i < CURL_ARRAYSIZE(testparams); i++) {
|
||||
curl = curl_easy_init();
|
||||
if(!curl) {
|
||||
curl_mfprintf(stderr, "curl_easy_init() failed\n");
|
||||
curl_global_cleanup();
|
||||
return TEST_ERR_MAJOR_BAD;
|
||||
}
|
||||
|
||||
test_setopt(curl, CURLOPT_WRITEFUNCTION, writedata);
|
||||
|
||||
#ifdef SINGLETEST
|
||||
if(SINGLETEST == i)
|
||||
#endif
|
||||
status |= onetest(curl, URL, testparams + i, i);
|
||||
curl_easy_cleanup(curl);
|
||||
}
|
||||
|
||||
curl_global_cleanup();
|
||||
curl_mprintf("%d\n", status);
|
||||
return (CURLcode)status;
|
||||
|
||||
test_cleanup:
|
||||
|
||||
curl_easy_cleanup(curl);
|
||||
curl_global_cleanup();
|
||||
|
||||
return res;
|
||||
}
|
||||
62
curl-8.15.0/tests/libtest/lib1301.c
Normal file
62
curl-8.15.0/tests/libtest/lib1301.c
Normal file
@@ -0,0 +1,62 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#define t1301_fail_unless(expr, msg) \
|
||||
do { \
|
||||
if(!(expr)) { \
|
||||
curl_mfprintf(stderr, "%s:%d Assertion '%s' FAILED: %s\n", \
|
||||
__FILE__, __LINE__, #expr, msg); \
|
||||
return TEST_ERR_FAILURE; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
static CURLcode test_lib1301(char *URL)
|
||||
{
|
||||
int rc;
|
||||
(void)URL;
|
||||
|
||||
rc = curl_strequal("iii", "III");
|
||||
t1301_fail_unless(rc != 0, "return code should be non-zero");
|
||||
|
||||
rc = curl_strequal("iiia", "III");
|
||||
t1301_fail_unless(rc == 0, "return code should be zero");
|
||||
|
||||
rc = curl_strequal("iii", "IIIa");
|
||||
t1301_fail_unless(rc == 0, "return code should be zero");
|
||||
|
||||
rc = curl_strequal("iiiA", "IIIa");
|
||||
t1301_fail_unless(rc != 0, "return code should be non-zero");
|
||||
|
||||
rc = curl_strnequal("iii", "III", 3);
|
||||
t1301_fail_unless(rc != 0, "return code should be non-zero");
|
||||
|
||||
rc = curl_strnequal("iiiABC", "IIIcba", 3);
|
||||
t1301_fail_unless(rc != 0, "return code should be non-zero");
|
||||
|
||||
rc = curl_strnequal("ii", "II", 3);
|
||||
t1301_fail_unless(rc != 0, "return code should be non-zero");
|
||||
|
||||
return CURLE_OK;
|
||||
}
|
||||
94
curl-8.15.0/tests/libtest/lib1308.c
Normal file
94
curl-8.15.0/tests/libtest/lib1308.c
Normal file
@@ -0,0 +1,94 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
static size_t print_httppost_callback(void *arg, const char *buf, size_t len)
|
||||
{
|
||||
fwrite(buf, len, 1, stdout);
|
||||
(*(size_t *) arg) += len;
|
||||
return len;
|
||||
}
|
||||
|
||||
#define t1308_fail_unless(expr, msg) \
|
||||
do { \
|
||||
if(!(expr)) { \
|
||||
curl_mfprintf(stderr, "%s:%d Assertion '%s' FAILED: %s\n", \
|
||||
__FILE__, __LINE__, #expr, msg); \
|
||||
errorcount++; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
static CURLcode test_lib1308(char *URL)
|
||||
{
|
||||
int errorcount = 0;
|
||||
CURLFORMcode rc;
|
||||
int res;
|
||||
struct curl_httppost *post = NULL;
|
||||
struct curl_httppost *last = NULL;
|
||||
size_t total_size = 0;
|
||||
char buffer[] = "test buffer";
|
||||
|
||||
rc = curl_formadd(&post, &last, CURLFORM_COPYNAME, "name",
|
||||
CURLFORM_COPYCONTENTS, "content", CURLFORM_END);
|
||||
t1308_fail_unless(rc == 0, "curl_formadd returned error");
|
||||
|
||||
/* after the first curl_formadd when there's a single entry, both pointers
|
||||
should point to the same struct */
|
||||
t1308_fail_unless(post == last, "post and last weren't the same");
|
||||
|
||||
rc = curl_formadd(&post, &last, CURLFORM_COPYNAME, "htmlcode",
|
||||
CURLFORM_COPYCONTENTS, "<HTML></HTML>",
|
||||
CURLFORM_CONTENTTYPE, "text/html", CURLFORM_END);
|
||||
t1308_fail_unless(rc == 0, "curl_formadd returned error");
|
||||
|
||||
rc = curl_formadd(&post, &last, CURLFORM_COPYNAME, "name_for_ptrcontent",
|
||||
CURLFORM_PTRCONTENTS, buffer, CURLFORM_END);
|
||||
t1308_fail_unless(rc == 0, "curl_formadd returned error");
|
||||
|
||||
res = curl_formget(post, &total_size, print_httppost_callback);
|
||||
t1308_fail_unless(res == 0, "curl_formget returned error");
|
||||
|
||||
t1308_fail_unless(total_size == 518, "curl_formget got wrong size back");
|
||||
|
||||
curl_formfree(post);
|
||||
|
||||
/* start a new formpost with a file upload and formget */
|
||||
post = last = NULL;
|
||||
|
||||
rc = curl_formadd(&post, &last,
|
||||
CURLFORM_PTRNAME, "name of file field",
|
||||
CURLFORM_FILE, URL,
|
||||
CURLFORM_FILENAME, "custom named file",
|
||||
CURLFORM_END);
|
||||
t1308_fail_unless(rc == 0, "curl_formadd returned error");
|
||||
|
||||
res = curl_formget(post, &total_size, print_httppost_callback);
|
||||
|
||||
t1308_fail_unless(res == 0, "curl_formget returned error");
|
||||
t1308_fail_unless(total_size == 899, "curl_formget got wrong size back");
|
||||
|
||||
curl_formfree(post);
|
||||
|
||||
return errorcount ? TEST_ERR_FAILURE : CURLE_OK;
|
||||
}
|
||||
119
curl-8.15.0/tests/libtest/lib1485.c
Normal file
119
curl-8.15.0/tests/libtest/lib1485.c
Normal file
@@ -0,0 +1,119 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
struct t1485_transfer_status {
|
||||
CURL *easy;
|
||||
curl_off_t out_len;
|
||||
size_t hd_line;
|
||||
CURLcode result;
|
||||
int http_status;
|
||||
};
|
||||
|
||||
static size_t t1485_header_callback(char *ptr, size_t size, size_t nmemb,
|
||||
void *userp)
|
||||
{
|
||||
struct t1485_transfer_status *st = (struct t1485_transfer_status *)userp;
|
||||
const char *hd = ptr;
|
||||
size_t len = size * nmemb;
|
||||
CURLcode result;
|
||||
|
||||
(void)fwrite(ptr, size, nmemb, stdout);
|
||||
++st->hd_line;
|
||||
if(len == 2 && hd[0] == '\r' && hd[1] == '\n') {
|
||||
curl_off_t clen;
|
||||
long httpcode = 0;
|
||||
/* end of a response */
|
||||
result = curl_easy_getinfo(st->easy, CURLINFO_RESPONSE_CODE, &httpcode);
|
||||
curl_mfprintf(stderr, "header_callback, get status: %ld, %d\n",
|
||||
httpcode, result);
|
||||
if(httpcode < 100 || httpcode >= 1000) {
|
||||
curl_mfprintf(stderr, "header_callback, invalid status: %ld, %d\n",
|
||||
httpcode, result);
|
||||
return CURLE_WRITE_ERROR;
|
||||
}
|
||||
st->http_status = (int)httpcode;
|
||||
if(st->http_status >= 200 && st->http_status < 300) {
|
||||
result = curl_easy_getinfo(st->easy, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T,
|
||||
&clen);
|
||||
curl_mfprintf(stderr, "header_callback, info Content-Length: %ld, %d\n",
|
||||
(long)clen, result);
|
||||
if(result) {
|
||||
st->result = result;
|
||||
return CURLE_WRITE_ERROR;
|
||||
}
|
||||
if(clen < 0) {
|
||||
curl_mfprintf(stderr,
|
||||
"header_callback, expected known Content-Length, "
|
||||
"got: %ld\n", (long)clen);
|
||||
return CURLE_WRITE_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
static size_t t1485_write_cb(char *ptr, size_t size, size_t nmemb, void *userp)
|
||||
{
|
||||
struct t1485_transfer_status *st = (struct t1485_transfer_status *)userp;
|
||||
size_t len = size * nmemb;
|
||||
fwrite(ptr, size, nmemb, stdout);
|
||||
st->out_len += (curl_off_t)len;
|
||||
return len;
|
||||
}
|
||||
|
||||
static CURLcode test_lib1485(char *URL)
|
||||
{
|
||||
CURL *curls = NULL;
|
||||
CURLcode res = CURLE_OK;
|
||||
struct t1485_transfer_status st;
|
||||
|
||||
start_test_timing();
|
||||
|
||||
memset(&st, 0, sizeof(st));
|
||||
|
||||
global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
easy_init(curls);
|
||||
st.easy = curls; /* to allow callbacks access */
|
||||
|
||||
easy_setopt(curls, CURLOPT_URL, URL);
|
||||
easy_setopt(curls, CURLOPT_WRITEFUNCTION, t1485_write_cb);
|
||||
easy_setopt(curls, CURLOPT_WRITEDATA, &st);
|
||||
easy_setopt(curls, CURLOPT_HEADERFUNCTION, t1485_header_callback);
|
||||
easy_setopt(curls, CURLOPT_HEADERDATA, &st);
|
||||
|
||||
easy_setopt(curls, CURLOPT_NOPROGRESS, 1L);
|
||||
|
||||
res = curl_easy_perform(curls);
|
||||
|
||||
test_cleanup:
|
||||
|
||||
curl_easy_cleanup(curls);
|
||||
curl_global_cleanup();
|
||||
|
||||
return res; /* return the final return code */
|
||||
}
|
||||
89
curl-8.15.0/tests/libtest/lib1500.c
Normal file
89
curl-8.15.0/tests/libtest/lib1500.c
Normal file
@@ -0,0 +1,89 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
static CURLcode test_lib1500(char *URL)
|
||||
{
|
||||
CURL *curls = NULL;
|
||||
CURLM *multi = NULL;
|
||||
int still_running;
|
||||
CURLcode i = TEST_ERR_FAILURE;
|
||||
CURLcode res = CURLE_OK;
|
||||
CURLMsg *msg;
|
||||
|
||||
start_test_timing();
|
||||
|
||||
global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
multi_init(multi);
|
||||
|
||||
easy_init(curls);
|
||||
|
||||
easy_setopt(curls, CURLOPT_URL, URL);
|
||||
easy_setopt(curls, CURLOPT_HEADER, 1L);
|
||||
|
||||
multi_add_handle(multi, curls);
|
||||
|
||||
multi_perform(multi, &still_running);
|
||||
|
||||
abort_on_test_timeout();
|
||||
|
||||
while(still_running) {
|
||||
CURLMcode mres;
|
||||
int num;
|
||||
mres = curl_multi_wait(multi, NULL, 0, TEST_HANG_TIMEOUT, &num);
|
||||
if(mres != CURLM_OK) {
|
||||
curl_mprintf("curl_multi_wait() returned %d\n", mres);
|
||||
res = TEST_ERR_MAJOR_BAD;
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
abort_on_test_timeout();
|
||||
|
||||
multi_perform(multi, &still_running);
|
||||
|
||||
abort_on_test_timeout();
|
||||
}
|
||||
|
||||
msg = curl_multi_info_read(multi, &still_running);
|
||||
if(msg)
|
||||
/* this should now contain a result code from the easy handle,
|
||||
get it */
|
||||
i = msg->data.result;
|
||||
|
||||
test_cleanup:
|
||||
|
||||
/* undocumented cleanup sequence - type UA */
|
||||
|
||||
curl_multi_cleanup(multi);
|
||||
curl_easy_cleanup(curls);
|
||||
curl_global_cleanup();
|
||||
|
||||
if(res)
|
||||
i = res;
|
||||
|
||||
return i; /* return the final return code */
|
||||
}
|
||||
108
curl-8.15.0/tests/libtest/lib1501.c
Normal file
108
curl-8.15.0/tests/libtest/lib1501.c
Normal file
@@ -0,0 +1,108 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
static CURLcode test_lib1501(char *URL)
|
||||
{
|
||||
static const long HANG_TIMEOUT = 30 * 1000;
|
||||
/* 500 milliseconds allowed. An extreme number but lets be really
|
||||
conservative to allow old and slow machines to run this test too */
|
||||
static const int MAX_BLOCKED_TIME_MS = 500;
|
||||
|
||||
CURL *handle = NULL;
|
||||
CURLM *mhandle = NULL;
|
||||
CURLcode res = CURLE_OK;
|
||||
int still_running = 0;
|
||||
|
||||
start_test_timing();
|
||||
|
||||
global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
easy_init(handle);
|
||||
|
||||
easy_setopt(handle, CURLOPT_URL, URL);
|
||||
easy_setopt(handle, CURLOPT_VERBOSE, 1L);
|
||||
|
||||
multi_init(mhandle);
|
||||
|
||||
multi_add_handle(mhandle, handle);
|
||||
|
||||
multi_perform(mhandle, &still_running);
|
||||
|
||||
abort_on_test_timeout_custom(HANG_TIMEOUT);
|
||||
|
||||
while(still_running) {
|
||||
struct timeval timeout;
|
||||
fd_set fdread;
|
||||
fd_set fdwrite;
|
||||
fd_set fdexcep;
|
||||
int maxfd = -99;
|
||||
struct curltime before;
|
||||
struct curltime after;
|
||||
timediff_t e;
|
||||
|
||||
timeout.tv_sec = 0;
|
||||
timeout.tv_usec = 100000L; /* 100 ms */
|
||||
|
||||
FD_ZERO(&fdread);
|
||||
FD_ZERO(&fdwrite);
|
||||
FD_ZERO(&fdexcep);
|
||||
|
||||
multi_fdset(mhandle, &fdread, &fdwrite, &fdexcep, &maxfd);
|
||||
|
||||
/* At this point, maxfd is guaranteed to be greater or equal than -1. */
|
||||
|
||||
select_test(maxfd + 1, &fdread, &fdwrite, &fdexcep, &timeout);
|
||||
|
||||
abort_on_test_timeout_custom(HANG_TIMEOUT);
|
||||
|
||||
curl_mfprintf(stderr, "ping\n");
|
||||
before = curlx_now();
|
||||
|
||||
multi_perform(mhandle, &still_running);
|
||||
|
||||
abort_on_test_timeout_custom(HANG_TIMEOUT);
|
||||
|
||||
after = curlx_now();
|
||||
e = curlx_timediff(after, before);
|
||||
curl_mfprintf(stderr, "pong = %ld\n", (long)e);
|
||||
|
||||
if(e > MAX_BLOCKED_TIME_MS) {
|
||||
res = CURLE_TOO_LARGE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
test_cleanup:
|
||||
|
||||
/* undocumented cleanup sequence - type UA */
|
||||
|
||||
curl_multi_cleanup(mhandle);
|
||||
curl_easy_cleanup(handle);
|
||||
curl_global_cleanup();
|
||||
|
||||
return res;
|
||||
}
|
||||
152
curl-8.15.0/tests/libtest/lib1502.c
Normal file
152
curl-8.15.0/tests/libtest/lib1502.c
Normal file
@@ -0,0 +1,152 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
/*
|
||||
* This source code is used for lib1502, lib1503, lib1504 and lib1505 with
|
||||
* only the testnum controlling the cleanup sequence.
|
||||
*
|
||||
* Test case 1502 converted from bug report #3575448, identifying a memory
|
||||
* leak in the CURLOPT_RESOLVE handling with the multi interface.
|
||||
*/
|
||||
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
static CURLcode test_lib1502(char *URL)
|
||||
{
|
||||
CURL *easy = NULL;
|
||||
CURL *dup;
|
||||
CURLM *multi = NULL;
|
||||
int still_running;
|
||||
CURLcode res = CURLE_OK;
|
||||
char redirect[160];
|
||||
|
||||
/* DNS cache injection */
|
||||
struct curl_slist *dns_cache_list;
|
||||
|
||||
res_global_init(CURL_GLOBAL_ALL);
|
||||
if(res) {
|
||||
return res;
|
||||
}
|
||||
|
||||
curl_msnprintf(redirect, sizeof(redirect), "google.com:%s:%s", libtest_arg2,
|
||||
libtest_arg3);
|
||||
|
||||
start_test_timing();
|
||||
|
||||
dns_cache_list = curl_slist_append(NULL, redirect);
|
||||
if(!dns_cache_list) {
|
||||
curl_mfprintf(stderr, "curl_slist_append() failed\n");
|
||||
curl_global_cleanup();
|
||||
return TEST_ERR_MAJOR_BAD;
|
||||
}
|
||||
|
||||
easy_init(easy);
|
||||
|
||||
easy_setopt(easy, CURLOPT_URL, URL);
|
||||
easy_setopt(easy, CURLOPT_HEADER, 1L);
|
||||
easy_setopt(easy, CURLOPT_RESOLVE, dns_cache_list);
|
||||
|
||||
dup = curl_easy_duphandle(easy);
|
||||
if(dup) {
|
||||
curl_easy_cleanup(easy);
|
||||
easy = dup;
|
||||
}
|
||||
else {
|
||||
curl_slist_free_all(dns_cache_list);
|
||||
curl_easy_cleanup(easy);
|
||||
curl_global_cleanup();
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
multi_init(multi);
|
||||
|
||||
multi_add_handle(multi, easy);
|
||||
|
||||
multi_perform(multi, &still_running);
|
||||
|
||||
abort_on_test_timeout();
|
||||
|
||||
while(still_running) {
|
||||
struct timeval timeout;
|
||||
fd_set fdread;
|
||||
fd_set fdwrite;
|
||||
fd_set fdexcep;
|
||||
int maxfd = -99;
|
||||
|
||||
FD_ZERO(&fdread);
|
||||
FD_ZERO(&fdwrite);
|
||||
FD_ZERO(&fdexcep);
|
||||
timeout.tv_sec = 1;
|
||||
timeout.tv_usec = 0;
|
||||
|
||||
multi_fdset(multi, &fdread, &fdwrite, &fdexcep, &maxfd);
|
||||
|
||||
/* At this point, maxfd is guaranteed to be greater or equal than -1. */
|
||||
|
||||
select_test(maxfd + 1, &fdread, &fdwrite, &fdexcep, &timeout);
|
||||
|
||||
abort_on_test_timeout();
|
||||
|
||||
multi_perform(multi, &still_running);
|
||||
|
||||
abort_on_test_timeout();
|
||||
}
|
||||
|
||||
test_cleanup:
|
||||
|
||||
switch(testnum) {
|
||||
case 1502:
|
||||
default:
|
||||
/* undocumented cleanup sequence - type UA */
|
||||
curl_multi_cleanup(multi);
|
||||
curl_easy_cleanup(easy);
|
||||
curl_global_cleanup();
|
||||
break;
|
||||
case 1503:
|
||||
/* proper cleanup sequence - type PA */
|
||||
curl_multi_remove_handle(multi, easy);
|
||||
curl_multi_cleanup(multi);
|
||||
curl_easy_cleanup(easy);
|
||||
curl_global_cleanup();
|
||||
break;
|
||||
case 1504:
|
||||
/* undocumented cleanup sequence - type UB */
|
||||
curl_easy_cleanup(easy);
|
||||
curl_multi_cleanup(multi);
|
||||
curl_global_cleanup();
|
||||
break;
|
||||
case 1505:
|
||||
/* proper cleanup sequence - type PB */
|
||||
curl_multi_remove_handle(multi, easy);
|
||||
curl_easy_cleanup(easy);
|
||||
curl_multi_cleanup(multi);
|
||||
curl_global_cleanup();
|
||||
break;
|
||||
}
|
||||
|
||||
curl_slist_free_all(dns_cache_list);
|
||||
|
||||
return res;
|
||||
}
|
||||
133
curl-8.15.0/tests/libtest/lib1506.c
Normal file
133
curl-8.15.0/tests/libtest/lib1506.c
Normal file
@@ -0,0 +1,133 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) Linus Nielsen Feltzing <linus@haxx.se>
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
static CURLcode test_lib1506(char *URL)
|
||||
{
|
||||
CURLcode res = CURLE_OK;
|
||||
CURL *curl[NUM_HANDLES] = {0};
|
||||
int running;
|
||||
CURLM *m = NULL;
|
||||
size_t i;
|
||||
char target_url[256];
|
||||
char dnsentry[256];
|
||||
struct curl_slist *slist = NULL, *slist2;
|
||||
char *port = libtest_arg3;
|
||||
char *address = libtest_arg2;
|
||||
|
||||
(void)URL;
|
||||
|
||||
/* Create fake DNS entries for serverX.example.com for all handles */
|
||||
for(i = 0; i < CURL_ARRAYSIZE(curl); i++) {
|
||||
curl_msnprintf(dnsentry, sizeof(dnsentry), "server%d.example.com:%s:%s",
|
||||
(int)i + 1, port, address);
|
||||
curl_mprintf("%s\n", dnsentry);
|
||||
slist2 = curl_slist_append(slist, dnsentry);
|
||||
if(!slist2) {
|
||||
curl_mfprintf(stderr, "curl_slist_append() failed\n");
|
||||
goto test_cleanup;
|
||||
}
|
||||
slist = slist2;
|
||||
}
|
||||
|
||||
start_test_timing();
|
||||
|
||||
global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
multi_init(m);
|
||||
|
||||
multi_setopt(m, CURLMOPT_MAXCONNECTS, 3L);
|
||||
|
||||
/* get each easy handle */
|
||||
for(i = 0; i < CURL_ARRAYSIZE(curl); i++) {
|
||||
/* get an easy handle */
|
||||
easy_init(curl[i]);
|
||||
/* specify target */
|
||||
curl_msnprintf(target_url, sizeof(target_url),
|
||||
"http://server%d.example.com:%s/path/1506%04i",
|
||||
(int)i + 1, port, (int)i + 1);
|
||||
target_url[sizeof(target_url) - 1] = '\0';
|
||||
easy_setopt(curl[i], CURLOPT_URL, target_url);
|
||||
/* go verbose */
|
||||
easy_setopt(curl[i], CURLOPT_VERBOSE, 1L);
|
||||
/* include headers */
|
||||
easy_setopt(curl[i], CURLOPT_HEADER, 1L);
|
||||
|
||||
easy_setopt(curl[i], CURLOPT_RESOLVE, slist);
|
||||
}
|
||||
|
||||
curl_mfprintf(stderr, "Start at URL 0\n");
|
||||
|
||||
for(i = 0; i < CURL_ARRAYSIZE(curl); i++) {
|
||||
/* add handle to multi */
|
||||
multi_add_handle(m, curl[i]);
|
||||
|
||||
for(;;) {
|
||||
struct timeval interval;
|
||||
fd_set rd, wr, exc;
|
||||
int maxfd = -99;
|
||||
|
||||
interval.tv_sec = 1;
|
||||
interval.tv_usec = 0;
|
||||
|
||||
multi_perform(m, &running);
|
||||
|
||||
abort_on_test_timeout();
|
||||
|
||||
if(!running)
|
||||
break; /* done */
|
||||
|
||||
FD_ZERO(&rd);
|
||||
FD_ZERO(&wr);
|
||||
FD_ZERO(&exc);
|
||||
|
||||
multi_fdset(m, &rd, &wr, &exc, &maxfd);
|
||||
|
||||
/* At this point, maxfd is guaranteed to be greater or equal than -1. */
|
||||
|
||||
select_test(maxfd + 1, &rd, &wr, &exc, &interval);
|
||||
|
||||
abort_on_test_timeout();
|
||||
}
|
||||
curlx_wait_ms(1); /* to ensure different end times */
|
||||
}
|
||||
|
||||
test_cleanup:
|
||||
|
||||
/* proper cleanup sequence - type PB */
|
||||
|
||||
for(i = 0; i < CURL_ARRAYSIZE(curl); i++) {
|
||||
curl_multi_remove_handle(m, curl[i]);
|
||||
curl_easy_cleanup(curl[i]);
|
||||
}
|
||||
|
||||
curl_slist_free_all(slist);
|
||||
|
||||
curl_multi_cleanup(m);
|
||||
curl_global_cleanup();
|
||||
|
||||
return res;
|
||||
}
|
||||
149
curl-8.15.0/tests/libtest/lib1507.c
Normal file
149
curl-8.15.0/tests/libtest/lib1507.c
Normal file
@@ -0,0 +1,149 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
/*
|
||||
* This is the list of basic details you need to tweak to get things right.
|
||||
*/
|
||||
#define USERNAME "user@example.com"
|
||||
#define PASSWORD "123qwerty"
|
||||
#define RECIPIENT "<1507-recipient@example.com>"
|
||||
#define MAILFROM "<1507-realuser@example.com>"
|
||||
|
||||
static size_t t1507_read_cb(char *ptr, size_t size, size_t nmemb, void *userp)
|
||||
{
|
||||
(void)ptr;
|
||||
(void)size;
|
||||
(void)nmemb;
|
||||
(void)userp;
|
||||
return CURL_READFUNC_ABORT;
|
||||
}
|
||||
|
||||
static CURLcode test_lib1507(char *URL)
|
||||
{
|
||||
static const int MULTI_PERFORM_HANG_TIMEOUT = 60 * 1000;
|
||||
|
||||
CURLcode res = CURLE_OK;
|
||||
CURL *curl = NULL;
|
||||
CURLM *mcurl = NULL;
|
||||
int still_running = 1;
|
||||
struct curltime mp_start;
|
||||
struct curl_slist *rcpt_list = NULL;
|
||||
|
||||
curl_global_init(CURL_GLOBAL_DEFAULT);
|
||||
|
||||
easy_init(curl);
|
||||
|
||||
multi_init(mcurl);
|
||||
|
||||
rcpt_list = curl_slist_append(rcpt_list, RECIPIENT);
|
||||
/* more addresses can be added here
|
||||
rcpt_list = curl_slist_append(rcpt_list, "<others@example.com>");
|
||||
*/
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_URL, URL);
|
||||
#if 0
|
||||
curl_easy_setopt(curl, CURLOPT_USERNAME, USERNAME);
|
||||
curl_easy_setopt(curl, CURLOPT_PASSWORD, PASSWORD);
|
||||
#endif
|
||||
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
|
||||
curl_easy_setopt(curl, CURLOPT_READFUNCTION, t1507_read_cb);
|
||||
curl_easy_setopt(curl, CURLOPT_MAIL_FROM, MAILFROM);
|
||||
curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, rcpt_list);
|
||||
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
multi_add_handle(mcurl, curl);
|
||||
|
||||
mp_start = curlx_now();
|
||||
|
||||
/* we start some action by calling perform right away */
|
||||
curl_multi_perform(mcurl, &still_running);
|
||||
|
||||
while(still_running) {
|
||||
struct timeval timeout;
|
||||
int rc; /* select() return code */
|
||||
|
||||
fd_set fdread;
|
||||
fd_set fdwrite;
|
||||
fd_set fdexcep;
|
||||
int maxfd = -1;
|
||||
|
||||
long curl_timeo = -1;
|
||||
|
||||
FD_ZERO(&fdread);
|
||||
FD_ZERO(&fdwrite);
|
||||
FD_ZERO(&fdexcep);
|
||||
|
||||
/* set a suitable timeout to play around with */
|
||||
timeout.tv_sec = 1;
|
||||
timeout.tv_usec = 0;
|
||||
|
||||
curl_multi_timeout(mcurl, &curl_timeo);
|
||||
if(curl_timeo >= 0) {
|
||||
curlx_mstotv(&timeout, curl_timeo);
|
||||
if(timeout.tv_sec > 1) {
|
||||
timeout.tv_sec = 1;
|
||||
timeout.tv_usec = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* get file descriptors from the transfers */
|
||||
curl_multi_fdset(mcurl, &fdread, &fdwrite, &fdexcep, &maxfd);
|
||||
|
||||
/* In a real-world program you OF COURSE check the return code of the
|
||||
function calls. On success, the value of maxfd is guaranteed to be
|
||||
greater or equal than -1. We call select(maxfd + 1, ...), specially in
|
||||
case of (maxfd == -1), we call select(0, ...), which is basically equal
|
||||
to sleep. */
|
||||
|
||||
rc = select(maxfd + 1, &fdread, &fdwrite, &fdexcep, &timeout);
|
||||
|
||||
if(curlx_timediff(curlx_now(), mp_start) > MULTI_PERFORM_HANG_TIMEOUT) {
|
||||
curl_mfprintf(stderr, "ABORTING TEST, since it seems "
|
||||
"that it would have run forever.\n");
|
||||
break;
|
||||
}
|
||||
|
||||
switch(rc) {
|
||||
case -1:
|
||||
/* select error */
|
||||
break;
|
||||
case 0: /* timeout */
|
||||
default: /* action */
|
||||
curl_multi_perform(mcurl, &still_running);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
test_cleanup:
|
||||
|
||||
curl_slist_free_all(rcpt_list);
|
||||
curl_multi_remove_handle(mcurl, curl);
|
||||
curl_multi_cleanup(mcurl);
|
||||
curl_easy_cleanup(curl);
|
||||
curl_global_cleanup();
|
||||
|
||||
return res;
|
||||
}
|
||||
49
curl-8.15.0/tests/libtest/lib1508.c
Normal file
49
curl-8.15.0/tests/libtest/lib1508.c
Normal file
@@ -0,0 +1,49 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) Linus Nielsen Feltzing <linus@haxx.se>
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
static CURLcode test_lib1508(char *URL)
|
||||
{
|
||||
CURLcode res = CURLE_OK;
|
||||
CURLM *m = NULL;
|
||||
|
||||
(void)URL;
|
||||
|
||||
global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
multi_init(m);
|
||||
|
||||
test_cleanup:
|
||||
|
||||
/* proper cleanup sequence - type PB */
|
||||
|
||||
curl_multi_cleanup(m);
|
||||
curl_global_cleanup();
|
||||
|
||||
curl_mprintf("We are done\n");
|
||||
|
||||
return res;
|
||||
}
|
||||
97
curl-8.15.0/tests/libtest/lib1509.c
Normal file
97
curl-8.15.0/tests/libtest/lib1509.c
Normal file
@@ -0,0 +1,97 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
size_t WriteOutput(char *ptr, size_t size, size_t nmemb, void *stream);
|
||||
size_t WriteHeader(char *ptr, size_t size, size_t nmemb, void *stream);
|
||||
|
||||
static unsigned long realHeaderSize = 0;
|
||||
|
||||
static CURLcode test_lib1509(char *URL)
|
||||
{
|
||||
long headerSize;
|
||||
CURLcode code;
|
||||
CURL *curl = NULL;
|
||||
CURLcode res = CURLE_OK;
|
||||
|
||||
global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
easy_init(curl);
|
||||
|
||||
easy_setopt(curl, CURLOPT_PROXY, libtest_arg2); /* set in first.c */
|
||||
|
||||
easy_setopt(curl, CURLOPT_WRITEFUNCTION, *WriteOutput);
|
||||
easy_setopt(curl, CURLOPT_HEADERFUNCTION, *WriteHeader);
|
||||
|
||||
easy_setopt(curl, CURLOPT_HEADER, 1L);
|
||||
easy_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
easy_setopt(curl, CURLOPT_URL, URL);
|
||||
easy_setopt(curl, CURLOPT_HTTPPROXYTUNNEL, 1L);
|
||||
|
||||
code = curl_easy_perform(curl);
|
||||
if(CURLE_OK != code) {
|
||||
curl_mfprintf(stderr, "%s:%d curl_easy_perform() failed, "
|
||||
"with code %d (%s)\n",
|
||||
__FILE__, __LINE__, code, curl_easy_strerror(code));
|
||||
res = TEST_ERR_MAJOR_BAD;
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
code = curl_easy_getinfo(curl, CURLINFO_HEADER_SIZE, &headerSize);
|
||||
if(CURLE_OK != code) {
|
||||
curl_mfprintf(stderr, "%s:%d curl_easy_getinfo() failed, "
|
||||
"with code %d (%s)\n",
|
||||
__FILE__, __LINE__, code, curl_easy_strerror(code));
|
||||
res = TEST_ERR_MAJOR_BAD;
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
curl_mprintf("header length is ........: %ld\n", headerSize);
|
||||
curl_mprintf("header length should be..: %lu\n", realHeaderSize);
|
||||
|
||||
test_cleanup:
|
||||
|
||||
curl_easy_cleanup(curl);
|
||||
curl_global_cleanup();
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
size_t WriteOutput(char *ptr, size_t size, size_t nmemb, void *stream)
|
||||
{
|
||||
fwrite(ptr, size, nmemb, stream);
|
||||
return nmemb * size;
|
||||
}
|
||||
|
||||
size_t WriteHeader(char *ptr, size_t size, size_t nmemb, void *stream)
|
||||
{
|
||||
(void)ptr;
|
||||
(void)stream;
|
||||
|
||||
realHeaderSize += curlx_uztoul(size * nmemb);
|
||||
|
||||
return nmemb * size;
|
||||
}
|
||||
99
curl-8.15.0/tests/libtest/lib1510.c
Normal file
99
curl-8.15.0/tests/libtest/lib1510.c
Normal file
@@ -0,0 +1,99 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) Linus Nielsen Feltzing <linus@haxx.se>
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
static CURLcode test_lib1510(char *URL)
|
||||
{
|
||||
static const int NUM_URLS = 4;
|
||||
|
||||
CURLcode res = CURLE_OK;
|
||||
CURL *curl = NULL;
|
||||
int i;
|
||||
char target_url[256];
|
||||
char dnsentry[256];
|
||||
struct curl_slist *slist = NULL, *slist2;
|
||||
char *port = libtest_arg3;
|
||||
char *address = libtest_arg2;
|
||||
|
||||
(void)URL;
|
||||
|
||||
/* Create fake DNS entries for serverX.example.com for all handles */
|
||||
for(i = 0; i < NUM_URLS; i++) {
|
||||
curl_msnprintf(dnsentry, sizeof(dnsentry),
|
||||
"server%d.example.com:%s:%s", i + 1, port, address);
|
||||
curl_mprintf("%s\n", dnsentry);
|
||||
slist2 = curl_slist_append(slist, dnsentry);
|
||||
if(!slist2) {
|
||||
curl_mfprintf(stderr, "curl_slist_append() failed\n");
|
||||
goto test_cleanup;
|
||||
}
|
||||
slist = slist2;
|
||||
}
|
||||
|
||||
start_test_timing();
|
||||
|
||||
global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
/* get an easy handle */
|
||||
easy_init(curl);
|
||||
|
||||
/* go verbose */
|
||||
easy_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
/* include headers */
|
||||
easy_setopt(curl, CURLOPT_HEADER, 1L);
|
||||
|
||||
easy_setopt(curl, CURLOPT_RESOLVE, slist);
|
||||
|
||||
easy_setopt(curl, CURLOPT_MAXCONNECTS, 3L);
|
||||
|
||||
/* get NUM_URLS easy handles */
|
||||
for(i = 0; i < NUM_URLS; i++) {
|
||||
/* specify target */
|
||||
curl_msnprintf(target_url, sizeof(target_url),
|
||||
"http://server%d.example.com:%s/path/1510%04i",
|
||||
i + 1, port, i + 1);
|
||||
target_url[sizeof(target_url) - 1] = '\0';
|
||||
easy_setopt(curl, CURLOPT_URL, target_url);
|
||||
|
||||
res = curl_easy_perform(curl);
|
||||
if(res)
|
||||
goto test_cleanup;
|
||||
|
||||
abort_on_test_timeout();
|
||||
}
|
||||
|
||||
test_cleanup:
|
||||
|
||||
/* proper cleanup sequence - type PB */
|
||||
|
||||
curl_easy_cleanup(curl);
|
||||
|
||||
curl_slist_free_all(slist);
|
||||
|
||||
curl_global_cleanup();
|
||||
|
||||
return res;
|
||||
}
|
||||
77
curl-8.15.0/tests/libtest/lib1511.c
Normal file
77
curl-8.15.0/tests/libtest/lib1511.c
Normal file
@@ -0,0 +1,77 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
static CURLcode test_lib1511(char *URL)
|
||||
{
|
||||
long unmet;
|
||||
CURL *curl = NULL;
|
||||
CURLcode res = CURLE_OK;
|
||||
|
||||
global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
easy_init(curl);
|
||||
|
||||
easy_setopt(curl, CURLOPT_URL, URL);
|
||||
easy_setopt(curl, CURLOPT_HEADER, 1L);
|
||||
easy_setopt(curl, CURLOPT_TIMECONDITION, (long)CURL_TIMECOND_IFMODSINCE);
|
||||
|
||||
/* TIMEVALUE in the future */
|
||||
easy_setopt(curl, CURLOPT_TIMEVALUE, 1566210680L);
|
||||
|
||||
res = curl_easy_perform(curl);
|
||||
if(res)
|
||||
goto test_cleanup;
|
||||
|
||||
curl_easy_getinfo(curl, CURLINFO_CONDITION_UNMET, &unmet);
|
||||
if(unmet != 1L) {
|
||||
res = TEST_ERR_FAILURE; /* not correct */
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
/* TIMEVALUE in the past */
|
||||
easy_setopt(curl, CURLOPT_TIMEVALUE, 1L);
|
||||
|
||||
res = curl_easy_perform(curl);
|
||||
if(res)
|
||||
goto test_cleanup;
|
||||
|
||||
curl_easy_getinfo(curl, CURLINFO_CONDITION_UNMET, &unmet);
|
||||
if(unmet) {
|
||||
res = TEST_ERR_FAILURE; /* not correct */
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
res = TEST_ERR_SUCCESS; /* this is where we should be */
|
||||
|
||||
test_cleanup:
|
||||
|
||||
/* always cleanup */
|
||||
curl_easy_cleanup(curl);
|
||||
curl_global_cleanup();
|
||||
|
||||
return res;
|
||||
}
|
||||
93
curl-8.15.0/tests/libtest/lib1512.c
Normal file
93
curl-8.15.0/tests/libtest/lib1512.c
Normal file
@@ -0,0 +1,93 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) Linus Nielsen Feltzing <linus@haxx.se>
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/*
|
||||
* Use global DNS cache (while deprecated it should still work), populate it
|
||||
* with CURLOPT_RESOLVE in the first request and then make sure a subsequent
|
||||
* easy transfer finds and uses the populated stuff.
|
||||
*/
|
||||
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
static CURLcode test_lib1512(char *URL)
|
||||
{
|
||||
CURLcode res = CURLE_OK;
|
||||
CURL *curl[2] = {NULL, NULL};
|
||||
char *port = libtest_arg3;
|
||||
char *address = libtest_arg2;
|
||||
char dnsentry[256];
|
||||
struct curl_slist *slist = NULL;
|
||||
size_t i;
|
||||
char target_url[256];
|
||||
(void)URL; /* URL is setup in the code */
|
||||
|
||||
if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
|
||||
curl_mfprintf(stderr, "curl_global_init() failed\n");
|
||||
return TEST_ERR_MAJOR_BAD;
|
||||
}
|
||||
|
||||
curl_msnprintf(dnsentry, sizeof(dnsentry), "server.example.curl:%s:%s",
|
||||
port, address);
|
||||
curl_mprintf("%s\n", dnsentry);
|
||||
slist = curl_slist_append(slist, dnsentry);
|
||||
|
||||
/* get each easy handle */
|
||||
for(i = 0; i < CURL_ARRAYSIZE(curl); i++) {
|
||||
/* get an easy handle */
|
||||
easy_init(curl[i]);
|
||||
/* specify target */
|
||||
curl_msnprintf(target_url, sizeof(target_url),
|
||||
"http://server.example.curl:%s/path/1512%04i",
|
||||
port, (int)i + 1);
|
||||
target_url[sizeof(target_url) - 1] = '\0';
|
||||
easy_setopt(curl[i], CURLOPT_URL, target_url);
|
||||
/* go verbose */
|
||||
easy_setopt(curl[i], CURLOPT_VERBOSE, 1L);
|
||||
/* include headers */
|
||||
easy_setopt(curl[i], CURLOPT_HEADER, 1L);
|
||||
|
||||
easy_setopt(curl[i], CURLOPT_DNS_USE_GLOBAL_CACHE, 1L);
|
||||
}
|
||||
|
||||
/* make the first one populate the GLOBAL cache */
|
||||
easy_setopt(curl[0], CURLOPT_RESOLVE, slist);
|
||||
|
||||
/* run each transfer */
|
||||
for(i = 0; (i < CURL_ARRAYSIZE(curl)) && !res; i++) {
|
||||
res = curl_easy_perform(curl[i]);
|
||||
if(res)
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
test_cleanup:
|
||||
|
||||
curl_easy_cleanup(curl[0]);
|
||||
curl_easy_cleanup(curl[1]);
|
||||
curl_slist_free_all(slist);
|
||||
curl_global_cleanup();
|
||||
|
||||
return res;
|
||||
}
|
||||
76
curl-8.15.0/tests/libtest/lib1513.c
Normal file
76
curl-8.15.0/tests/libtest/lib1513.c
Normal file
@@ -0,0 +1,76 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
/*
|
||||
* Test case converted from bug report #1318 by Petr Novak.
|
||||
*
|
||||
* Before the fix, this test program returned 52 (CURLE_GOT_NOTHING) instead
|
||||
* of 42 (CURLE_ABORTED_BY_CALLBACK).
|
||||
*/
|
||||
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
static int progressKiller(void *arg,
|
||||
double dltotal,
|
||||
double dlnow,
|
||||
double ultotal,
|
||||
double ulnow)
|
||||
{
|
||||
(void)arg;
|
||||
(void)dltotal;
|
||||
(void)dlnow;
|
||||
(void)ultotal;
|
||||
(void)ulnow;
|
||||
curl_mprintf("PROGRESSFUNCTION called\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
static CURLcode test_lib1513(char *URL)
|
||||
{
|
||||
CURL *curl;
|
||||
CURLcode res = CURLE_OK;
|
||||
|
||||
global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
easy_init(curl);
|
||||
|
||||
easy_setopt(curl, CURLOPT_URL, URL);
|
||||
easy_setopt(curl, CURLOPT_TIMEOUT, (long)7);
|
||||
easy_setopt(curl, CURLOPT_NOSIGNAL, (long)1);
|
||||
easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, progressKiller);
|
||||
easy_setopt(curl, CURLOPT_PROGRESSDATA, NULL);
|
||||
easy_setopt(curl, CURLOPT_NOPROGRESS, (long)0);
|
||||
|
||||
res = curl_easy_perform(curl);
|
||||
|
||||
test_cleanup:
|
||||
|
||||
/* undocumented cleanup sequence - type UA */
|
||||
|
||||
curl_easy_cleanup(curl);
|
||||
curl_global_cleanup();
|
||||
|
||||
return res;
|
||||
}
|
||||
88
curl-8.15.0/tests/libtest/lib1514.c
Normal file
88
curl-8.15.0/tests/libtest/lib1514.c
Normal file
@@ -0,0 +1,88 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
/*
|
||||
* Make sure libcurl does not send a `Content-Length: -1` header when HTTP POST
|
||||
* size is unknown.
|
||||
*/
|
||||
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
struct t1514_WriteThis {
|
||||
char *readptr;
|
||||
size_t sizeleft;
|
||||
};
|
||||
|
||||
static size_t t1514_read_cb(char *ptr, size_t size, size_t nmemb, void *userp)
|
||||
{
|
||||
struct t1514_WriteThis *pooh = (struct t1514_WriteThis *)userp;
|
||||
|
||||
if(size*nmemb < 1)
|
||||
return 0;
|
||||
|
||||
if(pooh->sizeleft) {
|
||||
*ptr = pooh->readptr[0]; /* copy one single byte */
|
||||
pooh->readptr++; /* advance pointer */
|
||||
pooh->sizeleft--; /* less data left */
|
||||
return 1; /* we return 1 byte at a time! */
|
||||
}
|
||||
|
||||
return 0; /* no more data left to deliver */
|
||||
}
|
||||
|
||||
static CURLcode test_lib1514(char *URL)
|
||||
{
|
||||
CURL *curl;
|
||||
CURLcode result = CURLE_OK;
|
||||
CURLcode res = CURLE_OK;
|
||||
|
||||
static char testdata[] = "dummy";
|
||||
|
||||
struct t1514_WriteThis pooh = { testdata, sizeof(testdata)-1 };
|
||||
|
||||
global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
easy_init(curl);
|
||||
|
||||
easy_setopt(curl, CURLOPT_URL, URL);
|
||||
easy_setopt(curl, CURLOPT_POST, 1L);
|
||||
/* Purposely omit to set CURLOPT_POSTFIELDSIZE */
|
||||
easy_setopt(curl, CURLOPT_READFUNCTION, t1514_read_cb);
|
||||
easy_setopt(curl, CURLOPT_READDATA, &pooh);
|
||||
|
||||
if(testnum == 1539) {
|
||||
/* speak HTTP 1.0 - no chunked! */
|
||||
easy_setopt(curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
|
||||
}
|
||||
|
||||
result = curl_easy_perform(curl);
|
||||
|
||||
test_cleanup:
|
||||
|
||||
curl_easy_cleanup(curl);
|
||||
curl_global_cleanup();
|
||||
|
||||
return result;
|
||||
}
|
||||
145
curl-8.15.0/tests/libtest/lib1515.c
Normal file
145
curl-8.15.0/tests/libtest/lib1515.c
Normal file
@@ -0,0 +1,145 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/*
|
||||
* Check for bugs #1303 and #1327: libcurl should never remove DNS entries
|
||||
* created via CURLOPT_RESOLVE, neither after DNS_CACHE_TIMEOUT elapses
|
||||
* (test1515) nor a dead connection is detected (test1616).
|
||||
*/
|
||||
|
||||
#include "first.h"
|
||||
|
||||
#include "testtrace.h"
|
||||
#include "memdebug.h"
|
||||
|
||||
#define DNS_TIMEOUT 1L
|
||||
|
||||
static CURLcode do_one_request(CURLM *m, char *URL, char *resolve)
|
||||
{
|
||||
CURL *curls;
|
||||
struct curl_slist *resolve_list = NULL;
|
||||
int still_running;
|
||||
CURLcode res = CURLE_OK;
|
||||
CURLMsg *msg;
|
||||
int msgs_left;
|
||||
|
||||
resolve_list = curl_slist_append(resolve_list, resolve);
|
||||
|
||||
easy_init(curls);
|
||||
|
||||
easy_setopt(curls, CURLOPT_URL, URL);
|
||||
easy_setopt(curls, CURLOPT_RESOLVE, resolve_list);
|
||||
easy_setopt(curls, CURLOPT_DNS_CACHE_TIMEOUT, DNS_TIMEOUT);
|
||||
|
||||
libtest_debug_config.nohex = 1;
|
||||
libtest_debug_config.tracetime = 1;
|
||||
easy_setopt(curls, CURLOPT_DEBUGDATA, &libtest_debug_config);
|
||||
easy_setopt(curls, CURLOPT_DEBUGFUNCTION, libtest_debug_cb);
|
||||
easy_setopt(curls, CURLOPT_VERBOSE, 1L);
|
||||
|
||||
multi_add_handle(m, curls);
|
||||
multi_perform(m, &still_running);
|
||||
|
||||
abort_on_test_timeout();
|
||||
|
||||
while(still_running) {
|
||||
struct timeval timeout;
|
||||
fd_set fdread, fdwrite, fdexcep;
|
||||
int maxfd = -99;
|
||||
|
||||
FD_ZERO(&fdread);
|
||||
FD_ZERO(&fdwrite);
|
||||
FD_ZERO(&fdexcep);
|
||||
timeout.tv_sec = 1;
|
||||
timeout.tv_usec = 0;
|
||||
|
||||
multi_fdset(m, &fdread, &fdwrite, &fdexcep, &maxfd);
|
||||
select_test(maxfd + 1, &fdread, &fdwrite, &fdexcep, &timeout);
|
||||
|
||||
abort_on_test_timeout();
|
||||
multi_perform(m, &still_running);
|
||||
|
||||
abort_on_test_timeout();
|
||||
}
|
||||
|
||||
do {
|
||||
msg = curl_multi_info_read(m, &msgs_left);
|
||||
if(msg && msg->msg == CURLMSG_DONE && msg->easy_handle == curls) {
|
||||
res = msg->data.result;
|
||||
break;
|
||||
}
|
||||
} while(msg);
|
||||
|
||||
test_cleanup:
|
||||
|
||||
curl_multi_remove_handle(m, curls);
|
||||
curl_easy_cleanup(curls);
|
||||
curl_slist_free_all(resolve_list);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static CURLcode test_lib1515(char *URL)
|
||||
{
|
||||
CURLM *multi = NULL;
|
||||
CURLcode res = CURLE_OK;
|
||||
char *address = libtest_arg2;
|
||||
char *port = libtest_arg3;
|
||||
char *path = URL;
|
||||
char dns_entry[256];
|
||||
int i;
|
||||
int count = 2;
|
||||
|
||||
curl_msnprintf(dns_entry, sizeof(dns_entry), "testserver.example.com:%s:%s",
|
||||
port, address);
|
||||
|
||||
start_test_timing();
|
||||
|
||||
global_init(CURL_GLOBAL_ALL);
|
||||
curl_global_trace("all");
|
||||
multi_init(multi);
|
||||
|
||||
for(i = 1; i <= count; i++) {
|
||||
char target_url[256];
|
||||
curl_msnprintf(target_url, sizeof(target_url),
|
||||
"http://testserver.example.com:%s/%s%04d", port, path, i);
|
||||
|
||||
/* second request must succeed like the first one */
|
||||
res = do_one_request(multi, target_url, dns_entry);
|
||||
if(res != CURLE_OK) {
|
||||
curl_mfprintf(stderr, "request %s failed with %d\n", target_url, res);
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
if(i < count)
|
||||
curlx_wait_ms((DNS_TIMEOUT + 1) * 1000);
|
||||
}
|
||||
|
||||
test_cleanup:
|
||||
|
||||
curl_multi_cleanup(multi);
|
||||
curl_global_cleanup();
|
||||
|
||||
return res;
|
||||
}
|
||||
125
curl-8.15.0/tests/libtest/lib1517.c
Normal file
125
curl-8.15.0/tests/libtest/lib1517.c
Normal file
@@ -0,0 +1,125 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
struct t1517_WriteThis {
|
||||
const char *readptr;
|
||||
size_t sizeleft;
|
||||
};
|
||||
|
||||
static size_t t1517_read_cb(char *ptr, size_t size, size_t nmemb, void *userp)
|
||||
{
|
||||
struct t1517_WriteThis *pooh = (struct t1517_WriteThis *)userp;
|
||||
size_t tocopy = size * nmemb;
|
||||
|
||||
/* Wait one second before return POST data *
|
||||
* so libcurl will wait before sending request body */
|
||||
curlx_wait_ms(1000);
|
||||
|
||||
if(tocopy < 1 || !pooh->sizeleft)
|
||||
return 0;
|
||||
|
||||
if(pooh->sizeleft < tocopy)
|
||||
tocopy = pooh->sizeleft;
|
||||
|
||||
memcpy(ptr, pooh->readptr, tocopy);/* copy requested data */
|
||||
pooh->readptr += tocopy; /* advance pointer */
|
||||
pooh->sizeleft -= tocopy; /* less data left */
|
||||
return tocopy;
|
||||
}
|
||||
|
||||
static CURLcode test_lib1517(char *URL)
|
||||
{
|
||||
static const char testdata[] =
|
||||
"this is what we post to the silly web server\n";
|
||||
|
||||
CURL *curl;
|
||||
CURLcode res = CURLE_OK;
|
||||
|
||||
struct t1517_WriteThis pooh;
|
||||
|
||||
if(!strcmp(URL, "check")) {
|
||||
#if (defined(_WIN32) || defined(__CYGWIN__))
|
||||
curl_mprintf("Windows TCP does not deliver response data but reports "
|
||||
"CONNABORTED\n");
|
||||
return TEST_ERR_FAILURE; /* skip since it fails on Windows without
|
||||
workaround */
|
||||
#else
|
||||
return CURLE_OK; /* sure, run this! */
|
||||
#endif
|
||||
}
|
||||
|
||||
pooh.readptr = testdata;
|
||||
pooh.sizeleft = strlen(testdata);
|
||||
|
||||
if(curl_global_init(CURL_GLOBAL_ALL)) {
|
||||
curl_mfprintf(stderr, "curl_global_init() failed\n");
|
||||
return TEST_ERR_MAJOR_BAD;
|
||||
}
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(!curl) {
|
||||
curl_mfprintf(stderr, "curl_easy_init() failed\n");
|
||||
curl_global_cleanup();
|
||||
return TEST_ERR_MAJOR_BAD;
|
||||
}
|
||||
|
||||
/* First set the URL that is about to receive our POST. */
|
||||
test_setopt(curl, CURLOPT_URL, URL);
|
||||
|
||||
/* Now specify we want to POST data */
|
||||
test_setopt(curl, CURLOPT_POST, 1L);
|
||||
|
||||
/* Set the expected POST size */
|
||||
test_setopt(curl, CURLOPT_POSTFIELDSIZE, (long)pooh.sizeleft);
|
||||
|
||||
/* we want to use our own read function */
|
||||
test_setopt(curl, CURLOPT_READFUNCTION, t1517_read_cb);
|
||||
|
||||
/* pointer to pass to our read function */
|
||||
test_setopt(curl, CURLOPT_READDATA, &pooh);
|
||||
|
||||
/* get verbose debug output please */
|
||||
test_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
|
||||
/* include headers in the output */
|
||||
test_setopt(curl, CURLOPT_HEADER, 1L);
|
||||
|
||||
/* detect HTTP error codes >= 400 */
|
||||
/* test_setopt(curl, CURLOPT_FAILONERROR, 1L); */
|
||||
|
||||
|
||||
/* Perform the request, res will get the return code */
|
||||
res = curl_easy_perform(curl);
|
||||
|
||||
test_cleanup:
|
||||
|
||||
/* always cleanup */
|
||||
curl_easy_cleanup(curl);
|
||||
curl_global_cleanup();
|
||||
|
||||
return res;
|
||||
}
|
||||
102
curl-8.15.0/tests/libtest/lib1518.c
Normal file
102
curl-8.15.0/tests/libtest/lib1518.c
Normal file
@@ -0,0 +1,102 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
/* Test inspired by github issue 3340 */
|
||||
|
||||
static size_t t1518_write_cb(char *buffer, size_t size, size_t nitems,
|
||||
void *outstream)
|
||||
{
|
||||
(void)buffer;
|
||||
(void)size;
|
||||
(void)nitems;
|
||||
(void)outstream;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static CURLcode test_lib1518(char *URL)
|
||||
{
|
||||
CURL *curl;
|
||||
CURLcode res = CURLE_OK;
|
||||
long curlResponseCode;
|
||||
long curlRedirectCount;
|
||||
char *effectiveUrl = NULL;
|
||||
char *redirectUrl = NULL;
|
||||
CURLU *urlu = NULL;
|
||||
curl = curl_easy_init();
|
||||
if(!curl) {
|
||||
curl_mfprintf(stderr, "curl_easy_init() failed\n");
|
||||
curl_global_cleanup();
|
||||
return TEST_ERR_MAJOR_BAD;
|
||||
}
|
||||
if(testnum == 1543) {
|
||||
/* set CURLOPT_URLU */
|
||||
CURLUcode rc = CURLUE_OK;
|
||||
urlu = curl_url();
|
||||
if(urlu)
|
||||
rc = curl_url_set(urlu, CURLUPART_URL, URL, CURLU_ALLOW_SPACE);
|
||||
if(!urlu || rc) {
|
||||
goto test_cleanup;
|
||||
}
|
||||
test_setopt(curl, CURLOPT_CURLU, urlu);
|
||||
test_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
|
||||
}
|
||||
else {
|
||||
test_setopt(curl, CURLOPT_URL, URL);
|
||||
/* just to make it explicit and visible in this test: */
|
||||
test_setopt(curl, CURLOPT_FOLLOWLOCATION, 0L);
|
||||
}
|
||||
|
||||
/* Perform the request, res will get the return code */
|
||||
res = curl_easy_perform(curl);
|
||||
if(res)
|
||||
goto test_cleanup;
|
||||
|
||||
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &curlResponseCode);
|
||||
curl_easy_getinfo(curl, CURLINFO_REDIRECT_COUNT, &curlRedirectCount);
|
||||
curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, &effectiveUrl);
|
||||
curl_easy_getinfo(curl, CURLINFO_REDIRECT_URL, &redirectUrl);
|
||||
test_setopt(curl, CURLOPT_WRITEFUNCTION, t1518_write_cb);
|
||||
|
||||
curl_mprintf("res %d\n"
|
||||
"status %ld\n"
|
||||
"redirects %ld\n"
|
||||
"effectiveurl %s\n"
|
||||
"redirecturl %s\n",
|
||||
res,
|
||||
curlResponseCode,
|
||||
curlRedirectCount,
|
||||
effectiveUrl,
|
||||
redirectUrl ? redirectUrl : "blank");
|
||||
|
||||
test_cleanup:
|
||||
|
||||
/* always cleanup */
|
||||
curl_easy_cleanup(curl);
|
||||
curl_global_cleanup();
|
||||
curl_url_cleanup(urlu);
|
||||
return res;
|
||||
}
|
||||
115
curl-8.15.0/tests/libtest/lib1520.c
Normal file
115
curl-8.15.0/tests/libtest/lib1520.c
Normal file
@@ -0,0 +1,115 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) Steve Holme, <steve_holme@hotmail.com>.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
/*
|
||||
* This is the list of basic details you need to tweak to get things right.
|
||||
*/
|
||||
#define TO "<recipient@example.com>"
|
||||
#define FROM "<sender@example.com>"
|
||||
|
||||
struct upload_status {
|
||||
int lines_read;
|
||||
};
|
||||
|
||||
static size_t t1520_read_cb(char *ptr, size_t size, size_t nmemb, void *userp)
|
||||
{
|
||||
static const char *payload_text[] = {
|
||||
"From: different\r\n",
|
||||
"To: another\r\n",
|
||||
"\r\n",
|
||||
"\r\n",
|
||||
".\r\n",
|
||||
".\r\n",
|
||||
"\r\n",
|
||||
".\r\n",
|
||||
"\r\n",
|
||||
"body",
|
||||
NULL
|
||||
};
|
||||
|
||||
struct upload_status *upload_ctx = (struct upload_status *)userp;
|
||||
const char *data;
|
||||
|
||||
if((size == 0) || (nmemb == 0) || ((size*nmemb) < 1)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
data = payload_text[upload_ctx->lines_read];
|
||||
|
||||
if(data) {
|
||||
size_t len = strlen(data);
|
||||
memcpy(ptr, data, len);
|
||||
upload_ctx->lines_read++;
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static CURLcode test_lib1520(char *URL)
|
||||
{
|
||||
CURLcode res;
|
||||
CURL *curl;
|
||||
struct curl_slist *rcpt_list = NULL;
|
||||
struct upload_status upload_ctx = {0};
|
||||
|
||||
if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
|
||||
curl_mfprintf(stderr, "curl_global_init() failed\n");
|
||||
return TEST_ERR_MAJOR_BAD;
|
||||
}
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(!curl) {
|
||||
curl_mfprintf(stderr, "curl_easy_init() failed\n");
|
||||
curl_global_cleanup();
|
||||
return TEST_ERR_MAJOR_BAD;
|
||||
}
|
||||
|
||||
rcpt_list = curl_slist_append(rcpt_list, TO);
|
||||
/* more addresses can be added here
|
||||
rcpt_list = curl_slist_append(rcpt_list, "<others@example.com>");
|
||||
*/
|
||||
|
||||
test_setopt(curl, CURLOPT_URL, URL);
|
||||
test_setopt(curl, CURLOPT_UPLOAD, 1L);
|
||||
test_setopt(curl, CURLOPT_READFUNCTION, t1520_read_cb);
|
||||
test_setopt(curl, CURLOPT_READDATA, &upload_ctx);
|
||||
test_setopt(curl, CURLOPT_MAIL_FROM, FROM);
|
||||
test_setopt(curl, CURLOPT_MAIL_RCPT, rcpt_list);
|
||||
test_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
|
||||
res = curl_easy_perform(curl);
|
||||
|
||||
test_cleanup:
|
||||
|
||||
curl_slist_free_all(rcpt_list);
|
||||
curl_easy_cleanup(curl);
|
||||
curl_global_cleanup();
|
||||
|
||||
return res;
|
||||
}
|
||||
99
curl-8.15.0/tests/libtest/lib1522.c
Normal file
99
curl-8.15.0/tests/libtest/lib1522.c
Normal file
@@ -0,0 +1,99 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
/* test case and code based on https://github.com/curl/curl/issues/2847 */
|
||||
|
||||
#include "testtrace.h"
|
||||
#include "memdebug.h"
|
||||
|
||||
static int sockopt_callback(void *clientp, curl_socket_t curlfd,
|
||||
curlsocktype purpose)
|
||||
{
|
||||
#if defined(SOL_SOCKET) && defined(SO_SNDBUF)
|
||||
int sndbufsize = 4 * 1024; /* 4KB send buffer */
|
||||
(void) clientp;
|
||||
(void) purpose;
|
||||
setsockopt(curlfd, SOL_SOCKET, SO_SNDBUF,
|
||||
(char *)&sndbufsize, sizeof(sndbufsize));
|
||||
#else
|
||||
(void)clientp;
|
||||
(void)curlfd;
|
||||
(void)purpose;
|
||||
#endif
|
||||
return CURL_SOCKOPT_OK;
|
||||
}
|
||||
|
||||
static CURLcode test_lib1522(char *URL)
|
||||
{
|
||||
static char g_Data[40 * 1024]; /* POST 40KB */
|
||||
|
||||
CURLcode code = TEST_ERR_MAJOR_BAD;
|
||||
CURLcode res;
|
||||
struct curl_slist *pHeaderList = NULL;
|
||||
CURL *curl = curl_easy_init();
|
||||
memset(g_Data, 'A', sizeof(g_Data)); /* send As! */
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_SOCKOPTFUNCTION, sockopt_callback);
|
||||
curl_easy_setopt(curl, CURLOPT_URL, URL);
|
||||
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, g_Data);
|
||||
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, (long)sizeof(g_Data));
|
||||
|
||||
libtest_debug_config.nohex = 1;
|
||||
libtest_debug_config.tracetime = 1;
|
||||
test_setopt(curl, CURLOPT_DEBUGDATA, &libtest_debug_config);
|
||||
test_setopt(curl, CURLOPT_DEBUGFUNCTION, libtest_debug_cb);
|
||||
test_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
|
||||
/* Remove "Expect: 100-continue" */
|
||||
pHeaderList = curl_slist_append(pHeaderList, "Expect:");
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, pHeaderList);
|
||||
|
||||
code = curl_easy_perform(curl);
|
||||
|
||||
if(code == CURLE_OK) {
|
||||
curl_off_t uploadSize;
|
||||
curl_easy_getinfo(curl, CURLINFO_SIZE_UPLOAD_T, &uploadSize);
|
||||
|
||||
curl_mprintf("uploadSize = %ld\n", (long)uploadSize);
|
||||
|
||||
if((size_t) uploadSize == sizeof(g_Data)) {
|
||||
curl_mprintf("!!!!!!!!!! PASS\n");
|
||||
}
|
||||
else {
|
||||
curl_mprintf("sent %d, libcurl says %d\n",
|
||||
(int)sizeof(g_Data), (int)uploadSize);
|
||||
}
|
||||
}
|
||||
else {
|
||||
curl_mprintf("curl_easy_perform() failed. e = %d\n", code);
|
||||
}
|
||||
test_cleanup:
|
||||
curl_slist_free_all(pHeaderList);
|
||||
curl_easy_cleanup(curl);
|
||||
curl_global_cleanup();
|
||||
|
||||
return code;
|
||||
}
|
||||
83
curl-8.15.0/tests/libtest/lib1523.c
Normal file
83
curl-8.15.0/tests/libtest/lib1523.c
Normal file
@@ -0,0 +1,83 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
/* test case and code based on https://github.com/curl/curl/issues/3927 */
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
static int dload_progress_cb(void *a, curl_off_t b, curl_off_t c,
|
||||
curl_off_t d, curl_off_t e)
|
||||
{
|
||||
(void)a;
|
||||
(void)b;
|
||||
(void)c;
|
||||
(void)d;
|
||||
(void)e;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static size_t t1523_write_cb(char *d, size_t n, size_t l, void *p)
|
||||
{
|
||||
/* take care of the data here, ignored in this example */
|
||||
(void)d;
|
||||
(void)p;
|
||||
return n*l;
|
||||
}
|
||||
|
||||
static CURLcode run(CURL *hnd, long limit, long time)
|
||||
{
|
||||
curl_easy_setopt(hnd, CURLOPT_LOW_SPEED_LIMIT, limit);
|
||||
curl_easy_setopt(hnd, CURLOPT_LOW_SPEED_TIME, time);
|
||||
return curl_easy_perform(hnd);
|
||||
}
|
||||
|
||||
static CURLcode test_lib1523(char *URL)
|
||||
{
|
||||
CURLcode ret;
|
||||
CURL *hnd;
|
||||
char buffer[CURL_ERROR_SIZE];
|
||||
curl_global_init(CURL_GLOBAL_ALL);
|
||||
hnd = curl_easy_init();
|
||||
curl_easy_setopt(hnd, CURLOPT_URL, URL);
|
||||
curl_easy_setopt(hnd, CURLOPT_WRITEFUNCTION, t1523_write_cb);
|
||||
curl_easy_setopt(hnd, CURLOPT_ERRORBUFFER, buffer);
|
||||
curl_easy_setopt(hnd, CURLOPT_NOPROGRESS, 0L);
|
||||
curl_easy_setopt(hnd, CURLOPT_XFERINFOFUNCTION, dload_progress_cb);
|
||||
|
||||
ret = run(hnd, 1, 2);
|
||||
if(ret)
|
||||
curl_mfprintf(stderr, "error (%d) %s\n", ret, buffer);
|
||||
|
||||
ret = run(hnd, 12000, 1);
|
||||
if(ret != CURLE_OPERATION_TIMEDOUT)
|
||||
curl_mfprintf(stderr, "error (%d) %s\n", ret, buffer);
|
||||
else
|
||||
ret = CURLE_OK;
|
||||
|
||||
curl_easy_cleanup(hnd);
|
||||
curl_global_cleanup();
|
||||
|
||||
return ret;
|
||||
}
|
||||
99
curl-8.15.0/tests/libtest/lib1525.c
Normal file
99
curl-8.15.0/tests/libtest/lib1525.c
Normal file
@@ -0,0 +1,99 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) Vijay Panghal, <vpanghal@maginatics.com>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/*
|
||||
* This unit test PUT http data over proxy. Proxy header will be different
|
||||
* from server http header
|
||||
*/
|
||||
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
static const char t1525_testdata[] = "Hello Cloud!\n";
|
||||
|
||||
static size_t t1525_read_cb(char *ptr, size_t size, size_t nmemb, void *stream)
|
||||
{
|
||||
size_t amount = nmemb * size; /* Total bytes curl wants */
|
||||
if(amount < strlen(t1525_testdata)) {
|
||||
return strlen(t1525_testdata);
|
||||
}
|
||||
(void)stream;
|
||||
memcpy(ptr, t1525_testdata, strlen(t1525_testdata));
|
||||
return strlen(t1525_testdata);
|
||||
}
|
||||
|
||||
static CURLcode test_lib1525(char *URL)
|
||||
{
|
||||
CURL *curl = NULL;
|
||||
CURLcode res = CURLE_FAILED_INIT;
|
||||
/* http and proxy header list */
|
||||
struct curl_slist *hhl = NULL;
|
||||
|
||||
if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
|
||||
curl_mfprintf(stderr, "curl_global_init() failed\n");
|
||||
return TEST_ERR_MAJOR_BAD;
|
||||
}
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(!curl) {
|
||||
curl_mfprintf(stderr, "curl_easy_init() failed\n");
|
||||
curl_global_cleanup();
|
||||
return TEST_ERR_MAJOR_BAD;
|
||||
}
|
||||
|
||||
hhl = curl_slist_append(hhl, "User-Agent: Http Agent");
|
||||
|
||||
if(!hhl) {
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
test_setopt(curl, CURLOPT_URL, URL);
|
||||
test_setopt(curl, CURLOPT_PROXY, libtest_arg2);
|
||||
test_setopt(curl, CURLOPT_HTTPHEADER, hhl);
|
||||
test_setopt(curl, CURLOPT_PROXYHEADER, hhl);
|
||||
test_setopt(curl, CURLOPT_HEADEROPT, (long)CURLHEADER_UNIFIED);
|
||||
test_setopt(curl, CURLOPT_POST, 0L);
|
||||
test_setopt(curl, CURLOPT_UPLOAD, 1L);
|
||||
test_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
test_setopt(curl, CURLOPT_PROXYTYPE, (long)CURLPROXY_HTTP);
|
||||
test_setopt(curl, CURLOPT_HEADER, 1L);
|
||||
test_setopt(curl, CURLOPT_WRITEFUNCTION, fwrite);
|
||||
test_setopt(curl, CURLOPT_READFUNCTION, t1525_read_cb);
|
||||
test_setopt(curl, CURLOPT_HTTPPROXYTUNNEL, 1L);
|
||||
test_setopt(curl, CURLOPT_INFILESIZE, (long)strlen(t1525_testdata));
|
||||
|
||||
res = curl_easy_perform(curl);
|
||||
|
||||
test_cleanup:
|
||||
|
||||
curl_easy_cleanup(curl);
|
||||
|
||||
curl_slist_free_all(hhl);
|
||||
|
||||
curl_global_cleanup();
|
||||
|
||||
return res;
|
||||
}
|
||||
105
curl-8.15.0/tests/libtest/lib1526.c
Normal file
105
curl-8.15.0/tests/libtest/lib1526.c
Normal file
@@ -0,0 +1,105 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) Vijay Panghal, <vpanghal@maginatics.com>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/*
|
||||
* This unit test PUT http data over proxy. Proxy header will be different
|
||||
* from server http header
|
||||
*/
|
||||
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
static const char t1526_testdata[] = "Hello Cloud!\n";
|
||||
|
||||
static size_t t1526_read_cb(char *ptr, size_t size, size_t nmemb, void *stream)
|
||||
{
|
||||
size_t amount = nmemb * size; /* Total bytes curl wants */
|
||||
if(amount < strlen(t1526_testdata)) {
|
||||
return strlen(t1526_testdata);
|
||||
}
|
||||
(void)stream;
|
||||
memcpy(ptr, t1526_testdata, strlen(t1526_testdata));
|
||||
return strlen(t1526_testdata);
|
||||
}
|
||||
|
||||
static CURLcode test_lib1526(char *URL)
|
||||
{
|
||||
CURL *curl = NULL;
|
||||
CURLcode res = CURLE_FAILED_INIT;
|
||||
/* http and proxy header list */
|
||||
struct curl_slist *hhl = NULL, *phl = NULL, *tmp = NULL;
|
||||
|
||||
if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
|
||||
curl_mfprintf(stderr, "curl_global_init() failed\n");
|
||||
return TEST_ERR_MAJOR_BAD;
|
||||
}
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(!curl) {
|
||||
curl_mfprintf(stderr, "curl_easy_init() failed\n");
|
||||
curl_global_cleanup();
|
||||
return TEST_ERR_MAJOR_BAD;
|
||||
}
|
||||
|
||||
hhl = curl_slist_append(hhl, "User-Agent: Http Agent");
|
||||
phl = curl_slist_append(phl, "User-Agent: Proxy Agent");
|
||||
if(!hhl || !phl) {
|
||||
goto test_cleanup;
|
||||
}
|
||||
tmp = curl_slist_append(phl, "Expect:");
|
||||
if(!tmp) {
|
||||
goto test_cleanup;
|
||||
}
|
||||
phl = tmp;
|
||||
|
||||
test_setopt(curl, CURLOPT_URL, URL);
|
||||
test_setopt(curl, CURLOPT_PROXY, libtest_arg2);
|
||||
test_setopt(curl, CURLOPT_HTTPHEADER, hhl);
|
||||
test_setopt(curl, CURLOPT_PROXYHEADER, phl);
|
||||
test_setopt(curl, CURLOPT_HEADEROPT, (long)CURLHEADER_SEPARATE);
|
||||
test_setopt(curl, CURLOPT_POST, 0L);
|
||||
test_setopt(curl, CURLOPT_UPLOAD, 1L);
|
||||
test_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
test_setopt(curl, CURLOPT_PROXYTYPE, (long)CURLPROXY_HTTP);
|
||||
test_setopt(curl, CURLOPT_HEADER, 1L);
|
||||
test_setopt(curl, CURLOPT_WRITEFUNCTION, fwrite);
|
||||
test_setopt(curl, CURLOPT_READFUNCTION, t1526_read_cb);
|
||||
test_setopt(curl, CURLOPT_HTTPPROXYTUNNEL, 1L);
|
||||
test_setopt(curl, CURLOPT_INFILESIZE, (long)strlen(t1526_testdata));
|
||||
|
||||
res = curl_easy_perform(curl);
|
||||
|
||||
test_cleanup:
|
||||
|
||||
curl_easy_cleanup(curl);
|
||||
|
||||
curl_slist_free_all(hhl);
|
||||
|
||||
curl_slist_free_all(phl);
|
||||
|
||||
curl_global_cleanup();
|
||||
|
||||
return res;
|
||||
}
|
||||
101
curl-8.15.0/tests/libtest/lib1527.c
Normal file
101
curl-8.15.0/tests/libtest/lib1527.c
Normal file
@@ -0,0 +1,101 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) Vijay Panghal, <vpanghal@maginatics.com>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/*
|
||||
* This unit test PUT http data over proxy. Same http header will be generated
|
||||
* for server and proxy
|
||||
*/
|
||||
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
static const char t1527_testdata[] = "Hello Cloud!\n";
|
||||
|
||||
static size_t t1527_read_cb(char *ptr, size_t size, size_t nmemb, void *stream)
|
||||
{
|
||||
size_t amount = nmemb * size; /* Total bytes curl wants */
|
||||
if(amount < strlen(t1527_testdata)) {
|
||||
return strlen(t1527_testdata);
|
||||
}
|
||||
(void)stream;
|
||||
memcpy(ptr, t1527_testdata, strlen(t1527_testdata));
|
||||
return strlen(t1527_testdata);
|
||||
}
|
||||
|
||||
static CURLcode test_lib1527(char *URL)
|
||||
{
|
||||
CURL *curl = NULL;
|
||||
CURLcode res = CURLE_FAILED_INIT;
|
||||
/* http header list */
|
||||
struct curl_slist *hhl = NULL, *tmp = NULL;
|
||||
|
||||
if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
|
||||
curl_mfprintf(stderr, "curl_global_init() failed\n");
|
||||
return TEST_ERR_MAJOR_BAD;
|
||||
}
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(!curl) {
|
||||
curl_mfprintf(stderr, "curl_easy_init() failed\n");
|
||||
curl_global_cleanup();
|
||||
return TEST_ERR_MAJOR_BAD;
|
||||
}
|
||||
|
||||
hhl = curl_slist_append(hhl, "User-Agent: Http Agent");
|
||||
if(!hhl) {
|
||||
goto test_cleanup;
|
||||
}
|
||||
tmp = curl_slist_append(hhl, "Expect: 100-continue");
|
||||
if(!tmp) {
|
||||
goto test_cleanup;
|
||||
}
|
||||
hhl = tmp;
|
||||
|
||||
test_setopt(curl, CURLOPT_URL, URL);
|
||||
test_setopt(curl, CURLOPT_PROXY, libtest_arg2);
|
||||
test_setopt(curl, CURLOPT_HTTPHEADER, hhl);
|
||||
test_setopt(curl, CURLOPT_POST, 0L);
|
||||
test_setopt(curl, CURLOPT_UPLOAD, 1L);
|
||||
test_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
test_setopt(curl, CURLOPT_PROXYTYPE, (long)CURLPROXY_HTTP);
|
||||
test_setopt(curl, CURLOPT_HEADER, 1L);
|
||||
test_setopt(curl, CURLOPT_WRITEFUNCTION, fwrite);
|
||||
test_setopt(curl, CURLOPT_READFUNCTION, t1527_read_cb);
|
||||
test_setopt(curl, CURLOPT_HTTPPROXYTUNNEL, 1L);
|
||||
test_setopt(curl, CURLOPT_INFILESIZE, (long)strlen(t1527_testdata));
|
||||
test_setopt(curl, CURLOPT_HEADEROPT, (long)CURLHEADER_UNIFIED);
|
||||
|
||||
res = curl_easy_perform(curl);
|
||||
|
||||
test_cleanup:
|
||||
|
||||
curl_easy_cleanup(curl);
|
||||
|
||||
curl_slist_free_all(hhl);
|
||||
|
||||
curl_global_cleanup();
|
||||
|
||||
return res;
|
||||
}
|
||||
74
curl-8.15.0/tests/libtest/lib1528.c
Normal file
74
curl-8.15.0/tests/libtest/lib1528.c
Normal file
@@ -0,0 +1,74 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
static CURLcode test_lib1528(char *URL)
|
||||
{
|
||||
CURL *curl = NULL;
|
||||
CURLcode res = CURLE_FAILED_INIT;
|
||||
/* http header list */
|
||||
struct curl_slist *hhl = NULL;
|
||||
struct curl_slist *phl = NULL;
|
||||
|
||||
if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
|
||||
curl_mfprintf(stderr, "curl_global_init() failed\n");
|
||||
return TEST_ERR_MAJOR_BAD;
|
||||
}
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(!curl) {
|
||||
curl_mfprintf(stderr, "curl_easy_init() failed\n");
|
||||
curl_global_cleanup();
|
||||
return TEST_ERR_MAJOR_BAD;
|
||||
}
|
||||
|
||||
hhl = curl_slist_append(hhl, "User-Agent: Http Agent");
|
||||
phl = curl_slist_append(phl, "Proxy-User-Agent: Http Agent2");
|
||||
|
||||
if(!hhl) {
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
test_setopt(curl, CURLOPT_URL, URL);
|
||||
test_setopt(curl, CURLOPT_PROXY, libtest_arg2);
|
||||
test_setopt(curl, CURLOPT_HTTPHEADER, hhl);
|
||||
test_setopt(curl, CURLOPT_PROXYHEADER, phl);
|
||||
test_setopt(curl, CURLOPT_HEADEROPT, (long)CURLHEADER_SEPARATE);
|
||||
test_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
test_setopt(curl, CURLOPT_PROXYTYPE, (long)CURLPROXY_HTTP);
|
||||
test_setopt(curl, CURLOPT_HEADER, 1L);
|
||||
|
||||
res = curl_easy_perform(curl);
|
||||
|
||||
test_cleanup:
|
||||
|
||||
curl_easy_cleanup(curl);
|
||||
curl_slist_free_all(hhl);
|
||||
curl_slist_free_all(phl);
|
||||
curl_global_cleanup();
|
||||
|
||||
return res;
|
||||
}
|
||||
62
curl-8.15.0/tests/libtest/lib1529.c
Normal file
62
curl-8.15.0/tests/libtest/lib1529.c
Normal file
@@ -0,0 +1,62 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
static CURLcode test_lib1529(char *URL)
|
||||
{
|
||||
CURL *curl = NULL;
|
||||
CURLcode res = CURLE_FAILED_INIT;
|
||||
char bURL[512];
|
||||
curl_msnprintf(bURL, sizeof(bURL),
|
||||
"%s HTTP/1.1\r\nGET http://1529.com/1529", URL);
|
||||
|
||||
if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
|
||||
curl_mfprintf(stderr, "curl_global_init() failed\n");
|
||||
return TEST_ERR_MAJOR_BAD;
|
||||
}
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(!curl) {
|
||||
curl_mfprintf(stderr, "curl_easy_init() failed\n");
|
||||
curl_global_cleanup();
|
||||
return TEST_ERR_MAJOR_BAD;
|
||||
}
|
||||
|
||||
test_setopt(curl, CURLOPT_URL, bURL);
|
||||
test_setopt(curl, CURLOPT_PROXY, libtest_arg2);
|
||||
test_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
test_setopt(curl, CURLOPT_PROXYTYPE, (long)CURLPROXY_HTTP);
|
||||
test_setopt(curl, CURLOPT_HEADER, 1L);
|
||||
|
||||
res = curl_easy_perform(curl);
|
||||
|
||||
test_cleanup:
|
||||
|
||||
curl_easy_cleanup(curl);
|
||||
curl_global_cleanup();
|
||||
|
||||
return res;
|
||||
}
|
||||
69
curl-8.15.0/tests/libtest/lib1530.c
Normal file
69
curl-8.15.0/tests/libtest/lib1530.c
Normal file
@@ -0,0 +1,69 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
static curl_socket_t opensocket(void *clientp,
|
||||
curlsocktype purpose,
|
||||
struct curl_sockaddr *address)
|
||||
{
|
||||
(void)purpose;
|
||||
(void)address;
|
||||
(void)clientp;
|
||||
curl_mfprintf(stderr, "opensocket() returns CURL_SOCKET_BAD\n");
|
||||
return CURL_SOCKET_BAD;
|
||||
}
|
||||
|
||||
static CURLcode test_lib1530(char *URL)
|
||||
{
|
||||
CURL *curl = NULL;
|
||||
CURLcode res = CURLE_FAILED_INIT;
|
||||
(void)URL;
|
||||
|
||||
if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
|
||||
curl_mfprintf(stderr, "curl_global_init() failed\n");
|
||||
return TEST_ERR_MAJOR_BAD;
|
||||
}
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(!curl) {
|
||||
curl_mfprintf(stderr, "curl_easy_init() failed\n");
|
||||
curl_global_cleanup();
|
||||
return TEST_ERR_MAJOR_BAD;
|
||||
}
|
||||
|
||||
test_setopt(curl, CURLOPT_URL, "http://99.99.99.99:9999");
|
||||
test_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
test_setopt(curl, CURLOPT_OPENSOCKETFUNCTION, opensocket);
|
||||
|
||||
res = curl_easy_perform(curl);
|
||||
|
||||
test_cleanup:
|
||||
|
||||
curl_easy_cleanup(curl);
|
||||
curl_global_cleanup();
|
||||
|
||||
return res;
|
||||
}
|
||||
148
curl-8.15.0/tests/libtest/lib1531.c
Normal file
148
curl-8.15.0/tests/libtest/lib1531.c
Normal file
@@ -0,0 +1,148 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
static CURLcode test_lib1531(char *URL)
|
||||
{
|
||||
static char const testData[] = ".abc\0xyz";
|
||||
static curl_off_t const testDataSize = sizeof(testData) - 1;
|
||||
|
||||
CURL *easy;
|
||||
CURLM *multi_handle;
|
||||
int still_running; /* keep number of running handles */
|
||||
CURLMsg *msg; /* for picking up messages with the transfer status */
|
||||
int msgs_left; /* how many messages are left */
|
||||
CURLcode res = CURLE_OK;
|
||||
|
||||
start_test_timing();
|
||||
|
||||
global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
/* Allocate one curl handle per transfer */
|
||||
easy = curl_easy_init();
|
||||
|
||||
/* init a multi stack */
|
||||
multi_handle = curl_multi_init();
|
||||
|
||||
/* add the individual transfer */
|
||||
curl_multi_add_handle(multi_handle, easy);
|
||||
|
||||
/* set the options (I left out a few, you'll get the point anyway) */
|
||||
curl_easy_setopt(easy, CURLOPT_URL, URL);
|
||||
curl_easy_setopt(easy, CURLOPT_POSTFIELDSIZE_LARGE, testDataSize);
|
||||
curl_easy_setopt(easy, CURLOPT_POSTFIELDS, testData);
|
||||
|
||||
/* we start some action by calling perform right away */
|
||||
curl_multi_perform(multi_handle, &still_running);
|
||||
|
||||
abort_on_test_timeout();
|
||||
|
||||
do {
|
||||
struct timeval timeout;
|
||||
int rc; /* select() return code */
|
||||
CURLMcode mc; /* curl_multi_fdset() return code */
|
||||
|
||||
fd_set fdread;
|
||||
fd_set fdwrite;
|
||||
fd_set fdexcep;
|
||||
int maxfd = -1;
|
||||
|
||||
long curl_timeo = -1;
|
||||
|
||||
FD_ZERO(&fdread);
|
||||
FD_ZERO(&fdwrite);
|
||||
FD_ZERO(&fdexcep);
|
||||
|
||||
/* set a suitable timeout to play around with */
|
||||
timeout.tv_sec = 1;
|
||||
timeout.tv_usec = 0;
|
||||
|
||||
curl_multi_timeout(multi_handle, &curl_timeo);
|
||||
if(curl_timeo >= 0) {
|
||||
curlx_mstotv(&timeout, curl_timeo);
|
||||
if(timeout.tv_sec > 1) {
|
||||
timeout.tv_sec = 1;
|
||||
timeout.tv_usec = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* get file descriptors from the transfers */
|
||||
mc = curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd);
|
||||
|
||||
if(mc != CURLM_OK) {
|
||||
curl_mfprintf(stderr, "curl_multi_fdset() failed, code %d.\n", mc);
|
||||
break;
|
||||
}
|
||||
|
||||
/* On success the value of maxfd is guaranteed to be >= -1. We call
|
||||
select(maxfd + 1, ...); specially in case of (maxfd == -1) there are
|
||||
no fds ready yet so we call select(0, ...) --or Sleep() on Windows--
|
||||
to sleep 100ms, which is the minimum suggested value in the
|
||||
curl_multi_fdset() doc. */
|
||||
|
||||
if(maxfd == -1) {
|
||||
rc = curlx_wait_ms(100);
|
||||
}
|
||||
else {
|
||||
/* Note that on some platforms 'timeout' may be modified by select().
|
||||
If you need access to the original value save a copy beforehand. */
|
||||
rc = select(maxfd + 1, &fdread, &fdwrite, &fdexcep, &timeout);
|
||||
}
|
||||
|
||||
switch(rc) {
|
||||
case -1:
|
||||
/* select error */
|
||||
break;
|
||||
case 0: /* timeout */
|
||||
default: /* action */
|
||||
curl_multi_perform(multi_handle, &still_running);
|
||||
break;
|
||||
}
|
||||
|
||||
abort_on_test_timeout();
|
||||
} while(still_running);
|
||||
|
||||
/* See how the transfers went */
|
||||
do {
|
||||
msg = curl_multi_info_read(multi_handle, &msgs_left);
|
||||
if(msg && msg->msg == CURLMSG_DONE) {
|
||||
curl_mprintf("HTTP transfer completed with status %d\n",
|
||||
msg->data.result);
|
||||
break;
|
||||
}
|
||||
|
||||
abort_on_test_timeout();
|
||||
} while(msg);
|
||||
|
||||
test_cleanup:
|
||||
curl_multi_cleanup(multi_handle);
|
||||
|
||||
/* Free the curl handles */
|
||||
curl_easy_cleanup(easy);
|
||||
curl_global_cleanup();
|
||||
|
||||
return res;
|
||||
}
|
||||
87
curl-8.15.0/tests/libtest/lib1532.c
Normal file
87
curl-8.15.0/tests/libtest/lib1532.c
Normal file
@@ -0,0 +1,87 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
/* Test CURLINFO_RESPONSE_CODE */
|
||||
|
||||
static CURLcode test_lib1532(char *URL)
|
||||
{
|
||||
CURL *curl;
|
||||
long httpcode;
|
||||
CURLcode res = CURLE_OK;
|
||||
|
||||
global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
easy_init(curl);
|
||||
|
||||
easy_setopt(curl, CURLOPT_URL, URL);
|
||||
|
||||
res = curl_easy_perform(curl);
|
||||
if(res) {
|
||||
curl_mfprintf(stderr,
|
||||
"%s:%d curl_easy_perform() failed with code %d (%s)\n",
|
||||
__FILE__, __LINE__, res, curl_easy_strerror(res));
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
res = curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &httpcode);
|
||||
if(res) {
|
||||
curl_mfprintf(stderr,
|
||||
"%s:%d curl_easy_getinfo() failed with code %d (%s)\n",
|
||||
__FILE__, __LINE__, res, curl_easy_strerror(res));
|
||||
goto test_cleanup;
|
||||
}
|
||||
if(httpcode != 200) {
|
||||
curl_mfprintf(stderr, "%s:%d unexpected response code %ld\n",
|
||||
__FILE__, __LINE__, httpcode);
|
||||
res = CURLE_HTTP_RETURNED_ERROR;
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
/* Test for a regression of github bug 1017 (response code does not reset) */
|
||||
curl_easy_reset(curl);
|
||||
|
||||
res = curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &httpcode);
|
||||
if(res) {
|
||||
curl_mfprintf(stderr,
|
||||
"%s:%d curl_easy_getinfo() failed with code %d (%s)\n",
|
||||
__FILE__, __LINE__, res, curl_easy_strerror(res));
|
||||
goto test_cleanup;
|
||||
}
|
||||
if(httpcode) {
|
||||
curl_mfprintf(stderr,
|
||||
"%s:%d curl_easy_reset failed to zero the response code\n"
|
||||
"possible regression of github bug 1017\n",
|
||||
__FILE__, __LINE__);
|
||||
res = CURLE_HTTP_RETURNED_ERROR;
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
test_cleanup:
|
||||
curl_easy_cleanup(curl);
|
||||
curl_global_cleanup();
|
||||
return res;
|
||||
}
|
||||
202
curl-8.15.0/tests/libtest/lib1533.c
Normal file
202
curl-8.15.0/tests/libtest/lib1533.c
Normal file
@@ -0,0 +1,202 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/*
|
||||
* This test sends data with CURLOPT_KEEP_SENDING_ON_ERROR.
|
||||
* The server responds with an early error response.
|
||||
* The test is successful if the connection can be reused for the next request,
|
||||
* because this implies that the data has been sent completely to the server.
|
||||
*/
|
||||
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
struct cb_data {
|
||||
CURL *easy_handle;
|
||||
int response_received;
|
||||
int paused;
|
||||
size_t remaining_bytes;
|
||||
};
|
||||
|
||||
static void reset_data(struct cb_data *data, CURL *curl)
|
||||
{
|
||||
data->easy_handle = curl;
|
||||
data->response_received = 0;
|
||||
data->paused = 0;
|
||||
data->remaining_bytes = 3;
|
||||
}
|
||||
|
||||
static size_t t1533_read_cb(char *ptr, size_t size, size_t nitems, void *userp)
|
||||
{
|
||||
struct cb_data *data = (struct cb_data *)userp;
|
||||
|
||||
/* wait until the server has sent all response headers */
|
||||
if(data->response_received) {
|
||||
size_t totalsize = nitems * size;
|
||||
|
||||
size_t bytes_to_send = data->remaining_bytes;
|
||||
if(bytes_to_send > totalsize) {
|
||||
bytes_to_send = totalsize;
|
||||
}
|
||||
|
||||
memset(ptr, 'a', bytes_to_send);
|
||||
data->remaining_bytes -= bytes_to_send;
|
||||
|
||||
return bytes_to_send;
|
||||
}
|
||||
else {
|
||||
data->paused = 1;
|
||||
return CURL_READFUNC_PAUSE;
|
||||
}
|
||||
}
|
||||
|
||||
static size_t t1533_write_cb(char *ptr, size_t size, size_t nmemb, void *userp)
|
||||
{
|
||||
struct cb_data *data = (struct cb_data *)userp;
|
||||
size_t totalsize = nmemb * size;
|
||||
|
||||
/* unused parameter */
|
||||
(void)ptr;
|
||||
|
||||
/* all response headers have been received */
|
||||
data->response_received = 1;
|
||||
|
||||
if(data->paused) {
|
||||
/* continue to send request body data */
|
||||
data->paused = 0;
|
||||
curl_easy_pause(data->easy_handle, CURLPAUSE_CONT);
|
||||
}
|
||||
|
||||
return totalsize;
|
||||
}
|
||||
|
||||
static CURLcode perform_and_check_connections(CURL *curl,
|
||||
const char *description,
|
||||
long expected_connections)
|
||||
{
|
||||
CURLcode res;
|
||||
long connections = 0;
|
||||
|
||||
res = curl_easy_perform(curl);
|
||||
if(res != CURLE_OK) {
|
||||
curl_mfprintf(stderr, "curl_easy_perform() failed with %d\n", res);
|
||||
return TEST_ERR_MAJOR_BAD;
|
||||
}
|
||||
|
||||
res = curl_easy_getinfo(curl, CURLINFO_NUM_CONNECTS, &connections);
|
||||
if(res != CURLE_OK) {
|
||||
curl_mfprintf(stderr, "curl_easy_getinfo() failed\n");
|
||||
return TEST_ERR_MAJOR_BAD;
|
||||
}
|
||||
|
||||
curl_mfprintf(stderr,
|
||||
"%s: expected: %ld connections; actual: %ld connections\n",
|
||||
description, expected_connections, connections);
|
||||
|
||||
if(connections != expected_connections) {
|
||||
return TEST_ERR_FAILURE;
|
||||
}
|
||||
|
||||
return TEST_ERR_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static CURLcode test_lib1533(char *URL)
|
||||
{
|
||||
struct cb_data data;
|
||||
CURL *curl = NULL;
|
||||
CURLcode res = TEST_ERR_FAILURE;
|
||||
CURLcode result;
|
||||
|
||||
if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
|
||||
curl_mfprintf(stderr, "curl_global_init() failed\n");
|
||||
return TEST_ERR_MAJOR_BAD;
|
||||
}
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(!curl) {
|
||||
curl_mfprintf(stderr, "curl_easy_init() failed\n");
|
||||
curl_global_cleanup();
|
||||
return TEST_ERR_MAJOR_BAD;
|
||||
}
|
||||
|
||||
reset_data(&data, curl);
|
||||
|
||||
test_setopt(curl, CURLOPT_URL, URL);
|
||||
test_setopt(curl, CURLOPT_POST, 1L);
|
||||
test_setopt(curl, CURLOPT_POSTFIELDSIZE_LARGE,
|
||||
(curl_off_t)data.remaining_bytes);
|
||||
test_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
test_setopt(curl, CURLOPT_READFUNCTION, t1533_read_cb);
|
||||
test_setopt(curl, CURLOPT_READDATA, &data);
|
||||
test_setopt(curl, CURLOPT_WRITEFUNCTION, t1533_write_cb);
|
||||
test_setopt(curl, CURLOPT_WRITEDATA, &data);
|
||||
|
||||
result = perform_and_check_connections(curl,
|
||||
"First request without CURLOPT_KEEP_SENDING_ON_ERROR", 1);
|
||||
if(result != TEST_ERR_SUCCESS) {
|
||||
res = result;
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
reset_data(&data, curl);
|
||||
|
||||
result = perform_and_check_connections(curl,
|
||||
"Second request without CURLOPT_KEEP_SENDING_ON_ERROR", 1);
|
||||
if(result != TEST_ERR_SUCCESS) {
|
||||
res = result;
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
test_setopt(curl, CURLOPT_KEEP_SENDING_ON_ERROR, 1L);
|
||||
|
||||
reset_data(&data, curl);
|
||||
|
||||
result = perform_and_check_connections(curl,
|
||||
"First request with CURLOPT_KEEP_SENDING_ON_ERROR", 1);
|
||||
if(result != TEST_ERR_SUCCESS) {
|
||||
res = result;
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
reset_data(&data, curl);
|
||||
|
||||
result = perform_and_check_connections(curl,
|
||||
"Second request with CURLOPT_KEEP_SENDING_ON_ERROR", 0);
|
||||
if(result != TEST_ERR_SUCCESS) {
|
||||
res = result;
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
res = TEST_ERR_SUCCESS;
|
||||
|
||||
test_cleanup:
|
||||
|
||||
curl_easy_cleanup(curl);
|
||||
|
||||
curl_global_cleanup();
|
||||
|
||||
return res;
|
||||
}
|
||||
138
curl-8.15.0/tests/libtest/lib1534.c
Normal file
138
curl-8.15.0/tests/libtest/lib1534.c
Normal file
@@ -0,0 +1,138 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
/* Test CURLINFO_FILETIME */
|
||||
|
||||
static CURLcode test_lib1534(char *URL)
|
||||
{
|
||||
CURL *curl, *dupe = NULL;
|
||||
long filetime;
|
||||
CURLcode res = CURLE_OK;
|
||||
|
||||
global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
easy_init(curl);
|
||||
|
||||
/* Test that a filetime is properly initialized on curl_easy_init.
|
||||
*/
|
||||
|
||||
res = curl_easy_getinfo(curl, CURLINFO_FILETIME, &filetime);
|
||||
if(res) {
|
||||
curl_mfprintf(stderr,
|
||||
"%s:%d curl_easy_getinfo() failed with code %d (%s)\n",
|
||||
__FILE__, __LINE__, res, curl_easy_strerror(res));
|
||||
goto test_cleanup;
|
||||
}
|
||||
if(filetime != -1) {
|
||||
curl_mfprintf(stderr,
|
||||
"%s:%d filetime init failed; expected -1 but is %ld\n",
|
||||
__FILE__, __LINE__, filetime);
|
||||
res = CURLE_FAILED_INIT;
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
easy_setopt(curl, CURLOPT_URL, URL);
|
||||
easy_setopt(curl, CURLOPT_FILETIME, 1L);
|
||||
|
||||
res = curl_easy_perform(curl);
|
||||
if(res) {
|
||||
curl_mfprintf(stderr,
|
||||
"%s:%d curl_easy_perform() failed with code %d (%s)\n",
|
||||
__FILE__, __LINE__, res, curl_easy_strerror(res));
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
/* Test that a filetime is properly set after receiving an HTTP resource.
|
||||
*/
|
||||
|
||||
res = curl_easy_getinfo(curl, CURLINFO_FILETIME, &filetime);
|
||||
if(res) {
|
||||
curl_mfprintf(stderr,
|
||||
"%s:%d curl_easy_getinfo() failed with code %d (%s)\n",
|
||||
__FILE__, __LINE__, res, curl_easy_strerror(res));
|
||||
goto test_cleanup;
|
||||
}
|
||||
if(filetime != 30) {
|
||||
curl_mfprintf(stderr, "%s:%d filetime of http resource is incorrect; "
|
||||
"expected 30 but is %ld\n",
|
||||
__FILE__, __LINE__, filetime);
|
||||
res = CURLE_HTTP_RETURNED_ERROR;
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
/* Test that a filetime is properly initialized on curl_easy_duphandle.
|
||||
*/
|
||||
|
||||
dupe = curl_easy_duphandle(curl);
|
||||
if(!dupe) {
|
||||
curl_mfprintf(stderr, "%s:%d curl_easy_duphandle() failed\n",
|
||||
__FILE__, __LINE__);
|
||||
res = CURLE_FAILED_INIT;
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
res = curl_easy_getinfo(dupe, CURLINFO_FILETIME, &filetime);
|
||||
if(res) {
|
||||
curl_mfprintf(stderr,
|
||||
"%s:%d curl_easy_getinfo() failed with code %d (%s)\n",
|
||||
__FILE__, __LINE__, res, curl_easy_strerror(res));
|
||||
goto test_cleanup;
|
||||
}
|
||||
if(filetime != -1) {
|
||||
curl_mfprintf(stderr,
|
||||
"%s:%d filetime init failed; expected -1 but is %ld\n",
|
||||
__FILE__, __LINE__, filetime);
|
||||
res = CURLE_FAILED_INIT;
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
/* Test that a filetime is properly initialized on curl_easy_reset.
|
||||
*/
|
||||
|
||||
curl_easy_reset(curl);
|
||||
|
||||
res = curl_easy_getinfo(curl, CURLINFO_FILETIME, &filetime);
|
||||
if(res) {
|
||||
curl_mfprintf(stderr,
|
||||
"%s:%d curl_easy_getinfo() failed with code %d (%s)\n",
|
||||
__FILE__, __LINE__, res, curl_easy_strerror(res));
|
||||
goto test_cleanup;
|
||||
}
|
||||
if(filetime != -1) {
|
||||
curl_mfprintf(stderr,
|
||||
"%s:%d filetime init failed; expected -1 but is %ld\n",
|
||||
__FILE__, __LINE__, filetime);
|
||||
res = CURLE_FAILED_INIT;
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
test_cleanup:
|
||||
curl_easy_cleanup(curl);
|
||||
curl_easy_cleanup(dupe);
|
||||
curl_global_cleanup();
|
||||
return res;
|
||||
}
|
||||
142
curl-8.15.0/tests/libtest/lib1535.c
Normal file
142
curl-8.15.0/tests/libtest/lib1535.c
Normal file
@@ -0,0 +1,142 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
/* Test CURLINFO_PROTOCOL */
|
||||
|
||||
static CURLcode test_lib1535(char *URL)
|
||||
{
|
||||
CURL *curl, *dupe = NULL;
|
||||
long protocol;
|
||||
CURLcode res = CURLE_OK;
|
||||
|
||||
global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
easy_init(curl);
|
||||
|
||||
/* Test that protocol is properly initialized on curl_easy_init.
|
||||
*/
|
||||
|
||||
res = curl_easy_getinfo(curl, CURLINFO_PROTOCOL, &protocol);
|
||||
|
||||
if(res) {
|
||||
curl_mfprintf(stderr,
|
||||
"%s:%d curl_easy_getinfo() failed with code %d (%s)\n",
|
||||
__FILE__, __LINE__, res, curl_easy_strerror(res));
|
||||
goto test_cleanup;
|
||||
}
|
||||
if(protocol) {
|
||||
curl_mfprintf(stderr,
|
||||
"%s:%d protocol init failed; expected 0 but is %ld\n",
|
||||
__FILE__, __LINE__, protocol);
|
||||
res = CURLE_FAILED_INIT;
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
easy_setopt(curl, CURLOPT_URL, URL);
|
||||
|
||||
res = curl_easy_perform(curl);
|
||||
if(res) {
|
||||
curl_mfprintf(stderr,
|
||||
"%s:%d curl_easy_perform() failed with code %d (%s)\n",
|
||||
__FILE__, __LINE__, res, curl_easy_strerror(res));
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
/* Test that a protocol is properly set after receiving an HTTP resource.
|
||||
*/
|
||||
|
||||
res = curl_easy_getinfo(curl, CURLINFO_PROTOCOL, &protocol);
|
||||
|
||||
if(res) {
|
||||
curl_mfprintf(stderr,
|
||||
"%s:%d curl_easy_getinfo() failed with code %d (%s)\n",
|
||||
__FILE__, __LINE__, res, curl_easy_strerror(res));
|
||||
goto test_cleanup;
|
||||
}
|
||||
if(protocol != CURLPROTO_HTTP) {
|
||||
curl_mfprintf(stderr,
|
||||
"%s:%d protocol of http resource is incorrect; "
|
||||
"expected %d but is %ld\n",
|
||||
__FILE__, __LINE__, CURLPROTO_HTTP, protocol);
|
||||
res = CURLE_HTTP_RETURNED_ERROR;
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
/* Test that a protocol is properly initialized on curl_easy_duphandle.
|
||||
*/
|
||||
|
||||
dupe = curl_easy_duphandle(curl);
|
||||
if(!dupe) {
|
||||
curl_mfprintf(stderr, "%s:%d curl_easy_duphandle() failed\n",
|
||||
__FILE__, __LINE__);
|
||||
res = CURLE_FAILED_INIT;
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
res = curl_easy_getinfo(dupe, CURLINFO_PROTOCOL, &protocol);
|
||||
|
||||
if(res) {
|
||||
curl_mfprintf(stderr,
|
||||
"%s:%d curl_easy_getinfo() failed with code %d (%s)\n",
|
||||
__FILE__, __LINE__, res, curl_easy_strerror(res));
|
||||
goto test_cleanup;
|
||||
}
|
||||
if(protocol) {
|
||||
curl_mfprintf(stderr,
|
||||
"%s:%d protocol init failed; expected 0 but is %ld\n",
|
||||
__FILE__, __LINE__, protocol);
|
||||
res = CURLE_FAILED_INIT;
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
/* Test that a protocol is properly initialized on curl_easy_reset.
|
||||
*/
|
||||
|
||||
curl_easy_reset(curl);
|
||||
|
||||
res = curl_easy_getinfo(curl, CURLINFO_PROTOCOL, &protocol);
|
||||
|
||||
if(res) {
|
||||
curl_mfprintf(stderr,
|
||||
"%s:%d curl_easy_getinfo() failed with code %d (%s)\n",
|
||||
__FILE__, __LINE__, res, curl_easy_strerror(res));
|
||||
goto test_cleanup;
|
||||
}
|
||||
if(protocol) {
|
||||
curl_mfprintf(stderr,
|
||||
"%s:%d protocol init failed; expected 0 but is %ld\n",
|
||||
__FILE__, __LINE__, protocol);
|
||||
res = CURLE_FAILED_INIT;
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
test_cleanup:
|
||||
curl_easy_cleanup(curl);
|
||||
curl_easy_cleanup(dupe);
|
||||
curl_global_cleanup();
|
||||
return res;
|
||||
}
|
||||
136
curl-8.15.0/tests/libtest/lib1536.c
Normal file
136
curl-8.15.0/tests/libtest/lib1536.c
Normal file
@@ -0,0 +1,136 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
/* Test CURLINFO_SCHEME */
|
||||
|
||||
static CURLcode test_lib1536(char *URL)
|
||||
{
|
||||
CURL *curl, *dupe = NULL;
|
||||
char *scheme;
|
||||
CURLcode res = CURLE_OK;
|
||||
|
||||
global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
easy_init(curl);
|
||||
|
||||
/* Test that scheme is properly initialized on curl_easy_init.
|
||||
*/
|
||||
|
||||
res = curl_easy_getinfo(curl, CURLINFO_SCHEME, &scheme);
|
||||
if(res) {
|
||||
curl_mfprintf(stderr,
|
||||
"%s:%d curl_easy_getinfo() failed with code %d (%s)\n",
|
||||
__FILE__, __LINE__, res, curl_easy_strerror(res));
|
||||
goto test_cleanup;
|
||||
}
|
||||
if(scheme) {
|
||||
curl_mfprintf(stderr,
|
||||
"%s:%d scheme init failed; expected NULL\n",
|
||||
__FILE__, __LINE__);
|
||||
res = CURLE_FAILED_INIT;
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
easy_setopt(curl, CURLOPT_URL, URL);
|
||||
|
||||
res = curl_easy_perform(curl);
|
||||
if(res) {
|
||||
curl_mfprintf(stderr,
|
||||
"%s:%d curl_easy_perform() failed with code %d (%s)\n",
|
||||
__FILE__, __LINE__, res, curl_easy_strerror(res));
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
/* Test that a scheme is properly set after receiving an HTTP resource.
|
||||
*/
|
||||
|
||||
res = curl_easy_getinfo(curl, CURLINFO_SCHEME, &scheme);
|
||||
if(res) {
|
||||
curl_mfprintf(stderr,
|
||||
"%s:%d curl_easy_getinfo() failed with code %d (%s)\n",
|
||||
__FILE__, __LINE__, res, curl_easy_strerror(res));
|
||||
goto test_cleanup;
|
||||
}
|
||||
if(!scheme || memcmp(scheme, "http", 5) != 0) {
|
||||
curl_mfprintf(stderr, "%s:%d scheme of http resource is incorrect; "
|
||||
"expected 'http' but is %s\n",
|
||||
__FILE__, __LINE__,
|
||||
(scheme == NULL ? "NULL" : "invalid"));
|
||||
res = CURLE_HTTP_RETURNED_ERROR;
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
/* Test that a scheme is properly initialized on curl_easy_duphandle.
|
||||
*/
|
||||
|
||||
dupe = curl_easy_duphandle(curl);
|
||||
if(!dupe) {
|
||||
curl_mfprintf(stderr, "%s:%d curl_easy_duphandle() failed\n",
|
||||
__FILE__, __LINE__);
|
||||
res = CURLE_FAILED_INIT;
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
res = curl_easy_getinfo(dupe, CURLINFO_SCHEME, &scheme);
|
||||
if(res) {
|
||||
curl_mfprintf(stderr,
|
||||
"%s:%d curl_easy_getinfo() failed with code %d (%s)\n",
|
||||
__FILE__, __LINE__, res, curl_easy_strerror(res));
|
||||
goto test_cleanup;
|
||||
}
|
||||
if(scheme) {
|
||||
curl_mfprintf(stderr, "%s:%d scheme init failed; expected NULL\n",
|
||||
__FILE__, __LINE__);
|
||||
res = CURLE_FAILED_INIT;
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
/* Test that a scheme is properly initialized on curl_easy_reset.
|
||||
*/
|
||||
|
||||
curl_easy_reset(curl);
|
||||
|
||||
res = curl_easy_getinfo(curl, CURLINFO_SCHEME, &scheme);
|
||||
if(res) {
|
||||
curl_mfprintf(stderr,
|
||||
"%s:%d curl_easy_getinfo() failed with code %d (%s)\n",
|
||||
__FILE__, __LINE__, res, curl_easy_strerror(res));
|
||||
goto test_cleanup;
|
||||
}
|
||||
if(scheme) {
|
||||
curl_mfprintf(stderr, "%s:%d scheme init failed; expected NULL\n",
|
||||
__FILE__, __LINE__);
|
||||
res = CURLE_FAILED_INIT;
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
test_cleanup:
|
||||
curl_easy_cleanup(curl);
|
||||
curl_easy_cleanup(dupe);
|
||||
curl_global_cleanup();
|
||||
return res;
|
||||
}
|
||||
91
curl-8.15.0/tests/libtest/lib1537.c
Normal file
91
curl-8.15.0/tests/libtest/lib1537.c
Normal file
@@ -0,0 +1,91 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
static CURLcode test_lib1537(char *URL)
|
||||
{
|
||||
const unsigned char a[] = {0x2f, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
|
||||
0x91, 0xa2, 0xb3, 0xc4, 0xd5, 0xe6, 0xf7};
|
||||
CURLcode res = CURLE_OK;
|
||||
char *ptr = NULL;
|
||||
int asize;
|
||||
int outlen = 0;
|
||||
char *raw;
|
||||
|
||||
(void)URL; /* we don't use this */
|
||||
|
||||
if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
|
||||
curl_mfprintf(stderr, "curl_global_init() failed\n");
|
||||
return TEST_ERR_MAJOR_BAD;
|
||||
}
|
||||
|
||||
asize = (int)sizeof(a);
|
||||
ptr = curl_easy_escape(NULL, (const char *)a, asize);
|
||||
curl_mprintf("%s\n", ptr);
|
||||
curl_free(ptr);
|
||||
|
||||
/* deprecated API */
|
||||
ptr = curl_escape((const char *)a, asize);
|
||||
if(!ptr) {
|
||||
res = TEST_ERR_MAJOR_BAD;
|
||||
goto test_cleanup;
|
||||
}
|
||||
curl_mprintf("%s\n", ptr);
|
||||
|
||||
raw = curl_easy_unescape(NULL, ptr, (int)strlen(ptr), &outlen);
|
||||
curl_mprintf("outlen == %d\n", outlen);
|
||||
curl_mprintf("unescape == original? %s\n",
|
||||
memcmp(raw, a, outlen) ? "no" : "YES");
|
||||
curl_free(raw);
|
||||
|
||||
/* deprecated API */
|
||||
raw = curl_unescape(ptr, (int)strlen(ptr));
|
||||
if(!raw) {
|
||||
res = TEST_ERR_MAJOR_BAD;
|
||||
goto test_cleanup;
|
||||
}
|
||||
outlen = (int)strlen(raw);
|
||||
curl_mprintf("[old] outlen == %d\n", outlen);
|
||||
curl_mprintf("[old] unescape == original? %s\n",
|
||||
memcmp(raw, a, outlen) ? "no" : "YES");
|
||||
curl_free(raw);
|
||||
curl_free(ptr);
|
||||
|
||||
/* weird input length */
|
||||
ptr = curl_easy_escape(NULL, (const char *)a, -1);
|
||||
curl_mprintf("escape -1 length: %s\n", ptr);
|
||||
|
||||
/* weird input length */
|
||||
outlen = 2017; /* just a value */
|
||||
ptr = curl_easy_unescape(NULL, "moahahaha", -1, &outlen);
|
||||
curl_mprintf("unescape -1 length: %s %d\n", ptr, outlen);
|
||||
|
||||
test_cleanup:
|
||||
curl_free(ptr);
|
||||
curl_global_cleanup();
|
||||
|
||||
return res;
|
||||
}
|
||||
62
curl-8.15.0/tests/libtest/lib1538.c
Normal file
62
curl-8.15.0/tests/libtest/lib1538.c
Normal file
@@ -0,0 +1,62 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
static CURLcode test_lib1538(char *URL)
|
||||
{
|
||||
CURLcode res = CURLE_OK;
|
||||
CURLcode easyret;
|
||||
CURLMcode multiret;
|
||||
CURLSHcode shareret;
|
||||
CURLUcode urlret;
|
||||
(void)URL;
|
||||
|
||||
/* NOLINTBEGIN(clang-analyzer-optin.core.EnumCastOutOfRange) */
|
||||
curl_easy_strerror((CURLcode)INT_MAX);
|
||||
curl_multi_strerror((CURLMcode)INT_MAX);
|
||||
curl_share_strerror((CURLSHcode)INT_MAX);
|
||||
curl_url_strerror((CURLUcode)INT_MAX);
|
||||
curl_easy_strerror((CURLcode)-INT_MAX);
|
||||
curl_multi_strerror((CURLMcode)-INT_MAX);
|
||||
curl_share_strerror((CURLSHcode)-INT_MAX);
|
||||
curl_url_strerror((CURLUcode)-INT_MAX);
|
||||
/* NOLINTEND(clang-analyzer-optin.core.EnumCastOutOfRange) */
|
||||
for(easyret = CURLE_OK; easyret <= CURL_LAST; easyret++) {
|
||||
curl_mprintf("e%d: %s\n", (int)easyret, curl_easy_strerror(easyret));
|
||||
}
|
||||
for(multiret = CURLM_CALL_MULTI_PERFORM; multiret <= CURLM_LAST;
|
||||
multiret++) {
|
||||
curl_mprintf("m%d: %s\n", (int)multiret, curl_multi_strerror(multiret));
|
||||
}
|
||||
for(shareret = CURLSHE_OK; shareret <= CURLSHE_LAST; shareret++) {
|
||||
curl_mprintf("s%d: %s\n", (int)shareret, curl_share_strerror(shareret));
|
||||
}
|
||||
for(urlret = CURLUE_OK; urlret <= CURLUE_LAST; urlret++) {
|
||||
curl_mprintf("u%d: %s\n", (int)urlret, curl_url_strerror(urlret));
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
123
curl-8.15.0/tests/libtest/lib1540.c
Normal file
123
curl-8.15.0/tests/libtest/lib1540.c
Normal file
@@ -0,0 +1,123 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "testtrace.h"
|
||||
#include "memdebug.h"
|
||||
|
||||
struct t1540_transfer_status {
|
||||
CURL *easy;
|
||||
int halted;
|
||||
int counter; /* count write callback invokes */
|
||||
int please; /* number of times xferinfo is called while halted */
|
||||
};
|
||||
|
||||
static int please_continue(void *userp,
|
||||
curl_off_t dltotal,
|
||||
curl_off_t dlnow,
|
||||
curl_off_t ultotal,
|
||||
curl_off_t ulnow)
|
||||
{
|
||||
struct t1540_transfer_status *st = (struct t1540_transfer_status *)userp;
|
||||
(void)dltotal;
|
||||
(void)dlnow;
|
||||
(void)ultotal;
|
||||
(void)ulnow;
|
||||
if(st->halted) {
|
||||
st->please++;
|
||||
if(st->please == 2) {
|
||||
/* waited enough, unpause! */
|
||||
curl_easy_pause(st->easy, CURLPAUSE_CONT);
|
||||
}
|
||||
}
|
||||
curl_mfprintf(stderr, "xferinfo: paused %d\n", st->halted);
|
||||
return 0; /* go on */
|
||||
}
|
||||
|
||||
static size_t t1540_header_callback(char *ptr, size_t size, size_t nmemb,
|
||||
void *userp)
|
||||
{
|
||||
size_t len = size * nmemb;
|
||||
(void)userp;
|
||||
(void)fwrite(ptr, size, nmemb, stdout);
|
||||
return len;
|
||||
}
|
||||
|
||||
static size_t t1540_write_cb(char *ptr, size_t size, size_t nmemb, void *userp)
|
||||
{
|
||||
struct t1540_transfer_status *st = (struct t1540_transfer_status *)userp;
|
||||
size_t len = size * nmemb;
|
||||
st->counter++;
|
||||
if(st->counter > 1) {
|
||||
/* the first call puts us on pause, so subsequent calls are after
|
||||
unpause */
|
||||
fwrite(ptr, size, nmemb, stdout);
|
||||
return len;
|
||||
}
|
||||
if(len)
|
||||
curl_mprintf("Got bytes but pausing!\n");
|
||||
st->halted = 1;
|
||||
return CURL_WRITEFUNC_PAUSE;
|
||||
}
|
||||
|
||||
static CURLcode test_lib1540(char *URL)
|
||||
{
|
||||
CURL *curls = NULL;
|
||||
CURLcode res = CURLE_OK;
|
||||
struct t1540_transfer_status st;
|
||||
|
||||
start_test_timing();
|
||||
|
||||
memset(&st, 0, sizeof(st));
|
||||
|
||||
global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
easy_init(curls);
|
||||
st.easy = curls; /* to allow callbacks access */
|
||||
|
||||
easy_setopt(curls, CURLOPT_URL, URL);
|
||||
easy_setopt(curls, CURLOPT_WRITEFUNCTION, t1540_write_cb);
|
||||
easy_setopt(curls, CURLOPT_WRITEDATA, &st);
|
||||
easy_setopt(curls, CURLOPT_HEADERFUNCTION, t1540_header_callback);
|
||||
easy_setopt(curls, CURLOPT_HEADERDATA, &st);
|
||||
|
||||
easy_setopt(curls, CURLOPT_XFERINFOFUNCTION, please_continue);
|
||||
easy_setopt(curls, CURLOPT_XFERINFODATA, &st);
|
||||
easy_setopt(curls, CURLOPT_NOPROGRESS, 0L);
|
||||
|
||||
libtest_debug_config.nohex = 1;
|
||||
libtest_debug_config.tracetime = 1;
|
||||
test_setopt(curls, CURLOPT_DEBUGDATA, &libtest_debug_config);
|
||||
easy_setopt(curls, CURLOPT_DEBUGFUNCTION, libtest_debug_cb);
|
||||
easy_setopt(curls, CURLOPT_VERBOSE, 1L);
|
||||
|
||||
res = curl_easy_perform(curls);
|
||||
|
||||
test_cleanup:
|
||||
|
||||
curl_easy_cleanup(curls);
|
||||
curl_global_cleanup();
|
||||
|
||||
return res; /* return the final return code */
|
||||
}
|
||||
151
curl-8.15.0/tests/libtest/lib1541.c
Normal file
151
curl-8.15.0/tests/libtest/lib1541.c
Normal file
@@ -0,0 +1,151 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
struct t1541_transfer_status {
|
||||
CURL *easy;
|
||||
int hd_count;
|
||||
int bd_count;
|
||||
CURLcode result;
|
||||
};
|
||||
|
||||
#define KN(a) a, #a
|
||||
|
||||
static int t1541_geterr(const char *name, CURLcode val, int lineno)
|
||||
{
|
||||
curl_mprintf("CURLINFO_%s returned %d, \"%s\" on line %d\n",
|
||||
name, val, curl_easy_strerror(val), lineno);
|
||||
return (int)val;
|
||||
}
|
||||
|
||||
static void report_time(const char *key, const char *where, curl_off_t time,
|
||||
bool ok)
|
||||
{
|
||||
if(ok)
|
||||
curl_mprintf("%s on %s is OK\n", key, where);
|
||||
else
|
||||
curl_mprintf("%s on %s is WRONG: %" CURL_FORMAT_CURL_OFF_T "\n",
|
||||
key, where, time);
|
||||
}
|
||||
|
||||
static void check_time(CURL *easy, int key, const char *name,
|
||||
const char *where)
|
||||
{
|
||||
curl_off_t tval;
|
||||
CURLcode res = curl_easy_getinfo(easy, (CURLINFO)key, &tval);
|
||||
if(res) {
|
||||
t1541_geterr(name, res, __LINE__);
|
||||
}
|
||||
else
|
||||
report_time(name, where, tval, tval > 0);
|
||||
}
|
||||
|
||||
static void check_time0(CURL *easy, int key, const char *name,
|
||||
const char *where)
|
||||
{
|
||||
curl_off_t tval;
|
||||
CURLcode res = curl_easy_getinfo(easy, (CURLINFO)key, &tval);
|
||||
if(res) {
|
||||
t1541_geterr(name, res, __LINE__);
|
||||
}
|
||||
else
|
||||
report_time(name, where, tval, !tval);
|
||||
}
|
||||
|
||||
static size_t t1541_header_callback(char *ptr, size_t size, size_t nmemb,
|
||||
void *userp)
|
||||
{
|
||||
struct t1541_transfer_status *st = (struct t1541_transfer_status *)userp;
|
||||
size_t len = size * nmemb;
|
||||
|
||||
(void)ptr;
|
||||
if(!st->hd_count++) {
|
||||
/* first header, check some CURLINFO value to be reported. See #13125 */
|
||||
check_time(st->easy, KN(CURLINFO_CONNECT_TIME_T), "1st header");
|
||||
check_time(st->easy, KN(CURLINFO_PRETRANSFER_TIME_T), "1st header");
|
||||
check_time(st->easy, KN(CURLINFO_STARTTRANSFER_TIME_T), "1st header");
|
||||
/* continuously updated */
|
||||
check_time(st->easy, KN(CURLINFO_TOTAL_TIME_T), "1st header");
|
||||
/* no SSL, must be 0 */
|
||||
check_time0(st->easy, KN(CURLINFO_APPCONNECT_TIME_T), "1st header");
|
||||
/* download not really started */
|
||||
check_time0(st->easy, KN(CURLINFO_SPEED_DOWNLOAD_T), "1st header");
|
||||
}
|
||||
(void)fwrite(ptr, size, nmemb, stdout);
|
||||
return len;
|
||||
}
|
||||
|
||||
static size_t t1541_write_cb(char *ptr, size_t size, size_t nmemb, void *userp)
|
||||
{
|
||||
struct t1541_transfer_status *st = (struct t1541_transfer_status *)userp;
|
||||
|
||||
(void)ptr;
|
||||
(void)st;
|
||||
fwrite(ptr, size, nmemb, stdout);
|
||||
return size * nmemb;
|
||||
}
|
||||
|
||||
static CURLcode test_lib1541(char *URL)
|
||||
{
|
||||
CURL *curls = NULL;
|
||||
CURLcode res = CURLE_OK;
|
||||
struct t1541_transfer_status st;
|
||||
|
||||
start_test_timing();
|
||||
|
||||
memset(&st, 0, sizeof(st));
|
||||
|
||||
global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
easy_init(curls);
|
||||
st.easy = curls; /* to allow callbacks access */
|
||||
|
||||
easy_setopt(curls, CURLOPT_URL, URL);
|
||||
easy_setopt(curls, CURLOPT_WRITEFUNCTION, t1541_write_cb);
|
||||
easy_setopt(curls, CURLOPT_WRITEDATA, &st);
|
||||
easy_setopt(curls, CURLOPT_HEADERFUNCTION, t1541_header_callback);
|
||||
easy_setopt(curls, CURLOPT_HEADERDATA, &st);
|
||||
|
||||
easy_setopt(curls, CURLOPT_NOPROGRESS, 0L);
|
||||
|
||||
res = curl_easy_perform(curls);
|
||||
|
||||
check_time(curls, KN(CURLINFO_CONNECT_TIME_T), "done");
|
||||
check_time(curls, KN(CURLINFO_PRETRANSFER_TIME_T), "done");
|
||||
check_time(curls, KN(CURLINFO_POSTTRANSFER_TIME_T), "done");
|
||||
check_time(curls, KN(CURLINFO_STARTTRANSFER_TIME_T), "done");
|
||||
/* no SSL, must be 0 */
|
||||
check_time0(curls, KN(CURLINFO_APPCONNECT_TIME_T), "done");
|
||||
check_time(curls, KN(CURLINFO_SPEED_DOWNLOAD_T), "done");
|
||||
check_time(curls, KN(CURLINFO_TOTAL_TIME_T), "done");
|
||||
|
||||
test_cleanup:
|
||||
|
||||
curl_easy_cleanup(curls);
|
||||
curl_global_cleanup();
|
||||
|
||||
return res; /* return the final return code */
|
||||
}
|
||||
83
curl-8.15.0/tests/libtest/lib1542.c
Normal file
83
curl-8.15.0/tests/libtest/lib1542.c
Normal file
@@ -0,0 +1,83 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/*
|
||||
* Test CURLOPT_MAXLIFETIME_CONN:
|
||||
* Send four requests, sleeping between the second and third and setting
|
||||
* MAXLIFETIME_CONN between the third and fourth. The first three requests
|
||||
* should use the same connection, and the fourth request should close the
|
||||
* first connection and open a second.
|
||||
*/
|
||||
|
||||
#include "first.h"
|
||||
|
||||
#include "testtrace.h"
|
||||
#include "memdebug.h"
|
||||
|
||||
static CURLcode test_lib1542(char *URL)
|
||||
{
|
||||
CURL *easy = NULL;
|
||||
CURLcode res = CURLE_OK;
|
||||
|
||||
global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
res_easy_init(easy);
|
||||
|
||||
easy_setopt(easy, CURLOPT_URL, URL);
|
||||
|
||||
libtest_debug_config.nohex = 1;
|
||||
libtest_debug_config.tracetime = 0;
|
||||
easy_setopt(easy, CURLOPT_DEBUGDATA, &libtest_debug_config);
|
||||
easy_setopt(easy, CURLOPT_DEBUGFUNCTION, libtest_debug_cb);
|
||||
easy_setopt(easy, CURLOPT_VERBOSE, 1L);
|
||||
|
||||
res = curl_easy_perform(easy);
|
||||
if(res)
|
||||
goto test_cleanup;
|
||||
|
||||
res = curl_easy_perform(easy);
|
||||
if(res)
|
||||
goto test_cleanup;
|
||||
|
||||
/* CURLOPT_MAXLIFETIME_CONN is inclusive - the connection needs to be 2
|
||||
* seconds old */
|
||||
curlx_wait_ms(2000);
|
||||
|
||||
res = curl_easy_perform(easy);
|
||||
if(res)
|
||||
goto test_cleanup;
|
||||
|
||||
easy_setopt(easy, CURLOPT_MAXLIFETIME_CONN, 1L);
|
||||
|
||||
res = curl_easy_perform(easy);
|
||||
if(res)
|
||||
goto test_cleanup;
|
||||
|
||||
test_cleanup:
|
||||
|
||||
curl_easy_cleanup(easy);
|
||||
curl_global_cleanup();
|
||||
|
||||
return res;
|
||||
}
|
||||
52
curl-8.15.0/tests/libtest/lib1545.c
Normal file
52
curl-8.15.0/tests/libtest/lib1545.c
Normal file
@@ -0,0 +1,52 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
static CURLcode test_lib1545(char *URL)
|
||||
{
|
||||
CURL *eh = NULL;
|
||||
CURLcode res = CURLE_OK;
|
||||
struct curl_httppost *lastptr = NULL;
|
||||
struct curl_httppost *m_formpost = NULL;
|
||||
|
||||
global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
easy_init(eh);
|
||||
|
||||
easy_setopt(eh, CURLOPT_URL, URL);
|
||||
curl_formadd(&m_formpost, &lastptr, CURLFORM_COPYNAME, "file",
|
||||
CURLFORM_FILE, "missing-file", CURLFORM_END);
|
||||
curl_easy_setopt(eh, CURLOPT_HTTPPOST, m_formpost);
|
||||
|
||||
(void)curl_easy_perform(eh);
|
||||
(void)curl_easy_perform(eh);
|
||||
|
||||
test_cleanup:
|
||||
|
||||
curl_formfree(m_formpost);
|
||||
curl_easy_cleanup(eh);
|
||||
curl_global_cleanup();
|
||||
|
||||
return res;
|
||||
}
|
||||
48
curl-8.15.0/tests/libtest/lib1550.c
Normal file
48
curl-8.15.0/tests/libtest/lib1550.c
Normal file
@@ -0,0 +1,48 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
#include <curl/multi.h>
|
||||
|
||||
static CURLcode test_lib1550(char *URL)
|
||||
{
|
||||
CURLM *handle;
|
||||
CURLcode res = CURLE_OK;
|
||||
static const char * const bl_servers[] =
|
||||
{"Microsoft-IIS/6.0", "nginx/0.8.54", NULL};
|
||||
static const char * const bl_sites[] =
|
||||
{"curl.se:443", "example.com:80", NULL};
|
||||
|
||||
global_init(CURL_GLOBAL_ALL);
|
||||
handle = curl_multi_init();
|
||||
(void)URL; /* unused */
|
||||
|
||||
curl_multi_setopt(handle, CURLMOPT_PIPELINING_SERVER_BL, bl_servers);
|
||||
curl_multi_setopt(handle, CURLMOPT_PIPELINING_SITE_BL, bl_sites);
|
||||
curl_multi_cleanup(handle);
|
||||
curl_global_cleanup();
|
||||
return CURLE_OK;
|
||||
}
|
||||
53
curl-8.15.0/tests/libtest/lib1551.c
Normal file
53
curl-8.15.0/tests/libtest/lib1551.c
Normal file
@@ -0,0 +1,53 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
#include <curl/multi.h>
|
||||
|
||||
static CURLcode test_lib1551(char *URL)
|
||||
{
|
||||
CURL *curl;
|
||||
CURLcode res = CURLE_OK;
|
||||
|
||||
global_init(CURL_GLOBAL_ALL);
|
||||
curl = curl_easy_init();
|
||||
if(curl) {
|
||||
curl_easy_setopt(curl, CURLOPT_URL, URL);
|
||||
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
|
||||
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
res = curl_easy_perform(curl);
|
||||
if(res)
|
||||
goto test_cleanup;
|
||||
|
||||
curl_mfprintf(stderr, "****************************** Do it again\n");
|
||||
res = curl_easy_perform(curl);
|
||||
}
|
||||
|
||||
test_cleanup:
|
||||
curl_easy_cleanup(curl);
|
||||
curl_global_cleanup();
|
||||
return res;
|
||||
}
|
||||
92
curl-8.15.0/tests/libtest/lib1552.c
Normal file
92
curl-8.15.0/tests/libtest/lib1552.c
Normal file
@@ -0,0 +1,92 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
static CURLcode test_lib1552(char *URL)
|
||||
{
|
||||
CURL *curls = NULL;
|
||||
CURLM *multi = NULL;
|
||||
int still_running;
|
||||
CURLcode i = CURLE_OK;
|
||||
CURLcode res = CURLE_OK;
|
||||
CURLMsg *msg;
|
||||
int counter = 3;
|
||||
|
||||
start_test_timing();
|
||||
|
||||
global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
multi_init(multi);
|
||||
|
||||
easy_init(curls);
|
||||
|
||||
easy_setopt(curls, CURLOPT_URL, URL);
|
||||
easy_setopt(curls, CURLOPT_HEADER, 1L);
|
||||
easy_setopt(curls, CURLOPT_VERBOSE, 1L);
|
||||
easy_setopt(curls, CURLOPT_USERPWD, "u:s");
|
||||
|
||||
multi_add_handle(multi, curls);
|
||||
|
||||
multi_perform(multi, &still_running);
|
||||
|
||||
abort_on_test_timeout();
|
||||
|
||||
while(still_running && counter--) {
|
||||
CURLMcode mres;
|
||||
int num;
|
||||
mres = curl_multi_wait(multi, NULL, 0, TEST_HANG_TIMEOUT, &num);
|
||||
if(mres != CURLM_OK) {
|
||||
curl_mprintf("curl_multi_wait() returned %d\n", mres);
|
||||
res = TEST_ERR_MAJOR_BAD;
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
abort_on_test_timeout();
|
||||
|
||||
multi_perform(multi, &still_running);
|
||||
|
||||
abort_on_test_timeout();
|
||||
}
|
||||
|
||||
msg = curl_multi_info_read(multi, &still_running);
|
||||
if(msg)
|
||||
/* this should now contain a result code from the easy handle,
|
||||
get it */
|
||||
i = msg->data.result;
|
||||
|
||||
test_cleanup:
|
||||
|
||||
/* undocumented cleanup sequence - type UA */
|
||||
|
||||
curl_multi_cleanup(multi);
|
||||
curl_easy_cleanup(curls);
|
||||
curl_global_cleanup();
|
||||
|
||||
if(res)
|
||||
i = res;
|
||||
|
||||
return i; /* return the final return code */
|
||||
}
|
||||
115
curl-8.15.0/tests/libtest/lib1553.c
Normal file
115
curl-8.15.0/tests/libtest/lib1553.c
Normal file
@@ -0,0 +1,115 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "testtrace.h"
|
||||
#include "memdebug.h"
|
||||
|
||||
static int t1553_xferinfo(void *p,
|
||||
curl_off_t dltotal, curl_off_t dlnow,
|
||||
curl_off_t ultotal, curl_off_t ulnow)
|
||||
{
|
||||
(void)p;
|
||||
(void)dlnow;
|
||||
(void)dltotal;
|
||||
(void)ulnow;
|
||||
(void)ultotal;
|
||||
curl_mfprintf(stderr, "xferinfo fail!\n");
|
||||
return 1; /* fail as fast as we can */
|
||||
}
|
||||
|
||||
static CURLcode test_lib1553(char *URL)
|
||||
{
|
||||
CURL *curls = NULL;
|
||||
CURLM *multi = NULL;
|
||||
int still_running;
|
||||
CURLcode i = CURLE_OK;
|
||||
CURLcode res = CURLE_OK;
|
||||
curl_mimepart *field = NULL;
|
||||
curl_mime *mime = NULL;
|
||||
int counter = 1;
|
||||
|
||||
start_test_timing();
|
||||
|
||||
global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
multi_init(multi);
|
||||
|
||||
easy_init(curls);
|
||||
|
||||
mime = curl_mime_init(curls);
|
||||
field = curl_mime_addpart(mime);
|
||||
curl_mime_name(field, "name");
|
||||
curl_mime_data(field, "value", CURL_ZERO_TERMINATED);
|
||||
|
||||
easy_setopt(curls, CURLOPT_URL, URL);
|
||||
easy_setopt(curls, CURLOPT_HEADER, 1L);
|
||||
easy_setopt(curls, CURLOPT_VERBOSE, 1L);
|
||||
easy_setopt(curls, CURLOPT_MIMEPOST, mime);
|
||||
easy_setopt(curls, CURLOPT_USERPWD, "u:s");
|
||||
easy_setopt(curls, CURLOPT_XFERINFOFUNCTION, t1553_xferinfo);
|
||||
easy_setopt(curls, CURLOPT_NOPROGRESS, 1L);
|
||||
|
||||
libtest_debug_config.nohex = 1;
|
||||
libtest_debug_config.tracetime = 1;
|
||||
test_setopt(curls, CURLOPT_DEBUGDATA, &libtest_debug_config);
|
||||
easy_setopt(curls, CURLOPT_DEBUGFUNCTION, libtest_debug_cb);
|
||||
easy_setopt(curls, CURLOPT_VERBOSE, 1L);
|
||||
|
||||
multi_add_handle(multi, curls);
|
||||
|
||||
multi_perform(multi, &still_running);
|
||||
|
||||
abort_on_test_timeout();
|
||||
|
||||
while(still_running && counter--) {
|
||||
CURLMcode mres;
|
||||
int num;
|
||||
mres = curl_multi_wait(multi, NULL, 0, TEST_HANG_TIMEOUT, &num);
|
||||
if(mres != CURLM_OK) {
|
||||
curl_mprintf("curl_multi_wait() returned %d\n", mres);
|
||||
res = TEST_ERR_MAJOR_BAD;
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
abort_on_test_timeout();
|
||||
|
||||
multi_perform(multi, &still_running);
|
||||
|
||||
abort_on_test_timeout();
|
||||
}
|
||||
|
||||
test_cleanup:
|
||||
|
||||
curl_mime_free(mime);
|
||||
curl_multi_remove_handle(multi, curls);
|
||||
curl_multi_cleanup(multi);
|
||||
curl_easy_cleanup(curls);
|
||||
curl_global_cleanup();
|
||||
|
||||
if(res)
|
||||
i = res;
|
||||
|
||||
return i; /* return the final return code */
|
||||
}
|
||||
108
curl-8.15.0/tests/libtest/lib1554.c
Normal file
108
curl-8.15.0/tests/libtest/lib1554.c
Normal file
@@ -0,0 +1,108 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
static const char *ldata_names[] = {
|
||||
"NONE",
|
||||
"SHARE",
|
||||
"COOKIE",
|
||||
"DNS",
|
||||
"SESSION",
|
||||
"CONNECT",
|
||||
"PSL",
|
||||
"HSTS",
|
||||
"NULL",
|
||||
};
|
||||
|
||||
static void t1554_test_lock(CURL *handle, curl_lock_data data,
|
||||
curl_lock_access laccess, void *useptr)
|
||||
{
|
||||
(void)handle;
|
||||
(void)data;
|
||||
(void)laccess;
|
||||
(void)useptr;
|
||||
curl_mprintf("-> Mutex lock %s\n", ldata_names[data]);
|
||||
}
|
||||
|
||||
static void t1554_test_unlock(CURL *handle, curl_lock_data data, void *useptr)
|
||||
{
|
||||
(void)handle;
|
||||
(void)data;
|
||||
(void)useptr;
|
||||
curl_mprintf("<- Mutex unlock %s\n", ldata_names[data]);
|
||||
}
|
||||
|
||||
/* test function */
|
||||
static CURLcode test_lib1554(char *URL)
|
||||
{
|
||||
CURLcode res = CURLE_OK;
|
||||
CURLSH *share = NULL;
|
||||
int i;
|
||||
|
||||
global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
share = curl_share_init();
|
||||
if(!share) {
|
||||
curl_mfprintf(stderr, "curl_share_init() failed\n");
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
curl_share_setopt(share, CURLSHOPT_SHARE, CURL_LOCK_DATA_CONNECT);
|
||||
curl_share_setopt(share, CURLSHOPT_LOCKFUNC, t1554_test_lock);
|
||||
curl_share_setopt(share, CURLSHOPT_UNLOCKFUNC, t1554_test_unlock);
|
||||
|
||||
/* Loop the transfer and cleanup the handle properly every lap. This will
|
||||
still reuse connections since the pool is in the shared object! */
|
||||
|
||||
for(i = 0; i < 3; i++) {
|
||||
CURL *curl = curl_easy_init();
|
||||
if(curl) {
|
||||
curl_easy_setopt(curl, CURLOPT_URL, URL);
|
||||
|
||||
/* use the share object */
|
||||
curl_easy_setopt(curl, CURLOPT_SHARE, share);
|
||||
|
||||
/* Perform the request, res will get the return code */
|
||||
res = curl_easy_perform(curl);
|
||||
|
||||
/* always cleanup */
|
||||
curl_easy_cleanup(curl);
|
||||
|
||||
/* Check for errors */
|
||||
if(res != CURLE_OK) {
|
||||
curl_mfprintf(stderr, "curl_easy_perform() failed: %s\n",
|
||||
curl_easy_strerror(res));
|
||||
goto test_cleanup;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
test_cleanup:
|
||||
curl_share_cleanup(share);
|
||||
curl_global_cleanup();
|
||||
|
||||
return res;
|
||||
}
|
||||
81
curl-8.15.0/tests/libtest/lib1555.c
Normal file
81
curl-8.15.0/tests/libtest/lib1555.c
Normal file
@@ -0,0 +1,81 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
/*
|
||||
* Verify that some API functions are locked from being called inside callback
|
||||
*/
|
||||
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
static CURL *t1555_curl;
|
||||
|
||||
static int progressCallback(void *arg,
|
||||
double dltotal,
|
||||
double dlnow,
|
||||
double ultotal,
|
||||
double ulnow)
|
||||
{
|
||||
CURLcode res = CURLE_OK;
|
||||
char buffer[256];
|
||||
size_t n = 0;
|
||||
(void)arg;
|
||||
(void)dltotal;
|
||||
(void)dlnow;
|
||||
(void)ultotal;
|
||||
(void)ulnow;
|
||||
res = curl_easy_recv(t1555_curl, buffer, 256, &n);
|
||||
curl_mprintf("curl_easy_recv returned %d\n", res);
|
||||
res = curl_easy_send(t1555_curl, buffer, n, &n);
|
||||
curl_mprintf("curl_easy_send returned %d\n", res);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static CURLcode test_lib1555(char *URL)
|
||||
{
|
||||
CURLcode res = CURLE_OK;
|
||||
|
||||
global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
easy_init(t1555_curl);
|
||||
|
||||
easy_setopt(t1555_curl, CURLOPT_URL, URL);
|
||||
easy_setopt(t1555_curl, CURLOPT_TIMEOUT, (long)7);
|
||||
easy_setopt(t1555_curl, CURLOPT_NOSIGNAL, (long)1);
|
||||
easy_setopt(t1555_curl, CURLOPT_PROGRESSFUNCTION, progressCallback);
|
||||
easy_setopt(t1555_curl, CURLOPT_PROGRESSDATA, NULL);
|
||||
easy_setopt(t1555_curl, CURLOPT_NOPROGRESS, (long)0);
|
||||
|
||||
res = curl_easy_perform(t1555_curl);
|
||||
|
||||
test_cleanup:
|
||||
|
||||
/* undocumented cleanup sequence - type UA */
|
||||
|
||||
curl_easy_cleanup(t1555_curl);
|
||||
curl_global_cleanup();
|
||||
|
||||
return res;
|
||||
}
|
||||
78
curl-8.15.0/tests/libtest/lib1556.c
Normal file
78
curl-8.15.0/tests/libtest/lib1556.c
Normal file
@@ -0,0 +1,78 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
struct headerinfo {
|
||||
size_t largest;
|
||||
};
|
||||
|
||||
static size_t header(char *ptr, size_t size, size_t nmemb, void *stream)
|
||||
{
|
||||
size_t headersize = size * nmemb;
|
||||
struct headerinfo *info = (struct headerinfo *)stream;
|
||||
(void)ptr;
|
||||
|
||||
if(headersize > info->largest)
|
||||
/* remember the longest header */
|
||||
info->largest = headersize;
|
||||
|
||||
return nmemb * size;
|
||||
}
|
||||
|
||||
static CURLcode test_lib1556(char *URL)
|
||||
{
|
||||
CURLcode code;
|
||||
CURL *curl = NULL;
|
||||
CURLcode res = CURLE_OK;
|
||||
struct headerinfo info = {0};
|
||||
|
||||
global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
easy_init(curl);
|
||||
|
||||
easy_setopt(curl, CURLOPT_HEADERFUNCTION, header);
|
||||
easy_setopt(curl, CURLOPT_HEADERDATA, &info);
|
||||
easy_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
easy_setopt(curl, CURLOPT_URL, URL);
|
||||
|
||||
code = curl_easy_perform(curl);
|
||||
if(CURLE_OK != code) {
|
||||
curl_mfprintf(stderr, "%s:%d curl_easy_perform() failed, "
|
||||
"with code %d (%s)\n",
|
||||
__FILE__, __LINE__, code, curl_easy_strerror(code));
|
||||
res = TEST_ERR_MAJOR_BAD;
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
curl_mprintf("Max = %ld\n", (long)info.largest);
|
||||
|
||||
test_cleanup:
|
||||
|
||||
curl_easy_cleanup(curl);
|
||||
curl_global_cleanup();
|
||||
|
||||
return res;
|
||||
}
|
||||
62
curl-8.15.0/tests/libtest/lib1557.c
Normal file
62
curl-8.15.0/tests/libtest/lib1557.c
Normal file
@@ -0,0 +1,62 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
static CURLcode test_lib1557(char *URL)
|
||||
{
|
||||
CURLM *curlm = NULL;
|
||||
CURL *curl1 = NULL;
|
||||
CURL *curl2 = NULL;
|
||||
int running_handles = 0;
|
||||
CURLcode res = CURLE_OK;
|
||||
|
||||
global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
multi_init(curlm);
|
||||
multi_setopt(curlm, CURLMOPT_MAX_HOST_CONNECTIONS, 1);
|
||||
|
||||
easy_init(curl1);
|
||||
easy_setopt(curl1, CURLOPT_URL, URL);
|
||||
multi_add_handle(curlm, curl1);
|
||||
|
||||
easy_init(curl2);
|
||||
easy_setopt(curl2, CURLOPT_URL, URL);
|
||||
multi_add_handle(curlm, curl2);
|
||||
|
||||
multi_perform(curlm, &running_handles);
|
||||
|
||||
multi_remove_handle(curlm, curl2);
|
||||
|
||||
/* If curl2 is still in the connect-pending list, this will crash */
|
||||
multi_remove_handle(curlm, curl1);
|
||||
|
||||
test_cleanup:
|
||||
curl_easy_cleanup(curl1);
|
||||
curl_easy_cleanup(curl2);
|
||||
curl_multi_cleanup(curlm);
|
||||
curl_global_cleanup();
|
||||
return res;
|
||||
}
|
||||
65
curl-8.15.0/tests/libtest/lib1558.c
Normal file
65
curl-8.15.0/tests/libtest/lib1558.c
Normal file
@@ -0,0 +1,65 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
static CURLcode test_lib1558(char *URL)
|
||||
{
|
||||
CURLcode res = CURLE_OK;
|
||||
CURL *curl = NULL;
|
||||
long protocol = 0;
|
||||
|
||||
global_init(CURL_GLOBAL_ALL);
|
||||
easy_init(curl);
|
||||
|
||||
easy_setopt(curl, CURLOPT_URL, URL);
|
||||
res = curl_easy_perform(curl);
|
||||
if(res) {
|
||||
curl_mfprintf(stderr, "curl_easy_perform() returned %d (%s)\n",
|
||||
res, curl_easy_strerror(res));
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
res = curl_easy_getinfo(curl, CURLINFO_PROTOCOL, &protocol);
|
||||
if(res) {
|
||||
curl_mfprintf(stderr, "curl_easy_getinfo() returned %d (%s)\n",
|
||||
res, curl_easy_strerror(res));
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
curl_mprintf("Protocol: %lx\n", protocol);
|
||||
|
||||
curl_easy_cleanup(curl);
|
||||
curl_global_cleanup();
|
||||
|
||||
return CURLE_OK;
|
||||
|
||||
test_cleanup:
|
||||
|
||||
curl_easy_cleanup(curl);
|
||||
curl_global_cleanup();
|
||||
|
||||
return res; /* return the final return code */
|
||||
}
|
||||
78
curl-8.15.0/tests/libtest/lib1559.c
Normal file
78
curl-8.15.0/tests/libtest/lib1559.c
Normal file
@@ -0,0 +1,78 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
static CURLcode test_lib1559(char *URL)
|
||||
{
|
||||
static const int EXCESSIVE = 10*1000*1000;
|
||||
|
||||
CURLcode res = CURLE_OK;
|
||||
CURL *curl = NULL;
|
||||
char *longurl = NULL;
|
||||
CURLU *u;
|
||||
(void)URL;
|
||||
|
||||
global_init(CURL_GLOBAL_ALL);
|
||||
easy_init(curl);
|
||||
|
||||
longurl = malloc(EXCESSIVE);
|
||||
if(!longurl) {
|
||||
res = TEST_ERR_MAJOR_BAD;
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
memset(longurl, 'a', EXCESSIVE);
|
||||
longurl[EXCESSIVE-1] = 0;
|
||||
|
||||
res = curl_easy_setopt(curl, CURLOPT_URL, longurl);
|
||||
curl_mprintf("CURLOPT_URL %d bytes URL == %d\n",
|
||||
EXCESSIVE, res);
|
||||
|
||||
res = curl_easy_setopt(curl, CURLOPT_POSTFIELDS, longurl);
|
||||
curl_mprintf("CURLOPT_POSTFIELDS %d bytes data == %d\n",
|
||||
EXCESSIVE, res);
|
||||
|
||||
u = curl_url();
|
||||
if(u) {
|
||||
CURLUcode uc = curl_url_set(u, CURLUPART_URL, longurl, 0);
|
||||
curl_mprintf("CURLUPART_URL %d bytes URL == %d (%s)\n",
|
||||
EXCESSIVE, (int)uc, curl_url_strerror(uc));
|
||||
uc = curl_url_set(u, CURLUPART_SCHEME, longurl, CURLU_NON_SUPPORT_SCHEME);
|
||||
curl_mprintf("CURLUPART_SCHEME %d bytes scheme == %d (%s)\n",
|
||||
EXCESSIVE, (int)uc, curl_url_strerror(uc));
|
||||
uc = curl_url_set(u, CURLUPART_USER, longurl, 0);
|
||||
curl_mprintf("CURLUPART_USER %d bytes user == %d (%s)\n",
|
||||
EXCESSIVE, (int)uc, curl_url_strerror(uc));
|
||||
curl_url_cleanup(u);
|
||||
}
|
||||
|
||||
test_cleanup:
|
||||
free(longurl);
|
||||
curl_easy_cleanup(curl);
|
||||
curl_global_cleanup();
|
||||
|
||||
return res; /* return the final return code */
|
||||
}
|
||||
2058
curl-8.15.0/tests/libtest/lib1560.c
Normal file
2058
curl-8.15.0/tests/libtest/lib1560.c
Normal file
File diff suppressed because it is too large
Load Diff
132
curl-8.15.0/tests/libtest/lib1564.c
Normal file
132
curl-8.15.0/tests/libtest/lib1564.c
Normal file
@@ -0,0 +1,132 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
#define WAKEUP_NUM 10
|
||||
|
||||
static CURLcode test_lib1564(char *URL)
|
||||
{
|
||||
CURLM *multi = NULL;
|
||||
int numfds;
|
||||
int i;
|
||||
CURLcode res = CURLE_OK;
|
||||
struct curltime time_before_wait, time_after_wait;
|
||||
|
||||
(void)URL;
|
||||
|
||||
start_test_timing();
|
||||
|
||||
global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
multi_init(multi);
|
||||
|
||||
/* no wakeup */
|
||||
|
||||
time_before_wait = curlx_now();
|
||||
multi_poll(multi, NULL, 0, 1000, &numfds);
|
||||
time_after_wait = curlx_now();
|
||||
|
||||
if(curlx_timediff(time_after_wait, time_before_wait) < 500) {
|
||||
curl_mfprintf(stderr, "%s:%d curl_multi_poll returned too early\n",
|
||||
__FILE__, __LINE__);
|
||||
res = TEST_ERR_MAJOR_BAD;
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
abort_on_test_timeout();
|
||||
|
||||
/* try a single wakeup */
|
||||
|
||||
res_multi_wakeup(multi);
|
||||
|
||||
time_before_wait = curlx_now();
|
||||
multi_poll(multi, NULL, 0, 1000, &numfds);
|
||||
time_after_wait = curlx_now();
|
||||
|
||||
if(curlx_timediff(time_after_wait, time_before_wait) > 500) {
|
||||
curl_mfprintf(stderr, "%s:%d curl_multi_poll returned too late\n",
|
||||
__FILE__, __LINE__);
|
||||
res = TEST_ERR_MAJOR_BAD;
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
abort_on_test_timeout();
|
||||
|
||||
/* previous wakeup should not wake up this */
|
||||
|
||||
time_before_wait = curlx_now();
|
||||
multi_poll(multi, NULL, 0, 1000, &numfds);
|
||||
time_after_wait = curlx_now();
|
||||
|
||||
if(curlx_timediff(time_after_wait, time_before_wait) < 500) {
|
||||
curl_mfprintf(stderr, "%s:%d curl_multi_poll returned too early\n",
|
||||
__FILE__, __LINE__);
|
||||
res = TEST_ERR_MAJOR_BAD;
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
abort_on_test_timeout();
|
||||
|
||||
/* try lots of wakeup */
|
||||
|
||||
for(i = 0; i < WAKEUP_NUM; ++i)
|
||||
res_multi_wakeup(multi);
|
||||
|
||||
time_before_wait = curlx_now();
|
||||
multi_poll(multi, NULL, 0, 1000, &numfds);
|
||||
time_after_wait = curlx_now();
|
||||
|
||||
if(curlx_timediff(time_after_wait, time_before_wait) > 500) {
|
||||
curl_mfprintf(stderr, "%s:%d curl_multi_poll returned too late\n",
|
||||
__FILE__, __LINE__);
|
||||
res = TEST_ERR_MAJOR_BAD;
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
abort_on_test_timeout();
|
||||
|
||||
/* Even lots of previous wakeups should not wake up this. */
|
||||
|
||||
time_before_wait = curlx_now();
|
||||
multi_poll(multi, NULL, 0, 1000, &numfds);
|
||||
time_after_wait = curlx_now();
|
||||
|
||||
if(curlx_timediff(time_after_wait, time_before_wait) < 500) {
|
||||
curl_mfprintf(stderr, "%s:%d curl_multi_poll returned too early\n",
|
||||
__FILE__, __LINE__);
|
||||
res = TEST_ERR_MAJOR_BAD;
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
abort_on_test_timeout();
|
||||
|
||||
test_cleanup:
|
||||
|
||||
curl_multi_cleanup(multi);
|
||||
curl_global_cleanup();
|
||||
|
||||
return res;
|
||||
}
|
||||
207
curl-8.15.0/tests/libtest/lib1565.c
Normal file
207
curl-8.15.0/tests/libtest/lib1565.c
Normal file
@@ -0,0 +1,207 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
#include <pthread.h>
|
||||
|
||||
#define CONN_NUM 3
|
||||
#define TIME_BETWEEN_START_SECS 2
|
||||
|
||||
static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
static CURL *pending_handles[CONN_NUM];
|
||||
static int pending_num = 0;
|
||||
static CURLcode t1565_test_failure = CURLE_OK;
|
||||
|
||||
static CURLM *testmulti = NULL;
|
||||
static const char *t1565_url;
|
||||
|
||||
static void *t1565_run_thread(void *ptr)
|
||||
{
|
||||
CURL *easy = NULL;
|
||||
CURLcode res = CURLE_OK;
|
||||
int i;
|
||||
|
||||
(void)ptr;
|
||||
|
||||
for(i = 0; i < CONN_NUM; i++) {
|
||||
curlx_wait_ms(TIME_BETWEEN_START_SECS * 1000);
|
||||
|
||||
easy_init(easy);
|
||||
|
||||
easy_setopt(easy, CURLOPT_URL, t1565_url);
|
||||
easy_setopt(easy, CURLOPT_VERBOSE, 0L);
|
||||
|
||||
pthread_mutex_lock(&lock);
|
||||
|
||||
if(t1565_test_failure) {
|
||||
pthread_mutex_unlock(&lock);
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
pending_handles[pending_num] = easy;
|
||||
pending_num++;
|
||||
easy = NULL;
|
||||
|
||||
pthread_mutex_unlock(&lock);
|
||||
|
||||
res_multi_wakeup(testmulti);
|
||||
}
|
||||
|
||||
test_cleanup:
|
||||
|
||||
curl_easy_cleanup(easy);
|
||||
|
||||
pthread_mutex_lock(&lock);
|
||||
|
||||
if(!t1565_test_failure)
|
||||
t1565_test_failure = res;
|
||||
|
||||
pthread_mutex_unlock(&lock);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static CURLcode test_lib1565(char *URL)
|
||||
{
|
||||
int still_running;
|
||||
int num;
|
||||
int i;
|
||||
int result;
|
||||
CURLcode res = CURLE_OK;
|
||||
CURL *started_handles[CONN_NUM];
|
||||
int started_num = 0;
|
||||
int finished_num = 0;
|
||||
pthread_t tid;
|
||||
bool tid_valid = false;
|
||||
struct CURLMsg *message;
|
||||
|
||||
start_test_timing();
|
||||
|
||||
global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
multi_init(testmulti);
|
||||
|
||||
t1565_url = URL;
|
||||
|
||||
result = pthread_create(&tid, NULL, t1565_run_thread, NULL);
|
||||
if(!result)
|
||||
tid_valid = true;
|
||||
else {
|
||||
curl_mfprintf(stderr, "%s:%d Couldn't create thread, errno %d\n",
|
||||
__FILE__, __LINE__, result);
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
while(1) {
|
||||
multi_perform(testmulti, &still_running);
|
||||
|
||||
abort_on_test_timeout();
|
||||
|
||||
while((message = curl_multi_info_read(testmulti, &num))) {
|
||||
if(message->msg == CURLMSG_DONE) {
|
||||
res = message->data.result;
|
||||
if(res)
|
||||
goto test_cleanup;
|
||||
multi_remove_handle(testmulti, message->easy_handle);
|
||||
finished_num++;
|
||||
}
|
||||
else {
|
||||
curl_mfprintf(stderr,
|
||||
"%s:%d Got an unexpected message from curl: %i\n",
|
||||
__FILE__, __LINE__, (int)message->msg);
|
||||
res = TEST_ERR_MAJOR_BAD;
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
abort_on_test_timeout();
|
||||
}
|
||||
|
||||
if(CONN_NUM == finished_num)
|
||||
break;
|
||||
|
||||
multi_poll(testmulti, NULL, 0, TEST_HANG_TIMEOUT, &num);
|
||||
|
||||
abort_on_test_timeout();
|
||||
|
||||
pthread_mutex_lock(&lock);
|
||||
|
||||
while(pending_num > 0) {
|
||||
res_multi_add_handle(testmulti, pending_handles[pending_num - 1]);
|
||||
if(res) {
|
||||
pthread_mutex_unlock(&lock);
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
started_handles[started_num] = pending_handles[pending_num - 1];
|
||||
started_num++;
|
||||
pending_num--;
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&lock);
|
||||
|
||||
abort_on_test_timeout();
|
||||
}
|
||||
|
||||
if(CONN_NUM != started_num) {
|
||||
curl_mfprintf(stderr, "%s:%d Not all connections started: %d of %d\n",
|
||||
__FILE__, __LINE__, started_num, CONN_NUM);
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
if(CONN_NUM != finished_num) {
|
||||
curl_mfprintf(stderr, "%s:%d Not all connections finished: %d of %d\n",
|
||||
__FILE__, __LINE__, started_num, CONN_NUM);
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
test_cleanup:
|
||||
|
||||
pthread_mutex_lock(&lock);
|
||||
if(!t1565_test_failure)
|
||||
t1565_test_failure = res;
|
||||
pthread_mutex_unlock(&lock);
|
||||
|
||||
if(tid_valid)
|
||||
pthread_join(tid, NULL);
|
||||
|
||||
curl_multi_cleanup(testmulti);
|
||||
for(i = 0; i < pending_num; i++)
|
||||
curl_easy_cleanup(pending_handles[i]);
|
||||
for(i = 0; i < started_num; i++)
|
||||
curl_easy_cleanup(started_handles[i]);
|
||||
curl_global_cleanup();
|
||||
|
||||
return t1565_test_failure;
|
||||
}
|
||||
|
||||
#else /* without pthread, this test doesn't work */
|
||||
static CURLcode test_lib1565(char *URL)
|
||||
{
|
||||
(void)URL;
|
||||
return CURLE_OK;
|
||||
}
|
||||
#endif
|
||||
59
curl-8.15.0/tests/libtest/lib1567.c
Normal file
59
curl-8.15.0/tests/libtest/lib1567.c
Normal file
@@ -0,0 +1,59 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
#include <curl/multi.h>
|
||||
|
||||
static CURLcode test_lib1567(char *URL)
|
||||
{
|
||||
CURL *curl = NULL;
|
||||
CURLcode res = CURLE_OK;
|
||||
CURLU *u = NULL;
|
||||
|
||||
global_init(CURL_GLOBAL_ALL);
|
||||
curl = curl_easy_init();
|
||||
if(curl) {
|
||||
u = curl_url();
|
||||
if(u) {
|
||||
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
|
||||
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
curl_url_set(u, CURLUPART_URL, URL, 0);
|
||||
curl_easy_setopt(curl, CURLOPT_CURLU, u);
|
||||
res = curl_easy_perform(curl);
|
||||
if(res)
|
||||
goto test_cleanup;
|
||||
|
||||
curl_mfprintf(stderr, "****************************** Do it again\n");
|
||||
res = curl_easy_perform(curl);
|
||||
}
|
||||
}
|
||||
|
||||
test_cleanup:
|
||||
curl_url_cleanup(u);
|
||||
curl_easy_cleanup(curl);
|
||||
curl_global_cleanup();
|
||||
return res;
|
||||
}
|
||||
51
curl-8.15.0/tests/libtest/lib1568.c
Normal file
51
curl-8.15.0/tests/libtest/lib1568.c
Normal file
@@ -0,0 +1,51 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
static CURLcode test_lib1568(char *URL)
|
||||
{
|
||||
CURLcode ret;
|
||||
CURL *hnd;
|
||||
curl_global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
hnd = curl_easy_init();
|
||||
curl_easy_setopt(hnd, CURLOPT_URL, URL);
|
||||
curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
|
||||
curl_easy_setopt(hnd, CURLOPT_HEADER, 1L);
|
||||
curl_easy_setopt(hnd, CURLOPT_USERPWD, "testuser:testpass");
|
||||
curl_easy_setopt(hnd, CURLOPT_USERAGENT, "lib1568");
|
||||
curl_easy_setopt(hnd, CURLOPT_HTTPAUTH, (long)CURLAUTH_DIGEST);
|
||||
curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L);
|
||||
curl_easy_setopt(hnd, CURLOPT_PORT, strtol(libtest_arg2, NULL, 10));
|
||||
|
||||
ret = curl_easy_perform(hnd);
|
||||
|
||||
curl_easy_cleanup(hnd);
|
||||
hnd = NULL;
|
||||
|
||||
curl_global_cleanup();
|
||||
return ret;
|
||||
}
|
||||
50
curl-8.15.0/tests/libtest/lib1569.c
Normal file
50
curl-8.15.0/tests/libtest/lib1569.c
Normal file
@@ -0,0 +1,50 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
static CURLcode test_lib1569(char *URL)
|
||||
{
|
||||
CURLcode res = CURLE_OK;
|
||||
CURL *hnd;
|
||||
global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
easy_init(hnd);
|
||||
easy_setopt(hnd, CURLOPT_URL, URL);
|
||||
easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
|
||||
easy_setopt(hnd, CURLOPT_HEADER, 1L);
|
||||
|
||||
res = curl_easy_perform(hnd);
|
||||
if(res)
|
||||
goto test_cleanup;
|
||||
|
||||
curl_easy_setopt(hnd, CURLOPT_URL, libtest_arg2);
|
||||
res = curl_easy_perform(hnd);
|
||||
|
||||
test_cleanup:
|
||||
curl_easy_cleanup(hnd);
|
||||
curl_global_cleanup();
|
||||
return res;
|
||||
}
|
||||
72
curl-8.15.0/tests/libtest/lib1571.c
Normal file
72
curl-8.15.0/tests/libtest/lib1571.c
Normal file
@@ -0,0 +1,72 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
static CURLcode test_lib1571(char *URL)
|
||||
{
|
||||
CURLcode res;
|
||||
CURL *curl;
|
||||
|
||||
if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
|
||||
curl_mfprintf(stderr, "curl_global_init() failed\n");
|
||||
return TEST_ERR_MAJOR_BAD;
|
||||
}
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(!curl) {
|
||||
curl_mfprintf(stderr, "curl_easy_init() failed\n");
|
||||
curl_global_cleanup();
|
||||
return TEST_ERR_MAJOR_BAD;
|
||||
}
|
||||
|
||||
test_setopt(curl, CURLOPT_HEADER, 1L);
|
||||
test_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
test_setopt(curl, CURLOPT_URL, URL);
|
||||
if((testnum == 1571) || (testnum == 1572) ||
|
||||
(testnum == 1575) || (testnum == 1581)) {
|
||||
test_setopt(curl, CURLOPT_POSTFIELDS, "moo");
|
||||
}
|
||||
if(testnum == 1581) {
|
||||
test_setopt(curl, CURLOPT_POSTREDIR, (long)CURL_REDIR_POST_301);
|
||||
}
|
||||
|
||||
test_setopt(curl, CURLOPT_CUSTOMREQUEST, "IGLOO");
|
||||
if((testnum == 1574) || (testnum == 1575)) {
|
||||
test_setopt(curl, CURLOPT_FOLLOWLOCATION, CURLFOLLOW_FIRSTONLY);
|
||||
}
|
||||
else {
|
||||
test_setopt(curl, CURLOPT_FOLLOWLOCATION, CURLFOLLOW_OBEYCODE);
|
||||
}
|
||||
|
||||
res = curl_easy_perform(curl);
|
||||
|
||||
test_cleanup:
|
||||
|
||||
curl_easy_cleanup(curl);
|
||||
curl_global_cleanup();
|
||||
|
||||
return res;
|
||||
}
|
||||
95
curl-8.15.0/tests/libtest/lib1576.c
Normal file
95
curl-8.15.0/tests/libtest/lib1576.c
Normal file
@@ -0,0 +1,95 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
static char t1576_testdata[] = "request indicates that the client, which made";
|
||||
|
||||
static size_t t1576_read_cb(char *ptr, size_t size, size_t nmemb, void *stream)
|
||||
{
|
||||
size_t amount = nmemb * size; /* Total bytes curl wants */
|
||||
if(amount < strlen(t1576_testdata)) {
|
||||
return strlen(t1576_testdata);
|
||||
}
|
||||
(void)stream;
|
||||
memcpy(ptr, t1576_testdata, strlen(t1576_testdata));
|
||||
return strlen(t1576_testdata);
|
||||
}
|
||||
|
||||
static int t1576_seek_callback(void *ptr, curl_off_t offset, int origin)
|
||||
{
|
||||
(void)ptr;
|
||||
(void)offset;
|
||||
if(origin != SEEK_SET)
|
||||
return CURL_SEEKFUNC_FAIL;
|
||||
return CURL_SEEKFUNC_OK;
|
||||
}
|
||||
|
||||
static CURLcode test_lib1576(char *URL)
|
||||
{
|
||||
CURLcode res;
|
||||
CURL *curl;
|
||||
struct curl_slist *pHeaderList = NULL;
|
||||
|
||||
if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
|
||||
curl_mfprintf(stderr, "curl_global_init() failed\n");
|
||||
return TEST_ERR_MAJOR_BAD;
|
||||
}
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(!curl) {
|
||||
curl_mfprintf(stderr, "curl_easy_init() failed\n");
|
||||
curl_global_cleanup();
|
||||
return TEST_ERR_MAJOR_BAD;
|
||||
}
|
||||
|
||||
test_setopt(curl, CURLOPT_HEADER, 1L);
|
||||
test_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
test_setopt(curl, CURLOPT_URL, URL);
|
||||
test_setopt(curl, CURLOPT_UPLOAD, 1L);
|
||||
test_setopt(curl, CURLOPT_READFUNCTION, t1576_read_cb);
|
||||
test_setopt(curl, CURLOPT_SEEKFUNCTION, t1576_seek_callback);
|
||||
test_setopt(curl, CURLOPT_INFILESIZE, (long)strlen(t1576_testdata));
|
||||
|
||||
test_setopt(curl, CURLOPT_CUSTOMREQUEST, "CURL");
|
||||
if(testnum == 1578 || testnum == 1580) {
|
||||
test_setopt(curl, CURLOPT_FOLLOWLOCATION, CURLFOLLOW_FIRSTONLY);
|
||||
}
|
||||
else {
|
||||
test_setopt(curl, CURLOPT_FOLLOWLOCATION, CURLFOLLOW_OBEYCODE);
|
||||
}
|
||||
/* Remove "Expect: 100-continue" */
|
||||
pHeaderList = curl_slist_append(pHeaderList, "Expect:");
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, pHeaderList);
|
||||
res = curl_easy_perform(curl);
|
||||
|
||||
test_cleanup:
|
||||
curl_easy_cleanup(curl);
|
||||
curl_global_cleanup();
|
||||
curl_slist_free_all(pHeaderList);
|
||||
|
||||
return res;
|
||||
}
|
||||
120
curl-8.15.0/tests/libtest/lib1591.c
Normal file
120
curl-8.15.0/tests/libtest/lib1591.c
Normal file
@@ -0,0 +1,120 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/*
|
||||
* This unit test PUT http data over proxy. Proxy header will be different
|
||||
* from server http header
|
||||
*/
|
||||
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
static size_t consumed = 0;
|
||||
|
||||
static size_t t1591_read_cb(char *ptr, size_t size, size_t nmemb, void *stream)
|
||||
{
|
||||
static const char testdata[] = "Hello Cloud!\r\n";
|
||||
|
||||
size_t amount = nmemb * size; /* Total bytes curl wants */
|
||||
|
||||
if(consumed == strlen(testdata)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(amount > strlen(testdata) - consumed) {
|
||||
amount = strlen(testdata);
|
||||
}
|
||||
|
||||
consumed += amount;
|
||||
(void)stream;
|
||||
memcpy(ptr, testdata, amount);
|
||||
return amount;
|
||||
}
|
||||
|
||||
/*
|
||||
* carefully not leak memory on OOM
|
||||
*/
|
||||
static int t1591_trailers_callback(struct curl_slist **list, void *userdata)
|
||||
{
|
||||
struct curl_slist *nlist = NULL;
|
||||
struct curl_slist *nlist2 = NULL;
|
||||
(void)userdata;
|
||||
nlist = curl_slist_append(*list, "my-super-awesome-trailer: trail1");
|
||||
if(nlist)
|
||||
nlist2 = curl_slist_append(nlist, "my-other-awesome-trailer: trail2");
|
||||
if(nlist2) {
|
||||
*list = nlist2;
|
||||
return CURL_TRAILERFUNC_OK;
|
||||
}
|
||||
else {
|
||||
curl_slist_free_all(nlist);
|
||||
return CURL_TRAILERFUNC_ABORT;
|
||||
}
|
||||
}
|
||||
|
||||
static CURLcode test_lib1591(char *URL)
|
||||
{
|
||||
CURL *curl = NULL;
|
||||
CURLcode res = CURLE_FAILED_INIT;
|
||||
/* http and proxy header list */
|
||||
struct curl_slist *hhl = NULL;
|
||||
|
||||
if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
|
||||
curl_mfprintf(stderr, "curl_global_init() failed\n");
|
||||
return TEST_ERR_MAJOR_BAD;
|
||||
}
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(!curl) {
|
||||
curl_mfprintf(stderr, "curl_easy_init() failed\n");
|
||||
curl_global_cleanup();
|
||||
return TEST_ERR_MAJOR_BAD;
|
||||
}
|
||||
|
||||
hhl = curl_slist_append(hhl, "Trailer: my-super-awesome-trailer,"
|
||||
" my-other-awesome-trailer");
|
||||
if(!hhl) {
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
test_setopt(curl, CURLOPT_URL, URL);
|
||||
test_setopt(curl, CURLOPT_HTTPHEADER, hhl);
|
||||
test_setopt(curl, CURLOPT_UPLOAD, 1L);
|
||||
test_setopt(curl, CURLOPT_READFUNCTION, t1591_read_cb);
|
||||
test_setopt(curl, CURLOPT_TRAILERFUNCTION, t1591_trailers_callback);
|
||||
test_setopt(curl, CURLOPT_TRAILERDATA, NULL);
|
||||
|
||||
res = curl_easy_perform(curl);
|
||||
|
||||
test_cleanup:
|
||||
|
||||
curl_easy_cleanup(curl);
|
||||
|
||||
curl_slist_free_all(hhl);
|
||||
|
||||
curl_global_cleanup();
|
||||
|
||||
return res;
|
||||
}
|
||||
121
curl-8.15.0/tests/libtest/lib1592.c
Normal file
121
curl-8.15.0/tests/libtest/lib1592.c
Normal file
@@ -0,0 +1,121 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
/*
|
||||
* See https://github.com/curl/curl/issues/3371
|
||||
*
|
||||
* This test case checks whether curl_multi_remove_handle() cancels
|
||||
* asynchronous DNS resolvers without blocking where possible. Obviously, it
|
||||
* only tests whichever resolver cURL is actually built with.
|
||||
*/
|
||||
|
||||
/* We're willing to wait a very generous two seconds for the removal. This is
|
||||
as low as we can go while still easily supporting SIGALRM timing for the
|
||||
non-threaded blocking resolver. It doesn't matter that much because when
|
||||
the test passes, we never wait this long. We set it much higher via
|
||||
the default TEST_HANG_TIMEOUT to avoid issues when running on overloaded
|
||||
CI machines. */
|
||||
|
||||
#include "first.h"
|
||||
|
||||
static CURLcode test_lib1592(char *URL)
|
||||
{
|
||||
int stillRunning;
|
||||
CURLM *multiHandle = NULL;
|
||||
CURL *curl = NULL;
|
||||
CURLcode res = CURLE_OK;
|
||||
CURLMcode mres;
|
||||
long timeout;
|
||||
|
||||
global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
multi_init(multiHandle);
|
||||
|
||||
easy_init(curl);
|
||||
|
||||
easy_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
easy_setopt(curl, CURLOPT_URL, URL);
|
||||
|
||||
/* Set a DNS server that hopefully will not respond when using c-ares. */
|
||||
if(curl_easy_setopt(curl, CURLOPT_DNS_SERVERS, "0.0.0.0") == CURLE_OK)
|
||||
/* Since we could set the DNS server, presume we are working with a
|
||||
resolver that can be cancelled (i.e. c-ares). Thus,
|
||||
curl_multi_remove_handle() should not block even when the resolver
|
||||
request is outstanding. So, set a request timeout _longer_ than the
|
||||
test hang timeout so we will fail if the handle removal call incorrectly
|
||||
blocks. */
|
||||
timeout = TEST_HANG_TIMEOUT * 2;
|
||||
else {
|
||||
/* If we can't set the DNS server, presume that we are configured to use a
|
||||
resolver that can't be cancelled (i.e. the threaded resolver or the
|
||||
non-threaded blocking resolver). So, we just test that the
|
||||
curl_multi_remove_handle() call does finish well within our test
|
||||
timeout.
|
||||
|
||||
But, it is very unlikely that the resolver request will take any time at
|
||||
all because we haven't been able to configure the resolver to use an
|
||||
non-responsive DNS server. At least we exercise the flow.
|
||||
*/
|
||||
curl_mfprintf(stderr,
|
||||
"CURLOPT_DNS_SERVERS not supported; "
|
||||
"assuming curl_multi_remove_handle() will block\n");
|
||||
timeout = TEST_HANG_TIMEOUT / 2;
|
||||
}
|
||||
|
||||
/* Setting a timeout on the request should ensure that even if we have to
|
||||
wait for the resolver during curl_multi_remove_handle(), it won't take
|
||||
longer than this, because the resolver request inherits its timeout from
|
||||
this. */
|
||||
easy_setopt(curl, CURLOPT_TIMEOUT_MS, timeout);
|
||||
|
||||
multi_add_handle(multiHandle, curl);
|
||||
|
||||
/* This should move the handle from INIT => CONNECT => WAITRESOLVE. */
|
||||
curl_mfprintf(stderr, "curl_multi_perform()...\n");
|
||||
multi_perform(multiHandle, &stillRunning);
|
||||
curl_mfprintf(stderr, "curl_multi_perform() succeeded\n");
|
||||
|
||||
/* Start measuring how long it takes to remove the handle. */
|
||||
curl_mfprintf(stderr, "curl_multi_remove_handle()...\n");
|
||||
start_test_timing();
|
||||
mres = curl_multi_remove_handle(multiHandle, curl);
|
||||
if(mres) {
|
||||
curl_mfprintf(stderr,
|
||||
"curl_multi_remove_handle() failed, with code %d\n", mres);
|
||||
res = TEST_ERR_MULTI;
|
||||
goto test_cleanup;
|
||||
}
|
||||
curl_mfprintf(stderr, "curl_multi_remove_handle() succeeded\n");
|
||||
|
||||
/* Fail the test if it took too long to remove. This happens after the fact,
|
||||
and says "it seems that it would have run forever", which isn't true, but
|
||||
it's close enough, and simple to do. */
|
||||
abort_on_test_timeout();
|
||||
|
||||
test_cleanup:
|
||||
curl_easy_cleanup(curl);
|
||||
curl_multi_cleanup(multiHandle);
|
||||
curl_global_cleanup();
|
||||
|
||||
return res;
|
||||
}
|
||||
81
curl-8.15.0/tests/libtest/lib1593.c
Normal file
81
curl-8.15.0/tests/libtest/lib1593.c
Normal file
@@ -0,0 +1,81 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/* Test suppressing the If-Modified-Since header */
|
||||
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
static CURLcode test_lib1593(char *URL)
|
||||
{
|
||||
struct curl_slist *header = NULL;
|
||||
long unmet;
|
||||
CURL *curl = NULL;
|
||||
CURLcode res = CURLE_OK;
|
||||
|
||||
global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
easy_init(curl);
|
||||
|
||||
easy_setopt(curl, CURLOPT_URL, URL);
|
||||
easy_setopt(curl, CURLOPT_TIMECONDITION, (long)CURL_TIMECOND_IFMODSINCE);
|
||||
/* Some TIMEVALUE; it doesn't matter. */
|
||||
easy_setopt(curl, CURLOPT_TIMEVALUE, 1566210680L);
|
||||
|
||||
header = curl_slist_append(NULL, "If-Modified-Since:");
|
||||
if(!header) {
|
||||
res = TEST_ERR_MAJOR_BAD;
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
easy_setopt(curl, CURLOPT_HTTPHEADER, header);
|
||||
|
||||
res = curl_easy_perform(curl);
|
||||
if(res)
|
||||
goto test_cleanup;
|
||||
|
||||
/* Confirm that the condition checking still worked, even though we
|
||||
* suppressed the actual header.
|
||||
* The server returns 304, which means the condition is "unmet".
|
||||
*/
|
||||
|
||||
res = curl_easy_getinfo(curl, CURLINFO_CONDITION_UNMET, &unmet);
|
||||
if(res)
|
||||
goto test_cleanup;
|
||||
|
||||
if(unmet != 1L) {
|
||||
res = TEST_ERR_FAILURE;
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
test_cleanup:
|
||||
|
||||
/* always cleanup */
|
||||
curl_easy_cleanup(curl);
|
||||
curl_slist_free_all(header);
|
||||
curl_global_cleanup();
|
||||
|
||||
return res;
|
||||
}
|
||||
62
curl-8.15.0/tests/libtest/lib1594.c
Normal file
62
curl-8.15.0/tests/libtest/lib1594.c
Normal file
@@ -0,0 +1,62 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/* Testing Retry-After header parser */
|
||||
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
static CURLcode test_lib1594(char *URL)
|
||||
{
|
||||
struct curl_slist *header = NULL;
|
||||
curl_off_t retry;
|
||||
CURL *curl = NULL;
|
||||
CURLcode res = CURLE_OK;
|
||||
|
||||
global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
easy_init(curl);
|
||||
|
||||
easy_setopt(curl, CURLOPT_URL, URL);
|
||||
|
||||
res = curl_easy_perform(curl);
|
||||
if(res)
|
||||
goto test_cleanup;
|
||||
|
||||
res = curl_easy_getinfo(curl, CURLINFO_RETRY_AFTER, &retry);
|
||||
if(res)
|
||||
goto test_cleanup;
|
||||
|
||||
curl_mprintf("Retry-After %" CURL_FORMAT_CURL_OFF_T "\n", retry);
|
||||
|
||||
test_cleanup:
|
||||
|
||||
/* always cleanup */
|
||||
curl_easy_cleanup(curl);
|
||||
curl_slist_free_all(header);
|
||||
curl_global_cleanup();
|
||||
|
||||
return res;
|
||||
}
|
||||
112
curl-8.15.0/tests/libtest/lib1597.c
Normal file
112
curl-8.15.0/tests/libtest/lib1597.c
Normal file
@@ -0,0 +1,112 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/* Testing CURLOPT_PROTOCOLS_STR */
|
||||
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
struct pair {
|
||||
const char *in;
|
||||
CURLcode *exp;
|
||||
};
|
||||
|
||||
static CURLcode test_lib1597(char *URL)
|
||||
{
|
||||
CURL *curl = NULL;
|
||||
CURLcode res = CURLE_OK;
|
||||
curl_version_info_data *curlinfo;
|
||||
const char *const *proto;
|
||||
int n;
|
||||
int i;
|
||||
static CURLcode ok = CURLE_OK;
|
||||
static CURLcode bad = CURLE_BAD_FUNCTION_ARGUMENT;
|
||||
static CURLcode unsup = CURLE_UNSUPPORTED_PROTOCOL;
|
||||
static CURLcode httpcode = CURLE_UNSUPPORTED_PROTOCOL;
|
||||
static CURLcode httpscode = CURLE_UNSUPPORTED_PROTOCOL;
|
||||
static char protolist[1024];
|
||||
|
||||
static const struct pair prots[] = {
|
||||
{"goobar", &unsup},
|
||||
{"http ", &unsup},
|
||||
{" http", &unsup},
|
||||
{"http", &httpcode},
|
||||
{"http,", &httpcode},
|
||||
{"https,", &httpscode},
|
||||
{"https,http", &httpscode},
|
||||
{"http,http", &httpcode},
|
||||
{"HTTP,HTTP", &httpcode},
|
||||
{",HTTP,HTTP", &httpcode},
|
||||
{"http,http,ft", &unsup},
|
||||
{"", &bad},
|
||||
{",,", &bad},
|
||||
{protolist, &ok},
|
||||
{"all", &ok},
|
||||
{NULL, NULL},
|
||||
};
|
||||
(void)URL;
|
||||
|
||||
global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
easy_init(curl);
|
||||
|
||||
/* Get enabled protocols.*/
|
||||
curlinfo = curl_version_info(CURLVERSION_NOW);
|
||||
if(!curlinfo) {
|
||||
fputs("curl_version_info failed\n", stderr);
|
||||
res = TEST_ERR_FAILURE;
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
n = 0;
|
||||
for(proto = curlinfo->protocols; *proto; proto++) {
|
||||
if((size_t) n >= sizeof(protolist)) {
|
||||
puts("protolist buffer too small\n");
|
||||
res = TEST_ERR_FAILURE;
|
||||
goto test_cleanup;
|
||||
}
|
||||
n += curl_msnprintf(protolist + n, sizeof(protolist) - n, ",%s", *proto);
|
||||
if(curl_strequal(*proto, "http"))
|
||||
httpcode = CURLE_OK;
|
||||
if(curl_strequal(*proto, "https"))
|
||||
httpscode = CURLE_OK;
|
||||
}
|
||||
|
||||
/* Run the tests. */
|
||||
for(i = 0; prots[i].in; i++) {
|
||||
res = curl_easy_setopt(curl, CURLOPT_PROTOCOLS_STR, prots[i].in);
|
||||
if(res != *prots[i].exp) {
|
||||
curl_mprintf("unexpectedly '%s' returned %d\n", prots[i].in, res);
|
||||
break;
|
||||
}
|
||||
}
|
||||
curl_mprintf("Tested %u strings\n", i);
|
||||
|
||||
test_cleanup:
|
||||
curl_easy_cleanup(curl);
|
||||
curl_global_cleanup();
|
||||
|
||||
return res;
|
||||
}
|
||||
106
curl-8.15.0/tests/libtest/lib1598.c
Normal file
106
curl-8.15.0/tests/libtest/lib1598.c
Normal file
@@ -0,0 +1,106 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/*
|
||||
* This unit test PUT http data over proxy. Proxy header will be different
|
||||
* from server http header
|
||||
*/
|
||||
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
/*
|
||||
* carefully not leak memory on OOM
|
||||
*/
|
||||
static int t1598_trailers_callback(struct curl_slist **list, void *userdata)
|
||||
{
|
||||
struct curl_slist *nlist = NULL;
|
||||
struct curl_slist *nlist2 = NULL;
|
||||
(void)userdata;
|
||||
nlist = curl_slist_append(*list, "my-super-awesome-trailer: trail1");
|
||||
if(nlist)
|
||||
nlist2 = curl_slist_append(nlist, "my-other-awesome-trailer: trail2");
|
||||
if(nlist2) {
|
||||
*list = nlist2;
|
||||
return CURL_TRAILERFUNC_OK;
|
||||
}
|
||||
else {
|
||||
curl_slist_free_all(nlist);
|
||||
return CURL_TRAILERFUNC_ABORT;
|
||||
}
|
||||
}
|
||||
|
||||
static CURLcode test_lib1598(char *URL)
|
||||
{
|
||||
static const char *post_data = "xxx=yyy&aaa=bbbbb";
|
||||
|
||||
CURL *curl = NULL;
|
||||
CURLcode res = CURLE_FAILED_INIT;
|
||||
/* http and proxy header list */
|
||||
struct curl_slist *hhl = NULL, *list;
|
||||
|
||||
if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
|
||||
curl_mfprintf(stderr, "curl_global_init() failed\n");
|
||||
return TEST_ERR_MAJOR_BAD;
|
||||
}
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(!curl) {
|
||||
curl_mfprintf(stderr, "curl_easy_init() failed\n");
|
||||
curl_global_cleanup();
|
||||
return TEST_ERR_MAJOR_BAD;
|
||||
}
|
||||
|
||||
hhl = curl_slist_append(hhl, "Trailer: my-super-awesome-trailer,"
|
||||
" my-other-awesome-trailer");
|
||||
if(!hhl)
|
||||
goto test_cleanup;
|
||||
if(hhl) {
|
||||
list = curl_slist_append(hhl, "Transfer-Encoding: chunked");
|
||||
if(!list)
|
||||
goto test_cleanup;
|
||||
hhl = list;
|
||||
}
|
||||
|
||||
test_setopt(curl, CURLOPT_URL, URL);
|
||||
test_setopt(curl, CURLOPT_HTTPHEADER, hhl);
|
||||
test_setopt(curl, CURLOPT_POSTFIELDSIZE, (long)strlen(post_data));
|
||||
test_setopt(curl, CURLOPT_POSTFIELDS, post_data);
|
||||
test_setopt(curl, CURLOPT_TRAILERFUNCTION, t1598_trailers_callback);
|
||||
test_setopt(curl, CURLOPT_TRAILERDATA, NULL);
|
||||
test_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
|
||||
res = curl_easy_perform(curl);
|
||||
|
||||
test_cleanup:
|
||||
|
||||
curl_easy_cleanup(curl);
|
||||
|
||||
curl_slist_free_all(hhl);
|
||||
|
||||
curl_global_cleanup();
|
||||
|
||||
return res;
|
||||
}
|
||||
44
curl-8.15.0/tests/libtest/lib1599.c
Normal file
44
curl-8.15.0/tests/libtest/lib1599.c
Normal file
@@ -0,0 +1,44 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
static CURLcode test_lib1599(char *URL)
|
||||
{
|
||||
CURL *curl;
|
||||
CURLcode res = CURLE_OK;
|
||||
|
||||
global_init(CURL_GLOBAL_ALL);
|
||||
curl = curl_easy_init();
|
||||
if(curl) {
|
||||
curl_easy_setopt(curl, CURLOPT_URL, URL);
|
||||
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
curl_easy_setopt(curl, CURLOPT_NETRC, (long)CURL_NETRC_REQUIRED);
|
||||
curl_easy_setopt(curl, CURLOPT_NETRC_FILE, libtest_arg2);
|
||||
|
||||
res = curl_easy_perform(curl);
|
||||
curl_easy_cleanup(curl);
|
||||
}
|
||||
curl_global_cleanup();
|
||||
return res;
|
||||
}
|
||||
89
curl-8.15.0/tests/libtest/lib1662.c
Normal file
89
curl-8.15.0/tests/libtest/lib1662.c
Normal file
@@ -0,0 +1,89 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
struct t1662_WriteThis {
|
||||
size_t sizeleft;
|
||||
};
|
||||
|
||||
static size_t t1662_read_cb(char *ptr, size_t size, size_t nmemb, void *userp)
|
||||
{
|
||||
static const char testdata[] = "mooaaa";
|
||||
|
||||
struct t1662_WriteThis *pooh = (struct t1662_WriteThis *)userp;
|
||||
size_t len = strlen(testdata);
|
||||
|
||||
if(size*nmemb < len)
|
||||
return 0;
|
||||
|
||||
if(pooh->sizeleft) {
|
||||
memcpy(ptr, testdata, strlen(testdata));
|
||||
pooh->sizeleft = 0;
|
||||
return len;
|
||||
}
|
||||
|
||||
return 0; /* no more data left to deliver */
|
||||
}
|
||||
|
||||
static CURLcode test_lib1662(char *URL)
|
||||
{
|
||||
CURLcode res = CURLE_OK;
|
||||
CURL *hnd;
|
||||
curl_mime *mime1;
|
||||
curl_mimepart *part1;
|
||||
struct t1662_WriteThis pooh = { 1 };
|
||||
|
||||
mime1 = NULL;
|
||||
|
||||
global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
hnd = curl_easy_init();
|
||||
if(hnd) {
|
||||
curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L);
|
||||
curl_easy_setopt(hnd, CURLOPT_URL, URL);
|
||||
curl_easy_setopt(hnd, CURLOPT_NOPROGRESS, 1L);
|
||||
mime1 = curl_mime_init(hnd);
|
||||
if(mime1) {
|
||||
part1 = curl_mime_addpart(mime1);
|
||||
curl_mime_data_cb(part1, -1, t1662_read_cb, NULL, NULL, &pooh);
|
||||
curl_mime_filename(part1, "poetry.txt");
|
||||
curl_mime_name(part1, "content");
|
||||
curl_easy_setopt(hnd, CURLOPT_MIMEPOST, mime1);
|
||||
curl_easy_setopt(hnd, CURLOPT_USERAGENT, "curl/2000");
|
||||
curl_easy_setopt(hnd, CURLOPT_FOLLOWLOCATION, 1L);
|
||||
curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L);
|
||||
curl_easy_setopt(hnd, CURLOPT_HTTP_VERSION,
|
||||
(long)CURL_HTTP_VERSION_2TLS);
|
||||
curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
|
||||
curl_easy_setopt(hnd, CURLOPT_FTP_SKIP_PASV_IP, 1L);
|
||||
curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
|
||||
res = curl_easy_perform(hnd);
|
||||
}
|
||||
}
|
||||
|
||||
curl_easy_cleanup(hnd);
|
||||
curl_mime_free(mime1);
|
||||
curl_global_cleanup();
|
||||
return res;
|
||||
}
|
||||
53
curl-8.15.0/tests/libtest/lib1900.c
Normal file
53
curl-8.15.0/tests/libtest/lib1900.c
Normal file
@@ -0,0 +1,53 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
static CURLcode test_lib1900(char *URL)
|
||||
{
|
||||
CURLcode res = CURLE_OK;
|
||||
CURL *hnd = NULL;
|
||||
CURL *second = NULL;
|
||||
|
||||
global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
easy_init(hnd);
|
||||
easy_setopt(hnd, CURLOPT_URL, URL);
|
||||
easy_setopt(hnd, CURLOPT_HSTS, "first-hsts.txt");
|
||||
easy_setopt(hnd, CURLOPT_HSTS, "second-hsts.txt");
|
||||
|
||||
second = curl_easy_duphandle(hnd);
|
||||
|
||||
curl_easy_cleanup(hnd);
|
||||
curl_easy_cleanup(second);
|
||||
curl_global_cleanup();
|
||||
return CURLE_OK;
|
||||
|
||||
test_cleanup:
|
||||
curl_easy_cleanup(hnd);
|
||||
curl_easy_cleanup(second);
|
||||
curl_global_cleanup();
|
||||
return res;
|
||||
}
|
||||
89
curl-8.15.0/tests/libtest/lib1901.c
Normal file
89
curl-8.15.0/tests/libtest/lib1901.c
Normal file
@@ -0,0 +1,89 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
static size_t t1901_read_cb(char *ptr, size_t size, size_t nmemb, void *stream)
|
||||
{
|
||||
static const char *chunks[] = {
|
||||
"one",
|
||||
"two",
|
||||
"three",
|
||||
"four",
|
||||
NULL
|
||||
};
|
||||
static int ix = 0;
|
||||
(void)size;
|
||||
(void)nmemb;
|
||||
(void)stream;
|
||||
if(chunks[ix]) {
|
||||
size_t len = strlen(chunks[ix]);
|
||||
strcpy(ptr, chunks[ix]);
|
||||
ix++;
|
||||
return len;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static CURLcode test_lib1901(char *URL)
|
||||
{
|
||||
CURL *curl;
|
||||
CURLcode res = CURLE_OK;
|
||||
struct curl_slist *chunk = NULL;
|
||||
|
||||
curl_global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(curl) {
|
||||
/* deliberately setting the size - to a wrong value to make sure libcurl
|
||||
ignores it */
|
||||
easy_setopt(curl, CURLOPT_POSTFIELDSIZE, 4L);
|
||||
easy_setopt(curl, CURLOPT_POSTFIELDS, NULL);
|
||||
easy_setopt(curl, CURLOPT_READFUNCTION, t1901_read_cb);
|
||||
easy_setopt(curl, CURLOPT_POST, 1L);
|
||||
easy_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
easy_setopt(curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
|
||||
easy_setopt(curl, CURLOPT_URL, URL);
|
||||
easy_setopt(curl, CURLOPT_READDATA, NULL);
|
||||
|
||||
chunk = curl_slist_append(chunk, "Expect:");
|
||||
if(chunk) {
|
||||
struct curl_slist *n =
|
||||
curl_slist_append(chunk, "Transfer-Encoding: chunked");
|
||||
if(n)
|
||||
chunk = n;
|
||||
if(n)
|
||||
easy_setopt(curl, CURLOPT_HTTPHEADER, n);
|
||||
}
|
||||
|
||||
res = curl_easy_perform(curl);
|
||||
}
|
||||
test_cleanup:
|
||||
curl_easy_cleanup(curl);
|
||||
curl_slist_free_all(chunk);
|
||||
|
||||
curl_global_cleanup();
|
||||
return res;
|
||||
}
|
||||
54
curl-8.15.0/tests/libtest/lib1903.c
Normal file
54
curl-8.15.0/tests/libtest/lib1903.c
Normal file
@@ -0,0 +1,54 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
static CURLcode test_lib1903(char *URL)
|
||||
{
|
||||
CURLcode res = CURLE_OK;
|
||||
CURL *ch = NULL;
|
||||
global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
easy_init(ch);
|
||||
|
||||
easy_setopt(ch, CURLOPT_URL, URL);
|
||||
easy_setopt(ch, CURLOPT_COOKIEFILE, libtest_arg2);
|
||||
res = curl_easy_perform(ch);
|
||||
if(res)
|
||||
goto test_cleanup;
|
||||
|
||||
curl_easy_reset(ch);
|
||||
|
||||
easy_setopt(ch, CURLOPT_URL, URL);
|
||||
easy_setopt(ch, CURLOPT_COOKIEFILE, libtest_arg2);
|
||||
easy_setopt(ch, CURLOPT_COOKIEJAR, libtest_arg3);
|
||||
res = curl_easy_perform(ch);
|
||||
|
||||
test_cleanup:
|
||||
curl_easy_cleanup(ch);
|
||||
curl_global_cleanup();
|
||||
|
||||
return res;
|
||||
}
|
||||
97
curl-8.15.0/tests/libtest/lib1905.c
Normal file
97
curl-8.15.0/tests/libtest/lib1905.c
Normal file
@@ -0,0 +1,97 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
static CURLcode test_lib1905(char *URL)
|
||||
{
|
||||
CURLSH *sh = NULL;
|
||||
CURL *ch = NULL;
|
||||
int unfinished;
|
||||
CURLM *cm;
|
||||
|
||||
curl_global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
cm = curl_multi_init();
|
||||
if(!cm) {
|
||||
curl_global_cleanup();
|
||||
return TEST_ERR_MULTI;
|
||||
}
|
||||
sh = curl_share_init();
|
||||
if(!sh)
|
||||
goto cleanup;
|
||||
|
||||
curl_share_setopt(sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_COOKIE);
|
||||
curl_share_setopt(sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_COOKIE);
|
||||
|
||||
ch = curl_easy_init();
|
||||
if(!ch)
|
||||
goto cleanup;
|
||||
|
||||
curl_easy_setopt(ch, CURLOPT_SHARE, sh);
|
||||
curl_easy_setopt(ch, CURLOPT_URL, URL);
|
||||
curl_easy_setopt(ch, CURLOPT_COOKIEFILE, libtest_arg2);
|
||||
curl_easy_setopt(ch, CURLOPT_COOKIEJAR, libtest_arg2);
|
||||
|
||||
curl_multi_add_handle(cm, ch);
|
||||
|
||||
unfinished = 1;
|
||||
while(unfinished) {
|
||||
int MAX = 0;
|
||||
long max_tout;
|
||||
fd_set R, W, E;
|
||||
struct timeval timeout;
|
||||
|
||||
FD_ZERO(&R);
|
||||
FD_ZERO(&W);
|
||||
FD_ZERO(&E);
|
||||
curl_multi_perform(cm, &unfinished);
|
||||
|
||||
curl_multi_fdset(cm, &R, &W, &E, &MAX);
|
||||
curl_multi_timeout(cm, &max_tout);
|
||||
|
||||
if(max_tout > 0) {
|
||||
curlx_mstotv(&timeout, max_tout);
|
||||
}
|
||||
else {
|
||||
timeout.tv_sec = 0;
|
||||
timeout.tv_usec = 1000;
|
||||
}
|
||||
|
||||
select(MAX + 1, &R, &W, &E, &timeout);
|
||||
}
|
||||
|
||||
curl_easy_setopt(ch, CURLOPT_COOKIELIST, "FLUSH");
|
||||
curl_easy_setopt(ch, CURLOPT_SHARE, NULL);
|
||||
|
||||
curl_multi_remove_handle(cm, ch);
|
||||
cleanup:
|
||||
curl_easy_cleanup(ch);
|
||||
curl_share_cleanup(sh);
|
||||
curl_multi_cleanup(cm);
|
||||
curl_global_cleanup();
|
||||
|
||||
return CURLE_OK;
|
||||
}
|
||||
83
curl-8.15.0/tests/libtest/lib1906.c
Normal file
83
curl-8.15.0/tests/libtest/lib1906.c
Normal file
@@ -0,0 +1,83 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
static CURLcode test_lib1906(char *URL)
|
||||
{
|
||||
CURLcode res = CURLE_OK;
|
||||
char *url_after = NULL;
|
||||
CURLU *curlu = curl_url();
|
||||
char error_buffer[CURL_ERROR_SIZE] = "";
|
||||
CURL *curl;
|
||||
|
||||
easy_init(curl);
|
||||
|
||||
curl_url_set(curlu, CURLUPART_URL, URL, CURLU_DEFAULT_SCHEME);
|
||||
easy_setopt(curl, CURLOPT_CURLU, curlu);
|
||||
easy_setopt(curl, CURLOPT_ERRORBUFFER, error_buffer);
|
||||
easy_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
/* msys2 times out instead of CURLE_COULDNT_CONNECT, so make it faster */
|
||||
easy_setopt(curl, CURLOPT_CONNECTTIMEOUT_MS, 5000L);
|
||||
/* set a port number that makes this request fail */
|
||||
easy_setopt(curl, CURLOPT_PORT, 1L);
|
||||
res = curl_easy_perform(curl);
|
||||
if(res != CURLE_COULDNT_CONNECT && res != CURLE_OPERATION_TIMEDOUT) {
|
||||
curl_mfprintf(stderr, "failure expected, "
|
||||
"curl_easy_perform returned %d: <%s>, <%s>\n",
|
||||
res, curl_easy_strerror(res), error_buffer);
|
||||
if(res == CURLE_OK)
|
||||
res = TEST_ERR_MAJOR_BAD; /* force an error return */
|
||||
goto test_cleanup;
|
||||
}
|
||||
res = CURLE_OK; /* reset for next use */
|
||||
|
||||
/* print the used url */
|
||||
curl_url_get(curlu, CURLUPART_URL, &url_after, 0);
|
||||
curl_mfprintf(stderr, "curlu now: <%s>\n", url_after);
|
||||
curl_free(url_after);
|
||||
url_after = NULL;
|
||||
|
||||
/* now reset CURLOP_PORT to go back to originally set port number */
|
||||
easy_setopt(curl, CURLOPT_PORT, 0L);
|
||||
|
||||
res = curl_easy_perform(curl);
|
||||
if(res)
|
||||
curl_mfprintf(stderr, "success expected, "
|
||||
"curl_easy_perform returned %d: <%s>, <%s>\n",
|
||||
res, curl_easy_strerror(res), error_buffer);
|
||||
|
||||
/* print url */
|
||||
curl_url_get(curlu, CURLUPART_URL, &url_after, 0);
|
||||
curl_mfprintf(stderr, "curlu now: <%s>\n", url_after);
|
||||
|
||||
test_cleanup:
|
||||
curl_free(url_after);
|
||||
curl_easy_cleanup(curl);
|
||||
curl_url_cleanup(curlu);
|
||||
curl_global_cleanup();
|
||||
|
||||
return res;
|
||||
}
|
||||
54
curl-8.15.0/tests/libtest/lib1907.c
Normal file
54
curl-8.15.0/tests/libtest/lib1907.c
Normal file
@@ -0,0 +1,54 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
static CURLcode test_lib1907(char *URL)
|
||||
{
|
||||
char *url_after;
|
||||
CURL *curl;
|
||||
CURLcode res = CURLE_OK;
|
||||
char error_buffer[CURL_ERROR_SIZE] = "";
|
||||
|
||||
curl_global_init(CURL_GLOBAL_DEFAULT);
|
||||
curl = curl_easy_init();
|
||||
curl_easy_setopt(curl, CURLOPT_URL, URL);
|
||||
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, error_buffer);
|
||||
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
res = curl_easy_perform(curl);
|
||||
if(!res)
|
||||
curl_mfprintf(stderr, "failure expected, "
|
||||
"curl_easy_perform returned %ld: <%s>, <%s>\n",
|
||||
(long) res, curl_easy_strerror(res), error_buffer);
|
||||
|
||||
/* print the used url */
|
||||
if(!curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, &url_after))
|
||||
curl_mprintf("Effective URL: %s\n", url_after);
|
||||
|
||||
curl_easy_cleanup(curl);
|
||||
curl_global_cleanup();
|
||||
|
||||
return res;
|
||||
}
|
||||
62
curl-8.15.0/tests/libtest/lib1908.c
Normal file
62
curl-8.15.0/tests/libtest/lib1908.c
Normal file
@@ -0,0 +1,62 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) Linus Nielsen Feltzing, <linus@haxx.se>
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
static CURLcode test_lib1908(char *URL)
|
||||
{
|
||||
CURLcode ret = CURLE_OK;
|
||||
CURL *hnd;
|
||||
start_test_timing();
|
||||
|
||||
curl_global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
hnd = curl_easy_init();
|
||||
if(hnd) {
|
||||
curl_easy_setopt(hnd, CURLOPT_URL, URL);
|
||||
curl_easy_setopt(hnd, CURLOPT_NOPROGRESS, 1L);
|
||||
curl_easy_setopt(hnd, CURLOPT_ALTSVC, libtest_arg2);
|
||||
ret = curl_easy_perform(hnd);
|
||||
|
||||
if(!ret) {
|
||||
/* make a copy and check that this also has alt-svc activated */
|
||||
CURL *also = curl_easy_duphandle(hnd);
|
||||
if(also) {
|
||||
ret = curl_easy_perform(also);
|
||||
/* we close the second handle first, which makes it store the alt-svc
|
||||
file only to get overwritten when the next handle is closed! */
|
||||
curl_easy_cleanup(also);
|
||||
}
|
||||
}
|
||||
|
||||
curl_easy_reset(hnd);
|
||||
|
||||
/* using the same file name for the alt-svc cache, this clobbers the
|
||||
content just written from the 'also' handle */
|
||||
curl_easy_cleanup(hnd);
|
||||
}
|
||||
curl_global_cleanup();
|
||||
return ret;
|
||||
}
|
||||
47
curl-8.15.0/tests/libtest/lib1910.c
Normal file
47
curl-8.15.0/tests/libtest/lib1910.c
Normal file
@@ -0,0 +1,47 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) Linus Nielsen Feltzing, <linus@haxx.se>
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
static CURLcode test_lib1910(char *URL)
|
||||
{
|
||||
CURLcode ret = CURLE_OK;
|
||||
CURL *hnd;
|
||||
start_test_timing();
|
||||
|
||||
curl_global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
hnd = curl_easy_init();
|
||||
if(hnd) {
|
||||
curl_easy_setopt(hnd, CURLOPT_URL, URL);
|
||||
curl_easy_setopt(hnd, CURLOPT_NOPROGRESS, 1L);
|
||||
curl_easy_setopt(hnd, CURLOPT_FOLLOWLOCATION, 1L);
|
||||
curl_easy_setopt(hnd, CURLOPT_USERPWD, "user\nname:pass\nword");
|
||||
ret = curl_easy_perform(hnd);
|
||||
curl_easy_cleanup(hnd);
|
||||
}
|
||||
curl_global_cleanup();
|
||||
return ret;
|
||||
}
|
||||
94
curl-8.15.0/tests/libtest/lib1911.c
Normal file
94
curl-8.15.0/tests/libtest/lib1911.c
Normal file
@@ -0,0 +1,94 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
/* The maximum string length limit (CURL_MAX_INPUT_LENGTH) is an internal
|
||||
define not publicly exposed so we set our own */
|
||||
#define MAX_INPUT_LENGTH 8000000
|
||||
|
||||
static CURLcode test_lib1911(char *URL)
|
||||
{
|
||||
static char testbuf[MAX_INPUT_LENGTH + 2];
|
||||
|
||||
const struct curl_easyoption *o;
|
||||
CURL *easy;
|
||||
int error = 0;
|
||||
(void)URL;
|
||||
|
||||
curl_global_init(CURL_GLOBAL_ALL);
|
||||
easy = curl_easy_init();
|
||||
if(!easy) {
|
||||
curl_global_cleanup();
|
||||
return TEST_ERR_EASY_INIT;
|
||||
}
|
||||
|
||||
/* make it a null-terminated C string with just As */
|
||||
memset(testbuf, 'A', MAX_INPUT_LENGTH + 1);
|
||||
testbuf[MAX_INPUT_LENGTH + 1] = 0;
|
||||
|
||||
curl_mprintf("string length: %d\n", (int)strlen(testbuf));
|
||||
|
||||
for(o = curl_easy_option_next(NULL);
|
||||
o;
|
||||
o = curl_easy_option_next(o)) {
|
||||
if(o->type == CURLOT_STRING) {
|
||||
CURLcode result;
|
||||
/*
|
||||
* Whitelist string options that are safe for abuse
|
||||
*/
|
||||
switch(o->id) {
|
||||
case CURLOPT_PROXY_TLSAUTH_TYPE:
|
||||
case CURLOPT_TLSAUTH_TYPE:
|
||||
case CURLOPT_RANDOM_FILE:
|
||||
case CURLOPT_EGDSOCKET:
|
||||
continue;
|
||||
default:
|
||||
/* check this */
|
||||
break;
|
||||
}
|
||||
|
||||
/* This is a string. Make sure that passing in a string longer
|
||||
CURL_MAX_INPUT_LENGTH returns an error */
|
||||
result = curl_easy_setopt(easy, o->id, testbuf);
|
||||
switch(result) {
|
||||
case CURLE_BAD_FUNCTION_ARGUMENT: /* the most normal */
|
||||
case CURLE_UNKNOWN_OPTION: /* left out from the build */
|
||||
case CURLE_NOT_BUILT_IN: /* not supported */
|
||||
case CURLE_UNSUPPORTED_PROTOCOL: /* detected by protocol2num() */
|
||||
break;
|
||||
default:
|
||||
/* all other return codes are unexpected */
|
||||
curl_mfprintf(stderr, "curl_easy_setopt(%s...) returned %d\n",
|
||||
o->name, result);
|
||||
error++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
curl_easy_cleanup(easy);
|
||||
curl_global_cleanup();
|
||||
return error == 0 ? CURLE_OK : TEST_ERR_FAILURE;
|
||||
}
|
||||
81
curl-8.15.0/tests/libtest/lib1912.c
Normal file
81
curl-8.15.0/tests/libtest/lib1912.c
Normal file
@@ -0,0 +1,81 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
#define print_err(name, exp) \
|
||||
curl_mfprintf(stderr, "Type mismatch for CURLOPT_%s (expected %s)\n", \
|
||||
name, exp);
|
||||
|
||||
static CURLcode test_lib1912(char *URL)
|
||||
{
|
||||
/* Only test if GCC typechecking is available */
|
||||
int error = 0;
|
||||
#ifdef CURLINC_TYPECHECK_GCC_H
|
||||
const struct curl_easyoption *o;
|
||||
for(o = curl_easy_option_next(NULL);
|
||||
o;
|
||||
o = curl_easy_option_next(o)) {
|
||||
/* Test for mismatch OR missing typecheck macros */
|
||||
if(curlcheck_long_option(o->id) !=
|
||||
(o->type == CURLOT_LONG || o->type == CURLOT_VALUES)) {
|
||||
print_err(o->name, "CURLOT_LONG or CURLOT_VALUES");
|
||||
error++;
|
||||
}
|
||||
if(curlcheck_off_t_option(o->id) != (o->type == CURLOT_OFF_T)) {
|
||||
print_err(o->name, "CURLOT_OFF_T");
|
||||
error++;
|
||||
}
|
||||
if(curlcheck_string_option(o->id) != (o->type == CURLOT_STRING)) {
|
||||
print_err(o->name, "CURLOT_STRING");
|
||||
error++;
|
||||
}
|
||||
if(curlcheck_slist_option(o->id) != (o->type == CURLOT_SLIST)) {
|
||||
print_err(o->name, "CURLOT_SLIST");
|
||||
error++;
|
||||
}
|
||||
if(curlcheck_cb_data_option(o->id) != (o->type == CURLOT_CBPTR)) {
|
||||
print_err(o->name, "CURLOT_CBPTR");
|
||||
error++;
|
||||
}
|
||||
/* From here: only test that the type matches if macro is known */
|
||||
if(curlcheck_write_cb_option(o->id) && (o->type != CURLOT_FUNCTION)) {
|
||||
print_err(o->name, "CURLOT_FUNCTION");
|
||||
error++;
|
||||
}
|
||||
if(curlcheck_conv_cb_option(o->id) && (o->type != CURLOT_FUNCTION)) {
|
||||
print_err(o->name, "CURLOT_FUNCTION");
|
||||
error++;
|
||||
}
|
||||
if(curlcheck_postfields_option(o->id) && (o->type != CURLOT_OBJECT)) {
|
||||
print_err(o->name, "CURLOT_OBJECT");
|
||||
error++;
|
||||
}
|
||||
/* Todo: no gcc typecheck for CURLOPTTYPE_BLOB types? */
|
||||
}
|
||||
#endif
|
||||
(void)URL;
|
||||
return error == 0 ? CURLE_OK : TEST_ERR_FAILURE;
|
||||
}
|
||||
48
curl-8.15.0/tests/libtest/lib1913.c
Normal file
48
curl-8.15.0/tests/libtest/lib1913.c
Normal file
@@ -0,0 +1,48 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
static CURLcode test_lib1913(char *URL)
|
||||
{
|
||||
CURLcode ret = CURLE_OK;
|
||||
CURL *hnd;
|
||||
start_test_timing();
|
||||
|
||||
curl_global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
hnd = curl_easy_init();
|
||||
if(hnd) {
|
||||
curl_easy_setopt(hnd, CURLOPT_URL, URL);
|
||||
curl_easy_setopt(hnd, CURLOPT_NOBODY, 1L);
|
||||
if(libtest_arg2)
|
||||
/* test1914 sets this extra arg */
|
||||
curl_easy_setopt(hnd, CURLOPT_FILETIME, 1L);
|
||||
ret = curl_easy_perform(hnd);
|
||||
curl_easy_cleanup(hnd);
|
||||
}
|
||||
curl_global_cleanup();
|
||||
return ret;
|
||||
}
|
||||
148
curl-8.15.0/tests/libtest/lib1915.c
Normal file
148
curl-8.15.0/tests/libtest/lib1915.c
Normal file
@@ -0,0 +1,148 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "testtrace.h"
|
||||
#include "memdebug.h"
|
||||
|
||||
struct state {
|
||||
int index;
|
||||
};
|
||||
|
||||
/* "read" is from the point of the library, it wants data from us */
|
||||
static CURLSTScode hstsread(CURL *easy, struct curl_hstsentry *e,
|
||||
void *userp)
|
||||
{
|
||||
struct entry {
|
||||
const char *name;
|
||||
const char *exp;
|
||||
};
|
||||
|
||||
static const struct entry preload_hosts[] = {
|
||||
#if (SIZEOF_TIME_T < 5)
|
||||
{ "1.example.com", "20370320 01:02:03" },
|
||||
{ "2.example.com", "20370320 03:02:01" },
|
||||
{ "3.example.com", "20370319 01:02:03" },
|
||||
#else
|
||||
{ "1.example.com", "25250320 01:02:03" },
|
||||
{ "2.example.com", "25250320 03:02:01" },
|
||||
{ "3.example.com", "25250319 01:02:03" },
|
||||
#endif
|
||||
{ "4.example.com", "" },
|
||||
{ NULL, NULL } /* end of list marker */
|
||||
};
|
||||
|
||||
const char *host;
|
||||
const char *expire;
|
||||
struct state *s = (struct state *)userp;
|
||||
(void)easy;
|
||||
host = preload_hosts[s->index].name;
|
||||
expire = preload_hosts[s->index++].exp;
|
||||
|
||||
if(host && (strlen(host) < e->namelen)) {
|
||||
strcpy(e->name, host);
|
||||
e->includeSubDomains = FALSE;
|
||||
strcpy(e->expire, expire);
|
||||
curl_mfprintf(stderr, "add '%s'\n", host);
|
||||
}
|
||||
else
|
||||
return CURLSTS_DONE;
|
||||
return CURLSTS_OK;
|
||||
}
|
||||
|
||||
/* verify error from callback */
|
||||
static CURLSTScode hstsreadfail(CURL *easy, struct curl_hstsentry *e,
|
||||
void *userp)
|
||||
{
|
||||
(void)easy;
|
||||
(void)e;
|
||||
(void)userp;
|
||||
return CURLSTS_FAIL;
|
||||
}
|
||||
|
||||
/* check that we get the hosts back in the save */
|
||||
static CURLSTScode hstswrite(CURL *easy, struct curl_hstsentry *e,
|
||||
struct curl_index *i, void *userp)
|
||||
{
|
||||
(void)easy;
|
||||
(void)userp;
|
||||
curl_mprintf("[%zu/%zu] %s %s\n", i->index, i->total, e->name, e->expire);
|
||||
return CURLSTS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Read/write HSTS cache entries via callback.
|
||||
*/
|
||||
|
||||
static CURLcode test_lib1915(char *URL)
|
||||
{
|
||||
CURLcode res = CURLE_OK;
|
||||
CURL *hnd;
|
||||
struct state st = {0};
|
||||
|
||||
global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
libtest_debug_config.nohex = 1;
|
||||
libtest_debug_config.tracetime = 1;
|
||||
|
||||
easy_init(hnd);
|
||||
easy_setopt(hnd, CURLOPT_URL, URL);
|
||||
easy_setopt(hnd, CURLOPT_CONNECTTIMEOUT, 1L);
|
||||
easy_setopt(hnd, CURLOPT_HSTSREADFUNCTION, hstsread);
|
||||
easy_setopt(hnd, CURLOPT_HSTSREADDATA, &st);
|
||||
easy_setopt(hnd, CURLOPT_HSTSWRITEFUNCTION, hstswrite);
|
||||
easy_setopt(hnd, CURLOPT_HSTSWRITEDATA, &st);
|
||||
easy_setopt(hnd, CURLOPT_HSTS_CTRL, CURLHSTS_ENABLE);
|
||||
easy_setopt(hnd, CURLOPT_DEBUGDATA, &libtest_debug_config);
|
||||
easy_setopt(hnd, CURLOPT_DEBUGFUNCTION, libtest_debug_cb);
|
||||
easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
|
||||
res = curl_easy_perform(hnd);
|
||||
curl_easy_cleanup(hnd);
|
||||
hnd = NULL;
|
||||
if(res == CURLE_OPERATION_TIMEDOUT) /* we expect that on Windows */
|
||||
res = CURLE_COULDNT_CONNECT;
|
||||
curl_mprintf("First request returned %d\n", res);
|
||||
res = CURLE_OK;
|
||||
|
||||
easy_init(hnd);
|
||||
easy_setopt(hnd, CURLOPT_URL, URL);
|
||||
easy_setopt(hnd, CURLOPT_CONNECTTIMEOUT, 1L);
|
||||
easy_setopt(hnd, CURLOPT_HSTSREADFUNCTION, hstsreadfail);
|
||||
easy_setopt(hnd, CURLOPT_HSTSREADDATA, &st);
|
||||
easy_setopt(hnd, CURLOPT_HSTSWRITEFUNCTION, hstswrite);
|
||||
easy_setopt(hnd, CURLOPT_HSTSWRITEDATA, &st);
|
||||
easy_setopt(hnd, CURLOPT_HSTS_CTRL, CURLHSTS_ENABLE);
|
||||
easy_setopt(hnd, CURLOPT_DEBUGDATA, &libtest_debug_config);
|
||||
easy_setopt(hnd, CURLOPT_DEBUGFUNCTION, libtest_debug_cb);
|
||||
easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
|
||||
res = curl_easy_perform(hnd);
|
||||
curl_easy_cleanup(hnd);
|
||||
hnd = NULL;
|
||||
curl_mprintf("Second request returned %d\n", res);
|
||||
|
||||
test_cleanup:
|
||||
curl_easy_cleanup(hnd);
|
||||
curl_global_cleanup();
|
||||
return res;
|
||||
}
|
||||
56
curl-8.15.0/tests/libtest/lib1916.c
Normal file
56
curl-8.15.0/tests/libtest/lib1916.c
Normal file
@@ -0,0 +1,56 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
static CURLcode test_lib1916(char *URL)
|
||||
{
|
||||
CURL *curl;
|
||||
CURLcode res = CURLE_OK;
|
||||
|
||||
if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
|
||||
curl_mfprintf(stderr, "curl_global_init() failed\n");
|
||||
return TEST_ERR_MAJOR_BAD;
|
||||
}
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(curl) {
|
||||
curl_easy_setopt(curl, CURLOPT_URL, URL);
|
||||
if(testnum == 1917) {
|
||||
/* without any postfields set! */
|
||||
curl_easy_setopt(curl, CURLOPT_POST, 1L);
|
||||
}
|
||||
else {
|
||||
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "");
|
||||
}
|
||||
res = curl_easy_perform(curl);
|
||||
if(res) {
|
||||
curl_mprintf("res: %d\n", res);
|
||||
}
|
||||
curl_easy_cleanup(curl);
|
||||
}
|
||||
curl_global_cleanup();
|
||||
return res;
|
||||
}
|
||||
54
curl-8.15.0/tests/libtest/lib1918.c
Normal file
54
curl-8.15.0/tests/libtest/lib1918.c
Normal file
@@ -0,0 +1,54 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
static CURLcode test_lib1918(char *URL)
|
||||
{
|
||||
const struct curl_easyoption *o;
|
||||
(void)URL;
|
||||
|
||||
curl_global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
for(o = curl_easy_option_next(NULL);
|
||||
o;
|
||||
o = curl_easy_option_next(o)) {
|
||||
const struct curl_easyoption *ename =
|
||||
curl_easy_option_by_name(o->name);
|
||||
const struct curl_easyoption *eid =
|
||||
curl_easy_option_by_id(o->id);
|
||||
|
||||
if(ename->id != o->id) {
|
||||
curl_mprintf("name lookup id %d doesn't match %d\n",
|
||||
ename->id, o->id);
|
||||
}
|
||||
else if(eid->id != o->id) {
|
||||
curl_mprintf("ID lookup %d doesn't match %d\n",
|
||||
ename->id, o->id);
|
||||
}
|
||||
}
|
||||
curl_global_cleanup();
|
||||
return CURLE_OK;
|
||||
}
|
||||
54
curl-8.15.0/tests/libtest/lib1919.c
Normal file
54
curl-8.15.0/tests/libtest/lib1919.c
Normal file
@@ -0,0 +1,54 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
static CURLcode test_lib1919(char *URL)
|
||||
{
|
||||
CURLcode res = CURLE_OK;
|
||||
CURL *curl;
|
||||
int i;
|
||||
|
||||
global_init(CURL_GLOBAL_ALL);
|
||||
easy_init(curl);
|
||||
easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_BEARER);
|
||||
easy_setopt(curl, CURLOPT_XOAUTH2_BEARER,
|
||||
"c4e448d652a961fda0ab64f882c8c161d5985f805d45d80c9ddca1");
|
||||
easy_setopt(curl, CURLOPT_SASL_AUTHZID,
|
||||
"c4e448d652a961fda0ab64f882c8c161d5985f805d45d80c9ddca2");
|
||||
easy_setopt(curl, CURLOPT_URL, URL);
|
||||
|
||||
for(i = 0; i < 2; i++) {
|
||||
/* the second request needs to do connection reuse */
|
||||
res = curl_easy_perform(curl);
|
||||
if(res)
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
test_cleanup:
|
||||
curl_easy_cleanup(curl);
|
||||
curl_global_cleanup();
|
||||
return res;
|
||||
}
|
||||
68
curl-8.15.0/tests/libtest/lib1933.c
Normal file
68
curl-8.15.0/tests/libtest/lib1933.c
Normal file
@@ -0,0 +1,68 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
static CURLcode test_lib1933(char *URL)
|
||||
{
|
||||
CURL *curl;
|
||||
CURLcode res = TEST_ERR_MAJOR_BAD;
|
||||
struct curl_slist *connect_to = NULL;
|
||||
struct curl_slist *list = NULL;
|
||||
|
||||
if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
|
||||
curl_mfprintf(stderr, "curl_global_init() failed\n");
|
||||
return TEST_ERR_MAJOR_BAD;
|
||||
}
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(!curl) {
|
||||
curl_mfprintf(stderr, "curl_easy_init() failed\n");
|
||||
curl_global_cleanup();
|
||||
return TEST_ERR_MAJOR_BAD;
|
||||
}
|
||||
|
||||
test_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
test_setopt(curl, CURLOPT_AWS_SIGV4, "xxx");
|
||||
test_setopt(curl, CURLOPT_HEADER, 0L);
|
||||
test_setopt(curl, CURLOPT_URL, URL);
|
||||
if(libtest_arg2) {
|
||||
connect_to = curl_slist_append(connect_to, libtest_arg2);
|
||||
}
|
||||
test_setopt(curl, CURLOPT_CONNECT_TO, connect_to);
|
||||
list = curl_slist_append(list, "Content-Type: application/json");
|
||||
test_setopt(curl, CURLOPT_HTTPHEADER, list);
|
||||
|
||||
res = curl_easy_perform(curl);
|
||||
|
||||
test_cleanup:
|
||||
|
||||
curl_slist_free_all(connect_to);
|
||||
curl_slist_free_all(list);
|
||||
curl_easy_cleanup(curl);
|
||||
curl_global_cleanup();
|
||||
|
||||
return res;
|
||||
}
|
||||
69
curl-8.15.0/tests/libtest/lib1934.c
Normal file
69
curl-8.15.0/tests/libtest/lib1934.c
Normal file
@@ -0,0 +1,69 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
static CURLcode test_lib1934(char *URL)
|
||||
{
|
||||
CURL *curl;
|
||||
CURLcode res = TEST_ERR_MAJOR_BAD;
|
||||
struct curl_slist *connect_to = NULL;
|
||||
struct curl_slist *list = NULL;
|
||||
|
||||
if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
|
||||
curl_mfprintf(stderr, "curl_global_init() failed\n");
|
||||
return TEST_ERR_MAJOR_BAD;
|
||||
}
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(!curl) {
|
||||
curl_mfprintf(stderr, "curl_easy_init() failed\n");
|
||||
curl_global_cleanup();
|
||||
return TEST_ERR_MAJOR_BAD;
|
||||
}
|
||||
|
||||
test_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
test_setopt(curl, CURLOPT_AWS_SIGV4, "xxx:yyy");
|
||||
test_setopt(curl, CURLOPT_USERPWD, "xxx:yyy");
|
||||
test_setopt(curl, CURLOPT_HEADER, 0L);
|
||||
test_setopt(curl, CURLOPT_URL, URL);
|
||||
if(libtest_arg2) {
|
||||
connect_to = curl_slist_append(connect_to, libtest_arg2);
|
||||
}
|
||||
test_setopt(curl, CURLOPT_CONNECT_TO, connect_to);
|
||||
list = curl_slist_append(list, "Content-Type: application/json");
|
||||
test_setopt(curl, CURLOPT_HTTPHEADER, list);
|
||||
|
||||
res = curl_easy_perform(curl);
|
||||
|
||||
test_cleanup:
|
||||
|
||||
curl_slist_free_all(connect_to);
|
||||
curl_slist_free_all(list);
|
||||
curl_easy_cleanup(curl);
|
||||
curl_global_cleanup();
|
||||
|
||||
return res;
|
||||
}
|
||||
69
curl-8.15.0/tests/libtest/lib1935.c
Normal file
69
curl-8.15.0/tests/libtest/lib1935.c
Normal file
@@ -0,0 +1,69 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
static CURLcode test_lib1935(char *URL)
|
||||
{
|
||||
CURL *curl;
|
||||
CURLcode res = TEST_ERR_MAJOR_BAD;
|
||||
struct curl_slist *connect_to = NULL;
|
||||
struct curl_slist *list = NULL;
|
||||
|
||||
if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
|
||||
curl_mfprintf(stderr, "curl_global_init() failed\n");
|
||||
return TEST_ERR_MAJOR_BAD;
|
||||
}
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(!curl) {
|
||||
curl_mfprintf(stderr, "curl_easy_init() failed\n");
|
||||
curl_global_cleanup();
|
||||
return TEST_ERR_MAJOR_BAD;
|
||||
}
|
||||
|
||||
test_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
test_setopt(curl, CURLOPT_AWS_SIGV4, "xxx:yyy:rrr");
|
||||
test_setopt(curl, CURLOPT_USERPWD, "xxx:yyy");
|
||||
test_setopt(curl, CURLOPT_HEADER, 0L);
|
||||
test_setopt(curl, CURLOPT_URL, URL);
|
||||
if(libtest_arg2) {
|
||||
connect_to = curl_slist_append(connect_to, libtest_arg2);
|
||||
}
|
||||
test_setopt(curl, CURLOPT_CONNECT_TO, connect_to);
|
||||
list = curl_slist_append(list, "Content-Type: application/json");
|
||||
test_setopt(curl, CURLOPT_HTTPHEADER, list);
|
||||
|
||||
res = curl_easy_perform(curl);
|
||||
|
||||
test_cleanup:
|
||||
|
||||
curl_slist_free_all(connect_to);
|
||||
curl_slist_free_all(list);
|
||||
curl_easy_cleanup(curl);
|
||||
curl_global_cleanup();
|
||||
|
||||
return res;
|
||||
}
|
||||
69
curl-8.15.0/tests/libtest/lib1936.c
Normal file
69
curl-8.15.0/tests/libtest/lib1936.c
Normal file
@@ -0,0 +1,69 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
static CURLcode test_lib1936(char *URL)
|
||||
{
|
||||
CURL *curl;
|
||||
CURLcode res = TEST_ERR_MAJOR_BAD;
|
||||
struct curl_slist *connect_to = NULL;
|
||||
struct curl_slist *list = NULL;
|
||||
|
||||
if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
|
||||
curl_mfprintf(stderr, "curl_global_init() failed\n");
|
||||
return TEST_ERR_MAJOR_BAD;
|
||||
}
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(!curl) {
|
||||
curl_mfprintf(stderr, "curl_easy_init() failed\n");
|
||||
curl_global_cleanup();
|
||||
return TEST_ERR_MAJOR_BAD;
|
||||
}
|
||||
|
||||
test_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
test_setopt(curl, CURLOPT_AWS_SIGV4, "xxx:yyy:rrr:sss");
|
||||
test_setopt(curl, CURLOPT_USERPWD, "xxx:yyy");
|
||||
test_setopt(curl, CURLOPT_HEADER, 0L);
|
||||
test_setopt(curl, CURLOPT_URL, URL);
|
||||
if(libtest_arg2) {
|
||||
connect_to = curl_slist_append(connect_to, libtest_arg2);
|
||||
}
|
||||
test_setopt(curl, CURLOPT_CONNECT_TO, connect_to);
|
||||
list = curl_slist_append(list, "Content-Type: application/json");
|
||||
test_setopt(curl, CURLOPT_HTTPHEADER, list);
|
||||
|
||||
res = curl_easy_perform(curl);
|
||||
|
||||
test_cleanup:
|
||||
|
||||
curl_slist_free_all(connect_to);
|
||||
curl_slist_free_all(list);
|
||||
curl_easy_cleanup(curl);
|
||||
curl_global_cleanup();
|
||||
|
||||
return res;
|
||||
}
|
||||
71
curl-8.15.0/tests/libtest/lib1937.c
Normal file
71
curl-8.15.0/tests/libtest/lib1937.c
Normal file
@@ -0,0 +1,71 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
static CURLcode test_lib1937(char *URL)
|
||||
{
|
||||
CURL *curl;
|
||||
CURLcode res = TEST_ERR_MAJOR_BAD;
|
||||
struct curl_slist *connect_to = NULL;
|
||||
struct curl_slist *list = NULL;
|
||||
|
||||
if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
|
||||
curl_mfprintf(stderr, "curl_global_init() failed\n");
|
||||
return TEST_ERR_MAJOR_BAD;
|
||||
}
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(!curl) {
|
||||
curl_mfprintf(stderr, "curl_easy_init() failed\n");
|
||||
curl_global_cleanup();
|
||||
return TEST_ERR_MAJOR_BAD;
|
||||
}
|
||||
|
||||
test_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
test_setopt(curl, CURLOPT_POST, 1L);
|
||||
test_setopt(curl, CURLOPT_AWS_SIGV4, "provider1:provider2:region:service");
|
||||
test_setopt(curl, CURLOPT_USERPWD, "keyId:SecretKey");
|
||||
test_setopt(curl, CURLOPT_HEADER, 0L);
|
||||
test_setopt(curl, CURLOPT_URL, URL);
|
||||
if(libtest_arg2) {
|
||||
connect_to = curl_slist_append(connect_to, libtest_arg2);
|
||||
}
|
||||
test_setopt(curl, CURLOPT_CONNECT_TO, connect_to);
|
||||
list = curl_slist_append(list, "Content-Type: application/json");
|
||||
test_setopt(curl, CURLOPT_HTTPHEADER, list);
|
||||
test_setopt(curl, CURLOPT_POSTFIELDS, "postData");
|
||||
|
||||
res = curl_easy_perform(curl);
|
||||
|
||||
test_cleanup:
|
||||
|
||||
curl_slist_free_all(connect_to);
|
||||
curl_slist_free_all(list);
|
||||
curl_easy_cleanup(curl);
|
||||
curl_global_cleanup();
|
||||
|
||||
return res;
|
||||
}
|
||||
73
curl-8.15.0/tests/libtest/lib1938.c
Normal file
73
curl-8.15.0/tests/libtest/lib1938.c
Normal file
@@ -0,0 +1,73 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
static CURLcode test_lib1938(char *URL)
|
||||
{
|
||||
CURL *curl;
|
||||
CURLcode res = TEST_ERR_MAJOR_BAD;
|
||||
struct curl_slist *connect_to = NULL;
|
||||
struct curl_slist *list = NULL;
|
||||
unsigned char data[] = {0x70, 0x6f, 0x73, 0x74, 0, 0x44, 0x61, 0x74, 0x61};
|
||||
|
||||
if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
|
||||
curl_mfprintf(stderr, "curl_global_init() failed\n");
|
||||
return TEST_ERR_MAJOR_BAD;
|
||||
}
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(!curl) {
|
||||
curl_mfprintf(stderr, "curl_easy_init() failed\n");
|
||||
curl_global_cleanup();
|
||||
return TEST_ERR_MAJOR_BAD;
|
||||
}
|
||||
|
||||
test_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
test_setopt(curl, CURLOPT_POST, 1L);
|
||||
test_setopt(curl, CURLOPT_AWS_SIGV4, "provider1:provider2:region:service");
|
||||
test_setopt(curl, CURLOPT_USERPWD, "keyId:SecretKey");
|
||||
test_setopt(curl, CURLOPT_HEADER, 0L);
|
||||
test_setopt(curl, CURLOPT_URL, URL);
|
||||
if(libtest_arg2) {
|
||||
connect_to = curl_slist_append(connect_to, libtest_arg2);
|
||||
}
|
||||
test_setopt(curl, CURLOPT_CONNECT_TO, connect_to);
|
||||
list = curl_slist_append(list, "Content-Type: application/json");
|
||||
test_setopt(curl, CURLOPT_HTTPHEADER, list);
|
||||
test_setopt(curl, CURLOPT_POSTFIELDS, data);
|
||||
test_setopt(curl, CURLOPT_POSTFIELDSIZE, (long)sizeof(data));
|
||||
|
||||
res = curl_easy_perform(curl);
|
||||
|
||||
test_cleanup:
|
||||
|
||||
curl_slist_free_all(connect_to);
|
||||
curl_slist_free_all(list);
|
||||
curl_easy_cleanup(curl);
|
||||
curl_global_cleanup();
|
||||
|
||||
return res;
|
||||
}
|
||||
71
curl-8.15.0/tests/libtest/lib1939.c
Normal file
71
curl-8.15.0/tests/libtest/lib1939.c
Normal file
@@ -0,0 +1,71 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
static CURLcode test_lib1939(char *URL)
|
||||
{
|
||||
CURLM *multi;
|
||||
CURL *easy;
|
||||
int running_handles;
|
||||
|
||||
curl_global_init(CURL_GLOBAL_DEFAULT);
|
||||
|
||||
multi = curl_multi_init();
|
||||
if(multi) {
|
||||
easy = curl_easy_init();
|
||||
if(easy) {
|
||||
CURLcode c;
|
||||
CURLMcode m;
|
||||
|
||||
/* Crash only happens when using HTTPS */
|
||||
c = curl_easy_setopt(easy, CURLOPT_URL, URL);
|
||||
if(!c)
|
||||
/* Any old HTTP tunneling proxy will do here */
|
||||
c = curl_easy_setopt(easy, CURLOPT_PROXY, libtest_arg2);
|
||||
|
||||
if(!c) {
|
||||
|
||||
/* We're going to drive the transfer using multi interface here,
|
||||
because we want to stop during the middle. */
|
||||
m = curl_multi_add_handle(multi, easy);
|
||||
|
||||
if(!m)
|
||||
/* Run the multi handle once, just enough to start establishing an
|
||||
HTTPS connection. */
|
||||
m = curl_multi_perform(multi, &running_handles);
|
||||
|
||||
if(m)
|
||||
curl_mfprintf(stderr, "curl_multi_perform failed\n");
|
||||
}
|
||||
/* Close the easy handle *before* the multi handle. Doing it the other
|
||||
way around avoids the issue. */
|
||||
curl_easy_cleanup(easy);
|
||||
}
|
||||
curl_multi_cleanup(multi); /* double-free happens here */
|
||||
}
|
||||
curl_global_cleanup();
|
||||
return CURLE_OK;
|
||||
}
|
||||
122
curl-8.15.0/tests/libtest/lib1940.c
Normal file
122
curl-8.15.0/tests/libtest/lib1940.c
Normal file
@@ -0,0 +1,122 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
static size_t t1940_write_cb(char *data, size_t n, size_t l, void *userp)
|
||||
{
|
||||
/* take care of the data here, ignored in this example */
|
||||
(void)data;
|
||||
(void)userp;
|
||||
return n*l;
|
||||
}
|
||||
|
||||
static void t1940_showem(CURL *easy, int header_request, unsigned int type)
|
||||
{
|
||||
static const char *testdata[] = {
|
||||
"daTE",
|
||||
"Server",
|
||||
"content-type",
|
||||
"content-length",
|
||||
"location",
|
||||
"set-cookie",
|
||||
"silly-thing",
|
||||
"fold",
|
||||
"blank",
|
||||
"Blank2",
|
||||
NULL
|
||||
};
|
||||
|
||||
int i;
|
||||
struct curl_header *header;
|
||||
for(i = 0; testdata[i]; i++) {
|
||||
if(CURLHE_OK == curl_easy_header(easy, testdata[i], 0,
|
||||
type, header_request, &header)) {
|
||||
if(header->amount > 1) {
|
||||
/* more than one, iterate over them */
|
||||
size_t index = 0;
|
||||
size_t amount = header->amount;
|
||||
do {
|
||||
curl_mprintf("- %s == %s (%u/%u)\n", header->name, header->value,
|
||||
(int)index, (int)amount);
|
||||
|
||||
if(++index == amount)
|
||||
break;
|
||||
if(CURLHE_OK != curl_easy_header(easy, testdata[i], index,
|
||||
type, header_request, &header))
|
||||
break;
|
||||
} while(1);
|
||||
}
|
||||
else {
|
||||
/* only one of this */
|
||||
curl_mprintf(" %s == %s\n", header->name, header->value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static CURLcode test_lib1940(char *URL)
|
||||
{
|
||||
CURL *easy = NULL;
|
||||
CURLcode res = CURLE_OK;
|
||||
|
||||
int header_request;
|
||||
if(testnum == 1946) {
|
||||
header_request = 0;
|
||||
}
|
||||
else {
|
||||
header_request = -1;
|
||||
}
|
||||
|
||||
global_init(CURL_GLOBAL_DEFAULT);
|
||||
easy_init(easy);
|
||||
easy_setopt(easy, CURLOPT_URL, URL);
|
||||
easy_setopt(easy, CURLOPT_VERBOSE, 1L);
|
||||
easy_setopt(easy, CURLOPT_FOLLOWLOCATION, 1L);
|
||||
/* ignores any content */
|
||||
easy_setopt(easy, CURLOPT_WRITEFUNCTION, t1940_write_cb);
|
||||
|
||||
/* if there's a proxy set, use it */
|
||||
if(libtest_arg2 && *libtest_arg2) {
|
||||
easy_setopt(easy, CURLOPT_PROXY, libtest_arg2);
|
||||
easy_setopt(easy, CURLOPT_HTTPPROXYTUNNEL, 1L);
|
||||
}
|
||||
res = curl_easy_perform(easy);
|
||||
if(res)
|
||||
goto test_cleanup;
|
||||
|
||||
t1940_showem(easy, header_request, CURLH_HEADER);
|
||||
if(libtest_arg2 && *libtest_arg2) {
|
||||
/* now show connect headers only */
|
||||
t1940_showem(easy, header_request, CURLH_CONNECT);
|
||||
}
|
||||
t1940_showem(easy, header_request, CURLH_1XX);
|
||||
t1940_showem(easy, header_request, CURLH_TRAILER);
|
||||
|
||||
test_cleanup:
|
||||
curl_easy_cleanup(easy);
|
||||
curl_global_cleanup();
|
||||
return res;
|
||||
}
|
||||
78
curl-8.15.0/tests/libtest/lib1945.c
Normal file
78
curl-8.15.0/tests/libtest/lib1945.c
Normal file
@@ -0,0 +1,78 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
static void t1945_showem(CURL *easy, unsigned int type)
|
||||
{
|
||||
struct curl_header *header = NULL;
|
||||
struct curl_header *prev = NULL;
|
||||
|
||||
/* !checksrc! disable EQUALSNULL 1 */
|
||||
while((header = curl_easy_nextheader(easy, type, 0, prev)) != NULL) {
|
||||
curl_mprintf(" %s == %s (%u/%u)\n", header->name, header->value,
|
||||
(int)header->index, (int)header->amount);
|
||||
prev = header;
|
||||
}
|
||||
}
|
||||
|
||||
static size_t t1945_write_cb(char *data, size_t n, size_t l, void *userp)
|
||||
{
|
||||
/* take care of the data here, ignored in this example */
|
||||
(void)data;
|
||||
(void)userp;
|
||||
return n*l;
|
||||
}
|
||||
|
||||
static CURLcode test_lib1945(char *URL)
|
||||
{
|
||||
CURL *easy;
|
||||
CURLcode res = CURLE_OK;
|
||||
|
||||
global_init(CURL_GLOBAL_DEFAULT);
|
||||
|
||||
easy_init(easy);
|
||||
curl_easy_setopt(easy, CURLOPT_URL, URL);
|
||||
curl_easy_setopt(easy, CURLOPT_VERBOSE, 1L);
|
||||
curl_easy_setopt(easy, CURLOPT_FOLLOWLOCATION, 1L);
|
||||
/* ignores any content */
|
||||
curl_easy_setopt(easy, CURLOPT_WRITEFUNCTION, t1945_write_cb);
|
||||
|
||||
/* if there's a proxy set, use it */
|
||||
if(libtest_arg2 && *libtest_arg2) {
|
||||
curl_easy_setopt(easy, CURLOPT_PROXY, libtest_arg2);
|
||||
curl_easy_setopt(easy, CURLOPT_HTTPPROXYTUNNEL, 1L);
|
||||
}
|
||||
res = curl_easy_perform(easy);
|
||||
if(res) {
|
||||
curl_mprintf("badness: %d\n", res);
|
||||
}
|
||||
t1945_showem(easy, CURLH_CONNECT|CURLH_HEADER|CURLH_TRAILER|CURLH_1XX);
|
||||
|
||||
test_cleanup:
|
||||
curl_easy_cleanup(easy);
|
||||
curl_global_cleanup();
|
||||
return res;
|
||||
}
|
||||
92
curl-8.15.0/tests/libtest/lib1947.c
Normal file
92
curl-8.15.0/tests/libtest/lib1947.c
Normal file
@@ -0,0 +1,92 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
static size_t t1947_write_cb(char *data, size_t n, size_t l, void *userp)
|
||||
{
|
||||
/* ignore the data */
|
||||
(void)data;
|
||||
(void)userp;
|
||||
return n*l;
|
||||
}
|
||||
|
||||
static CURLcode test_lib1947(char *URL)
|
||||
{
|
||||
CURL *curl;
|
||||
CURLcode res = CURLE_OK;
|
||||
struct curl_header *h;
|
||||
int count = 0;
|
||||
unsigned int origins;
|
||||
|
||||
global_init(CURL_GLOBAL_DEFAULT);
|
||||
|
||||
easy_init(curl);
|
||||
|
||||
/* perform a request that involves redirection */
|
||||
easy_setopt(curl, CURLOPT_URL, URL);
|
||||
easy_setopt(curl, CURLOPT_WRITEFUNCTION, t1947_write_cb);
|
||||
easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
|
||||
res = curl_easy_perform(curl);
|
||||
if(res) {
|
||||
curl_mfprintf(stderr, "curl_easy_perform() failed: %s\n",
|
||||
curl_easy_strerror(res));
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
/* count the number of requests by reading the first header of each
|
||||
request. */
|
||||
origins = (CURLH_HEADER|CURLH_TRAILER|CURLH_CONNECT|
|
||||
CURLH_1XX|CURLH_PSEUDO);
|
||||
do {
|
||||
h = curl_easy_nextheader(curl, origins, count, NULL);
|
||||
if(h)
|
||||
count++;
|
||||
} while(h);
|
||||
curl_mprintf("count = %u\n", count);
|
||||
|
||||
/* perform another request - without redirect */
|
||||
easy_setopt(curl, CURLOPT_URL, libtest_arg2);
|
||||
res = curl_easy_perform(curl);
|
||||
if(res) {
|
||||
curl_mfprintf(stderr, "curl_easy_perform() failed: %s\n",
|
||||
curl_easy_strerror(res));
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
/* count the number of requests again. */
|
||||
count = 0;
|
||||
do {
|
||||
h = curl_easy_nextheader(curl, origins, count, NULL);
|
||||
if(h)
|
||||
count++;
|
||||
} while(h);
|
||||
curl_mprintf("count = %u\n", count);
|
||||
|
||||
test_cleanup:
|
||||
curl_easy_cleanup(curl);
|
||||
curl_global_cleanup();
|
||||
return res;
|
||||
}
|
||||
77
curl-8.15.0/tests/libtest/lib1948.c
Normal file
77
curl-8.15.0/tests/libtest/lib1948.c
Normal file
@@ -0,0 +1,77 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *buf;
|
||||
size_t len;
|
||||
} put_buffer;
|
||||
|
||||
static size_t put_callback(char *ptr, size_t size, size_t nmemb, void *stream)
|
||||
{
|
||||
put_buffer *putdata = (put_buffer *)stream;
|
||||
size_t totalsize = size * nmemb;
|
||||
size_t tocopy = (putdata->len < totalsize) ? putdata->len : totalsize;
|
||||
memcpy(ptr, putdata->buf, tocopy);
|
||||
putdata->len -= tocopy;
|
||||
putdata->buf += tocopy;
|
||||
return tocopy;
|
||||
}
|
||||
|
||||
static CURLcode test_lib1948(char *URL)
|
||||
{
|
||||
CURL *curl;
|
||||
CURLcode res = CURLE_OK;
|
||||
static const char *testput = "This is test PUT data\n";
|
||||
put_buffer pbuf;
|
||||
|
||||
curl_global_init(CURL_GLOBAL_DEFAULT);
|
||||
|
||||
easy_init(curl);
|
||||
|
||||
/* PUT */
|
||||
easy_setopt(curl, CURLOPT_UPLOAD, 1L);
|
||||
easy_setopt(curl, CURLOPT_HEADER, 1L);
|
||||
easy_setopt(curl, CURLOPT_READFUNCTION, put_callback);
|
||||
pbuf.buf = (char *)CURL_UNCONST(testput);
|
||||
pbuf.len = strlen(testput);
|
||||
easy_setopt(curl, CURLOPT_READDATA, &pbuf);
|
||||
easy_setopt(curl, CURLOPT_INFILESIZE, (long)strlen(testput));
|
||||
easy_setopt(curl, CURLOPT_URL, URL);
|
||||
res = curl_easy_perform(curl);
|
||||
if(res)
|
||||
goto test_cleanup;
|
||||
|
||||
/* POST */
|
||||
easy_setopt(curl, CURLOPT_POST, 1L);
|
||||
easy_setopt(curl, CURLOPT_POSTFIELDS, testput);
|
||||
easy_setopt(curl, CURLOPT_POSTFIELDSIZE, (long)strlen(testput));
|
||||
res = curl_easy_perform(curl);
|
||||
|
||||
test_cleanup:
|
||||
curl_easy_cleanup(curl);
|
||||
curl_global_cleanup();
|
||||
return res;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user