diff options
Diffstat (limited to 'Build/source/libs/curl/src')
27 files changed, 6687 insertions, 0 deletions
diff --git a/Build/source/libs/curl/src/Makefile.am b/Build/source/libs/curl/src/Makefile.am new file mode 100644 index 00000000000..93ea6b5f07d --- /dev/null +++ b/Build/source/libs/curl/src/Makefile.am @@ -0,0 +1,48 @@ +# +# $Id: Makefile.am,v 1.20 2002/03/06 22:19:16 bagder Exp $ +# + +AUTOMAKE_OPTIONS = foreign nostdinc + +# we use srcdir/include for the static global include files +# we use builddir/src for the generated src/config.h file to get found +# we use srcdir/lib for the client-private header files +INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/src -I$(top_srcdir)/src + +bin_PROGRAMS = curl #memtest + +#memtest_SOURCES = memtest.c +#memtest_LDADD = $(top_srcdir)/lib/libcurl.la + +curl_SOURCES = main.c hugehelp.c urlglob.c writeout.c setup.h \ + config-win32.h \ + config-mac.h \ + config-vms.h \ + urlglob.h \ + version.h \ + writeout.h \ + config-win32.h \ + config-mac.h \ + config-vms.h + +curl_LDADD = ../lib/libcurl.la +curl_DEPENDENCIES = ../lib/libcurl.la +BUILT_SOURCES = hugehelp.c +CLEANFILES = hugehelp.c +NROFF=@NROFF@ + +EXTRA_DIST = mkhelp.pl curlmsg.msg \ + Makefile.vc6 Makefile.b32 Makefile.m32 config.h.in \ + macos/curl.mcp.xml.sit.hqx \ + macos/MACINSTALL.TXT \ + macos/src/curl_GUSIConfig.cpp \ + macos/src/macos_main.cpp + +MANPAGE=$(top_srcdir)/docs/curl.1 +README=$(top_srcdir)/docs/MANUAL +MKHELP=$(top_srcdir)/src/mkhelp.pl + +# This generates the hugehelp.c file +hugehelp.c: $(README) $(MANPAGE) mkhelp.pl + rm -f hugehelp.c + $(NROFF) -man $(MANPAGE) | $(PERL) $(MKHELP) $(README) > hugehelp.c diff --git a/Build/source/libs/curl/src/Makefile.b32 b/Build/source/libs/curl/src/Makefile.b32 new file mode 100644 index 00000000000..9adabef1602 --- /dev/null +++ b/Build/source/libs/curl/src/Makefile.b32 @@ -0,0 +1,45 @@ +############################################################ +# $Id: Makefile.b32,v 1.2 2001/08/09 09:10:36 bagder Exp $ +# +# Makefile.b32 - Borland's C++ Compiler 5.X +# +# 'src' directory +# +# Written by Jaepil Kim, pit@paradise.net.nz +############################################################ + +# Set program's name +PROGNAME = curl.exe + +# Setup environment +CXX = bcc32 +CXXFLAGS = -5 -O2 -WC -w-par -w-csu -w-aus +RM = del +TOPDIR = .. +DEFINES = -DNDEBUG -DLIBCURL_BIGENDIAN=0 -DWIN32 -D_CONSOLE -D_MBCS +LD = bcc32 +LDFLAGS = -lap -e$(PROGNAME) +INCDIRS = -I$(TOPDIR)/include +LIBCURLLIB= $(TOPDIR)/lib/libcurl.lib + +# 'BCCDIR' has to be set up in your c:\autoexec.bat +# i.e. SET BCCDIR = c:\Borland\BCC55 +# where c:\Borland\BCC55 is the compiler is installed +LINKLIB = $(BCCDIR)/lib/psdk/wsock32.lib + + +PROGRAMS = \ + curl.exe + +.c.obj: + $(CXX) -c $(INCDIRS) $(CXXFLAGS) $(DEFINES) $*.c + +all: $(PROGRAMS) + +curl.exe: $(LIBCURLLIB) $(LINKLIB) hugehelp.obj writeout.obj urlglob.obj main.obj + $(LD) $(LDFLAGS) hugehelp.obj writeout.obj urlglob.obj main.obj $(LIBCURLLIB) $(LINKLIB) + +clean: + $(RM) *.obj + $(RM) *.exe + $(RM) *.tds diff --git a/Build/source/libs/curl/src/Makefile.in b/Build/source/libs/curl/src/Makefile.in new file mode 100644 index 00000000000..185c7924669 --- /dev/null +++ b/Build/source/libs/curl/src/Makefile.in @@ -0,0 +1,421 @@ +# Makefile.in generated automatically by automake 1.5 from Makefile.am. + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +# 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@ + +# +# $Id: Makefile.am,v 1.20 2002/03/06 22:19:16 bagder Exp $ +# + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_HEADER = $(INSTALL_DATA) +transform = @program_transform_name@ +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_alias = @host_alias@ +host_triplet = @host@ +AMTAR = @AMTAR@ +AS = @AS@ +AWK = @AWK@ +CC = @CC@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +ECHO = @ECHO@ +EXEEXT = @EXEEXT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +IPV6_ENABLED = @IPV6_ENABLED@ +KRB4_ENABLED = @KRB4_ENABLED@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OPENSSL_ENABLED = @OPENSSL_ENABLED@ +PACKAGE = @PACKAGE@ +PERL = @PERL@ +PKGADD_NAME = @PKGADD_NAME@ +PKGADD_PKG = @PKGADD_PKG@ +PKGADD_VENDOR = @PKGADD_VENDOR@ +RANDOM_FILE = @RANDOM_FILE@ +RANLIB = @RANLIB@ +STRIP = @STRIP@ +VERSION = @VERSION@ +VERSIONNUM = @VERSIONNUM@ +YACC = @YACC@ +am__include = @am__include@ +am__quote = @am__quote@ +install_sh = @install_sh@ +NROFF = @NROFF@ + +AUTOMAKE_OPTIONS = foreign nostdinc + +# we use srcdir/include for the static global include files +# we use builddir/src for the generated src/config.h file to get found +# we use srcdir/lib for the client-private header files +INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/src -I$(top_srcdir)/src + +bin_PROGRAMS = curl #memtest + + +#memtest_SOURCES = memtest.c +#memtest_LDADD = $(top_srcdir)/lib/libcurl.la +curl_SOURCES = main.c hugehelp.c urlglob.c writeout.c setup.h \ + config-win32.h \ + config-mac.h \ + config-vms.h \ + urlglob.h \ + version.h \ + writeout.h \ + config-win32.h \ + config-mac.h \ + config-vms.h + + +curl_LDADD = ../lib/libcurl.la +curl_DEPENDENCIES = ../lib/libcurl.la +BUILT_SOURCES = hugehelp.c +CLEANFILES = hugehelp.c + +EXTRA_DIST = mkhelp.pl curlmsg.msg \ + Makefile.vc6 Makefile.b32 Makefile.m32 config.h.in \ + macos/curl.mcp.xml.sit.hqx \ + macos/MACINSTALL.TXT \ + macos/src/curl_GUSIConfig.cpp \ + macos/src/macos_main.cpp + + +MANPAGE = $(top_srcdir)/docs/curl.1 +README = $(top_srcdir)/docs/MANUAL +MKHELP = $(top_srcdir)/src/mkhelp.pl +subdir = src +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/lib/config.h config.h \ + $(top_builddir)/tests/server/config.h +CONFIG_CLEAN_FILES = +bin_PROGRAMS = curl$(EXEEXT) +PROGRAMS = $(bin_PROGRAMS) + +am_curl_OBJECTS = main.$(OBJEXT) hugehelp.$(OBJEXT) urlglob.$(OBJEXT) \ + writeout.$(OBJEXT) +curl_OBJECTS = $(am_curl_OBJECTS) +curl_LDFLAGS = + +DEFS = @DEFS@ +DEFAULT_INCLUDES = +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ +depcomp = $(SHELL) $(top_srcdir)/depcomp +@AMDEP_TRUE@DEP_FILES = $(DEPDIR)/hugehelp.Po $(DEPDIR)/main.Po \ +@AMDEP_TRUE@ $(DEPDIR)/urlglob.Po $(DEPDIR)/writeout.Po +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ + $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +CFLAGS = @CFLAGS@ +DIST_SOURCES = $(curl_SOURCES) +DIST_COMMON = ./stamp-h2.in Makefile.am Makefile.in config.h.in +SOURCES = $(curl_SOURCES) + +all: $(BUILT_SOURCES) config.h + $(MAKE) $(AM_MAKEFLAGS) all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && \ + CONFIG_HEADERS= CONFIG_LINKS= \ + CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status +config.h: stamp-h2 + @if test ! -f $@; then \ + rm -f stamp-h2; \ + $(MAKE) stamp-h2; \ + else :; fi +stamp-h2: $(srcdir)/config.h.in $(top_builddir)/config.status + @rm -f stamp-h2 stamp-h2T + @echo timestamp > stamp-h2T 2> /dev/null + cd $(top_builddir) \ + && CONFIG_FILES= CONFIG_HEADERS=src/config.h \ + $(SHELL) ./config.status + @mv stamp-h2T stamp-h2 +$(srcdir)/config.h.in: $(srcdir)/./stamp-h2.in + @if test ! -f $@; then \ + rm -f $(srcdir)/./stamp-h2.in; \ + $(MAKE) $(srcdir)/./stamp-h2.in; \ + else :; fi +$(srcdir)/./stamp-h2.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) $(top_srcdir)/acconfig.h + @rm -f $(srcdir)/./stamp-h2.in $(srcdir)/./stamp-h2.inT + @echo timestamp > $(srcdir)/./stamp-h2.inT 2> /dev/null + cd $(top_srcdir) && $(AUTOHEADER) + @mv $(srcdir)/./stamp-h2.inT $(srcdir)/./stamp-h2.in + +distclean-hdr: + -rm -f config.h +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(bindir) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + || test -f $$p1 \ + ; then \ + f=`echo $$p1|sed '$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$f"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$f; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " rm -f $(DESTDIR)$(bindir)/$$f"; \ + rm -f $(DESTDIR)$(bindir)/$$f; \ + done + +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) +curl$(EXEEXT): $(curl_OBJECTS) $(curl_DEPENDENCIES) + @rm -f curl$(EXEEXT) + $(LINK) $(curl_LDFLAGS) $(curl_OBJECTS) $(curl_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/hugehelp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/urlglob.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/writeout.Po@am__quote@ + +distclean-depend: + -rm -rf $(DEPDIR) + +.c.o: +@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(COMPILE) -c `test -f $< || echo '$(srcdir)/'`$< + +.c.obj: +@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(COMPILE) -c `cygpath -w $<` + +.c.lo: +@AMDEP_TRUE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(LTCOMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$< +CCDEPMODE = @CCDEPMODE@ +uninstall-info-am: + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique $(LISP) + +TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)config.h.in$$unique$(LISP)$$tags" \ + || etags $(ETAGS_ARGS) $$tags config.h.in $$unique $(LISP) + +GTAGS: + here=`CDPATH=: && cd $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH + +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + $(mkinstalldirs) $(distdir)/macos $(distdir)/macos/src + @for file in $(DISTFILES); do \ + if test -f $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + $(mkinstalldirs) "$(distdir)/$$dir"; \ + fi; \ + if test -d $$d/$$file; then \ + cp -pR $$d/$$file $(distdir) \ + || 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-am: Makefile $(PROGRAMS) config.h + +installdirs: + $(mkinstalldirs) $(DESTDIR)$(bindir) + +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: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-hdr distclean-libtool \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: install-binPROGRAMS + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +uninstall-am: uninstall-binPROGRAMS uninstall-info-am + +.PHONY: GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-generic clean-libtool distclean distclean-compile \ + distclean-depend distclean-generic distclean-hdr \ + distclean-libtool distclean-tags distdir dvi dvi-am info \ + info-am install install-am install-binPROGRAMS install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool tags uninstall \ + uninstall-am uninstall-binPROGRAMS uninstall-info-am + + +# This generates the hugehelp.c file +hugehelp.c: $(README) $(MANPAGE) mkhelp.pl + rm -f hugehelp.c + $(NROFF) -man $(MANPAGE) | $(PERL) $(MKHELP) $(README) > hugehelp.c +# 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: diff --git a/Build/source/libs/curl/src/Makefile.m32 b/Build/source/libs/curl/src/Makefile.m32 new file mode 100644 index 00000000000..59563894dcb --- /dev/null +++ b/Build/source/libs/curl/src/Makefile.m32 @@ -0,0 +1,73 @@ +############################################################# +# $Id: Makefile.m32,v 1.6 2001/09/25 07:55:19 bagder Exp $ +# +## Makefile for building curl.exe with MingW32 (GCC-2.95) and +## optionally OpenSSL (0.9.6) +## +## Use: make -f Makefile.m32 [SSL=1] [DYN=1] +## +## Comments to: Troy Engel <tengel@sonic.net> or +## Joern Hartroth <hartroth@acm.org> + +CC = gcc +STRIP = strip -s +OPENSSL_PATH = ../../openssl-0.9.6b + +# We may need these someday +# PERL = perl +# NROFF = nroff + +######################################################## +## Nothing more to do below this line! + +INCLUDES = -I. -I.. -I../include +CFLAGS = -g -O2 -DMINGW32 +LDFLAGS = +COMPILE = $(CC) $(INCLUDES) $(CFLAGS) +LINK = $(CC) $(CFLAGS) $(LDFLAGS) -o $@ + +curl_PROGRAMS = curl.exe +curl_OBJECTS = main.o hugehelp.o urlglob.o writeout.o +curl_SOURCES = main.c hugehelp.c urlglob.c writeout.c +ifdef DYN + curl_DEPENDENCIES = ../lib/libcurldll.a ../lib/libcurl.dll + curl_LDADD = -L../lib -lcurldll +else + curl_DEPENDENCIES = ../lib/libcurl.a + curl_LDADD = -L../lib -lcurl +endif +curl_LDADD += -lwsock32 -lws2_32 +ifdef SSL + curl_LDADD += -L$(OPENSSL_PATH)/out -leay32 -lssl32 -lRSAglue +endif + +PROGRAMS = $(curl_PROGRAMS) +SOURCES = $(curl_SOURCES) +OBJECTS = $(curl_OBJECTS) + +all: curl.exe + +curl.exe: $(curl_OBJECTS) $(curl_DEPENDENCIES) + -@erase $@ + $(LINK) $(curl_OBJECTS) $(curl_LDADD) + $(STRIP) $@ + +# We don't have nroff normally under win32 +# hugehelp.c: ../README.curl ../curl.1 mkhelp.pl +# -@erase hugehelp.c +# $(NROFF) -man ../curl.1 | $(PERL) mkhelp.pl ../README.curl > hugehelp.c + +.c.o: + $(COMPILE) -c $< + +.s.o: + $(COMPILE) -c $< + +.S.o: + $(COMPILE) -c $< + +clean: + -@erase $(curl_OBJECTS) + +distrib: clean + -@erase $(curl_PROGRAMS) diff --git a/Build/source/libs/curl/src/Makefile.vc6 b/Build/source/libs/curl/src/Makefile.vc6 new file mode 100644 index 00000000000..fa8f4d5cb96 --- /dev/null +++ b/Build/source/libs/curl/src/Makefile.vc6 @@ -0,0 +1,87 @@ +######################################################## +## Makefile for building curl.exe with MSVC6 +## Use: nmake -f makefile.vc6 [release | debug] [CFG=release-ssl] +## (default is release) +## "nmake -f makefile.vc6 CFG=release-ssl" statically links OpenSSL +## into curl.exe producing a standalone SSL-enabled executable. +## +## Comments to: Troy Engel <tengel@sonic.net> +## Updated by: Craig Davison <cd@securityfocus.com> +## release-ssl added by Miklos Nemeth <mnemeth@kfkisystems.com> + +PROGRAM_NAME = curl.exe + +######################################################## +## Nothing more to do below this line! + +## Release +CCR = cl.exe /MD /O2 /D "NDEBUG" +LINKR = link.exe /incremental:no /libpath:"../lib" + +## Debug +CCD = cl.exe /MDd /Gm /ZI /Od /D "_DEBUG" /GZ +LINKD = link.exe /incremental:yes /debug /libpath:"../lib" + +CFLAGS = /I "../include" /nologo /W3 /GX /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +LFLAGS = /nologo /out:$(PROGRAM_NAME) /subsystem:console /machine:I386 +LINKLIBS = ws2_32.lib libcurl.lib +LINKLIBS_DEBUG = ws2_32.lib libcurld.lib + +RELEASE_OBJS= \ + hugehelpr.obj \ + writeoutr.obj \ + urlglobr.obj \ + mainr.obj + +DEBUG_OBJS= \ + hugehelpd.obj \ + writeoutd.obj \ + urlglobd.obj \ + maind.obj + +LINK_OBJS= \ + hugehelp.obj \ + writeout.obj \ + urlglob.obj \ + main.obj + +all : release + +release: $(RELEASE_OBJS) + $(LINKR) $(LFLAGS) $(LINKLIBS) $(LINK_OBJS) + +debug: $(DEBUG_OBJS) + $(LINKD) $(LFLAGS) $(LINKLIBS_DEBUG) $(LINK_OBJS) + +## Release +hugehelpr.obj: hugehelp.c + $(CCR) $(CFLAGS) /Zm200 hugehelp.c +writeoutr.obj: writeout.c + $(CCR) $(CFLAGS) writeout.c +urlglobr.obj: urlglob.c + $(CCR) $(CFLAGS) urlglob.c +mainr.obj: main.c + $(CCR) $(CFLAGS) main.c + +## Debug +hugehelpd.obj: hugehelp.c + $(CCD) $(CFLAGS) /Zm200 hugehelp.c +writeoutd.obj: writeout.c + $(CCD) $(CFLAGS) writeout.c +urlglobd.obj: urlglob.c + $(CCD) $(CFLAGS) urlglob.c +maind.obj: main.c + $(CCD) $(CFLAGS) main.c + +clean: + -@erase hugehelp.obj + -@erase main.obj + -@erase vc60.idb + -@erase vc60.pdb + -@erase vc60.pch + -@erase curl.ilk + -@erase curl.pdb + +distrib: clean + -@erase $(PROGRAM_NAME) + diff --git a/Build/source/libs/curl/src/config-mac.h b/Build/source/libs/curl/src/config-mac.h new file mode 100644 index 00000000000..e43a9a5932e --- /dev/null +++ b/Build/source/libs/curl/src/config-mac.h @@ -0,0 +1,12 @@ +#define HAVE_UNISTD_H 1 +#define HAVE_FCNTL_H 1 +#define HAVE_UTIME_H 1 +#define HAVE_SYS_UTIME_H 1 + +#define HAVE_SETVBUF 1 +#define HAVE_UTIME 1 + +#define main(x,y) curl_main(x,y) + +/* we provide our own strdup prototype */ +char *strdup(char *s1); diff --git a/Build/source/libs/curl/src/config-vms.h b/Build/source/libs/curl/src/config-vms.h new file mode 100644 index 00000000000..26aabd927ea --- /dev/null +++ b/Build/source/libs/curl/src/config-vms.h @@ -0,0 +1,21 @@ +/* src/config.h. Generated automatically by configure. */ +/* Define cpu-machine-OS */ +#define OS "ALPHA-COMPAQ-VMS" + +/* Define if you have the <unistd.h> header file. */ +#define HAVE_UNISTD_H 1 + +/* Define if you have the <io.h> header file. */ +#undef HAVE_IO_H + +/* Define if you have strdup() */ +#define HAVE_STRDUP 1 + +/* Define if you have utime() */ +#undef HAVE_UTIME + +/* Define if you have the <utime.h> header file */ +#undef HAVE_UTIME_H + +/* Define if you have thhe <sys/utime.h> header file */ +#undef HAVE_SYS_UTIME_H diff --git a/Build/source/libs/curl/src/config-win32.h b/Build/source/libs/curl/src/config-win32.h new file mode 100644 index 00000000000..a606f2fb5ac --- /dev/null +++ b/Build/source/libs/curl/src/config-win32.h @@ -0,0 +1,36 @@ +/* src/config-win32.h. manually created to look like a config.h. */ +/* Define if you have the stricmp function. */ +#define HAVE_STRICMP 1 + +/* Define cpu-machine-OS */ +#define OS "win32" + +/* Define if you have the <io.h> header file. */ +#define HAVE_IO_H 1 + +/* Define if you have the strdup function. */ +#define HAVE_STRDUP 1 + +/* Define if you have the <fcntl.h> header file. */ +#define HAVE_FCNTL_H 1 + +/* Define if you have utime() */ +#define HAVE_UTIME 1 + +/* Define if you have the <sys/utime.h> header file */ +#define HAVE_SYS_UTIME_H 1 + +/************************************************* + * This section is for compiler specific defines.* + *************************************************/ +#ifdef MINGW32 /* Borland and MS don't have this */ + +/* Define if you have the <unistd.h> header file. */ +#define HAVE_UNISTD_H 1 + +#endif + +#ifdef FPTEX +#include <win32lib.h> +#undef vsnprintf +#endif diff --git a/Build/source/libs/curl/src/config.h.in b/Build/source/libs/curl/src/config.h.in new file mode 100644 index 00000000000..31825bf65f0 --- /dev/null +++ b/Build/source/libs/curl/src/config.h.in @@ -0,0 +1,21 @@ +/* src/config.h. Generated automatically by configure. */ +/* Define cpu-machine-OS */ +#undef OS + +/* Define if you have the <unistd.h> header file. */ +#undef HAVE_UNISTD_H + +/* Define if you have the <io.h> header file. */ +#undef HAVE_IO_H + +/* Define if you have strdup() */ +#undef HAVE_STRDUP + +/* Define if you have utime() */ +#undef HAVE_UTIME + +/* Define if you have the <utime.h> header file */ +#undef HAVE_UTIME_H + +/* Define if you have thhe <sys/utime.h> header file */ +#undef HAVE_SYS_UTIME_H diff --git a/Build/source/libs/curl/src/curl.rc b/Build/source/libs/curl/src/curl.rc new file mode 100644 index 00000000000..ef2fe0a6e9f --- /dev/null +++ b/Build/source/libs/curl/src/curl.rc @@ -0,0 +1,34 @@ +/* curl.rc: curl resources -*- C++ -*- + + Copyright (C) 1996-2003 Fabrice Popineau <fabrice.popineau@supelec.fr> + + This file is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 2, or (at your + option) any later version. + + This file is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this file; if not, write to the Free Software + Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, + USA. */ + +#include <texlive-version.h> + +#define VER_FILEVERSION TEXLIVE_MAJOR_VERSION,TEXLIVE_MINOR_VERSION,TEXLIVE_BETA_NUMBER,TEXLIVE_ALPHA_NUMBER +#define VER_FILEVERSION_STR TEXLIVE_PRODUCTVERSION_STR " curl 7.9.5" + +#define VER_INTERNALNAME_STR "curl" +#define VER_ORIGINALFILENAME_STR "curl.exe" + +#define VER_FILEDESCRIPTION_STR "Curl URL retrieving program" + +#define VER_LEGALCOPYRIGHT_STR "Copyright (C) 1998-2001, Daniel Stenberg, <daniel@haxx.se>, et al." + +#include <texlive.version> + +/* curl.rc ends here */ diff --git a/Build/source/libs/curl/src/curlmsg.msg b/Build/source/libs/curl/src/curlmsg.msg new file mode 100644 index 00000000000..7fed5a48485 --- /dev/null +++ b/Build/source/libs/curl/src/curlmsg.msg @@ -0,0 +1,56 @@ +.TITLE CURLMSG Message files +.FACILITY CURL,1793 /PREFIX=CURL_ +.SEVERITY ERROR +.BASE 1 +UNSUPPROTO <Unsupported Protocol> +FAILINIT <Failed Initialisation> +BADURLSYN <Malformed URL Syntax> +BADURLUSER <Malformed URL User-part> +BADPROXY <Couldn't resolve proxy> +BADHOST <Couldn't resolve host> +FAILHOST <Couldn't connect to host> +FTPUNKREPLY <FTP Unknown server reply> +FTPNOACC <FTP Access denied> +FTPUSRPW <FTP User/Password incorrect> +FTPBADPASS <FTP unknown answer to PASS request> +FTPBADUSER <FTP unknown answer to USER request> +FTPBADPASV <FTP unknown answer to PASV request> +FTPBAD227 <FTP unknown 227 reply> +FTPBADHOST227 <FTP cannot resolve host from 227 reply> +FTPNORECONN <FTP Unable to reconnect to 227 Host> +FTPNOBIN <FTP Cannot select BINARY mode> +PARTIALFILE <Only a part of the file was transferred> +FTPNORETR <FTP Couldn't retrieve file> +FTPWRITERR <FTP Server reported write problems> +FTPNOQUOTE <FTP Quote command error> +HTTPPNF <HTTP page not found> +WRITERR <Local write error> +BADUSER <Username badly specified> +FTPNOSTOR <FTP STOR command failed> +READERR <Local Read error> +OUTOFMEM <Out of memory> +TIMEOUT <Operation Timed out> +FTPNOASCII <FTP Cannot select ASCII mode> +FTPNOPORT <FTP PORT command failed> +FTPNOREST <FTP REST command failed> +FTPNOSIZE <FTP SIZE command failed> +HTTPRNGERR <HTTP Range error> +HTTPPOSTERR <HTTP Post error> +SSLNOCONN <SSL Handshaking failed> +FTPBADRESUME <FTP Download resume failed> +FILENOACC <FILE couldn't open faile> +LDAPNOBIND <LDAP Bind failed> +LDAPNOSRCH <LDAP Search Failed> +LDAPNOLIB <LDAP Library not found> +LDAPNOFUNC <LDAP Function not found> +ABORTCB <Callback aborted operation> +BADPARAM <Internal Error, Bad parameter to function> +BADORDER <Internal Error, Bad function calling order> +BADPWD <Bad password entered> +MNYREDIR <Too many redirects> +UNKTELNET <Unknown TELNET option specified> +UNKMSG <Unknown message (50)> +BADSSLCERT <Remote peer's SSL certificate wasn't OK> +SRVNOERR <The Server didn't reply anything, which here is considered an error> +MAXMSG <This is the LAST KNOWN MESSAGE, appearantly more have been added> +.END diff --git a/Build/source/libs/curl/src/depend.mak b/Build/source/libs/curl/src/depend.mak new file mode 100644 index 00000000000..b183fa15e86 --- /dev/null +++ b/Build/source/libs/curl/src/depend.mak @@ -0,0 +1,31 @@ +$(objdir)/writeout.obj: \ + $(curldir)/include/curl/curl.h \ + $(curldir)/include/curl/types.h \ + $(curldir)/include/curl/easy.h \ + $(curldir)/include/curl/mprintf.h \ + writeout.h + +$(objdir)/hugehelp.obj: \ + + +$(objdir)/urlglob.obj: \ + setup.h \ + config-win32.h \ + $(gnuw32dir)/win32lib.h \ + $(curldir)/include/curl/curl.h \ + $(curldir)/include/curl/types.h \ + $(curldir)/include/curl/easy.h \ + urlglob.h + +$(objdir)/main.obj: \ + setup.h \ + config-win32.h \ + $(gnuw32dir)/win32lib.h \ + $(curldir)/include/curl/curl.h \ + $(curldir)/include/curl/types.h \ + $(curldir)/include/curl/easy.h \ + $(curldir)/include/curl/mprintf.h \ + urlglob.h \ + writeout.h \ + version.h + diff --git a/Build/source/libs/curl/src/hugehelp.c b/Build/source/libs/curl/src/hugehelp.c new file mode 100644 index 00000000000..bd4b87bc604 --- /dev/null +++ b/Build/source/libs/curl/src/hugehelp.c @@ -0,0 +1,2132 @@ +/* NEVER EVER edit this manually, fix the mkhelp script instead! */ +#include <stdio.h> +void hugehelp(void) +{ +puts ( +" _ _ ____ _ \n" +" Project ___| | | | _ \\| | \n" +" / __| | | | |_) | | \n" +" | (__| |_| | _ <| |___ \n" +" \\___|\\___/|_| \\_\\_____|\n" +"NAME\n" +" curl - transfer a URL\n" +"\n" +"SYNOPSIS\n" +" curl [options] [URL...]\n" +"\n" +"DESCRIPTION\n" +" curl is a client to get documents/files from or send docu\n" +" ments to a server, using any of the supported protocols\n" +); + puts( +" (HTTP, HTTPS, FTP, GOPHER, DICT, TELNET, LDAP or FILE). The\n" +" command is designed to work without user interaction or any\n" +" kind of interactivity.\n" +"\n" +" curl offers a busload of useful tricks like proxy support,\n" +" user authentication, ftp upload, HTTP post, SSL (https:)\n" +" connections, cookies, file transfer resume and more.\n" +"\n" +"URL\n" +" The URL syntax is protocol dependent. You'll find a detailed\n" +" description in RFC 2396.\n" +"\n" +); + puts( +" You can specify multiple URLs or parts of URLs by writing\n" +" part sets within braces as in:\n" +"\n" +" http://site.{one,two,three}.com\n" +"\n" +" or you can get sequences of alphanumeric series by using []\n" +" as in:\n" +"\n" +" ftp://ftp.numericals.com/file[1-100].txt\n" +" ftp://ftp.numericals.com/file[001-100].txt (with leading\n" +" zeros)\n" +" ftp://ftp.letters.com/file[a-z].txt\n" +"\n" +" It is possible to specify up to 9 sets or series for a URL,\n" +); + puts( +" but no nesting is supported at the moment:\n" +"\n" +" http://www.any.org/archive[1996-1999]/vol\n" +" ume[1-4]part{a,b,c,index}.html\n" +"\n" +" You can specify any amount of URLs on the command line. They\n" +" will be fetched in a sequential manner in the specified\n" +" order.\n" +"\n" +" Curl will attempt to re-use connections for multiple file\n" +" transfers, so that getting many files from the same server\n" +" will not do multiple connects / handshakes. This improves\n" +); + puts( +" speed. Of course this is only done on files specified on a\n" +" single command line and cannot be used between separate curl\n" +" invokes.\n" +"OPTIONS\n" +" -a/--append\n" +" (FTP) When used in a ftp upload, this will tell curl to\n" +" append to the target file instead of overwriting it. If\n" +" the file doesn't exist, it will be created.\n" +"\n" +" If this option is used twice, the second one will dis\n" +" able append mode again.\n" +"\n" +" -A/--user-agent <agent string>\n" +); + puts( +" (HTTP) Specify the User-Agent string to send to the\n" +" HTTP server. Some badly done CGIs fail if its not set\n" +" to \"Mozilla/4.0\". To encode blanks in the string, sur\n" +" round the string with single quote marks. This can\n" +" also be set with the -H/--header flag of course.\n" +"\n" +" If this option is set more than once, the last one will\n" +" be the one that's used.\n" +"\n" +" -b/--cookie <name=data>\n" +); + puts( +" (HTTP) Pass the data to the HTTP server as a cookie. It\n" +" is supposedly the data previously received from the\n" +" server in a \"Set-Cookie:\" line. The data should be in\n" +" the format \"NAME1=VALUE1; NAME2=VALUE2\".\n" +"\n" +" If no '=' letter is used in the line, it is treated as\n" +" a filename to use to read previously stored cookie\n" +" lines from, which should be used in this session if\n" +); + puts( +" they match. Using this method also activates the\n" +" \"cookie parser\" which will make curl record incoming\n" +" cookies too, which may be handy if you're using this in\n" +" combination with the -L/--location option. The file\n" +" format of the file to read cookies from should be plain\n" +" HTTP headers or the Netscape/Mozilla cookie file for\n" +" mat.\n" +"\n" +" NOTE that the file specified with -b/--cookie is only\n" +); + puts( +" used as input. No cookies will be stored in the file.\n" +" To store cookies, save the HTTP headers to a file using\n" +" -D/--dump-header!\n" +"\n" +" If this option is set more than once, the last one will\n" +" be the one that's used.\n" +"\n" +" -B/--use-ascii\n" +" Use ASCII transfer when getting an FTP file or LDAP\n" +" info. For FTP, this can also be enforced by using an\n" +" URL that ends with \";type=A\". This option causes data\n" +); + puts( +" sent to stdout to be in text mode for win32 systems.\n" +"\n" +" If this option is used twice, the second one will dis\n" +" able ASCII usage.\n" +" --ciphers <list of ciphers>\n" +" (SSL) Specifies which ciphers to use in the connection.\n" +" The list of ciphers must be using valid ciphers. Read\n" +" up on SSL cipher list details on this URL:\n" +" http://www.openssl.org/docs/apps/ciphers.html (Option\n" +" added in curl 7.9)\n" +"\n" +); + puts( +" If this option is used severl times, the last one will\n" +" override the others.\n" +"\n" +" --connect-timeout <seconds>\n" +" Maximum time in seconds that you allow the connection\n" +" to the server to take. This only limits the connection\n" +" phase, once curl has connected this option is of no\n" +" more use. This option didn't work in win32 systems\n" +" until 7.7.2. See also the --max-time option.\n" +"\n" +); + puts( +" If this option is used several times, the last one will\n" +" be used.\n" +"\n" +" -c/--cookie-jar <file name>\n" +" Specify to which file you want curl to write all cook\n" +" ies after a completed operation. Curl writes all cook\n" +" ies previously read from a specified file as well as\n" +" all cookies received from remote server(s). If no cook\n" +" ies are known, no file will be written. The file will\n" +); + puts( +" be written using the Netscape cookie file format. If\n" +" you set the file name to a single dash, \"-\", the cook\n" +" ies will be written to stdout. (Option added in curl\n" +" 7.9)\n" +"\n" +" If this option is used several times, the last specfied\n" +" file name will be used.\n" +"\n" +" -C/--continue-at <offset>\n" +" Continue/Resume a previous file transfer at the given\n" +" offset. The given offset is the exact number of bytes\n" +); + puts( +" that will be skipped counted from the beginning of the\n" +" source file before it is transfered to the destination.\n" +" If used with uploads, the ftp server command SIZE will\n" +" not be used by curl.\n" +"\n" +" Use \"-C -\" to tell curl to automatically find out\n" +" where/how to resume the transfer. It then uses the\n" +" given output/input files to figure that out.\n" +"\n" +" If this option is used several times, the last one will\n" +); + puts( +" be used.\n" +"\n" +" -d/--data <data>\n" +" (HTTP) Sends the specified data in a POST request to\n" +" the HTTP server, in a way that can emulate as if a user\n" +" has filled in a HTML form and pressed the submit but\n" +" ton. Note that the data is sent exactly as specified\n" +" with no extra processing (with all newlines cut off).\n" +" The data is expected to be \"url-encoded\". This will\n" +); + puts( +" cause curl to pass the data to the server using the\n" +" content-type application/x-www-form-urlencoded. Compare\n" +" to -F. If more than one -d/--data option is used on the\n" +" same command line, the data pieces specified will be\n" +" merged together with a separating &-letter. Thus, using\n" +" '-d name=daniel -d skill=lousy' would generate a post\n" +" chunk that looks like 'name=daniel&skill=lousy'.\n" +"\n" +); + puts( +" If you start the data with the letter @, the rest\n" +" should be a file name to read the data from, or - if\n" +" you want curl to read the data from stdin. The con\n" +" tents of the file must already be url-encoded. Multiple\n" +" files can also be specified. Posting data from a file\n" +" named 'foobar' would thus be done with \"--data @foo\n" +" bar\".\n" +"\n" +" To post data purely binary, you should instead use the\n" +); + puts( +" --data-binary option.\n" +"\n" +" -d/--data is the same as --data-ascii.\n" +"\n" +" If this option is used several times, the ones follow\n" +" ing the first will append data.\n" +"\n" +" --data-ascii <data>\n" +" (HTTP) This is an alias for the -d/--data option.\n" +"\n" +" If this option is used several times, the ones follow\n" +" ing the first will append data.\n" +"\n" +" --data-binary <data>\n" +" (HTTP) This posts data in a similar manner as --data-\n" +); + puts( +" ascii does, although when using this option the entire\n" +" context of the posted data is kept as-is. If you want\n" +" to post a binary file without the strip-newlines fea\n" +" ture of the --data-ascii option, this is for you.\n" +"\n" +" If this option is used several times, the ones follow\n" +" ing the first will append data.\n" +"\n" +" --disable-epsv\n" +" (FTP) Tell curl to disable the use of the EPSV command\n" +); + puts( +" when doing passive FTP downloads. Curl will normally\n" +" always first attempt to use EPSV before PASV, but with\n" +" this option, it will not try using EPSV.\n" +"\n" +" IF this option is used several times, each occurrence\n" +" will toggle this on/off.\n" +" -D/--dump-header <file>\n" +" (HTTP/FTP) Write the HTTP headers to this file. Write\n" +" the FTP file info to this file if -I/--head is used.\n" +"\n" +); + puts( +" This option is handy to use when you want to store the\n" +" cookies that a HTTP site sends to you. The cookies\n" +" could then be read in a second curl invoke by using the\n" +" -b/--cookie option!\n" +"\n" +" If this option is used several times, the last one will\n" +" be used.\n" +"\n" +" -e/--referer <URL>\n" +" (HTTP) Sends the \"Referer Page\" information to the HTTP\n" +" server. This can also be set with the -H/--header flag\n" +); + puts( +" of course. When used with -L/--location you can append\n" +" \";auto\" to the referer URL to make curl automatically\n" +" set the previous URL when it follows a Location:\n" +" header. The \";auto\" string can be used alone, even if\n" +" you don't set an initial referer.\n" +"\n" +" If this option is used several times, the last one will\n" +" be used.\n" +"\n" +" --egd-file <file>\n" +" (HTTPS) Specify the path name to the Entropy Gathering\n" +); + puts( +" Daemon socket. The socket is used to seed the random\n" +" engine for SSL connections. See also the --random-file\n" +" option.\n" +"\n" +" -E/--cert <certificate[:password]>\n" +" (HTTPS) Tells curl to use the specified certificate\n" +" file when getting a file with HTTPS. The certificate\n" +" must be in PEM format. If the optional password isn't\n" +" specified, it will be queried for on the terminal. Note\n" +); + puts( +" that this certificate is the private key and the pri\n" +" vate certificate concatenated!\n" +"\n" +" If this option is used several times, the last one will\n" +" be used.\n" +"\n" +" --cacert <CA certificate>\n" +" (HTTPS) Tells curl to use the specified certificate\n" +" file to verify the peer. The certificate must be in PEM\n" +" format.\n" +"\n" +" If this option is used several times, the last one will\n" +" be used.\n" +"\n" +" -f/--fail\n" +); + puts( +" (HTTP) Fail silently (no output at all) on server\n" +" errors. This is mostly done like this to better enable\n" +" scripts etc to better deal with failed attempts. In\n" +" normal cases when a HTTP server fails to deliver a doc\n" +" ument, it returns a HTML document stating so (which\n" +" often also describes why and more). This flag will pre\n" +" vent curl from outputting that and fail silently\n" +" instead.\n" +"\n" +); + puts( +" If this option is used twice, the second will again\n" +" disable silent failure.\n" +"\n" +" -F/--form <name=content>\n" +" (HTTP) This lets curl emulate a filled in form in which\n" +" a user has pressed the submit button. This causes curl\n" +" to POST data using the content-type multipart/form-data\n" +" according to RFC1867. This enables uploading of binary\n" +" files etc. To force the 'content' part to be be a file,\n" +); + puts( +" prefix the file name with an @ sign. To just get the\n" +" content part from a file, prefix the file name with the\n" +" letter <. The difference between @ and < is then that @\n" +" makes a file get attached in the post as a file upload,\n" +" while the < makes a text field and just get the con\n" +" tents for that text field from a file.\n" +"\n" +" Example, to send your password file to the server,\n" +); + puts( +" where 'password' is the name of the form-field to which\n" +" /etc/passwd will be the input:\n" +"\n" +" curl -F password=@/etc/passwd www.mypasswords.com\n" +"\n" +" To read the file's content from stdin insted of a file,\n" +" use - where the file name should've been. This goes for\n" +" both @ and < constructs.\n" +"\n" +" This option can be used multiple times.\n" +"\n" +" -g/--globoff\n" +" This option switches off the \"URL globbing parser\".\n" +); + puts( +" When you set this option, you can specify URLs that\n" +" contain the letters {}[] without having them being\n" +" interpreted by curl itself. Note that these letters are\n" +" not normal legal URL contents but they should be\n" +" encoded according to the URI standard. (Option added in\n" +" curl 7.6)\n" +"\n" +" -G/--get\n" +" When used, this option will make all data specified\n" +" with -d/--data or --data-binary to be used in a HTTP\n" +); + puts( +" GET request instead of the POST request that otherwise\n" +" would be used. The data will be appended to the URL\n" +" with a '?' separator. (Option added in curl 7.9)\n" +"\n" +" -h/--help\n" +" Usage help.\n" +"\n" +" -H/--header <header>\n" +" (HTTP) Extra header to use when getting a web page. You\n" +" may specify any number of extra headers. Note that if\n" +" you should add a custom header that has the same name\n" +); + puts( +" as one of the internal ones curl would use, your exter\n" +" nally set header will be used instead of the internal\n" +" one. This allows you to make even trickier stuff than\n" +" curl would normally do. You should not replace inter\n" +" nally set headers without knowing perfectly well what\n" +" you're doing. Replacing an internal header with one\n" +" without content on the right side of the colon will\n" +); + puts( +" prevent that header from appearing.\n" +"\n" +" This option can be used multiple times.\n" +"\n" +" -i/--include\n" +" (HTTP) Include the HTTP-header in the output. The HTTP-\n" +" header includes things like server-name, date of the\n" +" document, HTTP-version and more...\n" +"\n" +" If this option is used twice, the second will again\n" +" disable header include.\n" +"\n" +" --interface <name>\n" +" Perform an operation using a specified interface. You\n" +); + puts( +" can enter interface name, IP address or host name. An\n" +" example could look like:\n" +"\n" +" curl --interface eth0:1 http://www.netscape.com/\n" +"\n" +" If this option is used several times, the last one will\n" +" be used.\n" +"\n" +" -I/--head\n" +" (HTTP/FTP) Fetch the HTTP-header only! HTTP-servers\n" +" feature the command HEAD which this uses to get nothing\n" +" but the header of a document. When used on a FTP file,\n" +); + puts( +" curl displays the file size only.\n" +"\n" +" If this option is used twice, the second will again\n" +" disable header only.\n" +"\n" +" --krb4 <level>\n" +" (FTP) Enable kerberos4 authentication and use. The\n" +" level must be entered and should be one of 'clear',\n" +" 'safe', 'confidential' or 'private'. Should you use a\n" +" level that is not one of these, 'private' will instead\n" +" be used.\n" +"\n" +); + puts( +" If this option is used several times, the last one will\n" +" be used.\n" +"\n" +" -K/--config <config file>\n" +" Specify which config file to read curl arguments from.\n" +" The config file is a text file in which command line\n" +" arguments can be written which then will be used as if\n" +" they were written on the actual command line. Options\n" +" and their parameters must be specified on the same con\n" +); + puts( +" fig file line. If the parameter is to contain white\n" +" spaces, the parameter must be inclosed within quotes.\n" +" If the first column of a config line is a '#' charac\n" +" ter, the rest of the line will be treated as a comment.\n" +"\n" +" Specify the filename as '-' to make curl read the file\n" +" from stdin.\n" +"\n" +" This option can be used multiple times.\n" +"\n" +" -l/--list-only\n" +" (FTP) When listing an FTP directory, this switch forces\n" +); + puts( +" a name-only view. Especially useful if you want to\n" +" machine-parse the contents of an FTP directory since\n" +" the normal directory view doesn't use a standard look\n" +" or format.\n" +"\n" +" If this option is used twice, the second will again\n" +" disable list only.\n" +"\n" +" -L/--location\n" +" (HTTP/HTTPS) If the server reports that the requested\n" +" page has a different location (indicated with the\n" +); + puts( +" header line Location:) this flag will let curl attempt\n" +" to reattempt the get on the new place. If used together\n" +" with -i or -I, headers from all requested pages will be\n" +" shown. If this flag is used when making a HTTP POST,\n" +" curl will automatically switch to GET after the initial\n" +" POST has been done.\n" +"\n" +" If this option is used twice, the second will again\n" +" disable location following.\n" +"\n" +" -m/--max-time <seconds>\n" +); + puts( +" Maximum time in seconds that you allow the whole opera\n" +" tion to take. This is useful for preventing your batch\n" +" jobs from hanging for hours due to slow networks or\n" +" links going down. This doesn't work fully in win32\n" +" systems. See also the --connect-timeout option.\n" +"\n" +" If this option is used several times, the last one will\n" +" be used.\n" +"\n" +" -M/--manual\n" +" Manual. Display the huge help text.\n" +"\n" +" -n/--netrc\n" +); + puts( +" Makes curl scan the .netrc file in the user's home\n" +" directory for login name and password. This is typi\n" +" cally used for ftp on unix. If used with http, curl\n" +" will enable user authentication. See netrc(4) or ftp(1)\n" +" for details on the file format. Curl will not complain\n" +" if that file hasn't the right permissions (it should\n" +" not be world nor group readable). The environment vari\n" +); + puts( +" able \"HOME\" is used to find the home directory.\n" +"\n" +" A quick and very simple example of how to setup a\n" +" .netrc to allow curl to ftp to the machine\n" +" host.domain.com with user name 'myself' and password\n" +" 'secret' should look similar to:\n" +"\n" +" machine host.domain.com login myself password secret\n" +"\n" +" If this option is used twice, the second will again\n" +" disable netrc usage.\n" +"\n" +" -N/--no-buffer\n" +); + puts( +" Disables the buffering of the output stream. In normal\n" +" work situations, curl will use a standard buffered out\n" +" put stream that will have the effect that it will out\n" +" put the data in chunks, not necessarily exactly when\n" +" the data arrives. Using this option will disable that\n" +" buffering.\n" +"\n" +" If this option is used twice, the second will again\n" +" switch on buffering.\n" +"\n" +" -o/--output <file>\n" +); + puts( +" Write output to <file> instead of stdout. If you are\n" +" using {} or [] to fetch multiple documents, you can use\n" +" '#' followed by a number in the <file> specifier. That\n" +" variable will be replaced with the current string for\n" +" the URL being fetched. Like in:\n" +"\n" +" curl http://{one,two}.site.com -o \"file_#1.txt\"\n" +"\n" +" or use several variables like:\n" +"\n" +" curl http://{site,host}.host[1-5].com -o \"#1_#2\"\n" +"\n" +); + puts( +" You may use this option as many times as you have num\n" +" ber of URLs.\n" +"\n" +" -O/--remote-name\n" +" Write output to a local file named like the remote file\n" +" we get. (Only the file part of the remote file is used,\n" +" the path is cut off.)\n" +"\n" +" You may use this option as many times as you have num\n" +" ber of URLs.\n" +"\n" +" -p/--proxytunnel\n" +" When an HTTP proxy is used, this option will cause non-\n" +); + puts( +" HTTP protocols to attempt to tunnel through the proxy\n" +" instead of merely using it to do HTTP-like operations.\n" +" The tunnel approach is made with the HTTP proxy CONNECT\n" +" request and requires that the proxy allows direct con\n" +" nect to the remote port number curl wants to tunnel\n" +" through to.\n" +"\n" +" If this option is used twice, the second will again\n" +" disable proxy tunnel.\n" +"\n" +" -P/--ftpport <address>\n" +); + puts( +" (FTP) Reverses the initiator/listener roles when con\n" +" necting with ftp. This switch makes Curl use the PORT\n" +" command instead of PASV. In practice, PORT tells the\n" +" server to connect to the client's specified address and\n" +" port, while PASV asks the server for an ip address and\n" +" port to connect to. <address> should be one of:\n" +"\n" +" interface i.e \"eth0\" to specify which interface's IP\n" +); + puts( +" address you want to use (Unix only)\n" +"\n" +" IP address i.e \"192.168.10.1\" to specify exact IP num\n" +" ber\n" +"\n" +" host name i.e \"my.host.domain\" to specify machine\n" +"\n" +" - (any single-letter string) to make it pick\n" +" the machine's default\n" +"\n" +" If this option is used several times, the last one will be\n" +" used.\n" +"\n" +" -q If used as the first parameter on the command line, the\n" +); + puts( +" $HOME/.curlrc file will not be read and used as a con\n" +" fig file.\n" +"\n" +" -Q/--quote <comand>\n" +" (FTP) Send an arbitrary command to the remote FTP\n" +" server, by using the QUOTE command of the server. Not\n" +" all servers support this command, and the set of QUOTE\n" +" commands are server specific! Quote commands are sent\n" +" BEFORE the transfer is taking place. To make commands\n" +); + puts( +" take place after a successful transfer, prefix them\n" +" with a dash '-'. You may specify any amount of commands\n" +" to be run before and after the transfer. If the server\n" +" returns failure for one of the commands, the entire\n" +" operation will be aborted.\n" +"\n" +" This option can be used multiple times.\n" +"\n" +" --random-file <file>\n" +" (HTTPS) Specify the path name to file containing what\n" +); + puts( +" will be considered as random data. The data is used to\n" +" seed the random engine for SSL connections. See also\n" +" the --edg-file option.\n" +"\n" +" -r/--range <range>\n" +" (HTTP/FTP) Retrieve a byte range (i.e a partial docu\n" +" ment) from a HTTP/1.1 or FTP server. Ranges can be\n" +" specified in a number of ways.\n" +"\n" +" 0-499 specifies the first 500 bytes\n" +"\n" +" 500-999 specifies the second 500 bytes\n" +"\n" +); + puts( +" -500 specifies the last 500 bytes\n" +"\n" +" 9500 specifies the bytes from offset 9500 and for\n" +" ward\n" +"\n" +" 0-0,-1 specifies the first and last byte only(*)(H)\n" +"\n" +" 500-700,600-799\n" +" specifies 300 bytes from offset 500(H)\n" +"\n" +" 100-199,500-599\n" +" specifies two separate 100 bytes ranges(*)(H)\n" +"\n" +" (*) = NOTE that this will cause the server to reply with a\n" +" multipart response!\n" +"\n" +); + puts( +" You should also be aware that many HTTP/1.1 servers do not\n" +" have this feature enabled, so that when you attempt to get a\n" +" range, you'll instead get the whole document.\n" +"\n" +" FTP range downloads only support the simple syntax 'start-\n" +" stop' (optionally with one of the numbers omitted). It\n" +" depends on the non-RFC command SIZE.\n" +"\n" +" If this option is used several times, the last one will be\n" +" used.\n" +"\n" +" -R/--remote-time\n" +); + puts( +" When used, this will make libcurl attempt to figure out\n" +" the timestamp of the remote file, and if that is avail\n" +" able make the local file get that same timestamp.\n" +" If this option is used twice, the second time disables\n" +" this again.\n" +"\n" +" -s/--silent\n" +" Silent mode. Don't show progress meter or error mes\n" +" sages. Makes Curl mute.\n" +"\n" +" If this option is used twice, the second will again\n" +" disable mute.\n" +"\n" +); + puts( +" -S/--show-error\n" +" When used with -s it makes curl show error message if\n" +" it fails.\n" +"\n" +" If this option is used twice, the second will again\n" +" disable show error.\n" +"\n" +" -t/--telnet-option <OPT=val>\n" +" Pass options to the telnet protocol. Supported options\n" +" are:\n" +"\n" +" TTYPE=<term> Sets the terminal type.\n" +"\n" +" XDISPLOC=<X display> Sets the X display location.\n" +"\n" +" NEW_ENV=<var,val> Sets an environment variable.\n" +"\n" +); + puts( +" -T/--upload-file <file>\n" +" This transfers the specified local file to the remote\n" +" URL. If there is no file part in the specified URL,\n" +" Curl will append the local file name. NOTE that you\n" +" must use a trailing / on the last directory to really\n" +" prove to Curl that there is no file name or curl will\n" +" think that your last directory name is the remote file\n" +" name to use. That will most likely cause the upload\n" +); + puts( +" operation to fail. If this is used on a http(s) server,\n" +" the PUT command will be used.\n" +"\n" +" Use the file name \"-\" (a single dash) to use stdin\n" +" instead of a given file.\n" +"\n" +" If this option is used several times, the last one will\n" +" be used.\n" +"\n" +" -u/--user <user:password>\n" +" Specify user and password to use when fetching. See\n" +" README.curl for detailed examples of how to use this.\n" +); + puts( +" If no password is specified, curl will ask for it\n" +" interactively.\n" +"\n" +" If this option is used several times, the last one will\n" +" be used.\n" +" -U/--proxy-user <user:password>\n" +" Specify user and password to use for Proxy authentica\n" +" tion. If no password is specified, curl will ask for it\n" +" interactively.\n" +"\n" +" If this option is used several times, the last one will\n" +" be used.\n" +"\n" +" --url <URL>\n" +); + puts( +" Specify a URL to fetch. This option is mostly handy\n" +" when you want to specify URL(s) in a config file.\n" +"\n" +" This option may be used any number of times. To control\n" +" where this URL is written, use the -o or the -O\n" +" options.\n" +"\n" +" -v/--verbose\n" +" Makes the fetching more verbose/talkative. Mostly\n" +" usable for debugging. Lines starting with '>' means\n" +" data sent by curl, '<' means data received by curl that\n" +); + puts( +" is hidden in normal cases and lines starting with '*'\n" +" means additional info provided by curl.\n" +"\n" +" If this option is used twice, the second will again\n" +" disable verbose.\n" +"\n" +" -V/--version\n" +" Displays the full version of curl, libcurl and other\n" +" 3rd party libraries linked with the executable.\n" +"\n" +" -w/--write-out <format>\n" +" Defines what to display after a completed and success\n" +); + puts( +" ful operation. The format is a string that may contain\n" +" plain text mixed with any number of variables. The\n" +" string can be specified as \"string\", to get read from a\n" +" particular file you specify it \"@filename\" and to tell\n" +" curl to read the format from stdin you write \"@-\".\n" +"\n" +" The variables present in the output format will be sub\n" +" stituted by the value or text that curl thinks fit, as\n" +); + puts( +" described below. All variables are specified like\n" +" %{variable_name} and to output a normal % you just\n" +" write them like %%. You can output a newline by using\n" +" \\n, a carriage return with \\r and a tab space with \\t.\n" +"\n" +" NOTE: The %-letter is a special letter in the\n" +" win32-environment, where all occurrences of % must be\n" +" doubled when using this option.\n" +"\n" +" Available variables are at this point:\n" +"\n" +); + puts( +" url_effective The URL that was fetched last. This is\n" +" mostly meaningful if you've told curl to\n" +" follow location: headers.\n" +"\n" +" http_code The numerical code that was found in the\n" +" last retrieved HTTP(S) page.\n" +"\n" +" time_total The total time, in seconds, that the\n" +" full operation lasted. The time will be\n" +); + puts( +" displayed with millisecond resolution.\n" +"\n" +" time_namelookup\n" +" The time, in seconds, it took from the\n" +" start until the name resolving was com\n" +" pleted.\n" +"\n" +" time_connect The time, in seconds, it took from the\n" +" start until the connect to the remote\n" +" host (or proxy) was completed.\n" +"\n" +" time_pretransfer\n" +); + puts( +" The time, in seconds, it took from the\n" +" start until the file transfer is just\n" +" about to begin. This includes all pre-\n" +" transfer commands and negotiations that\n" +" are specific to the particular proto\n" +" col(s) involved.\n" +"\n" +" time_starttransfer\n" +" The time, in seconds, it took from the\n" +); + puts( +" start until the first byte is just about\n" +" to be transfered. This includes\n" +" time_pretransfer and also the time the\n" +" server needs to calculate the result.\n" +"\n" +" size_download The total amount of bytes that were\n" +" downloaded.\n" +"\n" +" size_upload The total amount of bytes that were\n" +" uploaded.\n" +"\n" +); + puts( +" size_header The total amount of bytes of the down\n" +" loaded headers.\n" +"\n" +" size_request The total amount of bytes that were sent\n" +" in the HTTP request.\n" +"\n" +" speed_download The average download speed that curl\n" +" measured for the complete download.\n" +"\n" +" speed_upload The average upload speed that curl mea\n" +" sured for the complete upload.\n" +); + puts( +" content_type The Content-Type of the requested docu\n" +" ment, if there was any. (Added in 7.9.5)\n" +"\n" +" If this option is used several times, the last one will be\n" +" used.\n" +"\n" +" -x/--proxy <proxyhost[:port]>\n" +" Use specified HTTP proxy. If the port number is not\n" +" specified, it is assumed at port 1080.\n" +"\n" +" Note that all operations that are performed over a HTTP\n" +" proxy will transparantly be converted to HTTP. It means\n" +); + puts( +" that certain protocol specific operations might not be\n" +" available. This is not the case if you can tunnel\n" +" through the proxy, as done with the -p/--proxytunnel\n" +" option.\n" +"\n" +" If this option is used several times, the last one will\n" +" be used.\n" +"\n" +" -X/--request <command>\n" +" (HTTP) Specifies a custom request to use when communi\n" +" cating with the HTTP server. The specified request\n" +); + puts( +" will be used instead of the standard GET. Read the HTTP\n" +" 1.1 specification for details and explanations.\n" +"\n" +" (FTP) Specifies a custom FTP command to use instead of\n" +" LIST when doing file lists with ftp.\n" +"\n" +" If this option is used several times, the last one will\n" +" be used.\n" +"\n" +" -y/--speed-time <time>\n" +" If a download is slower than speed-limit bytes per sec\n" +" ond during a speed-time period, the download gets\n" +); + puts( +" aborted. If speed-time is used, the default speed-limit\n" +" will be 1 unless set with -y.\n" +"\n" +" If this option is used several times, the last one will\n" +" be used.\n" +"\n" +" -Y/--speed-limit <speed>\n" +" If a download is slower than this given speed, in bytes\n" +" per second, for speed-time seconds it gets aborted.\n" +" speed-time is set with -Y and is 30 if not set.\n" +"\n" +" If this option is used several times, the last one will\n" +" be used.\n" +"\n" +); + puts( +" -z/--time-cond <date expression>\n" +" (HTTP) Request to get a file that has been modified\n" +" later than the given time and date, or one that has\n" +" been modified before that time. The date expression can\n" +" be all sorts of date strings or if it doesn't match any\n" +" internal ones, it tries to get the time from a given\n" +" file name instead! See the GNU date(1) or curl_get\n" +" date(3) man pages for date expression details.\n" +"\n" +); + puts( +" Start the date expression with a dash (-) to make it\n" +" request for a document that is older than the given\n" +" date/time, default is a document that is newer than the\n" +" specified date/time.\n" +"\n" +" If this option is used several times, the last one will\n" +" be used.\n" +"\n" +" -3/--sslv3\n" +" (HTTPS) Forces curl to use SSL version 3 when negotiat\n" +" ing with a remote SSL server.\n" +"\n" +" -2/--sslv2\n" +); + puts( +" (HTTPS) Forces curl to use SSL version 2 when negotiat\n" +" ing with a remote SSL server.\n" +"\n" +" -0/--http1.0\n" +" (HTTP) Forces curl to issue its requests using HTTP 1.0\n" +" instead of using its internally preferred: HTTP 1.1.\n" +"\n" +" -#/--progress-bar\n" +" Make curl display progress information as a progress\n" +" bar instead of the default statistics.\n" +"\n" +" If this option is used twice, the second will again\n" +" disable the progress bar.\n" +"\n" +); + puts( +" --crlf\n" +" (FTP) Convert LF to CRLF in upload. Useful for MVS\n" +" (OS/390).\n" +"\n" +" If this option is used twice, the second will again\n" +" disable crlf converting.\n" +"\n" +" --stderr <file>\n" +" Redirect all writes to stderr to the specified file\n" +" instead. If the file name is a plain '-', it is instead\n" +" written to stdout. This option has no point when you're\n" +" using a shell with decent redirecting capabilities.\n" +"\n" +); + puts( +" If this option is used several times, the last one will\n" +" be used.\n" +"\n" +"FILES\n" +" ~/.curlrc\n" +" Default config file.\n" +"ENVIRONMENT\n" +" http_proxy [protocol://]<host>[:port]\n" +" Sets proxy server to use for HTTP.\n" +"\n" +" HTTPS_PROXY [protocol://]<host>[:port]\n" +" Sets proxy server to use for HTTPS.\n" +"\n" +" FTP_PROXY [protocol://]<host>[:port]\n" +" Sets proxy server to use for FTP.\n" +"\n" +" GOPHER_PROXY [protocol://]<host>[:port]\n" +); + puts( +" Sets proxy server to use for GOPHER.\n" +"\n" +" ALL_PROXY [protocol://]<host>[:port]\n" +" Sets proxy server to use if no protocol-specific proxy\n" +" is set.\n" +"\n" +" NO_PROXY <comma-separated list of hosts>\n" +" list of host names that shouldn't go through any proxy.\n" +" If set to a asterisk\n" +"\n" +"EXIT CODES\n" +" There exists a bunch of different error codes and their cor\n" +" responding error messages that may appear during bad condi\n" +); + puts( +" tions. At the time of this writing, the exit codes are:\n" +"\n" +" 1 Unsupported protocol. This build of curl has no support\n" +" for this protocol.\n" +"\n" +" 2 Failed to initialize.\n" +"\n" +" 3 URL malformat. The syntax was not correct.\n" +"\n" +" 4 URL user malformatted. The user-part of the URL syntax\n" +" was not correct.\n" +"\n" +" 5 Couldn't resolve proxy. The given proxy host could not\n" +" be resolved.\n" +"\n" +" 6 Couldn't resolve host. The given remote host was not\n" +); + puts( +" resolved.\n" +"\n" +" 7 Failed to connect to host.\n" +"\n" +" 8 FTP weird server reply. The server sent data curl\n" +" couldn't parse.\n" +"\n" +" 9 FTP access denied. The server denied login.\n" +"\n" +" 10 FTP user/password incorrect. Either one or both were\n" +" not accepted by the server.\n" +" 11 FTP weird PASS reply. Curl couldn't parse the reply\n" +" sent to the PASS request.\n" +"\n" +" 12 FTP weird USER reply. Curl couldn't parse the reply\n" +); + puts( +" sent to the USER request.\n" +"\n" +" 13 FTP weird PASV reply, Curl couldn't parse the reply\n" +" sent to the PASV request.\n" +"\n" +" 14 FTP weird 227 format. Curl couldn't parse the 227-line\n" +" the server sent.\n" +"\n" +" 15 FTP can't get host. Couldn't resolve the host IP we got\n" +" in the 227-line.\n" +"\n" +" 16 FTP can't reconnect. Couldn't connect to the host we\n" +" got in the 227-line.\n" +"\n" +" 17 FTP couldn't set binary. Couldn't change transfer\n" +); + puts( +" method to binary.\n" +"\n" +" 18 Partial file. Only a part of the file was transfered.\n" +"\n" +" 19 FTP couldn't RETR file. The RETR command failed.\n" +"\n" +" 20 FTP write error. The transfer was reported bad by the\n" +" server.\n" +"\n" +" 21 FTP quote error. A quote command returned error from\n" +" the server.\n" +"\n" +" 22 HTTP not found. The requested page was not found. This\n" +" return code only appears if --fail is used.\n" +"\n" +); + puts( +" 23 Write error. Curl couldn't write data to a local\n" +" filesystem or similar.\n" +"\n" +" 24 Malformat user. User name badly specified.\n" +"\n" +" 25 FTP couldn't STOR file. The server denied the STOR\n" +" operation.\n" +"\n" +" 26 Read error. Various reading problems.\n" +"\n" +" 27 Out of memory. A memory allocation request failed.\n" +"\n" +" 28 Operation timeout. The specified time-out period was\n" +" reached according to the conditions.\n" +"\n" +); + puts( +" 29 FTP couldn't set ASCII. The server returned an unknown\n" +" reply.\n" +" 30 FTP PORT failed. The PORT command failed.\n" +"\n" +" 31 FTP couldn't use REST. The REST command failed.\n" +"\n" +" 32 FTP couldn't use SIZE. The SIZE command failed. The\n" +" command is an extension to the original FTP spec RFC\n" +" 959.\n" +"\n" +" 33 HTTP range error. The range \"command\" didn't work.\n" +"\n" +" 34 HTTP post error. Internal post-request generation\n" +" error.\n" +"\n" +); + puts( +" 35 SSL connect error. The SSL handshaking failed.\n" +"\n" +" 36 FTP bad download resume. Couldn't continue an earlier\n" +" aborted download.\n" +"\n" +" 37 FILE couldn't read file. Failed to open the file. Per\n" +" missions?\n" +"\n" +" 38 LDAP cannot bind. LDAP bind operation failed.\n" +"\n" +" 39 LDAP search failed.\n" +"\n" +" 40 Library not found. The LDAP library was not found.\n" +"\n" +" 41 Function not found. A required LDAP function was not\n" +" found.\n" +"\n" +); + puts( +" 42 Aborted by callback. An application told curl to abort\n" +" the operation.\n" +"\n" +" 43 Internal error. A function was called with a bad param\n" +" eter.\n" +"\n" +" 44 Internal error. A function was called in a bad order.\n" +"\n" +" 45 Interface error. A specified outgoing interface could\n" +" not be used.\n" +"\n" +" 46 Bad password entered. An error was signaled when the\n" +" password was entered.\n" +"\n" +" 47 Too many redirects. When following redirects, curl hit\n" +); + puts( +" the maximum amount.\n" +"\n" +" 48 Unknown TELNET option specified.\n" +"\n" +" 49 Malformed telnet option.\n" +"\n" +" 51 The remote peer's SSL certificate wasn't ok\n" +" 52 The server didn't reply anything, which here is consid\n" +" ered an error.\n" +"\n" +" XX There will appear more error codes here in future\n" +" releases. The existing ones are meant to never change.\n" +"\n" +"BUGS\n" +" If you do find bugs, mail them to curl-bug@haxx.se.\n" +"\n" +"AUTHORS / CONTRIBUTORS\n" +); + puts( +" Daniel Stenberg is the main author, but the whole list of\n" +" contributors is found in the separate THANKS file.\n" +"\n" +"WWW\n" +" http://curl.haxx.se\n" +"\n" +"FTP\n" +" ftp://ftp.sunet.se/pub/www/utilities/curl/\n" +"\n" +"SEE ALSO\n" +" ftp(1), wget(1), snarf(1)\n" +"\n" +"LATEST VERSION\n" +"\n" +" You always find news about what's going on as well as the latest versions\n" +" from the curl web pages, located at:\n" +"\n" +" http://curl.haxx.se\n" +"\n" +"SIMPLE USAGE\n" +"\n" +" Get the main page from netscape's web-server:\n" +"\n" +); + puts( +" curl http://www.netscape.com/\n" +"\n" +" Get the root README file from funet's ftp-server:\n" +"\n" +" curl ftp://ftp.funet.fi/README\n" +"\n" +" Get a web page from a server using port 8000:\n" +"\n" +" curl http://www.weirdserver.com:8000/\n" +"\n" +" Get a list of the root directory of an FTP site:\n" +"\n" +" curl ftp://cool.haxx.se/\n" +"\n" +" Get a gopher document from funet's gopher server:\n" +"\n" +" curl gopher://gopher.funet.fi\n" +"\n" +" Get the definition of curl from a dictionary:\n" +"\n" +" curl dict://dict.org/m:curl\n" +"\n" +); + puts( +" Fetch two documents at once:\n" +"\n" +" curl ftp://cool.haxx.se/ http://www.weirdserver.com:8000/\n" +"\n" +"DOWNLOAD TO A FILE\n" +"\n" +" Get a web page and store in a local file:\n" +"\n" +" curl -o thatpage.html http://www.netscape.com/\n" +"\n" +" Get a web page and store in a local file, make the local file get the name\n" +" of the remote document (if no file name part is specified in the URL, this\n" +" will fail):\n" +"\n" +" curl -O http://www.netscape.com/index.html\n" +"\n" +" Fetch two files and store them with their remote names:\n" +"\n" +); + puts( +" curl -O www.haxx.se/index.html -O curl.haxx.se/download.html\n" +"\n" +"USING PASSWORDS\n" +"\n" +" FTP\n" +"\n" +" To ftp files using name+passwd, include them in the URL like:\n" +"\n" +" curl ftp://name:passwd@machine.domain:port/full/path/to/file\n" +"\n" +" or specify them with the -u flag like\n" +"\n" +" curl -u name:passwd ftp://machine.domain:port/full/path/to/file\n" +"\n" +" HTTP\n" +"\n" +" The HTTP URL doesn't support user and password in the URL string. Curl\n" +); + puts( +" does support that anyway to provide a ftp-style interface and thus you can\n" +" pick a file like:\n" +"\n" +" curl http://name:passwd@machine.domain/full/path/to/file\n" +"\n" +" or specify user and password separately like in\n" +"\n" +" curl -u name:passwd http://machine.domain/full/path/to/file\n" +"\n" +" NOTE! Since HTTP URLs don't support user and password, you can't use that\n" +" style when using Curl via a proxy. You _must_ use the -u style fetch\n" +" during such circumstances.\n" +"\n" +" HTTPS\n" +"\n" +); + puts( +" Probably most commonly used with private certificates, as explained below.\n" +"\n" +" GOPHER\n" +"\n" +" Curl features no password support for gopher.\n" +"\n" +"PROXY\n" +"\n" +" Get an ftp file using a proxy named my-proxy that uses port 888:\n" +"\n" +" curl -x my-proxy:888 ftp://ftp.leachsite.com/README\n" +"\n" +" Get a file from a HTTP server that requires user and password, using the\n" +" same proxy as above:\n" +"\n" +" curl -u user:passwd -x my-proxy:888 http://www.get.this/\n" +"\n" +); + puts( +" Some proxies require special authentication. Specify by using -U as above:\n" +"\n" +" curl -U user:passwd -x my-proxy:888 http://www.get.this/\n" +"\n" +" See also the environment variables Curl support that offer further proxy\n" +" control.\n" +"\n" +"RANGES\n" +"\n" +" With HTTP 1.1 byte-ranges were introduced. Using this, a client can request\n" +" to get only one or more subparts of a specified document. Curl supports\n" +" this with the -r flag.\n" +"\n" +" Get the first 100 bytes of a document:\n" +"\n" +" curl -r 0-99 http://www.get.this/\n" +"\n" +); + puts( +" Get the last 500 bytes of a document:\n" +"\n" +" curl -r -500 http://www.get.this/\n" +"\n" +" Curl also supports simple ranges for FTP files as well. Then you can only\n" +" specify start and stop position.\n" +"\n" +" Get the first 100 bytes of a document using FTP:\n" +"\n" +" curl -r 0-99 ftp://www.get.this/README \n" +"\n" +"UPLOADING\n" +"\n" +" FTP\n" +"\n" +" Upload all data on stdin to a specified ftp site:\n" +"\n" +" curl -T - ftp://ftp.upload.com/myfile\n" +"\n" +" Upload data from a specified file, login with user and password:\n" +"\n" +); + puts( +" curl -T uploadfile -u user:passwd ftp://ftp.upload.com/myfile\n" +"\n" +" Upload a local file to the remote site, and use the local file name remote\n" +" too:\n" +" \n" +" curl -T uploadfile -u user:passwd ftp://ftp.upload.com/\n" +"\n" +" Upload a local file to get appended to the remote file using ftp:\n" +"\n" +" curl -T localfile -a ftp://ftp.upload.com/remotefile\n" +"\n" +" Curl also supports ftp upload through a proxy, but only if the proxy is\n" +); + puts( +" configured to allow that kind of tunneling. If it does, you can run curl in\n" +" a fashion similar to:\n" +"\n" +" curl --proxytunnel -x proxy:port -T localfile ftp.upload.com\n" +"\n" +" HTTP\n" +"\n" +" Upload all data on stdin to a specified http site:\n" +"\n" +" curl -T - http://www.upload.com/myfile\n" +"\n" +" Note that the http server must've been configured to accept PUT before this\n" +" can be done successfully.\n" +"\n" +" For other ways to do http data upload, see the POST section below.\n" +"\n" +"VERBOSE / DEBUG\n" +"\n" +); + puts( +" If curl fails where it isn't supposed to, if the servers don't let you\n" +" in, if you can't understand the responses: use the -v flag to get VERBOSE\n" +" fetching. Curl will output lots of info and all data it sends and\n" +" receives in order to let the user see all client-server interaction.\n" +"\n" +" curl -v ftp://ftp.upload.com/\n" +"\n" +"DETAILED INFORMATION\n" +"\n" +" Different protocols provide different ways of getting detailed information\n" +); + puts( +" about specific files/documents. To get curl to show detailed information\n" +" about a single file, you should use -I/--head option. It displays all\n" +" available info on a single file for HTTP and FTP. The HTTP information is a\n" +" lot more extensive.\n" +"\n" +" For HTTP, you can get the header information (the same as -I would show)\n" +" shown before the data by using -i/--include. Curl understands the\n" +" -D/--dump-header option when getting files from both FTP and HTTP, and it\n" +); + puts( +" will then store the headers in the specified file.\n" +"\n" +" Store the HTTP headers in a separate file (headers.txt in the example):\n" +"\n" +" curl --dump-header headers.txt curl.haxx.se\n" +"\n" +" Note that headers stored in a separate file can be very useful at a later\n" +" time if you want curl to use cookies sent by the server. More about that in\n" +" the cookies section.\n" +"\n" +"POST (HTTP)\n" +"\n" +" It's easy to post data using curl. This is done using the -d <data>\n" +" option. The post data must be urlencoded.\n" +"\n" +); + puts( +" Post a simple \"name\" and \"phone\" guestbook.\n" +"\n" +" curl -d \"name=Rafael%20Sagula&phone=3320780\" \\\n" +" http://www.where.com/guest.cgi\n" +"\n" +" How to post a form with curl, lesson #1:\n" +"\n" +" Dig out all the <input> tags in the form that you want to fill in. (There's\n" +" a perl program called formfind.pl on the curl site that helps with this).\n" +"\n" +" If there's a \"normal\" post, you use -d to post. -d takes a full \"post\n" +" string\", which is in the format\n" +"\n" +); + puts( +" <variable1>=<data1>&<variable2>=<data2>&...\n" +"\n" +" The 'variable' names are the names set with \"name=\" in the <input> tags, and\n" +" the data is the contents you want to fill in for the inputs. The data *must*\n" +" be properly URL encoded. That means you replace space with + and that you\n" +" write weird letters with %XX where XX is the hexadecimal representation of\n" +" the letter's ASCII code.\n" +"\n" +" Example:\n" +"\n" +" (page located at http://www.formpost.com/getthis/\n" +"\n" +); + puts( +" <form action=\"post.cgi\" method=\"post\">\n" +" <input name=user size=10>\n" +" <input name=pass type=password size=10>\n" +" <input name=id type=hidden value=\"blablabla\">\n" +" <input name=ding value=\"submit\">\n" +" </form>\n" +"\n" +" We want to enter user 'foobar' with password '12345'.\n" +"\n" +" To post to this, you enter a curl command line like:\n" +"\n" +" curl -d \"user=foobar&pass=12345&id=blablabla&dig=submit\" (continues)\n" +" http://www.formpost.com/getthis/post.cgi\n" +"\n" +"\n" +); + puts( +" While -d uses the application/x-www-form-urlencoded mime-type, generally\n" +" understood by CGI's and similar, curl also supports the more capable\n" +" multipart/form-data type. This latter type supports things like file upload.\n" +"\n" +" -F accepts parameters like -F \"name=contents\". If you want the contents to\n" +" be read from a file, use <@filename> as contents. When specifying a file,\n" +" you can also specify the file content type by appending ';type=<mime type>'\n" +); + puts( +" to the file name. You can also post the contents of several files in one\n" +" field. For example, the field name 'coolfiles' is used to send three files,\n" +" with different content types using the following syntax:\n" +"\n" +" curl -F \"coolfiles=@fil1.gif;type=image/gif,fil2.txt,fil3.html\" \\\n" +" http://www.post.com/postit.cgi\n" +"\n" +" If the content-type is not specified, curl will try to guess from the file\n" +" extension (it only knows a few), or use the previously specified type (from\n" +); + puts( +" an earlier file if several files are specified in a list) or else it will\n" +" using the default type 'text/plain'.\n" +"\n" +" Emulate a fill-in form with -F. Let's say you fill in three fields in a\n" +" form. One field is a file name which to post, one field is your name and one\n" +" field is a file description. We want to post the file we have written named\n" +" \"cooltext.txt\". To let curl do the posting of this data instead of your\n" +" favourite browser, you have to read the HTML source of the form page and\n" +); + puts( +" find the names of the input fields. In our example, the input field names\n" +" are 'file', 'yourname' and 'filedescription'.\n" +"\n" +" curl -F \"file=@cooltext.txt\" -F \"yourname=Daniel\" \\\n" +" -F \"filedescription=Cool text file with cool text inside\" \\\n" +" http://www.post.com/postit.cgi\n" +"\n" +" To send two files in one post you can do it in two ways:\n" +"\n" +" 1. Send multiple files in a single \"field\" with a single field name:\n" +" \n" +" curl -F \"pictures=@dog.gif,cat.gif\" \n" +" \n" +); + puts( +" 2. Send two fields with two field names: \n" +"\n" +" curl -F \"docpicture=@dog.gif\" -F \"catpicture=@cat.gif\" \n" +"\n" +"REFERRER\n" +"\n" +" A HTTP request has the option to include information about which address\n" +" that referred to actual page. Curl allows you to specify the\n" +" referrer to be used on the command line. It is especially useful to\n" +" fool or trick stupid servers or CGI scripts that rely on that information\n" +" being available or contain certain data.\n" +"\n" +); + puts( +" curl -e www.coolsite.com http://www.showme.com/\n" +"\n" +" NOTE: The referer field is defined in the HTTP spec to be a full URL.\n" +"\n" +"USER AGENT\n" +"\n" +" A HTTP request has the option to include information about the browser\n" +" that generated the request. Curl allows it to be specified on the command\n" +" line. It is especially useful to fool or trick stupid servers or CGI\n" +" scripts that only accept certain browsers.\n" +"\n" +" Example:\n" +"\n" +" curl -A 'Mozilla/3.0 (Win95; I)' http://www.nationsbank.com/\n" +"\n" +); + puts( +" Other common strings:\n" +" 'Mozilla/3.0 (Win95; I)' Netscape Version 3 for Windows 95\n" +" 'Mozilla/3.04 (Win95; U)' Netscape Version 3 for Windows 95\n" +" 'Mozilla/2.02 (OS/2; U)' Netscape Version 2 for OS/2\n" +" 'Mozilla/4.04 [en] (X11; U; AIX 4.2; Nav)' NS for AIX\n" +" 'Mozilla/4.05 [en] (X11; U; Linux 2.0.32 i586)' NS for Linux\n" +"\n" +" Note that Internet Explorer tries hard to be compatible in every way:\n" +" 'Mozilla/4.0 (compatible; MSIE 4.01; Windows 95)' MSIE for W95\n" +); + puts( +"\n" +" Mozilla is not the only possible User-Agent name:\n" +" 'Konqueror/1.0' KDE File Manager desktop client\n" +" 'Lynx/2.7.1 libwww-FM/2.14' Lynx command line browser\n" +"\n" +"COOKIES\n" +"\n" +" Cookies are generally used by web servers to keep state information at the\n" +" client's side. The server sets cookies by sending a response line in the\n" +" headers that looks like 'Set-Cookie: <data>' where the data part then\n" +" typically contains a set of NAME=VALUE pairs (separated by semicolons ';'\n" +); + puts( +" like \"NAME1=VALUE1; NAME2=VALUE2;\"). The server can also specify for what\n" +" path the \"cookie\" should be used for (by specifying \"path=value\"), when the\n" +" cookie should expire (\"expire=DATE\"), for what domain to use it\n" +" (\"domain=NAME\") and if it should be used on secure connections only\n" +" (\"secure\").\n" +"\n" +" If you've received a page from a server that contains a header like:\n" +" Set-Cookie: sessionid=boo123; path=\"/foo\";\n" +"\n" +); + puts( +" it means the server wants that first pair passed on when we get anything in\n" +" a path beginning with \"/foo\".\n" +"\n" +" Example, get a page that wants my name passed in a cookie:\n" +"\n" +" curl -b \"name=Daniel\" www.sillypage.com\n" +"\n" +" Curl also has the ability to use previously received cookies in following\n" +" sessions. If you get cookies from a server and store them in a file in a\n" +" manner similar to:\n" +"\n" +" curl --dump-header headers www.example.com\n" +"\n" +); + puts( +" ... you can then in a second connect to that (or another) site, use the\n" +" cookies from the 'headers' file like:\n" +"\n" +" curl -b headers www.example.com\n" +"\n" +" Note that by specifying -b you enable the \"cookie awareness\" and with -L\n" +" you can make curl follow a location: (which often is used in combination\n" +" with cookies). So that if a site sends cookies and a location, you can\n" +" use a non-existing file to trigger the cookie awareness like:\n" +"\n" +" curl -L -b empty.txt www.example.com\n" +"\n" +); + puts( +" The file to read cookies from must be formatted using plain HTTP headers OR\n" +" as netscape's cookie file. Curl will determine what kind it is based on the\n" +" file contents. In the above command, curl will parse the header and store\n" +" the cookies received from www.example.com. curl will send to the server the\n" +" stored cookies which match the request as it follows the location. The\n" +" file \"empty.txt\" may be a non-existant file.\n" +" \n" +"\n" +"PROGRESS METER\n" +"\n" +); + puts( +" The progress meter exists to show a user that something actually is\n" +" happening. The different fields in the output have the following meaning:\n" +"\n" +" % Total % Received % Xferd Average Speed Time Curr.\n" +" Dload Upload Total Current Left Speed\n" +" 0 151M 0 38608 0 0 9406 0 4:41:43 0:00:04 4:41:39 9287\n" +"\n" +" From left-to-right:\n" +" % - percentage completed of the whole transfer\n" +); + puts( +" Total - total size of the whole expected transfer\n" +" % - percentage completed of the download\n" +" Received - currently downloaded amount of bytes\n" +" % - percentage completed of the upload\n" +" Xferd - currently uploaded amount of bytes\n" +" Average Speed\n" +" Dload - the average transfer speed of the download\n" +" Average Speed\n" +" Upload - the average transfer speed of the upload\n" +" Time Total - expected time to complete the operation\n" +); + puts( +" Time Current - time passed since the invoke\n" +" Time Left - expected time left to completetion\n" +" Curr.Speed - the average transfer speed the last 5 seconds (the first\n" +" 5 seconds of a transfer is based on less time of course.)\n" +"\n" +" The -# option will display a totally different progress bar that doesn't\n" +" need much explanation!\n" +"\n" +"SPEED LIMIT\n" +"\n" +" Curl allows the user to set the transfer speed conditions that must be met\n" +); + puts( +" to let the transfer keep going. By using the switch -y and -Y you\n" +" can make curl abort transfers if the transfer speed is below the specified\n" +" lowest limit for a specified time.\n" +"\n" +" To have curl abort the download if the speed is slower than 3000 bytes per\n" +" second for 1 minute, run:\n" +"\n" +" curl -y 3000 -Y 60 www.far-away-site.com\n" +"\n" +" This can very well be used in combination with the overall time limit, so\n" +" that the above operatioin must be completed in whole within 30 minutes:\n" +"\n" +); + puts( +" curl -m 1800 -y 3000 -Y 60 www.far-away-site.com\n" +"\n" +"CONFIG FILE\n" +"\n" +" Curl automatically tries to read the .curlrc file (or _curlrc file on win32\n" +" systems) from the user's home dir on startup.\n" +"\n" +" The config file could be made up with normal command line switches, but you\n" +" can also specify the long options without the dashes to make it more\n" +" readable. You can separate the options and the parameter with spaces, or\n" +" with = or :. Comments can be used within the file. If the first letter on a\n" +); + puts( +" line is a '#'-letter the rest of the line is treated as a comment.\n" +"\n" +" If you want the parameter to contain spaces, you must inclose the entire\n" +" parameter within double quotes (\"). Within those quotes, you specify a\n" +" quote as \\\".\n" +"\n" +" NOTE: You must specify options and their arguments on the same line.\n" +"\n" +" Example, set default time out and proxy in a config file:\n" +"\n" +" # We want a 30 minute timeout:\n" +" -m 1800\n" +" # ... and we use a proxy for all accesses:\n" +); + puts( +" proxy = proxy.our.domain.com:8080\n" +"\n" +" White spaces ARE significant at the end of lines, but all white spaces\n" +" leading up to the first characters of each line are ignored.\n" +"\n" +" Prevent curl from reading the default file by using -q as the first command\n" +" line parameter, like:\n" +"\n" +" curl -q www.thatsite.com\n" +"\n" +" Force curl to get and display a local help page in case it is invoked\n" +" without URL by making a config file similar to:\n" +"\n" +" # default url to get\n" +); + puts( +" url = \"http://help.with.curl.com/curlhelp.html\"\n" +"\n" +" You can specify another config file to be read by using the -K/--config\n" +" flag. If you set config file name to \"-\" it'll read the config from stdin,\n" +" which can be handy if you want to hide options from being visible in process\n" +" tables etc:\n" +"\n" +" echo \"user = user:passwd\" | curl -K - http://that.secret.site.com\n" +"\n" +"EXTRA HEADERS\n" +"\n" +" When using curl in your own very special programs, you may end up needing\n" +); + puts( +" to pass on your own custom headers when getting a web page. You can do\n" +" this by using the -H flag.\n" +"\n" +" Example, send the header \"X-you-and-me: yes\" to the server when getting a\n" +" page:\n" +"\n" +" curl -H \"X-you-and-me: yes\" www.love.com\n" +"\n" +" This can also be useful in case you want curl to send a different text in a\n" +" header than it normally does. The -H header you specify then replaces the\n" +" header curl would normally send. If you replace an internal header with an\n" +); + puts( +" empty one, you prevent that header from being sent. To prevent the Host:\n" +" header from being used:\n" +"\n" +" curl -H \"Host:\" www.server.com\n" +"\n" +"FTP and PATH NAMES\n" +"\n" +" Do note that when getting files with the ftp:// URL, the given path is\n" +" relative the directory you enter. To get the file 'README' from your home\n" +" directory at your ftp site, do:\n" +"\n" +" curl ftp://user:passwd@my.site.com/README\n" +"\n" +" But if you want the README file from the root directory of that very same\n" +); + puts( +" site, you need to specify the absolute file name:\n" +"\n" +" curl ftp://user:passwd@my.site.com//README\n" +"\n" +" (I.e with an extra slash in front of the file name.)\n" +"\n" +"FTP and firewalls\n" +"\n" +" The FTP protocol requires one of the involved parties to open a second\n" +" connction as soon as data is about to get transfered. There are two ways to\n" +" do this.\n" +"\n" +" The default way for curl is to issue the PASV command which causes the\n" +" server to open another port and await another connection performed by the\n" +); + puts( +" client. This is good if the client is behind a firewall that don't allow\n" +" incoming connections.\n" +"\n" +" curl ftp.download.com\n" +"\n" +" If the server for example, is behind a firewall that don't allow connections\n" +" on other ports than 21 (or if it just doesn't support the PASV command), the\n" +" other way to do it is to use the PORT command and instruct the server to\n" +" connect to the client on the given (as parameters to the PORT command) IP\n" +" number and port.\n" +"\n" +); + puts( +" The -P flag to curl supports a few different options. Your machine may have\n" +" several IP-addresses and/or network interfaces and curl allows you to select\n" +" which of them to use. Default address can also be used:\n" +"\n" +" curl -P - ftp.download.com\n" +"\n" +" Download with PORT but use the IP address of our 'le0' interface (this does\n" +" not work on windows):\n" +"\n" +" curl -P le0 ftp.download.com\n" +"\n" +" Download with PORT but use 192.168.0.10 as our IP address to use:\n" +"\n" +); + puts( +" curl -P 192.168.0.10 ftp.download.com\n" +"\n" +"NETWORK INTERFACE\n" +"\n" +" Get a web page from a server using a specified port for the interface:\n" +"\n" +" curl --interface eth0:1 http://www.netscape.com/\n" +"\n" +" or\n" +"\n" +" curl --interface 192.168.1.10 http://www.netscape.com/\n" +"\n" +"HTTPS\n" +"\n" +" Secure HTTP requires SSL libraries to be installed and used when curl is\n" +" built. If that is done, curl is capable of retrieving and posting documents\n" +" using the HTTPS procotol.\n" +"\n" +" Example:\n" +"\n" +" curl https://www.secure-site.com\n" +"\n" +); + puts( +" Curl is also capable of using your personal certificates to get/post files\n" +" from sites that require valid certificates. The only drawback is that the\n" +" certificate needs to be in PEM-format. PEM is a standard and open format to\n" +" store certificates with, but it is not used by the most commonly used\n" +" browsers (Netscape and MSEI both use the so called PKCS#12 format). If you\n" +" want curl to use the certificates you use with your (favourite) browser, you\n" +); + puts( +" may need to download/compile a converter that can convert your browser's\n" +" formatted certificates to PEM formatted ones. This kind of converter is\n" +" included in recent versions of OpenSSL, and for older versions Dr Stephen\n" +" N. Henson has written a patch for SSLeay that adds this functionality. You\n" +" can get his patch (that requires an SSLeay installation) from his site at:\n" +" http://www.drh-consultancy.demon.co.uk/\n" +"\n" +); + puts( +" Example on how to automatically retrieve a document using a certificate with\n" +" a personal password:\n" +"\n" +" curl -E /path/to/cert.pem:password https://secure.site.com/\n" +"\n" +" If you neglect to specify the password on the command line, you will be\n" +" prompted for the correct password before any data can be received.\n" +"\n" +" Many older SSL-servers have problems with SSLv3 or TLS, that newer versions\n" +" of OpenSSL etc is using, therefore it is sometimes useful to specify what\n" +); + puts( +" SSL-version curl should use. Use -3 or -2 to specify that exact SSL version\n" +" to use:\n" +"\n" +" curl -2 https://secure.site.com/\n" +"\n" +" Otherwise, curl will first attempt to use v3 and then v2.\n" +"\n" +" To use OpenSSL to convert your favourite browser's certificate into a PEM\n" +" formatted one that curl can use, do something like this (assuming netscape,\n" +" but IE is likely to work similarly):\n" +"\n" +" You start with hitting the 'security' menu button in netscape. \n" +"\n" +); + puts( +" Select 'certificates->yours' and then pick a certificate in the list \n" +"\n" +" Press the 'export' button \n" +"\n" +" enter your PIN code for the certs \n" +"\n" +" select a proper place to save it \n" +"\n" +" Run the 'openssl' application to convert the certificate. If you cd to the\n" +" openssl installation, you can do it like:\n" +"\n" +" # ./apps/openssl pkcs12 -in [file you saved] -clcerts -out [PEMfile]\n" +"\n" +"\n" +"RESUMING FILE TRANSFERS\n" +"\n" +" To continue a file transfer where it was previously aborted, curl supports\n" +); + puts( +" resume on http(s) downloads as well as ftp uploads and downloads.\n" +"\n" +" Continue downloading a document:\n" +"\n" +" curl -C - -o file ftp://ftp.server.com/path/file\n" +"\n" +" Continue uploading a document(*1):\n" +"\n" +" curl -C - -T file ftp://ftp.server.com/path/file\n" +"\n" +" Continue downloading a document from a web server(*2):\n" +"\n" +" curl -C - -o file http://www.server.com/\n" +"\n" +" (*1) = This requires that the ftp server supports the non-standard command\n" +" SIZE. If it doesn't, curl will say so.\n" +"\n" +); + puts( +" (*2) = This requires that the web server supports at least HTTP/1.1. If it\n" +" doesn't, curl will say so.\n" +"\n" +"TIME CONDITIONS\n" +"\n" +" HTTP allows a client to specify a time condition for the document it\n" +" requests. It is If-Modified-Since or If-Unmodified-Since. Curl allow you to\n" +" specify them with the -z/--time-cond flag.\n" +"\n" +" For example, you can easily make a download that only gets performed if the\n" +" remote file is newer than a local copy. It would be made like:\n" +"\n" +); + puts( +" curl -z local.html http://remote.server.com/remote.html\n" +"\n" +" Or you can download a file only if the local file is newer than the remote\n" +" one. Do this by prepending the date string with a '-', as in:\n" +"\n" +" curl -z -local.html http://remote.server.com/remote.html\n" +"\n" +" You can specify a \"free text\" date as condition. Tell curl to only download\n" +" the file if it was updated since yesterday:\n" +"\n" +" curl -z yesterday http://remote.server.com/remote.html\n" +"\n" +); + puts( +" Curl will then accept a wide range of date formats. You always make the date\n" +" check the other way around by prepending it with a dash '-'.\n" +"\n" +"DICT\n" +"\n" +" For fun try\n" +"\n" +" curl dict://dict.org/m:curl\n" +" curl dict://dict.org/d:heisenbug:jargon\n" +" curl dict://dict.org/d:daniel:web1913\n" +"\n" +" Aliases for 'm' are 'match' and 'find', and aliases for 'd' are 'define'\n" +" and 'lookup'. For example,\n" +"\n" +" curl dict://dict.org/find:curl\n" +"\n" +); + puts( +" Commands that break the URL description of the RFC (but not the DICT\n" +" protocol) are\n" +"\n" +" curl dict://dict.org/show:db\n" +" curl dict://dict.org/show:strat\n" +"\n" +" Authentication is still missing (but this is not required by the RFC)\n" +"\n" +"LDAP\n" +"\n" +" If you have installed the OpenLDAP library, curl can take advantage of it\n" +" and offer ldap:// support.\n" +"\n" +" LDAP is a complex thing and writing an LDAP query is not an easy task. I do\n" +); + puts( +" advice you to dig up the syntax description for that elsewhere. Two places\n" +" that might suit you are:\n" +"\n" +" Netscape's \"Netscape Directory SDK 3.0 for C Programmer's Guide Chapter 10:\n" +" Working with LDAP URLs\":\n" +" http://developer.netscape.com/docs/manuals/dirsdk/csdk30/url.htm\n" +"\n" +" RFC 2255, \"The LDAP URL Format\" http://www.rfc-editor.org/rfc/rfc2255.txt\n" +"\n" +" To show you an example, this is now I can get all people from my local LDAP\n" +" server that has a certain sub-domain in their email address:\n" +"\n" +); + puts( +" curl -B \"ldap://ldap.frontec.se/o=frontec??sub?mail=*sth.frontec.se\"\n" +"\n" +" If I want the same info in HTML format, I can get it by not using the -B\n" +" (enforce ASCII) flag.\n" +"\n" +"ENVIRONMENT VARIABLES\n" +"\n" +" Curl reads and understands the following environment variables:\n" +"\n" +" HTTP_PROXY, HTTPS_PROXY, FTP_PROXY, GOPHER_PROXY\n" +"\n" +" They should be set for protocol-specific proxies. General proxy should be\n" +" set with\n" +" \n" +" ALL_PROXY\n" +"\n" +); + puts( +" A comma-separated list of host names that shouldn't go through any proxy is\n" +" set in (only an asterisk, '*' matches all hosts)\n" +"\n" +" NO_PROXY\n" +"\n" +" If a tail substring of the domain-path for a host matches one of these\n" +" strings, transactions with that node will not be proxied.\n" +"\n" +"\n" +" The usage of the -x/--proxy flag overrides the environment variables.\n" +"\n" +"NETRC\n" +"\n" +" Unix introduced the .netrc concept a long time ago. It is a way for a user\n" +); + puts( +" to specify name and password for commonly visited ftp sites in a file so\n" +" that you don't have to type them in each time you visit those sites. You\n" +" realize this is a big security risk if someone else gets hold of your\n" +" passwords, so therefor most unix programs won't read this file unless it is\n" +" only readable by yourself (curl doesn't care though).\n" +"\n" +" Curl supports .netrc files if told so (using the -n/--netrc option). This is\n" +); + puts( +" not restricted to only ftp, but curl can use it for all protocols where\n" +" authentication is used.\n" +"\n" +" A very simple .netrc file could look something like:\n" +"\n" +" machine curl.haxx.se login iamdaniel password mysecret\n" +"\n" +"CUSTOM OUTPUT\n" +"\n" +" To better allow script programmers to get to know about the progress of\n" +" curl, the -w/--write-out option was introduced. Using this, you can specify\n" +" what information from the previous transfer you want to extract.\n" +"\n" +); + puts( +" To display the amount of bytes downloaded together with some text and an\n" +" ending newline:\n" +"\n" +" curl -w 'We downloaded %{size_download} bytes\\n' www.download.com\n" +"\n" +"KERBEROS4 FTP TRANSFER\n" +"\n" +" Curl supports kerberos4 for FTP transfers. You need the kerberos package\n" +" installed and used at curl build time for it to be used.\n" +"\n" +" First, get the krb-ticket the normal way, like with the kauth tool. Then use\n" +" curl in way similar to:\n" +"\n" +); + puts( +" curl --krb4 private ftp://krb4site.com -u username:fakepwd\n" +"\n" +" There's no use for a password on the -u switch, but a blank one will make\n" +" curl ask for one and you already entered the real password to kauth.\n" +"\n" +"TELNET\n" +"\n" +" The curl telnet support is basic and very easy to use. Curl passes all data\n" +" passed to it on stdin to the remote server. Connect to a remote telnet\n" +" server using a command line similar to:\n" +"\n" +" curl telnet://remote.server.com\n" +"\n" +); + puts( +" And enter the data to pass to the server on stdin. The result will be sent\n" +" to stdout or to the file you specify with -o.\n" +"\n" +" You might want the -N/--no-buffer option to switch off the buffered output\n" +" for slow connections or similar.\n" +"\n" +" Pass options to the telnet protocol negotiation, by using the -t option. To\n" +" tell the server we use a vt100 terminal, try something like:\n" +"\n" +" curl -tTTYPE=vt100 telnet://remote.server.com\n" +"\n" +" Other interesting options for it -t include:\n" +"\n" +); + puts( +" - XDISPLOC=<X display> Sets the X display location.\n" +"\n" +" - NEW_ENV=<var,val> Sets an environment variable.\n" +"\n" +" NOTE: the telnet protocol does not specify any way to login with a specified\n" +" user and password so curl can't do that automatically. To do that, you need\n" +" to track when the login prompt is received and send the username and\n" +" password accordingly.\n" +"\n" +"PERSISTANT CONNECTIONS\n" +"\n" +" Specifying multiple files on a single command line will make curl transfer\n" +); + puts( +" all of them, one after the other in the specified order.\n" +"\n" +" libcurl will attempt to use persistant connections for the transfers so that\n" +" the second transfer to the same host can use the same connection that was\n" +" already initiated and was left open in the previous transfer. This greatly\n" +" decreases connection time for all but the first transfer and it makes a far\n" +" better use of the network.\n" +"\n" +" Note that curl cannot use persistant connections for transfers that are used\n" +); + puts( +" in subsequence curl invokes. Try to stuff as many URLs as possible on the\n" +" same command line if they are using the same host, as that'll make the\n" +" transfers faster. If you use a http proxy for file transfers, practicly\n" +" all transfers will be persistant.\n" +"\n" +" Persistant connections were introduced in curl 7.7.\n" +"\n" +"MAILING LISTS\n" +"\n" +" For your convenience, we have several open mailing lists to discuss curl,\n" +" its development and things relevant to this.\n" +"\n" +); + puts( +" To subscribe to the main curl list, mail curl-request@contactor.se with\n" +" \"subscribe <fill in your email address>\" in the body.\n" +"\n" +" To subscribe to the curl-library users/deverlopers list, follow the\n" +" instructions at http://curl.haxx.se/mail/\n" +"\n" +" To subscribe to the curl-announce list, to only get information about new\n" +" releases, follow the instructions at http://curl.haxx.se/mail/\n" +"\n" +" To subscribe to the curl-and-PHP list in which curl using with PHP is\n" +); + puts( +" discussed, follow the instructions at http://curl.haxx.se/mail/\n" +"\n" +" Please direct curl questions, feature requests and trouble reports to one of\n" +" these mailing lists instead of mailing any individual.\n" + ) ; +} diff --git a/Build/source/libs/curl/src/macos/MACINSTALL.TXT b/Build/source/libs/curl/src/macos/MACINSTALL.TXT new file mode 100644 index 00000000000..17da133259b --- /dev/null +++ b/Build/source/libs/curl/src/macos/MACINSTALL.TXT @@ -0,0 +1 @@ +MACOS (not MACOS X)
===================
This is the first attempt at porting cURL to MacOS.
http, ftp, dict and telnet seems to work fine, other protocols and advanced
features have not been all tested.
This port is heavily based on the GUSI library from Matthias Neeracher.
GUSI (Grand Unified Socket Interface) is a POSIX/Pthreads/Sockets library
bringing some of the comforts of UNIX 98 to traditional MacOS.
The latest GUSI release can be downloaded from sourceforge
at <http://sourceforge.net/projects/gusi/>
I have also write a few functions to help port UNIX applications to MacOS.
These functions are part of the GUSI Extra library that can be downloaded at
<http://perso.wanadoo.fr/ela/resources.html#gusiextra>
OpenSSL support is still experimental but I hope to deliver a version
including SSL soon.
cURL for MacOS requires using the CodeWarrior compiler from Metrowerks.
First download GUSI, GUSI Extra and cURL. Access paths have been setup so that
GUSI, GUSI Extra and cURL directories should have the same parent directory.
Follow the instructions in GUSI Extra "readme.txt" mainly the ones related to
SIOUX and GUSI patches. If you do not apply these patches curl will not behave
correctly.
In the 'curl/src/macos' directory, decode "curl.mcp.xml.sit.hqx" (This is a
stuffit binhexed file)
From the CodeWarrior IDE, import 'curl/src/macos/curl.xml', adjust the access
paths if required. Then you should be able to build:
- the libcurl libraries for PPC and 68K.
- the curl application (also available for PPC and 68K) which is the command
line version of cURL.
If the file "hugehelp.c" is missing rename "curl/src/hugehelp.c.cvs" to
"hugehelp.c" and make sure its file type is 'TEXT'
\ No newline at end of file diff --git a/Build/source/libs/curl/src/macos/curl.mcp.xml.sit.hqx b/Build/source/libs/curl/src/macos/curl.mcp.xml.sit.hqx new file mode 100644 index 00000000000..01650b9a148 --- /dev/null +++ b/Build/source/libs/curl/src/macos/curl.mcp.xml.sit.hqx @@ -0,0 +1 @@ +(This file must be converted with BinHex 4.0)
:%'0eFQ`ZE@0`,RKYE#jcDA3!8dP8090*9#%!N!3F@`#3")EF8h4eCQC*G#!SBbN
a16Nh,6)`-$%J3@aKC'4TEL"6HA0dC@ec,#"*EQ-Z,#"SG(4`1Lm[Gj!$,Q&XB@4
ND@jcHA-ZBfpY,e0dG@CQ5A3[$3SD!!83!!!F@`#3!h)!!3#3!h)0,`fPT9*PFf9
bGQ9NTD8!TC!%!3!!2!!3Z$+T+EJbU5N!N!d-['F!"*UP!!!E'J#3"!m!Bh9bE#j
YBh!ZH'eX!!%`!P4&@&4$9dP&!3$rN!3!N!U!!*!*!CS!N!0K!*!%$`"#`G6)[bB
"`A,RBHAV3f@ZJUhAq'5,9!EjE+@0l9R9ECKR4kTRRh2Tr@@VMJ"@0,FaU4R&FMa
LBT)4LbVeb+BC%jqHQQI4[fPBGXP3'T4BeHdDm#H-`9$4'EUJEJ186cE)3X(8K-U
1KiJ4+5-HVi0DI[@5XBTQHb300K2--ZQmjPHEfdA)NhXMSJc'A+@kemq4P`'SeCB
TD8QEYXMK8Kk4YZRkc1,G%m39"[dp8Zmc'[eKd,jpTVh555HQXd2`S9"KrGB`laE
(r+!)8r8DP'9kbYVQeY-aSjVQRA2k-`'2pqTr9EP6Z&H-%4eK4@qp1Z(fDAd1&`A
H1IYG&T86QUHmp*%cdr$@G4fJrQ[9'8p)f"FPKmMQH6!kGBGeTA5Im1Pp*(P69-*
b8ld+I'KQIH`@CNfcIEGE&Zbb`3f,4IkZ#4Ve"2%R-a#MLYefeG"*FSMj,RD`aaE
DHh6$h8hF"r`SK84RjI*$KFfI&J3ZTk"r!J2$Nr#%K(IA803e(bAG645j1231E'$
C5$(Nr9Z2LZbqJPSH&9[h1(,+e"8!I$4XKrIeH6Y"")PlSQG2V4#-hZAbb2jBT25
(IUG-bFQ+0[bbfAlrpIDlpCradaS5G(*4d%[i*ISQ&5*3e$NVT#A+!Y3P%V*@HX9
6AGI"h1N`D@lj56PX8fB95NekUL&lk'15a*Z(38rC`Ii%$Y$E-A"!QfHG(Ed)Uhd
$e&Ckrm4jfVikK&j$D[%H)*lGX!FUK'&[Ck*%#lJUT9qiT13X#T4mK2)e"`%-JFe
)*)Sa9b+92'@Gb8N6d9E+kJ#VEA(c6+d`%E82FXcNKJYM'a,FD@Jf-Bhe0i+B2b'
4,T!!lq1IYLpFITlMfGiYPc0f$6,+MDV5TI9#X-SpJhU%)Fb8cp2EjaJ6Y-)DC*f
e'FGC5B'BdQV'H!@cS`XJID*-@m3!EFmNq*Ve20Pc0%pLrF4I`MH*iE!bAI`TJ6f
fIkZ$4)P"bTla%@'ZL"8pmd(L(R3XEa8KPe@FkheL$l%E1UF89BS&afbE`RN#pXJ
IUFD+"e#6RG6PSV[,G0B8l,Ipa2UU$4a@eA6jr+8Y,jkA1f9)d0!)UcD8pc1PCaS
$4e#PcC8bCKD'Ar-2Yr"-%XLQh@AF!9p6rj`FhAk@,R*F(2h!LB#ca(F'im+pi,L
Bf4LJV+icK26r2XR2)q9fr#K3PQ3PU)3V#9KqDVJL&pEb*`f)lAAq9FdpFU[$8N6
H43&)*h$BNrd0,c(!ICCA2Nh-i-b#,A9)Dq6b0QXcb4Cb)HG0c,H"E8"bQ0V82+K
(6bpND%LUfp6S(mNAhkhHBJTdab-6GA&I%2cqe4`NjKlSpKDmI6m!h0,h!`LC-2j
pCCGeT6#1Y62eS"hVZBAlj!YPi8DS1XV14b!3d)r5Z1C(*KTB'Df3!+cZN!#aJMU
am2DQK54epTl55RJcT[d$'Q5Me1@)lDI#N6S,Rb-#2%BpdZePl2&DZb9GH)-0FR`
3N!!5&mlD,Sp)"5ZC2f@E-bpUflPTaUfFJ4mZUlcp#`iNNNl#eBaVI1&m0!dP'F[
lT`UUYVZpKX&HPmBMVf"+'fS0*6pRfA+HccXLd0PXk",eKDrh`@MYIGqm(MRcMcP
UCb#C$m'[dhBrb438Hbh4+bDe&0"BSF1P+PPP4@i`%iP22P9ibJHTcBXRN5!leUL
LkN%bVNT!r-qGI('DMAp8jc1e[eH9VBp1+DSk0V(-aMaJD(6FHQ+T'%'h8"e3LeY
*2ldFPa@Tem)!l+PBLXN#idPfFC0i-V-9Ed2X@hEhCC!!e2J+JDccb1@@XE`Ch+V
@!I1YF"Jf&8Kc*-A[5BT"cFJ3I8rP#Vb#NHYS+"%q25(pP2,aD$5KBV4"&PiN--c
f!&h'b,[%ZDE0!j&ZY32dZD3h)p'VEr2p@kU8c8kU,K'lh$A8,)`efrhRPmImIpI
YXG)SXje6-1Z$'lrlYNl#ECVlA2V[1h9Ej6X"Q-(LA%P65$-Ka92rah%dQmeF#KH
(%CE56(aEpX$BKjEHj(6mN!"l3iEi(2#eJXU2$BHK`913!#8U6q3!&-VfilRY05#
+CbP+)RJR0D'943,GI+$+0I0+'SNaNUMBZ[q4'kLpb*c)iGMP,'c'hFQc1B6@@J6
fXPPfGrc`"VaZDc5@lD1*@AIr'1UT5C'NI$HV@!e*U##m)62YSNd$`'p*J1[@ZVM
5D'GRTkrhF6"1D9-DV'2YVR*$RV,I`+QmTjICq92DT-f+SL1lD&kp)C8`64h*aY*
AaJiFNQBGVU!$p6A1-m-e*1L9Iic!B!lQ,rZIkda"cB%TJ`U*0QP,'JVEhkFUFU&
(X5K4`r3eG5!0T0`KfYQ6-I-E-mUbb&1TIGYrd"X"EXL$@U!J)EB+%q8mMd,dFeJ
fLGJA5!N*4MXRSYfk8"8Vp9RY*4rXaR0dQ"3d!1R%CAQZRaPE1*MZ&DHdelBBaaA
(CTA1k$H!##ZMT'i$kB0JJPc9Y"5Em&M)DRM*#SIahMpP`2T[3F,Sr2JX9E@,U5L
10Sdd1Y(qAG#,G'hX$PibcN@!,X`qX*,'eM#B)#S*k1PLLI*REMpB"UmhHT-j!0&
TG)jc$@3BLI"em*jDf-B%qLmRR$,BQ1q)YN!*Q1ZNVH,YL#f$!C3-1#@Lch3a2+D
1S3dIq-1a[1C*E$*P+KPQG`THP&p'TQ$JJ-*$cK9F03c3F-aJGGic8i,3hd[fAQ(
X2Zr!KU)Rlj!!cer8P'[-pmXiEG4ETUADfi2e!+XIM"@%f)[i)Ikd3c!4jR!-4ar
q1T6*aH(Xp6eP)1"JRKV00!kq!BaZa-p*GA93QrN2e@l5U!bDcH)QqRTh9BT04b$
5Yml1!p$+q9ILbSc)r+'IfN,jLH0'9S)Z+ji4P'1GBK9MHCmrhF8AVC(Xmm"IHl#
QFBJ"3PC,19FjeHrVT3AV%qCIqAh1VJm(G,#b$Gh-aRS@jXNFTGXV8@2Eq&L#U%L
bf**dKC),j0c9*P0&V!XPRpA0'`jEQG1PDJ+Zdb`[PpRLe34(EcHI-CPm54(VIbE
2J3S%q'`"i`+,HjI3D&@MmVRC5ffqFSVlc[1eQP`@)$eHGrSTSGA@,fc&Yd%c#-[
c`N5)bZ%5b!`+QA-C%YBp[NpG`fMrU'VklXR-he$9jRbE5pBEJR2GeER[mN'1,[`
*5HDBYJFl#DN&kKi#mVHiL2@'H4Lb-%(#jb5!e"`RQeJJPfD*L#l$'($NZ1*53#4
P"Z19[8kVVN86PN0#LLPpq&`6QI1)ZR-h3b"[H'qCf&q%J1$CRiFD6AhC'iAdA!5
&9qaeYeVcr,1k'F2P%TlIY-mjXqRIMK+"1cJjQ1[ad0mTG53!aa[IQhlKS@)N-(a
pUJ$DahNB2HZ[!!fJ,p(-ACep@IGH86&XYZf#UZd`6HTD`e66bA,VjkUkQpeq)%J
hajLPmXp(SipKb*'k%k1f[e'0!D&Sh80Q"$BH&jiJb+SEbpTbQBkE2Qp,5[hLS@1
1pUZ(*&)`(+D+RH8$Z0,+br4iTZJ2rZVP,UC!FP8[XHa#3+"aHC!!DMcpKpFDeIe
D%2`@$YX20DB&iIcJUS-R%eCPc4&MSE2f3qfA9IJK5I@,R4403FVlTR'JKYF'NBr
eC`jcaFi8Bl$9bp,K,TCp"cJ33fq@Z6`!DldUA,C8J[(2MaI2,p!`$5YT12Mei`2
kEK")F$6(J8GAiLMFaTiMqpE8KiZGrrk"D3Fi#8(4*fVmGK4GIb9Pb9N,%Qh2V&b
G`4BR#1B@ZrmSF@DdRU#!!i64LJXc9abPYpjfa+I*FSZ(&IkqF2,@5XqlSfe(pJ5
@FBNcIm6`B$SBQ19pA0k8'bmMac8kRP[Q#l4qV9P3ibU$dmlE'[@*Dj1JGRJe4[Z
5M#`*0UYGpeTAFQV4)hc"Frq0Qe88T#fG+YrEd%GD5VaN8ee69)@GJLMaCTYZJ$h
Y`PmD[A8fB#4GP0TV(G5&@%i-DBILl&5HUC*fk#qhfiL-VdMPEK`@*G5aB'3@1DI
`Gmq!%mJhD-m-E@ei1#pf)H!Y)#hdYf5,Kre61KKr6-k+iC&[6#!,*8aC4V,dBda
*G-Ea,kcp`EQYmI)q(TSXdpT[&6NmmVela*&ZrNk#!a*Ek1U9e(A-C#MTiFrU*8#
GRIPS(IG0NC0@D@C,ef!3$-V,f1MmeU$hMNGflfPjdA1l$m'dhT6mE$5k,&09Rk*
35$B&A8hc`Q,f[MCL'()&ZSp9"F43Y6Gp$d@GQ1*-IFE)fQ`!Gl+4bY!)4&ME!i1
S(e$jM(!B0$aPZUklAZC&R6Q$q(JE0b`QVJ8l2ELL'2i"i$m4hNQq3$S*@r,KlPV
@0aB$#$cij*NFIiA[#P'Hmk'D%mJh*T,r&0T!Sj!!I%QRN!"4J!C25i'JdhRAG4#
+iPZ,'C)pS[%JqMbf%5Z@HYTRpTjm`P9K-jj6!9j,5+E8[jbd,$Qb,rLerVlm'a"
EJ,NAIG%b0S`!KTfSi1,Hlm6&Tl86i@XA-SjmDCVVm2JR[U[ZUaabTc`"ZLc''*T
MA06`8"HaVhrb,12m0TYp8$49BH,J(bC-qMij8S3`iIJLm!&DUAX,NDT4j(cCZq`
Sjr#YLPbe+8AqUc@cBNPJ0I"'D`jmfZPUpmQhXQ'2G"i,XrX6PZh5*UdATE`QBJT
2*-NNJ'H03hDLq3NLl8V#BcH(SN53!&)l)I#5DJXfUc)pbK*kKMMdhlkIbRYcdU*
-kaTcDabVQGjqY*`D1++%&&hPjA0$mc46dA5Pa&+%QbaXIY(9*40iKhGhE(!d(Zj
TU%6JfY"(KHR"&-pfT-D8AB"c'iDKcqH'9"0#TcflZJ5YE#(YDU4QTYFS*`lY2+'
HUH+"N6hThTfY$V%@bmP3RrZVqj*lIM!qQ&'(*R8#YUX0ViVa-8c1cLi5mSh423Y
c"ZTZ&UCCXZeRVUh#+(cU-p`4R%4,2aCl@ZeXXYH'f1j5r6'Fdp6k&d9CITqHK#@
jRIp9LG#d$jCXIJ9ZTRb1X1r#JCA&JjmSEMUfVbL!D[6I$5#JScE6Na9lmKfF0EH
V"15k'@bDdk%miP"ThZ@A0I0@V`65l5S9deFHd#$hUXR5GDT"DMik$YJL+GmY#CB
f%KC+a"&%)ihiBfR+0I#@&ENYGGfGh1ZaX"RlLlZ$l-9X9H*LaaQqEZ6LZ'rpIM*
GCa`prJ+&V"j-rb!(B[h8XVQbRfQhYc,GJ(J65aIbPCVha(mX8UAS2e@%VYZYMF(
$UMM#pf[eK66(Dj1)d*GNK+[I"ZK52ijfp01Pj098q,AA1GUbRR,5Z)jBdJMD1LZ
Y8$2iKCVB!R2!PiF*N!$Ycb2#1Nh6&f-fSDEc2YH1jp9GM@!XI'*ilG-Qc4qT0fe
dIZdlC9qP)X!!&@4T9A$EaNq-AZKQ6%R$$a54DScX[R*,M*!!k)K4LrB9Ma0[+II
jcUfa44M*R18DLAMSp36ELf),#2#qPidNRI[QVFj%D95q)Xa`RS6EjCd+5BN6MeV
%!,Q1a$r!B1`Bp3FM8IpLD)S+$G#+BR1)d#!hB9'5GRjMXFLAC-06*FkSLrBpG6X
,q$JVU-a-"TBp@F)+T`$8S[Dj!EIek6Ei!CIBUAGZpERj!eKb9(,X'RqjiBH5bbP
-M*hrM9L`Xhl"GqM#U-f9*jXA"IQeZ[b#&`DqGehATT!!(S$6dqLGCl@A-NeefUB
CPHNb!6cQp-!L[%Qal$RBVE9ZN!#qrF#!'d&V@ceTH8bbU3`DV0!06TamU$%('FZ
l0N`a41a+-&6)Jcjl2XS1jHBp[HE"-PTaj6*#rZXdIX8%X8XRqJXc(FN5iG%bELS
+b,60YmQf"J65!j!!D%+B#Ik0&-B3B@*GM[jJlJBU$RkG93B`&-#!h+HerJ8PT,@
b4!M[IeX(5fA%bFZLUp@K6(mkd@BTHhBcDkGaJh0`$CA2N!#3!%G1-Ne!SYh%drH
F,BQM`')#DqM&#U(*Y-1lG45[6@GDN!#,bMKZRMG8"D$T2Kc192P!mSK@0AC8#3E
D5,p-B+X2ZcmCQAIc,2AEdK5!+1N5*`cl9qJ@N!")h+G,fYaRJrRN`dd1NQ"E$VL
ki6&AIilJU6[Z6pR5B*U9Rm1S[dr`a6mp3Fd`ArhVJQ!TR9T#ZhI+MpjYcFC*Tpf
JP)[hkrKT5D`IVBCl"QA0TS2!TdYN8%E#epb&4PA9Q-hQ50A5SA@GjUa`kE-X-HM
+d28*r*JYMjd!ICRc,(ZrmcU5e(4KNd[IAR$U[Tm*rdK"&(P&HE,U5c&(#0[`'-D
5f6@Qdr3dIB[VAlQbBHEiXrVYae)ZjkP@,'U[dE)NKfe95B9"Jk0'I$A8b$VC&CI
hj0TB-$9m0"N8$CIaHe"M2@3-GQ$(12rHGfTrFM[EP9BMH3B`fcFE2PM'VNZ+fSm
R[kIC&VabE@DX[9ZChF-R3*X*[Gmakl`@[!XBM"Iq3#d4e2`)6dE"fe2&5r'*3)D
fB!kY""qf-#Xh!5DUNqDYG(&`URfpc*RAAS-#r+D@!A[j8r[eAi!S-rimJJ'!JGb
%*BZ5$!f,GjJjLa5D")q,RL4XR[Ppi(r8RNiP$2e@ALL+bU&lUIljbU5MXf56RSK
#8KbRX8C@f&kmYX-V,K+TmASNfml4&HPfSV$Y(&Y&J8ER)M[,N!"VmB&c'$a2h'h
c`MAp!+rpRY(4Qe8@Z#el[0+YYH#ZYd3EMkbHRechUKDqX5k8m)cfAKj'mJ*[h6'
6)pLEDAqcBBi5[CE[rpIkcC%LIUe3f4@8TFUBfZ9B6FYY-F)N[fBV'h3@(m&iB,a
)d1HkSQUS"C91!eHTUrHa9J[FLDk'K8-H9XmKc$L*'V5H'-5[*p)TC'El!$b2J"k
T0Ul!A)(4ZlVY!Te#X5V)+@[J"r1e-BdkRFe`N!#r0DcM"VUBekGkJe,*5cpX0PS
T(d3588LNcfA!1-TB8GQ`K0eIIl0N96)Nd!Rb%&4LIRETS'P3+jA+Bi9SY#qCmGI
5Ai,[V-NK#La5439PX&LDc8hTl$aLj359-bqmDJZ)GiaX1k1[k)bMZ2r(U*c[Gej
%D)m*@@+eGqbF249V)fRpkp)6e0JrHiB*[K8*9fGR-AU+jTcpi#f0+U0+L@Yc'U2
dc04kb961J1JdC5PLEV30PJSYZXJ#jfdlb$,0UrY"jX[RkUY8JLY)-L`Gj6ieH'6
%C*LCT`)3ZS@[X2!%!-SJKp1jEL2Cml64,qZhPa)'AidDL1Ybp@6`iI80l+RfHpd
Y1XF"[0[r!$B*PqDdHB95)l8[1I%*Nr,#e&Y3CCiNFC[8dj9TDKdh)Q6,,fCk(S#
pQbBT0TY@PD(I@lDhBV%Pk9GrD%IY,YpIM-V9cE(UBbG2&Xck6c5I1BcMA-YcJFA
0,Q"*[F1C16*jHTMMPV0@6HYDU5V0`dPbD&X+MPSlR&+hbi36I8(5pBhrN!$Nj*a
Z#!akZ&EGD+M,95XdGQGpfB`RY9BjCa9"Jp0EhH,EFY$Xp0#fq5DI#KVJBj,10hZ
`Bq#LBCm2%H@E,+X9!b92Xb3iDFh4MVPIpfIVl"rkr%Eie%$X)MHS6PM!XTB'1$H
kR%(U%"b&pq)aqe3a9TkCmFDMGk2qq%"HEh*XqVLk9-A,*pAd(dpZSG2Q#&qCJP2
X5cRMX'hX$'L5*+0!i`51"Yaj''JmqAJA#qUqe!P,MR-!NDje18N(qV3@5C1&B`D
IqHRl9X2i2T6ZJH'e!jK,MY#3!+TSYiGI*AaPcjIbGE,pQ5[0Bk@%Ahrf#aQ$NkU
d!GNU@XiVQ!T6'EHGZC4@(Qf-icF'*X1,1elXp1L)jmi`Y"F,'Fll%A@'$Mp1IT%
4pZjYGj%b,8rhMFlIh1-NN!#MD$'mrpeRD+18mX9YJ+9kiQE-B&U''*jE1*6raUl
$40TV"8Aj2`cF3YHakZ6%05+TZ8&#e4HlCpJjL2$)l&2RNVNKBEAbL2UqijV4C,4
!9bq*`lQDp-&$iV8-!)S2)(el3Gp5lfekXY%TkcB%-PkqfD`DRD,R`APCTf%SkYi
YkMk9pc01i''-FlHj6bF6QU%PJ+-@4DbAp91&Q,4`0mc1'1(,P6j)j1fMGbAf%BG
,M8&e!2R'Uk,%Rcm9JkL53'"eTe@IXaCCY!0!33RNL)DY5CYmjN%VhK,U8GXFG+[
8jmX*Z2'(9BE)F'c"[r"4(UF4E*Qa[Nk-j&"MM!B6UZ*0YpL'!+9)G*&k,&2l@&&
AbpQL&q)IrbB+ED(J8lRM"*Ii6%VUADiNE'dVU'q%[LHeia*6Y%89acHSZLZH(mq
I[jRmr6$mVc-RTPb8+)ZMjI@hNG(F0VT&bU@(Hq1!F"2j881[Z$Nm5SC@1$41qHC
Z*B%dX0kZFfcHDPjCH`GJrbU5DkEdIaTUI+NaK"PdSmI[LPTLJ9IJ8KA#kV"2Uia
KdERdQFN93d"lqUqXj@Mr+*qi6&"UECZ-#,*iEC&C`bZqlMfYpM(epQ)*%&C![LJ
hPR8L[G0#*-Pj,5P*C$cF+BTi2&i!bX+hlrFri`8+M'SNkXcMM(Q3!%%A2MlD*28
VCqT[JjMIq0PTUq0qPSAf4a0$XLC)-48j(c*)V1K5Pc(m%SGL+($j+p8S%dQ3!&Z
lQ%+#S[eP8p$5$[$Vq)R)6HaCkZT5CT&*Rb,2I'PA"EVrJTPJKBE@Xi$J%rQAiUE
$fqc2ald8l1R&r%FZ(Gq*VR(@l'M!MiUBId*-Kd&S!pP"YBNkYP[B[Z%YlT5SmY!
2rJF43CSX-e@Gp1FDa-d'!JQ@al9raL0r$[fkG0#D5VmHClHGEqhD`fmVA[jC+rM
(&qL@f"N"(1DT-#2bD)j)N3!`Tr&$Rep"LN@aR!Rl(5lcE1UYTUmcVKrX(f1)40K
Y4RQl"CKXF9C08YC(*$aR5a@QalMZGITR05QRZ"+h`52GmMN4pj6iXh*6MZFb8ke
arcTIYkJ%@!F4TNFBfCKU#I3SZViZSKC0e*!!"cFIrhEC%XbSMX6jaS5&9#h@!`d
[Y&`V)j*NiURXkhF0DP5e2dAG*Z,9N!$*D[l1$KF5SNi[b"J@Z2Di),1E93CDGmd
Gb1)8,k@iE`R'kNHkLYb%dGd34Y,C013(''CiPAT2BRL[dYPHEY6ZE'`i0f-mp)a
X&[HT"f3K+8rfE`T!,%MI)YZKJqZ#ZDTfGRYe'+5[Ke+2E%ecBS3pPC!!rU*,drD
&884$ZmbC%Y-Iea(IUfjblN-*cX2hB`Mr+aG#AhMaaJfKPbd5P[+H$9A'(jGqcQ-
2pAc0'J[b`hF4+N1dYV[8#-aHm&FiqHbK`R8PpZ*be,`-[a"P"q1lcb$Z8I%0RA2
X8bcClk*cpGU1Q5c6VI%#`63X"PYE,*Hi3bF21r2JTij#%Q3J'cij@e+-99)rZqB
$DdVZbrG[S8$eBj!!@$Z3!%C,DD1H[Dr+iFXKGGD&**8$2mqBZG+M+&`P%``#e8Y
13020cm&rj9ND(4q*S+D%eYGi'X(IT1lA+fV1,T!!6(fcKe2S6"!X-C-F-TqlSTB
BJTb$,U'!bY8!!!:
\ No newline at end of file diff --git a/Build/source/libs/curl/src/macos/src/curl_GUSIConfig.cpp b/Build/source/libs/curl/src/macos/src/curl_GUSIConfig.cpp new file mode 100644 index 00000000000..b13d5ec3cbd --- /dev/null +++ b/Build/source/libs/curl/src/macos/src/curl_GUSIConfig.cpp @@ -0,0 +1,79 @@ +/**************** BEGIN GUSI CONFIGURATION **************************** + * + * GUSI Configuration section generated by GUSI Configurator + * last modified: Mon Oct 29 15:41:51 2001 + * + * This section will be overwritten by the next run of Configurator. + */ + +#define GUSI_SOURCE +#include <GUSIConfig.h> +#include <sys/cdefs.h> + +/* Declarations of Socket Factories */ + +__BEGIN_DECLS +void GUSIwithInetSockets(); +void GUSIwithLocalSockets(); +void GUSIwithMTInetSockets(); +void GUSIwithMTTcpSockets(); +void GUSIwithMTUdpSockets(); +void GUSIwithOTInetSockets(); +void GUSIwithOTTcpSockets(); +void GUSIwithOTUdpSockets(); +void GUSIwithPPCSockets(); +void GUSISetupFactories(); +__END_DECLS + +/* Configure Socket Factories */ + +void GUSISetupFactories() +{ +#ifdef GUSISetupFactories_BeginHook + GUSISetupFactories_BeginHook +#endif + GUSIwithInetSockets(); +#ifdef GUSISetupFactories_EndHook + GUSISetupFactories_EndHook +#endif +} + +/* Declarations of File Devices */ + +__BEGIN_DECLS +void GUSIwithNullSockets(); +void GUSISetupDevices(); +__END_DECLS + +/* Configure File Devices */ + +void GUSISetupDevices() +{ +#ifdef GUSISetupDevices_BeginHook + GUSISetupDevices_BeginHook +#endif + GUSIwithNullSockets(); +#ifdef GUSISetupDevices_EndHook + GUSISetupDevices_EndHook +#endif +} + +#ifndef __cplusplus +#error GUSISetupConfig() needs to be written in C++ +#endif + +GUSIConfiguration::FileSuffix sSuffices[] = { + "", '????', '????' +}; + +extern "C" void GUSISetupConfig() +{ + GUSIConfiguration * config = + GUSIConfiguration::CreateInstance(GUSIConfiguration::kNoResource); + + config->ConfigureDefaultTypeCreator('TEXT', 'CWIE'); + config->ConfigureSuffices( + sizeof(sSuffices)/sizeof(GUSIConfiguration::FileSuffix)-1, sSuffices); +} + +/**************** END GUSI CONFIGURATION *************************/ diff --git a/Build/source/libs/curl/src/macos/src/macos_main.cpp b/Build/source/libs/curl/src/macos/src/macos_main.cpp new file mode 100644 index 00000000000..01ed6fe27f0 --- /dev/null +++ b/Build/source/libs/curl/src/macos/src/macos_main.cpp @@ -0,0 +1,44 @@ +/* ========================================================================= + Copyright (C) 2001 Eric Lavigne + + Permission is granted to anyone to use this software for any purpose on any + computer system, and to redistribute it freely, subject to the following + restrictions: + - The author is not responsible for the consequences of use of this + software, no matter how awful, even if they arise from defects in it. + - The origin of this software must not be misrepresented, either by + explicit claim or by omission. + - You are allowed to distributed modified copies of the software, in source + and binary form, provided they are marked plainly as altered versions, and + are not misrepresented as being the original software. + ========================================================================= */ + +#include <stdlib.h> +#include <string.h> +#include <stdio.h> +#include <Memory.h> +#include <GUSICommandLine.h> +#include <stdlib.h> + +/* ========================================================================= */ + +DECLARE_MAIN(curl) + +REGISTER_MAIN_START +REGISTER_MAIN(curl) +REGISTER_MAIN_END + +/* ========================================================================= */ + +int main() +{ + ::MaxApplZone(); + for (int i = 1; i <= 10; i++) + ::MoreMasters(); + + (void) exec_commands(); + + return 0; +} + + diff --git a/Build/source/libs/curl/src/main.c b/Build/source/libs/curl/src/main.c new file mode 100644 index 00000000000..1a9a14ef0d0 --- /dev/null +++ b/Build/source/libs/curl/src/main.c @@ -0,0 +1,2535 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 2001, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * In order to be useful for every potential user, curl and libcurl are + * dual-licensed under the MPL and the MIT/X-derivate licenses. + * + * 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 MPL or the MIT/X-derivate + * licenses. You may pick one of these licenses. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * $Id: main.c,v 1.112 2002/02/28 23:55:18 bagder Exp $ + *****************************************************************************/ + +/* This is now designed to have its own local setup.h */ +#include "setup.h" + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <stdarg.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <ctype.h> + +#include <curl/curl.h> + +#define _MPRINTF_REPLACE /* we want curl-functions instead of native ones */ +#include <curl/mprintf.h> + +#include "urlglob.h" +#include "writeout.h" + +#define CURLseparator "--_curl_--" + +#if defined(WIN32)&&!defined(__CYGWIN32__) +#include <winsock.h> +#endif + +#include "version.h" + +#ifdef HAVE_IO_H /* typical win32 habit */ +#include <io.h> +#endif + +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif + +#ifdef HAVE_FCNTL_H +#include <fcntl.h> +#endif + +#ifdef HAVE_UTIME_H +#include <utime.h> +#else +#ifdef HAVE_SYS_UTIME_H +#include <sys/utime.h> +#endif +#endif + +/* The last #include file should be: */ +#ifdef MALLOCDEBUG +/* this is low-level hard-hacking memory leak tracking shit */ +#include "../lib/memdebug.h" +#endif + +#define DEFAULT_MAXREDIRS 50L + +#ifndef __cplusplus /* (rabe) */ +#ifndef typedef_bool +typedef char bool; +#endif +#endif /* (rabe) */ + +#define CURL_PROGRESS_STATS 0 /* default progress display */ +#define CURL_PROGRESS_BAR 1 + +typedef enum { + HTTPREQ_UNSPEC, + HTTPREQ_GET, + HTTPREQ_HEAD, + HTTPREQ_POST, + HTTPREQ_SIMPLEPOST, + HTTPREQ_CUSTOM, + HTTPREQ_LAST +} HttpReq; + +/* Just a set of bits */ +#define CONF_DEFAULT 0 + +#define CONF_AUTO_REFERER (1<<4) /* the automatic referer-system please! */ +#define CONF_VERBOSE (1<<5) /* talk a lot */ +#define CONF_HEADER (1<<8) /* throw the header out too */ +#define CONF_NOPROGRESS (1<<10) /* shut off the progress meter */ +#define CONF_NOBODY (1<<11) /* use HEAD to get http document */ +#define CONF_FAILONERROR (1<<12) /* no output on http error codes >= 300 */ +#define CONF_UPLOAD (1<<14) /* this is an upload */ +#define CONF_FTPLISTONLY (1<<16) /* Use NLST when listing ftp dir */ +#define CONF_FTPAPPEND (1<<20) /* Append instead of overwrite on upload! */ +#define CONF_NETRC (1<<22) /* read user+password from .netrc */ +#define CONF_FOLLOWLOCATION (1<<23) /* use Location: Luke! */ +#define CONF_GETTEXT (1<<24) /* use ASCII/text for transfer */ +#define CONF_HTTPPOST (1<<25) /* multipart/form-data HTTP POST */ + +#define CONF_MUTE (1<<28) /* force NOPROGRESS */ + +#ifndef HAVE_STRDUP +/* Ultrix doesn't have strdup(), so make a quick clone: */ +char *strdup(char *str) +{ + int len; + char *newstr; + + len = strlen(str); + newstr = (char *) malloc((len+1)*sizeof(char)); + if (!newstr) + return (char *)NULL; + + strcpy(newstr,str); + + return newstr; + +} +#endif + +#ifdef VMS +int vms_show = 0; +#define FAC_CURL 0xC01 +#define FAC_SYSTEM 0 +#define MSG_NORMAL 0 +#define VMS_STS(c,f,e,s) (((c&0xF)<<28)|((f&0xFFF)<<16)|((e&0x1FFF)<3)|(s&7)) +#define VMSSTS_HIDE VMS_STS(1,0,0,0) +#define SEV_WARNING 0 +#define SEV_SUCCESS 1 +#define SEV_ERROR 2 +#define SEV_INFO 3 /* success, with an extra hint */ +#define SEV_FATAL 4 +globalvalue int CURL_UNSUPPROTO; /* these are from curlmsg.msg file..... */ +globalvalue int CURL_FAILINIT; +globalvalue int CURL_BADURLSYN; +globalvalue int CURL_BADURLUSER; +globalvalue int CURL_BADPROXY; +globalvalue int CURL_BADHOST; +globalvalue int CURL_FAILHOST; +globalvalue int CURL_FTPUNKREPLY; +globalvalue int CURL_FTPNOACC; +globalvalue int CURL_FTPUSRPW; +globalvalue int CURL_FTPBADPASS; +globalvalue int CURL_FTPBADUSER; +globalvalue int CURL_FTPBADPASV; +globalvalue int CURL_FTPBAD227; +globalvalue int CURL_FTPBADHOST227; +globalvalue int CURL_FTPNORECONN; +globalvalue int CURL_FTPNOBIN; +globalvalue int CURL_PARTIALFILE; +globalvalue int CURL_FTPNORETR; +globalvalue int CURL_FTPWRITERR; +globalvalue int CURL_FTPNOQUOTE; +globalvalue int CURL_HTTPPNF; +globalvalue int CURL_WRITERR; +globalvalue int CURL_BADUSER; +globalvalue int CURL_FTPNOSTOR; +globalvalue int CURL_READERR; +globalvalue int CURL_OUTOFMEM; +globalvalue int CURL_TIMEOUT; +globalvalue int CURL_FTPNOASCII; +globalvalue int CURL_FTPNOPORT; +globalvalue int CURL_FTPNOREST; +globalvalue int CURL_FTPNOSIZE; +globalvalue int CURL_HTTPRNGERR; +globalvalue int CURL_HTTPPOSTERR; +globalvalue int CURL_SSLNOCONN; +globalvalue int CURL_FTPBADRESUME; +globalvalue int CURL_FILENOACC; +globalvalue int CURL_LDAPNOBIND; +globalvalue int CURL_LDAPNOSRCH; +globalvalue int CURL_LDAPNOLIB; +globalvalue int CURL_LDAPNOFUNC; +globalvalue int CURL_ABORTCB; +globalvalue int CURL_BADPARAM; +globalvalue int CURL_BADORDER; +globalvalue int CURL_BADPWD; +globalvalue int CURL_MNYREDIR; +globalvalue int CURL_UNKTELNET; +globalvalue int CURL_UNKMSG; +globalvalue int CURL_BADSSLCERT; +globalvalue int CURL_SRVNOERR; +globalvalue int CURL_MAXMSG; +long vms_cond[] = { + VMS_STS(1,FAC_SYSTEM,MSG_NORMAL,SEV_SUCCESS), + CURL_UNSUPPROTO, /* these are from curlmsg.msg file..... */ + CURL_FAILINIT, + CURL_BADURLSYN, + CURL_BADURLUSER, + CURL_BADPROXY, + CURL_BADHOST, + CURL_FAILHOST, + CURL_FTPUNKREPLY, + CURL_FTPNOACC, + CURL_FTPUSRPW, + CURL_FTPBADPASS, + CURL_FTPBADUSER, + CURL_FTPBADPASV, + CURL_FTPBAD227, + CURL_FTPBADHOST227, + CURL_FTPNORECONN, + CURL_FTPNOBIN, + CURL_PARTIALFILE, + CURL_FTPNORETR, + CURL_FTPWRITERR, + CURL_FTPNOQUOTE, + CURL_HTTPPNF, + CURL_WRITERR, + CURL_BADUSER, + CURL_FTPNOSTOR, + CURL_READERR, + CURL_OUTOFMEM, + CURL_TIMEOUT, + CURL_FTPNOASCII, + CURL_FTPNOPORT, + CURL_FTPNOREST, + CURL_FTPNOSIZE, + CURL_HTTPRNGERR, + CURL_HTTPPOSTERR, + CURL_SSLNOCONN, + CURL_FTPBADRESUME, + CURL_FILENOACC, + CURL_LDAPNOBIND, + CURL_LDAPNOSRCH, + CURL_LDAPNOLIB, + CURL_LDAPNOFUNC, + CURL_ABORTCB, + CURL_BADPARAM, + CURL_BADORDER, + CURL_BADPWD, + CURL_MNYREDIR, + CURL_UNKTELNET, + CURL_UNKMSG, + CURL_BADSSLCERT, + CURL_SRVNOERR, + CURL_MAXMSG +}; +#endif + +extern void hugehelp(void); + +/* + * This is the main global constructor for the app. Call this before + * _any_ libcurl usage. If this fails, *NO* libcurl functions may be + * used, or havoc may be the result. + */ +CURLcode main_init(void) +{ + return curl_global_init(CURL_GLOBAL_DEFAULT); +} + +/* + * This is the main global destructor for the app. Call this after + * _all_ libcurl usage is done. + */ +void main_free(void) +{ + curl_global_cleanup(); +} + +int SetHTTPrequest(HttpReq req, HttpReq *store) +{ + if((*store == HTTPREQ_UNSPEC) || + (*store == req)) { + *store = req; + return 0; + } + fprintf(stderr, "You can only select one HTTP request!\n"); + return 1; +} + +static void helpf(const char *fmt, ...) +{ + va_list ap; + if(fmt) { + va_start(ap, fmt); + fputs("curl: ", stderr); /* prefix it */ + vfprintf(stderr, fmt, ap); + va_end(ap); + } + fprintf(stderr, "curl: try 'curl --help' for more information\n"); +} + +/* + * A chain of these nodes contain URL to get and where to put the URL's + * contents. + */ +struct getout { + struct getout *next; + char *url; + char *outfile; + int flags; +}; +#define GETOUT_OUTFILE (1<<0) /* set when outfile is deemed done */ +#define GETOUT_URL (1<<1) /* set when URL is deemed done */ +#define GETOUT_USEREMOTE (1<<2) /* use remote file name locally */ + +static void help(void) +{ + printf(CURL_ID "%s\n" + "Usage: curl [options...] <url>\n" + "Options: (H) means HTTP/HTTPS only, (F) means FTP only\n" + " -a/--append Append to target file when uploading (F)\n" + " -A/--user-agent <string> User-Agent to send to server (H)\n" + " -b/--cookie <name=string/file> Cookie string or file to read cookies from (H)\n" + " -B/--use-ascii Use ASCII/text transfer\n", + curl_version()); + puts(" -c/--cookie-jar <file> Write all cookies to this file after operation (H)\n" + " -C/--continue-at <offset> Specify absolute resume offset\n" + " -d/--data <data> HTTP POST data (H)\n" + " --data-ascii <data> HTTP POST ASCII data (H)\n" + " --data-binary <data> HTTP POST binary data (H)\n" + " --disable-epsv Prevents curl from using EPSV (F)\n" + " -D/--dump-header <file> Write the headers to this file\n" + " --egd-file <file> EGD socket path for random data (SSL)\n" + " -e/--referer Referer page (H)"); + puts(" -E/--cert <cert[:passwd]> Specifies your certificate file and password (HTTPS)\n" + " --cert-type <type> Specifies your certificate file type (DER/PEM/ENG) (HTTPS)\n" + " --key <key> Specifies your private key file (HTTPS)\n" + " --key-type <type> Specifies your private key file type (DER/PEM/ENG) (HTTPS)\n" + " --pass <pass> Specifies your passphrase for the private key (HTTPS)"); + puts(" --engine <eng> Specifies the crypto engine to use (HTTPS)\n" + " --cacert <file> CA certifciate to verify peer against (SSL)\n" + " --ciphers <list> What SSL ciphers to use (SSL)\n" + " --connect-timeout <seconds> Maximum time allowed for connection\n" + " -f/--fail Fail silently (no output at all) on errors (H)\n" + " -F/--form <name=content> Specify HTTP POST data (H)\n" + " -g/--globoff Disable URL sequences and ranges using {} and []\n" + " -G/--get Send the -d data with a HTTP GET (H)"); + puts(" -h/--help This help text\n" + " -H/--header <line> Custom header to pass to server. (H)\n" + " -i/--include Include the HTTP-header in the output (H)\n" + " -I/--head Fetch document info only (HTTP HEAD/FTP SIZE)\n" + " --interface <interface> Specify the interface to be used\n" + " --krb4 <level> Enable krb4 with specified security level (F)\n" + " -K/--config Specify which config file to read\n" + " -l/--list-only List only names of an FTP directory (F)"); + puts(" -L/--location Follow Location: hints (H)\n" + " -m/--max-time <seconds> Maximum time allowed for the transfer\n" + " -M/--manual Display huge help text\n" + " -n/--netrc Read .netrc for user name and password\n" + " -N/--no-buffer Disables the buffering of the output stream"); + puts(" -o/--output <file> Write output to <file> instead of stdout\n" + " -O/--remote-name Write output to a file named as the remote file\n" + " -p/--proxytunnel Perform non-HTTP services through a HTTP proxy\n" + " -P/--ftpport <address> Use PORT with address instead of PASV when ftping (F)\n" + " -q When used as the first parameter disables .curlrc\n" + " -Q/--quote <cmd> Send QUOTE command to FTP before file transfer (F)"); + puts(" -r/--range <range> Retrieve a byte range from a HTTP/1.1 or FTP server\n" + " -R/--remote-time Set the remote file's time on the local output\n" + " -s/--silent Silent mode. Don't output anything\n" + " -S/--show-error Show error. With -s, make curl show errors when they occur\n" + " --stderr <file> Where to redirect stderr. - means stdout.\n" + " -t/--telnet-option <OPT=val> Set telnet option\n" + " -T/--upload-file <file> Transfer/upload <file> to remote site\n" + " --url <URL> Another way to specify URL to work with"); + puts(" -u/--user <user[:password]> Specify user and password to use\n" + " -U/--proxy-user <user[:password]> Specify Proxy authentication\n" + " -v/--verbose Makes the operation more talkative\n" + " -V/--version Outputs version number then quits\n" + " -w/--write-out [format] What to output after completion\n" + " -x/--proxy <host[:port]> Use proxy. (Default port is 1080)\n" + " --random-file <file> File to use for reading random data from (SSL)\n" + " -X/--request <command> Specific request command to use"); + puts(" -y/--speed-time Time needed to trig speed-limit abort. Defaults to 30\n" + " -Y/--speed-limit Stop transfer if below speed-limit for 'speed-time' secs\n" + " -z/--time-cond <time> Includes a time condition to the server (H)\n" + " -Z/--max-redirs <num> Set maximum number of redirections allowed (H)\n" + " -0/--http1.0 Force usage of HTTP 1.0 (H)\n" + " -1/--tlsv1 Force usage of TLSv1 (H)\n" + " -2/--sslv2 Force usage of SSLv2 (H)\n" + " -3/--sslv3 Force usage of SSLv3 (H)"); + puts(" -#/--progress-bar Display transfer progress as a progress bar\n" + " --crlf Convert LF to CRLF in upload. Useful for MVS (OS/390)"); +} + +struct LongShort { + const char *letter; + const char *lname; + bool extraparam; +}; + +struct Configurable { + bool remote_time; + char *random_file; + char *egd_file; + char *useragent; + char *cookie; /* single line with specified cookies */ + char *cookiejar; /* write to this file */ + char *cookiefile; /* read from this file */ + bool use_resume; + bool resume_from_current; + bool disable_epsv; + int resume_from; + char *postfields; + long postfieldsize; + char *referer; + long timeout; + long connecttimeout; + long maxredirs; + char *headerfile; + char *ftpport; + char *iface; + unsigned short porttouse; + char *range; + int low_speed_limit; + int low_speed_time; + bool showerror; + char *infile; + char *userpwd; + char *proxyuserpwd; + char *proxy; + bool configread; + bool proxytunnel; + long conf; + + struct getout *url_list; /* point to the first node */ + struct getout *url_last; /* point to the last/current node */ + + struct getout *url_get; /* point to the node to fill in URL */ + struct getout *url_out; /* point to the node to fill in outfile */ + + char *cipher_list; + char *cert; + char *cert_type; + char *cacert; + char *key; + char *key_type; + char *key_passwd; + char *engine; + bool crlf; + char *customrequest; + char *krb4level; + long httpversion; + bool progressmode; + bool nobuffer; + bool globoff; + bool use_httpget; + + char *writeout; /* %-styled format string to output */ + + FILE *errors; /* if stderr redirect is requested */ + + struct curl_slist *quote; + struct curl_slist *postquote; + struct curl_slist *prequote; + + long ssl_version; + curl_TimeCond timecond; + time_t condtime; + + struct curl_slist *headers; + + struct HttpPost *httppost; + struct HttpPost *last_post; + + struct curl_slist *telnet_options; + + HttpReq httpreq; +}; + +static int parseconfig(char *filename, + struct Configurable *config); +static char *my_get_line(FILE *fp); + +static void GetStr(char **string, + char *value) +{ + if(*string) + free(*string); + if(value && *value) + *string = strdup(value); + else + *string = NULL; +} + +static char *file2string(FILE *file) +{ + char buffer[256]; + char *ptr; + char *string=NULL; + int len=0; + int stringlen; + + if(file) { + while(fgets(buffer, sizeof(buffer), file)) { + ptr= strchr(buffer, '\r'); + if(ptr) + *ptr=0; + ptr= strchr(buffer, '\n'); + if(ptr) + *ptr=0; + stringlen=strlen(buffer); + if(string) + string = realloc(string, len+stringlen+1); + else + string = malloc(stringlen+1); + + strcpy(string+len, buffer); + + len+=stringlen; + } + return string; + } + else + return NULL; /* no string */ +} + +static char *file2memory(FILE *file, long *size) +{ + char buffer[1024]; + char *string=NULL; + char *newstring=NULL; + long len=0; + long stringlen=0; + + if(file) { + while((len = fread(buffer, 1, sizeof(buffer), file))) { + if(string) { + newstring = realloc(string, len+stringlen); + if(newstring) + string = newstring; + else + break; /* no more strings attached! :-) */ + } + else + string = malloc(len); + memcpy(&string[stringlen], buffer, len); + stringlen+=len; + } + *size = stringlen; + return string; + } + else + return NULL; /* no string */ +} + +void clean_getout(struct Configurable *config) +{ + struct getout *node=config->url_list; + struct getout *next; + + while(node) { + next = node->next; + if(node->url) + free(node->url); + if(node->outfile) + free(node->outfile); + free(node); + + node = next; /* GOTO next */ + } +} + +struct getout *new_getout(struct Configurable *config) +{ + struct getout *node =malloc(sizeof(struct getout)); + struct getout *last= config->url_last; + if(node) { + /* clear the struct */ + memset(node, 0, sizeof(struct getout)); + + /* append this new node last in the list */ + if(last) + last->next = node; + else + config->url_list = node; /* first node */ + + /* move the last pointer */ + config->url_last = node; + } + return node; +} + +/* Structure for storing the information needed to build a multiple files + * section +*/ +struct multi_files { + struct curl_forms form; + struct multi_files *next; +}; + +/* Add a new list entry possibly with a type_name + */ +static void *AddMultiFiles (const char *file_name, + const char *type_name, + struct multi_files **multi_start, + struct multi_files **multi_current) +{ + struct multi_files *multi; + struct multi_files *multi_type = NULL; + multi = (struct multi_files *)malloc(sizeof(struct multi_files)); + if (multi) { + memset(multi, 0, sizeof(struct multi_files)); + multi->form.option = CURLFORM_FILE; + multi->form.value = file_name; + } + else + return NULL; + if (type_name) { + multi_type = (struct multi_files *)malloc(sizeof(struct multi_files)); + if (multi_type) { + memset(multi_type, 0, sizeof(struct multi_files)); + multi_type->form.option = CURLFORM_CONTENTTYPE; + multi_type->form.value = type_name; + multi->next = multi_type; + } + else { + free (multi); + return NULL; + } + } + if (!*multi_start) + *multi_start = multi; + if (!*multi_current) { + if (multi_type) + *multi_current = multi_type; + else + *multi_current = multi; + } + else { + if (multi_type) { + (*multi_current)->next = multi; + *multi_current = multi_type; + } + else { + (*multi_current)->next = multi; + *multi_current = multi; + } + } + return *multi_current; +} + +/* Free the items of the list. + */ +static void FreeMultiInfo (struct multi_files **multi_start) +{ + struct multi_files *multi; + while (*multi_start) { + multi = *multi_start; + *multi_start = (*multi_start)->next; + free (multi); + } +} + +/*************************************************************************** + * + * formparse() + * + * Reads a 'name=value' paramter and builds the appropriate linked list. + * + * Specify files to upload with 'name=@filename'. Supports specified + * given Content-Type of the files. Such as ';type=<content-type>'. + * + * You may specify more than one file for a single name (field). Specify + * multiple files by writing it like: + * + * 'name=@filename,filename2,filename3' + * + * If you want content-types specified for each too, write them like: + * + * 'name=@filename;type=image/gif,filename2,filename3' + * + * Does use curl_formadd to fulfill it's job. Is heavily based on the + * old curl_formparse code. + * + ***************************************************************************/ + +#define FORM_FILE_SEPARATOR ',' +#define FORM_TYPE_SEPARATOR ';' + +static int formparse(char *input, + struct HttpPost **httppost, + struct HttpPost **last_post) +{ + /* nextarg MUST be a string in the format 'name=contents' and we'll + build a linked list with the info */ + char name[256]; + char *contents; + char major[128]; + char minor[128]; + char *contp; + const char *type = NULL; + char *sep; + char *sep2; + + /* Preallocate contents to the length of input to make sure we don't + overwrite anything. */ + contents = malloc(strlen(input)); + contents[0] = '\000'; + + if(1 <= sscanf(input, "%255[^=]=%[^\n]", name, contents)) { + /* the input was using the correct format */ + contp = contents; + + if('@' == contp[0]) { + struct multi_files *multi_start = NULL, *multi_current = NULL; + /* we use the @-letter to indicate file name(s) */ + contp++; + + multi_start = multi_current=NULL; + + do { + /* since this was a file, it may have a content-type specifier + at the end too */ + + sep=strchr(contp, FORM_TYPE_SEPARATOR); + sep2=strchr(contp, FORM_FILE_SEPARATOR); + + /* pick the closest */ + if(sep2 && (sep2 < sep)) { + sep = sep2; + + /* no type was specified! */ + } + if(sep) { + + /* if we got here on a comma, don't do much */ + if(FORM_FILE_SEPARATOR != *sep) + type = strstr(sep+1, "type="); + else + type=NULL; + + *sep=0; /* terminate file name at separator */ + + if(type) { + type += strlen("type="); + + if(2 != sscanf(type, "%127[^/]/%127[^,\n]", + major, minor)) { + fprintf(stderr, "Illegally formatted content-type field!\n"); + free(contents); + FreeMultiInfo (&multi_start); + return 2; /* illegal content-type syntax! */ + } + /* now point beyond the content-type specifier */ + sep = (char *)type + strlen(major)+strlen(minor)+1; + + /* find the following comma */ + sep=strchr(sep, FORM_FILE_SEPARATOR); + } + } + else { + type=NULL; + sep=strchr(contp, FORM_FILE_SEPARATOR); + } + if(sep) { + /* the next file name starts here */ + *sep =0; + sep++; + } + /* if type == NULL curl_formadd takes care of the problem */ + + if (!AddMultiFiles (contp, type, &multi_start, &multi_current)) { + fprintf(stderr, "Error building form post!\n"); + free(contents); + FreeMultiInfo (&multi_start); + return 3; + } + contp = sep; /* move the contents pointer to after the separator */ + } while(sep && *sep); /* loop if there's another file name */ + /* now we add the multiple files section */ + if (multi_start) { + struct curl_forms *forms = NULL; + struct multi_files *ptr = multi_start; + unsigned int i, count = 0; + while (ptr) { + ptr = ptr->next; + ++count; + } + forms = + (struct curl_forms *)malloc((count+1)*sizeof(struct curl_forms)); + if (!forms) + { + fprintf(stderr, "Error building form post!\n"); + free(contents); + FreeMultiInfo (&multi_start); + return 4; + } + for (i = 0, ptr = multi_start; i < count; ++i, ptr = ptr->next) + { + forms[i].option = ptr->form.option; + forms[i].value = ptr->form.value; + } + forms[count].option = CURLFORM_END; + FreeMultiInfo (&multi_start); + if (curl_formadd (httppost, last_post, + CURLFORM_COPYNAME, name, + CURLFORM_ARRAY, forms, CURLFORM_END) != 0) { + fprintf(stderr, "curl_formadd failed!\n"); + free(forms); + free(contents); + return 5; + } + free(forms); + } + } + else { + if( contp[0]=='<' ) { + if (curl_formadd (httppost, last_post, + CURLFORM_COPYNAME, name, + CURLFORM_FILECONTENT, contp+1, CURLFORM_END) != 0) { + fprintf(stderr, "curl_formadd failed!\n"); + free(contents); + return 6; + } + } + else { + if (curl_formadd (httppost, last_post, + CURLFORM_COPYNAME, name, + CURLFORM_COPYCONTENTS, contp, CURLFORM_END) != 0) { + fprintf(stderr, "curl_formadd failed!\n"); + free(contents); + return 7; + } + } + } + + } + else { + fprintf(stderr, "Illegally formatted input field!\n"); + free(contents); + return 1; + } + free(contents); + return 0; +} + + +typedef enum { + PARAM_OK, + PARAM_OPTION_AMBIGUOUS, + PARAM_OPTION_UNKNOWN, + PARAM_REQUIRES_PARAMETER, + PARAM_BAD_USE, + PARAM_HELP_REQUESTED, + PARAM_GOT_EXTRA_PARAMETER, + + PARAM_LAST +} ParameterError; + +static ParameterError getparameter(char *flag, /* f or -long-flag */ + char *nextarg, /* NULL if unset */ + bool *usedarg, /* set to TRUE if the arg + has been used */ + struct Configurable *config) +{ + char letter; + char subletter=0; /* subletters can only occur on long options */ + + const char *parse=NULL; + int res; + unsigned int j; + time_t now; + int hit=-1; + bool longopt=FALSE; + bool singleopt=FALSE; /* when true means '-o foo' used '-ofoo' */ + + + /* single-letter, + long-name, + boolean whether it takes an additional argument + */ + struct LongShort aliases[]= { + {"9", "crlf", FALSE}, + {"8", "stderr", TRUE}, + {"7", "interface", TRUE}, + {"6", "krb4", TRUE}, + {"5", "url", TRUE}, + {"5a", "random-file", TRUE}, + {"5b", "egd-file", TRUE}, + {"5c", "connect-timeout", TRUE}, + {"5d", "ciphers", TRUE}, + {"5e", "disable-epsv", FALSE}, + + {"0", "http1.0", FALSE}, + {"1", "tlsv1", FALSE}, + {"2", "sslv2", FALSE}, + {"3", "sslv3", FALSE}, + {"a", "append", FALSE}, + {"A", "user-agent", TRUE}, + {"b", "cookie", TRUE}, + {"B", "ftp-ascii", FALSE}, /* this long format is OBSOLETE now! */ + {"B", "use-ascii", FALSE}, + {"c", "cookie-jar", TRUE}, + {"C", "continue-at", TRUE}, + {"d", "data", TRUE}, + {"da", "data-ascii", TRUE}, + {"db", "data-binary", TRUE}, + {"D", "dump-header", TRUE}, + {"e", "referer", TRUE}, + {"E", "cert", TRUE}, + {"Ea", "cacert", TRUE}, + {"Eb","cert-type", TRUE}, + {"Ec","key", TRUE}, + {"Ed","key-type", TRUE}, + {"Ee","pass", TRUE}, + {"Ef","engine", TRUE}, + {"f", "fail", FALSE}, + {"F", "form", TRUE}, + {"g", "globoff", FALSE}, + {"G", "get", FALSE}, + {"h", "help", FALSE}, + {"H", "header", TRUE}, + {"i", "include", FALSE}, + {"I", "head", FALSE}, + {"K", "config", TRUE}, + {"l", "list-only", FALSE}, + {"L", "location", FALSE}, + {"m", "max-time", TRUE}, + {"M", "manual", FALSE}, + {"n", "netrc", FALSE}, + {"N", "no-buffer", FALSE}, + {"o", "output", TRUE}, + {"O", "remote-name", FALSE}, + {"p", "proxytunnel", FALSE}, + {"P", "ftpport", TRUE}, + {"q", "disable", FALSE}, + {"Q", "quote", TRUE}, + {"r", "range", TRUE}, + {"R", "remote-time", FALSE}, + {"s", "silent", FALSE}, + {"S", "show-error", FALSE}, + {"t", "telnet-options", TRUE}, + {"T", "upload-file", TRUE}, + {"u", "user", TRUE}, + {"U", "proxy-user", TRUE}, + {"v", "verbose", FALSE}, + {"V", "version", FALSE}, + {"w", "write-out", TRUE}, + {"x", "proxy", TRUE}, + {"X", "request", TRUE}, + {"X", "http-request", TRUE}, /* OBSOLETE VERSION */ + {"Y", "speed-limit", TRUE}, + {"y", "speed-time", TRUE}, + {"z", "time-cond", TRUE}, + {"Z", "max-redirs", TRUE}, + {"#", "progress-bar",FALSE}, + }; + + if(('-' != flag[0]) || + (('-' == flag[0]) && ('-' == flag[1]))) { + /* this should be a long name */ + char *word=('-' == flag[0])?flag+2:flag; + int fnam=strlen(word); + int numhits=0; + for(j=0; j< sizeof(aliases)/sizeof(aliases[0]); j++) { + if(strnequal(aliases[j].lname, word, fnam)) { + longopt = TRUE; + numhits++; + if(strequal(aliases[j].lname, word)) { + parse = aliases[j].letter; + hit = j; + numhits = 1; /* a single unique hit */ + break; + } + parse = aliases[j].letter; + hit = j; + } + } + if(numhits>1) { + /* this is at least the second match! */ + return PARAM_OPTION_AMBIGUOUS; + } + if(hit < 0) { + return PARAM_OPTION_UNKNOWN; + } + } + else { + flag++; /* prefixed with one dash, pass it */ + hit=-1; + parse = flag; + } + + do { + /* we can loop here if we have multiple single-letters */ + + if(!longopt) + letter = parse?*parse:'\0'; + else { + letter = parse[0]; + subletter = parse[1]; + } + *usedarg = FALSE; /* default is that we don't use the arg */ + +#if 0 + fprintf(stderr, "OPTION: %c %s\n", letter, nextarg?nextarg:"<null>"); +#endif + if(hit < 0) { + for(j=0; j< sizeof(aliases)/sizeof(aliases[0]); j++) { + if(letter == aliases[j].letter[0]) { + hit = j; + break; + } + } + if(hit < 0) { + return PARAM_OPTION_UNKNOWN; + } + } + if(hit < 0) { + return PARAM_OPTION_UNKNOWN; + } + if(!longopt && aliases[hit].extraparam && parse[1]) { + nextarg=(char *)&parse[1]; /* this is the actual extra parameter */ + singleopt=TRUE; /* don't loop anymore after this */ + } + else if((!nextarg || !*nextarg) && aliases[hit].extraparam) { + return PARAM_REQUIRES_PARAMETER; + } + else if(nextarg && aliases[hit].extraparam) + *usedarg = TRUE; /* mark it as used */ + + switch(letter) { + case '9': /* there is no short letter for this */ + /* LF -> CRLF conversinon? */ + config->crlf = TRUE; + break; + case '8': /* there is no short letter for this */ + if(strcmp(nextarg, "-")) + config->errors = fopen(nextarg, "wt"); + else + config->errors = stdout; + break; + case '7': /* there is no short letter for this */ + /* interface */ + GetStr(&config->iface, nextarg); + break; + case '6': /* there is no short letter for this */ + /* krb4 level string */ + GetStr(&config->krb4level, nextarg); + break; + case '5': + switch(subletter) { + case 'a': /* random-file */ + GetStr(&config->random_file, nextarg); + break; + case 'b': /* egd-file */ + GetStr(&config->egd_file, nextarg); + break; + case 'c': /* connect-timeout */ + config->connecttimeout=atoi(nextarg); + break; + case 'd': /* ciphers */ + GetStr(&config->cipher_list, nextarg); + break; + case 'e': /* --disable-epsv */ + config->disable_epsv ^= TRUE; + break; + default: /* the URL! */ + { + struct getout *url; + if(config->url_get || (config->url_get=config->url_list)) { + /* there's a node here, if it already is filled-in continue to find + an "empty" node */ + while(config->url_get && (config->url_get->flags&GETOUT_URL)) + config->url_get = config->url_get->next; + } + + /* now there might or might not be an available node to fill in! */ + + if(config->url_get) + /* existing node */ + url = config->url_get; + else + /* there was no free node, create one! */ + url=new_getout(config); + + if(url) { + /* fill in the URL */ + GetStr(&url->url, nextarg); + url->flags |= GETOUT_URL; + } + } + } + break; + case '#': /* added 19990617 larsa */ + config->progressmode ^= CURL_PROGRESS_BAR; + break; + case '0': + /* HTTP version 1.0 */ + config->httpversion = CURL_HTTP_VERSION_1_0; + break; + case '1': + /* TLS version 1 */ + config->ssl_version = CURL_SSLVERSION_TLSv1; + break; + case '2': + /* SSL version 2 */ + config->ssl_version = CURL_SSLVERSION_SSLv2; + break; + case '3': + /* SSL version 3 */ + config->ssl_version = CURL_SSLVERSION_SSLv3; + break; + case 'a': + /* This makes the FTP sessions use APPE instead of STOR */ + config->conf ^= CONF_FTPAPPEND; + break; + case 'A': + /* This specifies the User-Agent name */ + GetStr(&config->useragent, nextarg); + break; + case 'b': /* cookie string coming up: */ + if(nextarg[0] == '@') { + nextarg++; + } + else if(strchr(nextarg, '=')) { + /* A cookie string must have a =-letter */ + GetStr(&config->cookie, nextarg); + break; + } + /* We have a cookie file to read from! */ + GetStr(&config->cookiefile, nextarg); + break; + case 'B': + /* use ASCII/text when transfering */ + config->conf ^= CONF_GETTEXT; + break; + case 'c': + /* get the file name to dump all cookies in */ + GetStr(&config->cookiejar, nextarg); + break; + case 'C': + /* This makes us continue an ftp transfer at given position */ + if(!strequal(nextarg, "-")) { + config->resume_from= atoi(nextarg); + config->resume_from_current = FALSE; + } + else { + config->resume_from_current = TRUE; + config->resume_from = 0; + } + config->use_resume=TRUE; + break; + case 'd': + /* postfield data */ + { + char *postdata=NULL; + + if('@' == *nextarg) { + /* the data begins with a '@' letter, it means that a file name + or - (stdin) follows */ + FILE *file; + + nextarg++; /* pass the @ */ + + if(strequal("-", nextarg)) + file = stdin; + else + file = fopen(nextarg, "r"); + + if(subletter == 'b') /* forced binary */ + postdata = file2memory(file, &config->postfieldsize); + else + postdata = file2string(file); + if(file && (file != stdin)) + fclose(stdin); + } + else { + GetStr(&postdata, nextarg); + } + + if(config->postfields && *config->postfields) { + /* we already have a string, we append this one + with a separating &-letter */ + char *oldpost=config->postfields; + config->postfields=aprintf("%s&%s", oldpost, postdata); + free(oldpost); + free(postdata); + } + else + config->postfields=postdata; + } + + if(SetHTTPrequest(HTTPREQ_SIMPLEPOST, &config->httpreq)) + return PARAM_BAD_USE; + break; + case 'D': + /* dump-header to given file name */ + GetStr(&config->headerfile, nextarg); + break; + case 'e': + { + char *ptr = strstr(nextarg, ";auto"); + if(ptr) { + /* Automatic referer requested, this may be combined with a + set initial one */ + config->conf |= CONF_AUTO_REFERER; + *ptr = 0; /* zero terminate here */ + } + GetStr(&config->referer, nextarg); + } + break; + case 'E': + switch(subletter) { + case 'a': /* CA info PEM file */ + /* CA info PEM file */ + GetStr(&config->cacert, nextarg); + break; + case 'b': /* cert file type */ + GetStr(&config->cert_type, nextarg); + break; + case 'c': /* private key file */ + GetStr(&config->key, nextarg); + break; + case 'd': /* private key file type */ + GetStr(&config->key_type, nextarg); + break; + case 'e': /* private key passphrase */ + GetStr(&config->key_passwd, nextarg); + break; + case 'f': /* crypto engine */ + GetStr(&config->engine, nextarg); + break; + default: /* certificate file */ + { + char *ptr = strchr(nextarg, ':'); + /* Since we live in a world of weirdness and confusion, the win32 + dudes can use : when using drive letters and thus + c:\file:password needs to work. In order not to break + compatibility, we still use : as separator, but we try to detect + when it is used for a file name! On windows. */ +#ifdef WIN32 + if(ptr && + (ptr == &nextarg[1]) && + (nextarg[2] == '\\') && + (isalpha((int)nextarg[0])) ) + /* colon in the second column, followed by a backslash, and the + first character is an alphabetic letter: + + this is a drive letter colon */ + ptr = strchr(&nextarg[3], ':'); /* find the next one instead */ +#endif + if(ptr) { + /* we have a password too */ + *ptr=0; + ptr++; + GetStr(&config->key_passwd, ptr); + } + GetStr(&config->cert, nextarg); + } + } + break; + case 'f': + /* fail hard on errors */ + config->conf ^= CONF_FAILONERROR; + break; + case 'F': + /* "form data" simulation, this is a little advanced so lets do our best + to sort this out slowly and carefully */ + if(formparse(nextarg, + &config->httppost, + &config->last_post)) + return PARAM_BAD_USE; + if(SetHTTPrequest(HTTPREQ_POST, &config->httpreq)) + return PARAM_BAD_USE; + break; + + case 'g': /* g disables URLglobbing */ + config->globoff ^= TRUE; + break; + + case 'G': /* HTTP GET */ + config->use_httpget = TRUE; + break; + + case 'h': /* h for help */ + help(); + return PARAM_HELP_REQUESTED; + case 'H': + /* A custom header to append to a list */ + config->headers = curl_slist_append(config->headers, nextarg); + break; + case 'i': + config->conf ^= CONF_HEADER; /* include the HTTP header as well */ + break; + case 'I': + /* + * This is a bit tricky. We either SET both bits, or we clear both + * bits. Let's not make any other outcomes from this. + */ + if((CONF_HEADER|CONF_NOBODY) != + (config->conf&(CONF_HEADER|CONF_NOBODY)) ) { + /* one of them weren't set, set both */ + config->conf |= (CONF_HEADER|CONF_NOBODY); + if(SetHTTPrequest(HTTPREQ_HEAD, &config->httpreq)) + return PARAM_BAD_USE; + } + else { + /* both were set, clear both */ + config->conf &= ~(CONF_HEADER|CONF_NOBODY); + if(SetHTTPrequest(HTTPREQ_GET, &config->httpreq)) + return PARAM_BAD_USE; + } + break; + case 'K': + res = parseconfig(nextarg, config); + config->configread = TRUE; + if(res) + return res; + break; + case 'l': + config->conf ^= CONF_FTPLISTONLY; /* only list the names of the FTP dir */ + break; + case 'L': + config->conf ^= CONF_FOLLOWLOCATION; /* Follow Location: HTTP headers */ + break; + case 'm': + /* specified max time */ + config->timeout = atoi(nextarg); + break; + case 'M': /* M for manual, huge help */ + hugehelp(); + return PARAM_HELP_REQUESTED; + case 'n': + /* pick info from .netrc, if this is used for http, curl will + automatically enfore user+password with the request */ + config->conf ^= CONF_NETRC; + break; + case 'N': + /* disable the output I/O buffering */ + config->nobuffer ^= 1; + break; + case 'o': + case 'O': + /* output file */ + { + struct getout *url; + if(config->url_out || (config->url_out=config->url_list)) { + /* there's a node here, if it already is filled-in continue to find + an "empty" node */ + while(config->url_out && (config->url_out->flags&GETOUT_OUTFILE)) + config->url_out = config->url_out->next; + } + + /* now there might or might not be an available node to fill in! */ + + if(config->url_out) + /* existing node */ + url = config->url_out; + else + /* there was no free node, create one! */ + url=new_getout(config); + + if(url) { + /* fill in the outfile */ + if('o' == letter) + GetStr(&url->outfile, nextarg); + else { + url->outfile=NULL; /* leave it */ + url->flags |= GETOUT_USEREMOTE; + } + url->flags |= GETOUT_OUTFILE; + } + } + break; + case 'P': + /* This makes the FTP sessions use PORT instead of PASV */ + /* use <eth0> or <192.168.10.10> style addresses. Anything except + this will make us try to get the "default" address. + NOTE: this is a changed behaviour since the released 4.1! + */ + GetStr(&config->ftpport, nextarg); + break; + case 'p': + /* proxy tunnel for non-http protocols */ + config->proxytunnel ^= TRUE; + break; + + case 'q': /* if used first, already taken care of, we do it like + this so we don't cause an error! */ + break; + case 'Q': + /* QUOTE command to send to FTP server */ + switch(nextarg[0]) { + case '-': + /* prefixed with a dash makes it a POST TRANSFER one */ + nextarg++; + config->postquote = curl_slist_append(config->postquote, nextarg); + break; + case '+': + /* prefixed with a plus makes it a just-before-transfer one */ + nextarg++; + config->prequote = curl_slist_append(config->prequote, nextarg); + break; + default: + config->quote = curl_slist_append(config->quote, nextarg); + } + break; + case 'r': + /* byte range requested */ + GetStr(&config->range, nextarg); + break; + case 'R': + /* use remote file's time */ + config->remote_time ^= TRUE; + break; + case 's': + /* don't show progress meter, don't show errors : */ + config->conf |= (CONF_MUTE|CONF_NOPROGRESS); + config->showerror ^= TRUE; /* toggle off */ + break; + case 'S': + /* show errors */ + config->showerror ^= TRUE; /* toggle on if used with -s */ + break; + case 't': + /* Telnet options */ + config->telnet_options = curl_slist_append(config->telnet_options, nextarg); + break; + case 'T': + /* we are uploading */ + config->conf |= CONF_UPLOAD; + if(!strequal("-", nextarg)) + /* make - equal stdin */ + GetStr(&config->infile, nextarg); + break; + case 'u': + /* user:password */ + GetStr(&config->userpwd, nextarg); + break; + case 'U': + /* Proxy user:password */ + GetStr(&config->proxyuserpwd, nextarg); + break; + case 'v': + config->conf ^= CONF_VERBOSE; /* talk a lot */ + break; + case 'V': + printf(CURL_ID "%s\n", curl_version()); + return PARAM_HELP_REQUESTED; + case 'w': + /* get the output string */ + if('@' == *nextarg) { + /* the data begins with a '@' letter, it means that a file name + or - (stdin) follows */ + FILE *file; + nextarg++; /* pass the @ */ + if(strequal("-", nextarg)) + file = stdin; + else + file = fopen(nextarg, "r"); + config->writeout = file2string(file); + if(file && (file != stdin)) + fclose(stdin); + } + else + GetStr(&config->writeout, nextarg); + break; + case 'x': + /* proxy */ + GetStr(&config->proxy, nextarg); + break; + case 'X': + /* set custom request */ + GetStr(&config->customrequest, nextarg); + break; + case 'y': + /* low speed time */ + config->low_speed_time = atoi(nextarg); + if(!config->low_speed_limit) + config->low_speed_limit = 1; + break; + case 'Y': + /* low speed limit */ + config->low_speed_limit = atoi(nextarg); + if(!config->low_speed_time) + config->low_speed_time=30; + break; + case 'z': /* time condition coming up */ + switch(*nextarg) { + case '+': + nextarg++; + default: + /* If-Modified-Since: (section 14.28 in RFC2068) */ + config->timecond = TIMECOND_IFMODSINCE; + break; + case '-': + /* If-Unmodified-Since: (section 14.24 in RFC2068) */ + config->timecond = TIMECOND_IFUNMODSINCE; + nextarg++; + break; + case '=': + /* Last-Modified: (section 14.29 in RFC2068) */ + config->timecond = TIMECOND_LASTMOD; + nextarg++; + break; + } + now=time(NULL); + config->condtime=curl_getdate(nextarg, &now); + if(-1 == (int)config->condtime) { + /* now let's see if it is a file name to get the time from instead! */ + struct stat statbuf; + if(-1 == stat(nextarg, &statbuf)) { + /* failed, remove time condition */ + config->timecond = TIMECOND_NONE; + } + else { + /* pull the time out from the file */ + config->condtime = statbuf.st_mtime; + } + } + break; + case 'Z': + /* specified max no of redirects (http(s)) */ + config->maxredirs = atoi(nextarg); + break; + + default: /* unknown flag */ + return PARAM_OPTION_UNKNOWN; + } + hit = -1; + + } while(!longopt && !singleopt && *++parse && !*usedarg); + + return PARAM_OK; +} + + +static int parseconfig(char *filename, + struct Configurable *config) +{ + int res; + FILE *file; + char filebuffer[256]; + bool usedarg; + char *home=NULL; + + if(!filename || !*filename) { + /* NULL or no file name attempts to load .curlrc from the homedir! */ + +#define CURLRC DOT_CHAR "curlrc" + + home = curl_getenv("HOME"); /* portable environment reader */ + if(!home) + return 0; + if(strlen(home)>(sizeof(filebuffer)-strlen(CURLRC))) { + free(home); + return 0; + } + + sprintf(filebuffer, "%s%s%s", home, DIR_CHAR, CURLRC); + + filename = filebuffer; + } + + if(strcmp(filename,"-")) + file = fopen(filename, "r"); + else + file = stdin; + + if(file) { + char *line; + char *aline; + char *option; + char *param; + int lineno=0; + bool alloced_param; + +#define isseparator(x) (((x)=='=') || ((x) == ':')) + + while (NULL != (aline = my_get_line(file))) { + lineno++; + line = aline; + alloced_param=FALSE; + + /* lines with # in the fist column is a comment! */ + while(isspace((int)*line)) + line++; + + switch(*line) { + case '#': + case '/': + case '\r': + case '\n': + case '*': + case '\0': + free(line); + continue; + } + + /* the option keywords starts here */ + option = line; + while(*line && !isspace((int)*line) && !isseparator(*line)) + line++; + /* ... and has ended here */ + + *line++=0; /* zero terminate, we have a local copy of the data */ + +#ifdef DEBUG_CONFIG + fprintf(stderr, "GOT: %s\n", option); +#endif + + /* pass spaces and separator(s) */ + while(isspace((int)*line) || isseparator(*line)) + line++; + + /* the parameter starts here (unless quoted) */ + if(*line == '\"') { + char *ptr; + /* quoted parameter, do the qoute dance */ + line++; + param=strdup(line); /* parameter */ + alloced_param=TRUE; + + ptr=param; + while(*line && (*line != '\"')) { + if(*line == '\\') { + char out; + line++; + + /* default is to output the letter after the backslah */ + switch(out = *line) { + case '\0': + continue; /* this'll break out of the loop */ + case 't': + out='\t'; + break; + case 'n': + out='\n'; + break; + case 'r': + out='\r'; + break; + case 'v': + out='\v'; + break; + } + *ptr++=out; + line++; + } + else + *ptr++=*line++; + } + *ptr=0; /* always zero terminate */ + + } + else { + param=line; /* parameter starts here */ + while(*line && !isspace((int)*line)) + line++; + *line=0; /* zero terminate */ + } +#ifdef DEBUG_CONFIG + fprintf(stderr, "PARAM: \"%s\"\n", param); +#endif + res = getparameter(option, param, &usedarg, config); + + if(*param && !usedarg) + /* we passed in a parameter that wasn't used! */ + res = PARAM_GOT_EXTRA_PARAMETER; + + if(res != PARAM_OK) { + /* the help request isn't really an error */ + if(!strcmp(filename, "-")) { + filename=(char *)"<stdin>"; + } + if(PARAM_HELP_REQUESTED != res) { + const char *reason; + switch(res) { + default: + case PARAM_GOT_EXTRA_PARAMETER: + reason = "had unsupported trailing garbage"; + break; + case PARAM_OPTION_UNKNOWN: + reason = "is unknown"; + break; + case PARAM_OPTION_AMBIGUOUS: + reason = "is ambiguous"; + break; + case PARAM_REQUIRES_PARAMETER: + reason = "requires parameter"; + break; + case PARAM_BAD_USE: + reason = "is badly used here"; + break; + } + fprintf(stderr, "%s:%d: warning: '%s' %s\n", + filename, lineno, option, reason); + } + } + + if(alloced_param) + free(param); + + free(aline); + } + if(file != stdin) + fclose(file); + } + if(home) + free(home); + return 0; +} + +struct OutStruct { + char *filename; + FILE *stream; + struct Configurable *config; +}; + +int my_fwrite(void *buffer, size_t size, size_t nmemb, void *stream) +{ + struct OutStruct *out=(struct OutStruct *)stream; + if(out && !out->stream) { + /* open file for writing */ + out->stream=fopen(out->filename, "wb"); + if(!out->stream) + return -1; /* failure */ + if(out->config->nobuffer) { + /* disable output buffering */ +#ifdef HAVE_SETVBUF + setvbuf(out->stream, NULL, _IONBF, 0); +#endif + } + } + return fwrite(buffer, size, nmemb, out->stream); +} + +struct ProgressData { + size_t total; + size_t prev; + size_t point; + int width; + FILE *out; /* where to write everything to */ +}; + +int myprogress (void *clientp, + size_t dltotal, + size_t dlnow, + size_t ultotal, + size_t ulnow) +{ + /* The original progress-bar source code was written for curl by Lars Aas, + and this new edition inherites some of his concepts. */ + + char line[256]; + char outline[256]; + char format[40]; + float frac; + float percent; + int barwidth; + int num; + int i; + + struct ProgressData *bar = (struct ProgressData *)clientp; + size_t total = dltotal + ultotal; + + bar->point = dlnow + ulnow; /* we've come this far */ + + if(0 == total) { + int prevblock = bar->prev / 1024; + int thisblock = bar->point / 1024; + while ( thisblock > prevblock ) { + fprintf( bar->out, "#" ); + prevblock++; + } + } + else { + frac = (float) bar->point / (float) total; + percent = frac * 100.0f; + barwidth = bar->width - 7; + num = (int) (((float)barwidth) * frac); + i = 0; + for ( i = 0; i < num; i++ ) { + line[i] = '#'; + } + line[i] = '\0'; + sprintf( format, "%%-%ds %%5.1f%%%%", barwidth ); + sprintf( outline, format, line, percent ); + fprintf( bar->out, "\r%s", outline ); + } + bar->prev = bar->point; + + return 0; +} + +static +void progressbarinit(struct ProgressData *bar, + struct Configurable *config) +{ +#ifdef __EMX__ + /* 20000318 mgs */ + int scr_size [2]; +#endif + char *colp; + + memset(bar, 0, sizeof(struct ProgressData)); + +/* TODO: get terminal width through ansi escapes or something similar. + try to update width when xterm is resized... - 19990617 larsa */ +#ifndef __EMX__ + /* 20000318 mgs + * OS/2 users most likely won't have this env var set, and besides that + * we're using our own way to determine screen width */ + colp = curl_getenv("COLUMNS"); + if (colp != NULL) { + bar->width = atoi(colp); + free(colp); + } + else + bar->width = 79; +#else + /* 20000318 mgs + * We use this emx library call to get the screen width, and subtract + * one from what we got in order to avoid a problem with the cursor + * advancing to the next line if we print a string that is as long as + * the screen is wide. */ + + _scrsize(scr_size); + bar->width = scr_size[0] - 1; +#endif + + bar->out = config->errors; +} + +void free_config_fields(struct Configurable *config) +{ + if(config->random_file) + free(config->random_file); + if(config->egd_file) + free(config->egd_file); + if(config->userpwd) + free(config->userpwd); + if(config->postfields) + free(config->postfields); + if(config->proxy) + free(config->proxy); + if(config->proxyuserpwd) + free(config->proxyuserpwd); + if(config->cookie) + free(config->cookie); + if(config->cookiefile) + free(config->cookiefile); + if(config->krb4level) + free(config->krb4level); + if(config->headerfile) + free(config->headerfile); + if(config->ftpport) + free(config->ftpport); + if(config->infile) + free(config->infile); + if(config->range) + free(config->range); + if(config->customrequest) + free(config->customrequest); + if(config->writeout) + free(config->writeout); + if(config->httppost) + curl_formfree(config->httppost); + if(config->cacert) + free(config->cacert); + if(config->cookiejar) + free(config->cookiejar); + + curl_slist_free_all(config->quote); /* checks for config->quote == NULL */ + curl_slist_free_all(config->postquote); /* */ + curl_slist_free_all(config->headers); /* */ +} + + +static int +operate(struct Configurable *config, int argc, char *argv[]) +{ + char errorbuffer[CURL_ERROR_SIZE]; + char useragent[128]; /* buah, we don't want a larger default user agent */ + struct ProgressData progressbar; + struct getout *urlnode; + struct getout *nextnode; + + struct OutStruct outs; + struct OutStruct heads; + + char *url = NULL; + + URLGlob *urls=NULL; + int urlnum; + char *outfiles; + int separator = 0; + + FILE *infd = stdin; + FILE *headerfilep = NULL; + char *urlbuffer=NULL; + int infilesize=-1; /* -1 means unknown */ + bool stillflags=TRUE; + + bool allocuseragent=FALSE; + + char *httpgetfields=NULL; + + CURL *curl; + int res = 0; + int i; + +#ifdef MALLOCDEBUG + /* this sends all memory debug messages to a logfile named memdump */ + char *env; + env = curl_getenv("CURL_MEMDEBUG"); + if(env) { + free(env); + curl_memdebug("memdump"); + } +#endif + + errorbuffer[0]=0; /* prevent junk from being output */ + + main_init(); /* inits */ + + config->showerror=TRUE; + config->conf=CONF_DEFAULT; + config->use_httpget=FALSE; + + if(argc>1 && + (!strnequal("--", argv[1], 2) && (argv[1][0] == '-')) && + strchr(argv[1], 'q')) { + /* + * The first flag, that is not a verbose name, but a shortname + * and it includes the 'q' flag! + */ + ; + } + else { + res = parseconfig(NULL, config); + if(res) + return res; + } + + if ((argc < 2) && !config->url_list) { + helpf(NULL); + return CURLE_FAILED_INIT; + } + + /* Parse options */ + for (i = 1; i < argc; i++) { + if(stillflags && + ('-' == argv[i][0])) { + char *nextarg; + bool passarg; + char *origopt=argv[i]; + + char *flag = argv[i]; + + if(strequal("--", argv[i])) + /* this indicates the end of the flags and thus enables the + following (URL) argument to start with -. */ + stillflags=FALSE; + else { + nextarg= (i < argc - 1)? argv[i+1]: NULL; + + res = getparameter(flag, nextarg, &passarg, config); + if(res) { + switch(res) { + case PARAM_OPTION_AMBIGUOUS: + helpf("option %s is ambiguous\n", origopt); + break; + case PARAM_OPTION_UNKNOWN: + helpf("option %s is unknown\n", origopt); + break; + case PARAM_REQUIRES_PARAMETER: + helpf("option %s requires an extra argument!\n", origopt); + break; + case PARAM_BAD_USE: + helpf("option %s was wrongly used!\n", origopt); + break; + case PARAM_HELP_REQUESTED: + /* no text */ + break; + } + clean_getout(config); + return CURLE_FAILED_INIT; + } + + if(passarg) /* we're supposed to skip this */ + i++; + } + } + else { + bool used; + /* just add the URL please */ + res = getparameter((char *)"--url", argv[i], &used, config); + if(res) + return res; + } + } + + if(!config->url_list) { + helpf("no URL specified!\n"); + return CURLE_FAILED_INIT; + } + if(NULL == config->useragent) { + /* set non-zero default values: */ + snprintf(useragent, sizeof(useragent), + CURL_NAME "/" CURL_VERSION " (" OS ") " "%s", curl_version()); + config->useragent= useragent; + } + else + allocuseragent = TRUE; + + if (config->postfields) { + if (config->use_httpget) { + /* Use the postfields data for a http get */ + httpgetfields = strdup(config->postfields); + free(config->postfields); + config->postfields = NULL; + if(SetHTTPrequest((config->conf&CONF_NOBODY?HTTPREQ_HEAD:HTTPREQ_GET), + &config->httpreq)) { + free(httpgetfields); + return PARAM_BAD_USE; + } + } + else { + if(SetHTTPrequest(HTTPREQ_SIMPLEPOST, &config->httpreq)) + return PARAM_BAD_USE; + } + } + + /* + * Get a curl handle to use for all forthcoming curl transfers. Cleanup + * when all transfers are done. This is supported with libcurl 7.7 and + * should not be attempted on previous versions. + */ + curl = curl_easy_init(); + if(!curl) + return CURLE_FAILED_INIT; + + urlnode = config->url_list; + + /* loop through the list of given URLs */ + while(urlnode) { + + /* get the full URL (it might be NULL) */ + url=urlnode->url; + + if(NULL == url) { + /* This node had no URL, skip it and continue to the next */ + if(urlnode->outfile) + free(urlnode->outfile); + + /* move on to the next URL */ + nextnode=urlnode->next; + free(urlnode); /* free the node */ + urlnode = nextnode; + continue; /* next please */ + } + + /* default output stream is stdout */ + outs.stream = stdout; + outs.config = config; + + if(!config->globoff) { + /* Unless explicitly shut off, we expand '{...}' and '[...]' expressions + and return total number of URLs in pattern set */ + res = glob_url(&urls, url, &urlnum); + if(res != CURLE_OK) + return res; + } + + + /* save outfile pattern before expansion */ + outfiles = urlnode->outfile?strdup(urlnode->outfile):NULL; + + if ((!outfiles || strequal(outfiles, "-")) && urlnum > 1) { + /* multiple files extracted to stdout, insert separators! */ + separator = 1; + } + for(i = 0; + (url = urls?next_url(urls):(i?NULL:strdup(url))); + i++) { + char *outfile; + outfile = outfiles?strdup(outfiles):NULL; + + if((urlnode->flags&GETOUT_USEREMOTE) || + (outfile && !strequal("-", outfile)) ) { + + /* + * We have specified a file name to store the result in, or we have + * decided we want to use the remote file name. + */ + + if(!outfile) { + /* Find and get the remote file name */ + char * pc =strstr(url, "://"); + if(pc) + pc+=3; + else + pc=url; + pc = strrchr(pc, '/'); + outfile = (char *) NULL == pc ? NULL : strdup(pc+1) ; + if(!outfile) { + helpf("Remote file name has no length!\n"); + return CURLE_WRITE_ERROR; + } + } + else if(urls) { + /* fill '#1' ... '#9' terms from URL pattern */ + char *storefile = outfile; + outfile = match_url(storefile, urls); + free(storefile); + } + + if(config->resume_from_current) { + /* we're told to continue where we are now, then we get the size of + the file as it is now and open it for append instead */ + + struct stat fileinfo; + +/*VMS?? -- Danger, the filesize is only valid for stream files */ + if(0 == stat(outfile, &fileinfo)) { + /* set offset to current file size: */ + config->resume_from = fileinfo.st_size; + } + /* else let offset remain 0 */ + } + + if(config->resume_from) { + /* open file for output: */ + outs.stream=(FILE *) fopen(outfile, config->resume_from?"ab":"wb"); + if (!outs.stream) { + helpf("Can't open '%s'!\n", outfile); + return CURLE_WRITE_ERROR; + } + } + else { + outs.filename = outfile; + outs.stream = NULL; /* open when needed */ + } + } + if(config->infile) { + /* + * We have specified a file to upload + */ + struct stat fileinfo; + + /* If no file name part is given in the URL, we add this file name */ + char *ptr=strstr(url, "://"); + if(ptr) + ptr+=3; + else + ptr=url; + ptr = strrchr(ptr, '/'); + if(!ptr || !strlen(++ptr)) { + /* The URL has no file name part, add the local file name. In order + to be able to do so, we have to create a new URL in another + buffer.*/ + + /* We only want the part of the local path that is on the right + side of the rightmost slash and backslash. */ + char *filep = strrchr(config->infile, '/'); + char *file2 = strrchr(filep?filep:config->infile, '\\'); + + if(file2) + filep = file2+1; + else if(filep) + filep++; + else + filep = config->infile; + + urlbuffer=(char *)malloc(strlen(url) + strlen(filep) + 3); + if(!urlbuffer) { + helpf("out of memory\n"); + return CURLE_OUT_OF_MEMORY; + } + if(ptr) + /* there is a trailing slash on the URL */ + sprintf(urlbuffer, "%s%s", url, filep); + else + /* thers is no trailing slash on the URL */ + sprintf(urlbuffer, "%s/%s", url, filep); + + url = urlbuffer; /* use our new URL instead! */ + } +/*VMS??-- Reading binary from files can be a problem... */ +/*VMS?? Only FIXED, VAR etc WITHOUT implied CC will work */ +/*VMS?? Others need a \n appended to a line */ +/*VMS??-- Stat gives a size but this is UNRELIABLE in VMS */ +/*VMS?? As a f.e. a fixed file with implied CC needs to have a byte added */ +/*VMS?? for every record processed, this can by derived from Filesize & recordsize */ +/*VMS?? for VARiable record files the records need to be counted! */ +/*VMS?? for every record add 1 for linefeed and subtract 2 for the record header */ +/*VMS?? for VARIABLE header files only the bare record data needs to be considered with one appended if implied CC */ + + infd=(FILE *) fopen(config->infile, "rb"); + if (!infd || stat(config->infile, &fileinfo)) { + helpf("Can't open '%s'!\n", config->infile); + return CURLE_READ_ERROR; + } + infilesize=fileinfo.st_size; + + } + if((config->conf&CONF_UPLOAD) && + config->resume_from_current) { + config->resume_from = -1; /* -1 will then force get-it-yourself */ + } + if(config->headerfile) { + /* open file for output: */ + if(strcmp(config->headerfile,"-")) { + heads.filename = config->headerfile; + headerfilep=NULL; + } + else + headerfilep=stdout; + heads.stream = headerfilep; + heads.config = config; + } + + if(outs.stream && isatty(fileno(outs.stream)) && + !(config->conf&(CONF_UPLOAD|CONF_HTTPPOST))) + /* we send the output to a tty and it isn't an upload operation, + therefore we switch off the progress meter */ + config->conf |= CONF_NOPROGRESS; + + + if (urlnum > 1) { + fprintf(stderr, "\n[%d/%d]: %s --> %s\n", + i+1, urlnum, url, outfile ? outfile : "<stdout>"); + if (separator) + printf("%s%s\n", CURLseparator, url); + } + if (httpgetfields) { + /* Find out whether the url contains a file name */ + char *pc =strstr(url, "://"); + char separator='?'; + if(pc) + pc+=3; + else + pc=url; + + pc = strrchr(pc, '/'); /* check for a slash */ + + if(pc) { + /* there is a slash present in the URL */ + + if(strchr(pc, '?')) + /* Ouch, there's already a question mark in the URL string, we + then appead the data with an amperand separator instead! */ + separator='&'; + } + /* + * Then append ? followed by the get fields to the url. + */ + urlbuffer=(char *)malloc(strlen(url) + strlen(httpgetfields) + 2); + if(!urlbuffer) { + helpf("out of memory\n"); + return CURLE_OUT_OF_MEMORY; + } + if (pc) + sprintf(urlbuffer, "%s%c%s", url, separator, httpgetfields); + else + /* Append / before the ? to create a well-formed url + if the url contains a hostname only + */ + sprintf(urlbuffer, "%s/?%s", url, httpgetfields); + + free(url); /* free previous URL */ + url = urlbuffer; /* use our new URL instead! */ + } + + if(!config->errors) + config->errors = stderr; + +#if defined(WIN32) && !defined(__CYGWIN32__) + if(!outfile && !(config->conf & CONF_GETTEXT)) { + /* We get the output to stdout and we have not got the ASCII/text flag, + then set stdout to be binary */ + setmode( 1, O_BINARY ); + } +#endif + + curl_easy_setopt(curl, CURLOPT_SSLENGINE, config->engine); + curl_easy_setopt(curl, CURLOPT_SSLENGINE_DEFAULT, 1); + + curl_easy_setopt(curl, CURLOPT_FILE, (FILE *)&outs); /* where to store */ + /* what call to write: */ + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, my_fwrite); + curl_easy_setopt(curl, CURLOPT_INFILE, infd); /* for uploads */ + /* size of uploaded file: */ + curl_easy_setopt(curl, CURLOPT_INFILESIZE, infilesize); + curl_easy_setopt(curl, CURLOPT_URL, url); /* what to fetch */ + curl_easy_setopt(curl, CURLOPT_PROXY, config->proxy); /* proxy to use */ + curl_easy_setopt(curl, CURLOPT_VERBOSE, config->conf&CONF_VERBOSE); + curl_easy_setopt(curl, CURLOPT_HEADER, config->conf&CONF_HEADER); + curl_easy_setopt(curl, CURLOPT_NOPROGRESS, config->conf&CONF_NOPROGRESS); + curl_easy_setopt(curl, CURLOPT_NOBODY, config->conf&CONF_NOBODY); + curl_easy_setopt(curl, CURLOPT_FAILONERROR, + config->conf&CONF_FAILONERROR); + curl_easy_setopt(curl, CURLOPT_UPLOAD, config->conf&CONF_UPLOAD); + curl_easy_setopt(curl, CURLOPT_FTPLISTONLY, + config->conf&CONF_FTPLISTONLY); + curl_easy_setopt(curl, CURLOPT_FTPAPPEND, config->conf&CONF_FTPAPPEND); + curl_easy_setopt(curl, CURLOPT_NETRC, config->conf&CONF_NETRC); + curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, + config->conf&CONF_FOLLOWLOCATION); + curl_easy_setopt(curl, CURLOPT_TRANSFERTEXT, config->conf&CONF_GETTEXT); + curl_easy_setopt(curl, CURLOPT_MUTE, config->conf&CONF_MUTE); + curl_easy_setopt(curl, CURLOPT_USERPWD, config->userpwd); + curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD, config->proxyuserpwd); + curl_easy_setopt(curl, CURLOPT_RANGE, config->range); + curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, errorbuffer); + curl_easy_setopt(curl, CURLOPT_TIMEOUT, config->timeout); + curl_easy_setopt(curl, CURLOPT_POSTFIELDS, config->postfields); + + /* new in libcurl 7.2: */ + curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, config->postfieldsize); + + curl_easy_setopt(curl, CURLOPT_REFERER, config->referer); + curl_easy_setopt(curl, CURLOPT_AUTOREFERER, + config->conf&CONF_AUTO_REFERER); + curl_easy_setopt(curl, CURLOPT_USERAGENT, config->useragent); + curl_easy_setopt(curl, CURLOPT_FTPPORT, config->ftpport); + curl_easy_setopt(curl, CURLOPT_LOW_SPEED_LIMIT, config->low_speed_limit); + curl_easy_setopt(curl, CURLOPT_LOW_SPEED_TIME, config->low_speed_time); + curl_easy_setopt(curl, CURLOPT_RESUME_FROM, + config->use_resume?config->resume_from:0); + curl_easy_setopt(curl, CURLOPT_COOKIE, config->cookie); + curl_easy_setopt(curl, CURLOPT_HTTPHEADER, config->headers); + curl_easy_setopt(curl, CURLOPT_HTTPPOST, config->httppost); + curl_easy_setopt(curl, CURLOPT_SSLCERT, config->cert); + curl_easy_setopt(curl, CURLOPT_SSLCERTTYPE, config->cert_type); + curl_easy_setopt(curl, CURLOPT_SSLKEY, config->key); + curl_easy_setopt(curl, CURLOPT_SSLKEYTYPE, config->key_type); + curl_easy_setopt(curl, CURLOPT_SSLKEYPASSWD, config->key_passwd); + + if(config->cacert) { + curl_easy_setopt(curl, CURLOPT_CAINFO, config->cacert); + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, TRUE); + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 2); + } + else + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 1); + + if((config->conf&CONF_NOBODY) || + config->remote_time) { + /* no body or use remote time */ + curl_easy_setopt(curl, CURLOPT_FILETIME, TRUE); + } + + if (config->maxredirs) + curl_easy_setopt(curl, CURLOPT_MAXREDIRS, config->maxredirs); + else + curl_easy_setopt(curl, CURLOPT_MAXREDIRS, DEFAULT_MAXREDIRS); + + curl_easy_setopt(curl, CURLOPT_CRLF, config->crlf); + curl_easy_setopt(curl, CURLOPT_QUOTE, config->quote); + curl_easy_setopt(curl, CURLOPT_POSTQUOTE, config->postquote); + curl_easy_setopt(curl, CURLOPT_WRITEHEADER, + config->headerfile?&heads:NULL); + curl_easy_setopt(curl, CURLOPT_COOKIEFILE, config->cookiefile); + /* cookie jar was added in 7.9 */ + curl_easy_setopt(curl, CURLOPT_COOKIEJAR, config->cookiejar); + curl_easy_setopt(curl, CURLOPT_SSLVERSION, config->ssl_version); + curl_easy_setopt(curl, CURLOPT_TIMECONDITION, config->timecond); + curl_easy_setopt(curl, CURLOPT_TIMEVALUE, config->condtime); + curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, config->customrequest); + curl_easy_setopt(curl, CURLOPT_STDERR, config->errors); + + /* three new ones in libcurl 7.3: */ + curl_easy_setopt(curl, CURLOPT_HTTPPROXYTUNNEL, config->proxytunnel); + curl_easy_setopt(curl, CURLOPT_INTERFACE, config->iface); + curl_easy_setopt(curl, CURLOPT_KRB4LEVEL, config->krb4level); + + if((config->progressmode == CURL_PROGRESS_BAR) && + !(config->conf&(CONF_NOPROGRESS|CONF_MUTE))) { + /* we want the alternative style, then we have to implement it + ourselves! */ + progressbarinit(&progressbar, config); + curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, myprogress); + curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, &progressbar); + } + + /* new in libcurl 7.6.2: */ + curl_easy_setopt(curl, CURLOPT_TELNETOPTIONS, config->telnet_options); + + /* new in libcurl 7.7: */ + curl_easy_setopt(curl, CURLOPT_RANDOM_FILE, config->random_file); + curl_easy_setopt(curl, CURLOPT_EGDSOCKET, config->egd_file); + curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, config->connecttimeout); + + if(config->cipher_list) + curl_easy_setopt(curl, CURLOPT_SSL_CIPHER_LIST, config->cipher_list); + + if(config->httpversion) + curl_easy_setopt(curl, CURLOPT_HTTP_VERSION, config->httpversion); + + /* new in libcurl 7.9.2: */ + if(config->disable_epsv) + /* disable it */ + curl_easy_setopt(curl, CURLOPT_FTP_USE_EPSV, FALSE); + + res = curl_easy_perform(curl); + + if(config->writeout) { + ourWriteOut(curl, config->writeout); + } + +#ifdef VMS + if (!config->showerror) { + vms_show = VMSSTS_HIDE; + } +#else + if((res!=CURLE_OK) && config->showerror) + fprintf(config->errors, "curl: (%d) %s\n", res, errorbuffer); +#endif + + if(config->headerfile && !headerfilep && heads.stream) + fclose(heads.stream); + + if (outfile && !strequal(outfile, "-") && outs.stream) + fclose(outs.stream); + +#ifdef HAVE_UTIME + /* Important that we set the time _after_ the file has been + closed, as is done above here */ + if(config->remote_time && outs.filename) { + /* as libcurl if we got a time. Pretty please */ + long filetime; + curl_easy_getinfo(curl, CURLINFO_FILETIME, &filetime); + if(filetime >= 0) { + struct utimbuf times; + times.actime = filetime; + times.modtime = filetime; + utime(outs.filename, ×); /* set the time we got */ + } + } +#endif + + if (config->infile) + fclose(infd); + if(headerfilep) + fclose(headerfilep); + + if (httpgetfields) + free(httpgetfields); + + if(url) + free(url); + + if(outfile) + free(outfile); + } + if(outfiles) + free(outfiles); + + if(urls) + /* cleanup memory used for URL globbing patterns */ + glob_cleanup(urls); + + /* empty this urlnode struct */ + if(urlnode->url) + free(urlnode->url); + if(urlnode->outfile) + free(urlnode->outfile); + + /* move on to the next URL */ + nextnode=urlnode->next; + free(urlnode); /* free the node */ + urlnode = nextnode; + + } /* while-loop through all URLs */ + + if(allocuseragent) + free(config->useragent); + + /* cleanup the curl handle! */ + curl_easy_cleanup(curl); + + if((config->errors != stderr) && + (config->errors != stdout)) + /* it wasn't directed to stdout or stderr so close the file! */ + fclose(config->errors); + + main_free(); /* cleanup */ + + return res; +} + + +int main(int argc, char *argv[]) +{ + int res; + struct Configurable config; + memset(&config, 0, sizeof(struct Configurable)); + + res = operate(&config, argc, argv); + free_config_fields(&config); + +#ifdef VMS + if (res > 52) res = 53; /* MAXMSG, porting helper */ + return (vms_cond[res]|vms_show); +#else + return res; +#endif +} + +static char *my_get_line(FILE *fp) +{ + char buf[4096]; + char *nl = NULL; + char *retval = NULL; + + do + { + if (NULL == fgets(buf, sizeof(buf), fp)) + break; + if (NULL == retval) + retval = strdup(buf); + else + { + if (NULL == (retval = realloc(retval, + strlen(retval) + strlen(buf) + 1))) + break; + strcat(retval, buf); + } + } + while (NULL == (nl = strchr(retval, '\n'))); + + if (NULL != nl) + *nl = '\0'; + + return retval; +} diff --git a/Build/source/libs/curl/src/mkhelp.pl b/Build/source/libs/curl/src/mkhelp.pl new file mode 100644 index 00000000000..edc8d173e2e --- /dev/null +++ b/Build/source/libs/curl/src/mkhelp.pl @@ -0,0 +1,94 @@ +#!/usr/local/bin/perl + +# Yeah, I know, probably 1000 other persons already wrote a script like +# this, but I'll tell ya: + +# THEY DON'T FIT ME :-) + +# Get readme file as parameter: +$README = $ARGV[0]; + +if($README eq "") { + print "usage: mkreadme.pl <README>\n"; + exit; +} + + +push @out, " _ _ ____ _ \n"; +push @out, " Project ___| | | | _ \\| | \n"; +push @out, " / __| | | | |_) | | \n"; +push @out, " | (__| |_| | _ <| |___ \n"; +push @out, " \\___|\\___/|_| \\_\\_____|\n"; + +$head=0; +loop: +while (<STDIN>) { + $line = $_; + + # this kind should be removed first: + $line =~ s/_//g; + + # then this: + $line =~ s/.//g; + + if($line =~ /^curl/i) { + # cut off the page headers + $head=1; + next loop; + } + + if($line =~ /^[ \t]*\n/) { + $wline++; + # we only make one empty line max + next loop; + } + if($wline) { + $wline = 0; + if(!$head) { + push @out, "\n"; + } + $head =0; + } + push @out, $line; +} +push @out, "\n"; # just an extra newline + +open(READ, "<$README") || + die "couldn't read the README infile"; + +while(<READ>) { + push @out, $_; +} +close(READ); + + +print "/* NEVER EVER edit this manually, fix the mkhelp script instead! */\n" +; +print "#include <stdio.h>\n"; +print "void hugehelp(void)\n"; +print "{\n"; +print "puts (\n"; + +$outsize=0; +for(@out) { + chop; + + $new = $_; + + $outsize += length($new)+1; # one for the newline + + $new =~ s/\\/\\\\/g; + $new =~ s/\"/\\\"/g; + + # gcc 2.96 claims ISO C89 only is required to support 509 letter strings + if($outsize > 500) { + # terminate and make another puts() call here + print ");\n puts(\n"; + $outsize=length($new)+1; + } + printf("\"%s\\n\"\n", $new); + +} + +print " ) ;\n}\n" + diff --git a/Build/source/libs/curl/src/setup.h b/Build/source/libs/curl/src/setup.h new file mode 100644 index 00000000000..387fde05391 --- /dev/null +++ b/Build/source/libs/curl/src/setup.h @@ -0,0 +1,80 @@ +#ifndef __CLIENT_SETUP_H +#define __CLIENT_SETUP_H +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 2001, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * In order to be useful for every potential user, curl and libcurl are + * dual-licensed under the MPL and the MIT/X-derivate licenses. + * + * 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 MPL or the MIT/X-derivate + * licenses. You may pick one of these licenses. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * $Id: setup.h,v 1.11 2002/02/20 23:24:04 bagder Exp $ + *****************************************************************************/ + +#include <stdio.h> + +#if !defined(WIN32) && defined(_WIN32) +/* This _might_ be a good Borland fix. Please report whether this works or + not! */ +#define WIN32 +#endif + +#ifdef HAVE_CONFIG_H +#ifdef VMS +#include "config-vms.h" +#else +#include "config.h" /* the configure script results */ +#endif +#else +#ifdef WIN32 +/* include the hand-modified win32 adjusted config.h! */ +#include "config-win32.h" +#endif +#ifdef macintosh +/* this is not the same as Mac OS X */ +#include "config-mac.h" +#endif +#endif + +#ifndef OS +#define OS "unknown" +#endif + +#if !defined(fileno) && !defined(WIN32) /* sunos 4 have this as a macro! */ +int fileno( FILE *stream); +#endif + +#ifdef WIN32 +#define PATH_CHAR ";" +#define DIR_CHAR "\\" +#define DOT_CHAR "_" +#else +#ifdef __EMX__ +/* 20000318 mgs + * OS/2 supports leading dots in filenames if the volume is formatted + * with JFS or HPFS. */ +#define PATH_CHAR ";" +#define DIR_CHAR "\\" +#define DOT_CHAR "." +#else + +#define PATH_CHAR ":" +#define DIR_CHAR "/" +#define DOT_CHAR "." + +#endif +#endif + +#endif /* __SETUP_H */ diff --git a/Build/source/libs/curl/src/stamp-h2.in b/Build/source/libs/curl/src/stamp-h2.in new file mode 100644 index 00000000000..9788f70238c --- /dev/null +++ b/Build/source/libs/curl/src/stamp-h2.in @@ -0,0 +1 @@ +timestamp diff --git a/Build/source/libs/curl/src/urlglob.c b/Build/source/libs/curl/src/urlglob.c new file mode 100644 index 00000000000..d77240c9593 --- /dev/null +++ b/Build/source/libs/curl/src/urlglob.c @@ -0,0 +1,472 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 2002, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * In order to be useful for every potential user, curl and libcurl are + * dual-licensed under the MPL and the MIT/X-derivate licenses. + * + * 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 MPL or the MIT/X-derivate + * licenses. You may pick one of these licenses. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * $Id: urlglob.c,v 1.16 2002/03/06 22:52:00 bagder Exp $ + *****************************************************************************/ + +/* client-local setup.h */ +#include "setup.h" + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <ctype.h> +#include <curl/curl.h> +#include "urlglob.h" + +#ifdef MALLOCDEBUG +#include "../lib/memdebug.h" +#endif + +typedef enum { + GLOB_OK, + GLOB_ERROR +} GlobCode; + +/* + * glob_word() + * + * Input a full globbed string, set the forth argument to the amount of + * strings we get out of this. Return GlobCode. + */ +GlobCode glob_word(URLGlob *, /* object anchor */ + char *, /* globbed string */ + int, /* position */ + int *); /* returned number of strings */ + +GlobCode glob_set(URLGlob *glob, char *pattern, int pos, int *amount) +{ + /* processes a set expression with the point behind the opening '{' + ','-separated elements are collected until the next closing '}' + */ + char* buf = glob->glob_buffer; + URLPattern *pat; + + pat = (URLPattern*)&glob->pattern[glob->size / 2]; + /* patterns 0,1,2,... correspond to size=1,3,5,... */ + pat->type = UPTSet; + pat->content.Set.size = 0; + pat->content.Set.ptr_s = 0; + pat->content.Set.elements = (char**)malloc(0); + ++glob->size; + + while (1) { + switch (*pattern) { + case '\0': /* URL ended while set was still open */ + /*printf("error: unmatched brace at pos %d\n", pos);*/ + return GLOB_ERROR; + + case '{': + case '[': /* no nested expressions at this time */ + /*printf("error: nested braces not supported %d\n", pos);*/ + return GLOB_ERROR; + + case ',': + case '}': /* set element completed */ + *buf = '\0'; + pat->content.Set.elements = + realloc(pat->content.Set.elements, + (pat->content.Set.size + 1) * sizeof(char*)); + if (!pat->content.Set.elements) { + /*printf("out of memory in set pattern\n");*/ + return GLOB_ERROR; + } + pat->content.Set.elements[pat->content.Set.size] = + strdup(glob->glob_buffer); + ++pat->content.Set.size; + + if (*pattern == '}') { + /* entire set pattern completed */ + int wordamount; + + /* always check for a literal (may be "") between patterns */ + if(GLOB_ERROR == glob_word(glob, ++pattern, ++pos, &wordamount)) + wordamount=1; + *amount = pat->content.Set.size * wordamount; + + return GLOB_OK; + } + + buf = glob->glob_buffer; + ++pattern; + ++pos; + break; + + case ']': /* illegal closing bracket */ + /*printf("error: illegal pattern at pos %d\n", pos);*/ + return GLOB_ERROR; + + case '\\': /* escaped character, skip '\' */ + if (*(buf+1) == '\0') { /* but no escaping of '\0'! */ + /*printf("error: illegal pattern at pos %d\n", pos); */ + return GLOB_ERROR; + } + ++pattern; + ++pos; /* intentional fallthrough */ + + default: + *buf++ = *pattern++; /* copy character to set element */ + ++pos; + } + } + return GLOB_ERROR; +} + +GlobCode glob_range(URLGlob *glob, char *pattern, int pos, int *amount) +{ + /* processes a range expression with the point behind the opening '[' + - char range: e.g. "a-z]", "B-Q]" + - num range: e.g. "0-9]", "17-2000]" + - num range with leading zeros: e.g. "001-999]" + expression is checked for well-formedness and collected until the next ']' + */ + URLPattern *pat; + char *c; + int wordamount=1; + + pat = (URLPattern*)&glob->pattern[glob->size / 2]; + /* patterns 0,1,2,... correspond to size=1,3,5,... */ + ++glob->size; + + if (isalpha((int)*pattern)) { /* character range detected */ + pat->type = UPTCharRange; + if (sscanf(pattern, "%c-%c]", &pat->content.CharRange.min_c, + &pat->content.CharRange.max_c) != 2 || + pat->content.CharRange.min_c >= pat->content.CharRange.max_c || + pat->content.CharRange.max_c - pat->content.CharRange.min_c > 'z' - 'a') { + /* the pattern is not well-formed */ +#if 0 + printf("error: illegal pattern or range specification after pos %d\n", + pos); +#endif + return GLOB_ERROR; + } + pat->content.CharRange.ptr_c = pat->content.CharRange.min_c; + /* always check for a literal (may be "") between patterns */ + + if(GLOB_ERROR == glob_word(glob, pattern + 4, pos + 4, &wordamount)) + wordamount=1; + + *amount = (pat->content.CharRange.max_c - + pat->content.CharRange.min_c + 1) * + wordamount; + + return GLOB_OK; + } + + if (isdigit((int)*pattern)) { /* numeric range detected */ + + pat->type = UPTNumRange; + pat->content.NumRange.padlength = 0; + if (sscanf(pattern, "%d-%d]", + &pat->content.NumRange.min_n, + &pat->content.NumRange.max_n) != 2 || + pat->content.NumRange.min_n >= pat->content.NumRange.max_n) { + /* the pattern is not well-formed */ +#if 0 + printf("error: illegal pattern or range specification after pos %d\n", + pos); +#endif + return GLOB_ERROR; + } + if (*pattern == '0') { /* leading zero specified */ + c = pattern; + while (isdigit((int)*c++)) + ++pat->content.NumRange.padlength; /* padding length is set for all + instances of this pattern */ + } + pat->content.NumRange.ptr_n = pat->content.NumRange.min_n; + c = (char*)(strchr(pattern, ']') + 1); /* continue after next ']' */ + + /* always check for a literal (may be "") between patterns */ + + if(GLOB_ERROR == glob_word(glob, c, pos + (c - pattern), &wordamount)) + wordamount = 1; + + *amount = (pat->content.NumRange.max_n - + pat->content.NumRange.min_n + 1) * + wordamount; + + return GLOB_OK; + } + /*printf("error: illegal character in range specification at pos %d\n", + pos);*/ + return GLOB_ERROR; +} + +GlobCode glob_word(URLGlob *glob, char *pattern, int pos, int *amount) +{ + /* processes a literal string component of a URL + special characters '{' and '[' branch to set/range processing functions + */ + char* buf = glob->glob_buffer; + int litindex; + + *amount = 1; /* default is one single string */ + + while (*pattern != '\0' && *pattern != '{' && *pattern != '[') { + if (*pattern == '}' || *pattern == ']') + return GLOB_ERROR; + + /* only allow \ to escape known "special letters" */ + if (*pattern == '\\' && + (*(pattern+1) == '{' || *(pattern+1) == '[' || + *(pattern+1) == '}' || *(pattern+1) == ']') ) { + + /* escape character, skip '\' */ + ++pattern; + ++pos; + if (*pattern == '\0') /* but no escaping of '\0'! */ + return GLOB_ERROR; + } + *buf++ = *pattern++; /* copy character to literal */ + ++pos; + } + *buf = '\0'; + litindex = glob->size / 2; + /* literals 0,1,2,... correspond to size=0,2,4,... */ + glob->literal[litindex] = strdup(glob->glob_buffer); + ++glob->size; + + switch (*pattern) { + case '\0': + return GLOB_OK; /* singular URL processed */ + + case '{': + /* process set pattern */ + return glob_set(glob, ++pattern, ++pos, amount); + + case '[': + /* process range pattern */ + return glob_range(glob, ++pattern, ++pos, amount); + } + + return GLOB_ERROR; /* something got wrong */ +} + +int glob_url(URLGlob** glob, char* url, int *urlnum) +{ + /* + * We can deal with any-size, just make a buffer with the same length + * as the specified URL! + */ + URLGlob *glob_expand; + int amount; + char *glob_buffer=(char *)malloc(strlen(url)+1); + + if(NULL == glob_buffer) + return CURLE_OUT_OF_MEMORY; + + glob_expand = (URLGlob*)malloc(sizeof(URLGlob)); + if(NULL == glob_expand) { + free(glob_buffer); + return CURLE_OUT_OF_MEMORY; + } + glob_expand->size = 0; + glob_expand->urllen = strlen(url); + glob_expand->glob_buffer = glob_buffer; + glob_expand->beenhere=0; + if(GLOB_OK == glob_word(glob_expand, url, 1, &amount)) + *urlnum = amount; + else { + /* it failed, we cleanup */ + free(glob_buffer); + free(glob_expand); + glob_expand = NULL; + *urlnum = 1; + } + + *glob = glob_expand; + return CURLE_OK; +} + +void glob_cleanup(URLGlob* glob) +{ + int i, elem; + + for (i = glob->size - 1; i >= 0; --i) { + if (!(i & 1)) { /* even indexes contain literals */ + free(glob->literal[i/2]); + } else { /* odd indexes contain sets or ranges */ + if (glob->pattern[i/2].type == UPTSet) { + for (elem = glob->pattern[i/2].content.Set.size - 1; elem >= 0; --elem) { + free(glob->pattern[i/2].content.Set.elements[elem]); + } + free(glob->pattern[i/2].content.Set.elements); + } + } + } + free(glob->glob_buffer); + free(glob); +} + +char *next_url(URLGlob *glob) +{ + char *buf = glob->glob_buffer; + URLPattern *pat; + char *lit; + signed int i; + int carry; + + if (!glob->beenhere) + glob->beenhere = 1; + else { + carry = 1; + + /* implement a counter over the index ranges of all patterns, + starting with the rightmost pattern */ + for (i = glob->size / 2 - 1; carry && i >= 0; --i) { + carry = 0; + pat = &glob->pattern[i]; + switch (pat->type) { + case UPTSet: + if (++pat->content.Set.ptr_s == pat->content.Set.size) { + pat->content.Set.ptr_s = 0; + carry = 1; + } + break; + case UPTCharRange: + if (++pat->content.CharRange.ptr_c > pat->content.CharRange.max_c) { + pat->content.CharRange.ptr_c = pat->content.CharRange.min_c; + carry = 1; + } + break; + case UPTNumRange: + if (++pat->content.NumRange.ptr_n > pat->content.NumRange.max_n) { + pat->content.NumRange.ptr_n = pat->content.NumRange.min_n; + carry = 1; + } + break; + default: + printf("internal error: invalid pattern type (%d)\n", pat->type); + exit (CURLE_FAILED_INIT); + } + } + if (carry) /* first pattern ptr has run into overflow, done! */ + return NULL; + } + + for (i = 0; i < glob->size; ++i) { + if (!(i % 2)) { /* every other term (i even) is a literal */ + lit = glob->literal[i/2]; + strcpy(buf, lit); + buf += strlen(lit); + } + else { /* the rest (i odd) are patterns */ + pat = &glob->pattern[i/2]; + switch(pat->type) { + case UPTSet: + strcpy(buf, pat->content.Set.elements[pat->content.Set.ptr_s]); + buf += strlen(pat->content.Set.elements[pat->content.Set.ptr_s]); + break; + case UPTCharRange: + *buf++ = pat->content.CharRange.ptr_c; + break; + case UPTNumRange: + sprintf(buf, "%0*d", pat->content.NumRange.padlength, pat->content.NumRange.ptr_n); + buf += strlen(buf); /* make no sprint() return code assumptions */ + break; + default: + printf("internal error: invalid pattern type (%d)\n", pat->type); + exit (CURLE_FAILED_INIT); + } + } + } + *buf = '\0'; + return strdup(glob->glob_buffer); +} + +char *match_url(char *filename, URLGlob *glob) +{ + char *target; + URLPattern pat; + int i; + int allocsize; + int stringlen=0; + char numbuf[18]; + char *appendthis; + int appendlen; + + /* We cannot use the glob_buffer for storage here since the filename may + * be longer than the URL we use. We allocate a good start size, then + * we need to realloc in case of need. + */ + allocsize=strlen(filename); + target = malloc(allocsize); + if(NULL == target) + return NULL; /* major failure */ + + while (*filename != '\0') { + if (*filename == '#') { + if (!isdigit((int)*++filename) || + *filename == '0') { /* only '#1' ... '#9' allowed */ + /* printf("illegal matching expression\n"); + exit(CURLE_URL_MALFORMAT);*/ + continue; + } + i = *filename - '1'; + if (i + 1 > glob->size / 2) { + /*printf("match against nonexisting pattern\n"); + exit(CURLE_URL_MALFORMAT);*/ + continue; + } + pat = glob->pattern[i]; + switch (pat.type) { + case UPTSet: + appendthis = pat.content.Set.elements[pat.content.Set.ptr_s]; + appendlen = (int)strlen(pat.content.Set.elements[pat.content.Set.ptr_s]); + break; + case UPTCharRange: + numbuf[0]=pat.content.CharRange.ptr_c; + numbuf[1]=0; + appendthis=numbuf; + appendlen=1; + break; + case UPTNumRange: + sprintf(numbuf, "%0*d", pat.content.NumRange.padlength, pat.content.NumRange.ptr_n); + appendthis = numbuf; + appendlen = (int)strlen(numbuf); + break; + default: + printf("internal error: invalid pattern type (%d)\n", pat.type); + return NULL; + } + ++filename; + } + else { + appendthis=filename++; + appendlen=1; + } + if(appendlen + stringlen >= allocsize) { + char *newstr; + allocsize = (appendlen + stringlen)*2; + newstr=realloc(target, allocsize); + if(NULL ==newstr) { + free(target); + return NULL; + } + target=newstr; + } + memcpy(&target[stringlen], appendthis, appendlen); + stringlen += appendlen; + } + target[stringlen]= '\0'; + return target; +} diff --git a/Build/source/libs/curl/src/urlglob.h b/Build/source/libs/curl/src/urlglob.h new file mode 100644 index 00000000000..fa1f6843ed6 --- /dev/null +++ b/Build/source/libs/curl/src/urlglob.h @@ -0,0 +1,61 @@ +#ifndef __URLGLOB_H +#define __URLGLOB_H +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * In order to be useful for every potential user, curl and libcurl are + * dual-licensed under the MPL and the MIT/X-derivate licenses. + * + * 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 MPL or the MIT/X-derivate + * licenses. You may pick one of these licenses. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * $Id: urlglob.h,v 1.8 2001/01/08 07:37:44 bagder Exp $ + *****************************************************************************/ +typedef enum {UPTSet=1,UPTCharRange,UPTNumRange} URLPatternType; + +typedef struct { + URLPatternType type; + union { + struct { + char **elements; + short size; + short ptr_s; + } Set; + struct { + char min_c, max_c; + char ptr_c; + } CharRange; + struct { + int min_n, max_n; + short padlength; + int ptr_n; + } NumRange ; + } content; +} URLPattern; + +typedef struct { + char* literal[10]; + URLPattern pattern[9]; + int size; + int urllen; + char *glob_buffer; + char beenhere; +} URLGlob; + +int glob_url(URLGlob**, char*, int *); +char* next_url(URLGlob*); +char* match_url(char*, URLGlob *); +void glob_cleanup(URLGlob* glob); + +#endif diff --git a/Build/source/libs/curl/src/version.h b/Build/source/libs/curl/src/version.h new file mode 100644 index 00000000000..ec1798c84dd --- /dev/null +++ b/Build/source/libs/curl/src/version.h @@ -0,0 +1,3 @@ +#define CURL_NAME "curl" +#define CURL_VERSION "7.9.5" +#define CURL_ID CURL_NAME " " CURL_VERSION " (" OS ") " diff --git a/Build/source/libs/curl/src/win32.mak b/Build/source/libs/curl/src/win32.mak new file mode 100644 index 00000000000..8d1274e8d86 --- /dev/null +++ b/Build/source/libs/curl/src/win32.mak @@ -0,0 +1,54 @@ +################################################################################ +# +# Makefile : Curl / src +# Author : Fabrice Popineau <Fabrice.Popineau@supelec.fr> +# Platform : Win32, Microsoft VC++ 6.0, depends upon fpTeX 0.5 sources +# Time-stamp: <02/08/05 23:47:35 popineau> +# +################################################################################ +root_srcdir = ..\..\.. +!ifdef DEVELOPMENT +INCLUDE=$(INCLUDE);$(root_srcdir)\texk.development +!else +INCLUDE=$(INCLUDE);$(root_srcdir)\texk +!endif + +USE_GNUW32 = 1 +USE_CURL = 1 + +!include <msvc/common.mak> + +programs = $(objdir)\curl.exe +libfiles = +includefiles = +manfiles = +infofiles = +installinfoflags = + +objects= \ + $(objdir)\hugehelp.obj \ + $(objdir)\writeout.obj \ + $(objdir)\urlglob.obj \ + $(objdir)\main.obj + +default: all + +all: $(objdir) $(programs) + +$(objdir)\curl.exe: $(objects) $(objdir)\curl.res $(curllib) $(gnuw32lib) + $(link) $(**) $(conlibs) + +!include <msvc/config.mak> +!include <msvc/install.mak> + +install:: install-exec install-lib install-include + +!include <msvc/clean.mak> + +!include <msvc/rdepend.mak> +!include "./depend.mak" + +# +# Local Variables: +# mode: makefile +# End:
\ No newline at end of file diff --git a/Build/source/libs/curl/src/writeout.c b/Build/source/libs/curl/src/writeout.c new file mode 100644 index 00000000000..01bcaeb2f18 --- /dev/null +++ b/Build/source/libs/curl/src/writeout.c @@ -0,0 +1,217 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * In order to be useful for every potential user, curl and libcurl are + * dual-licensed under the MPL and the MIT/X-derivate licenses. + * + * 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 MPL or the MIT/X-derivate + * licenses. You may pick one of these licenses. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * $Id: writeout.c,v 1.9 2002/02/25 07:40:49 bagder Exp $ + *****************************************************************************/ + +#include <stdio.h> +#include <string.h> + +#include <curl/curl.h> + +#define _MPRINTF_REPLACE /* we want curl-functions instead of native ones */ +#include <curl/mprintf.h> + +#include "writeout.h" + +typedef enum { + VAR_NONE, /* must be the first */ + VAR_TOTAL_TIME, + VAR_NAMELOOKUP_TIME, + VAR_CONNECT_TIME, + VAR_PRETRANSFER_TIME, + VAR_STARTTRANSFER_TIME, + VAR_SIZE_DOWNLOAD, + VAR_SIZE_UPLOAD, + VAR_SPEED_DOWNLOAD, + VAR_SPEED_UPLOAD, + VAR_HTTP_CODE, + VAR_HEADER_SIZE, + VAR_REQUEST_SIZE, + VAR_EFFECTIVE_URL, + VAR_CONTENT_TYPE, + VAR_NUM_OF_VARS /* must be the last */ +} replaceid; + +struct variable { + const char *name; + replaceid id; +}; + + +static struct variable replacements[]={ + {"url_effective", VAR_EFFECTIVE_URL}, + {"http_code", VAR_HTTP_CODE}, + {"time_total", VAR_TOTAL_TIME}, + {"time_namelookup", VAR_NAMELOOKUP_TIME}, + {"time_connect", VAR_CONNECT_TIME}, + {"time_pretransfer", VAR_PRETRANSFER_TIME}, + {"time_starttransfer", VAR_STARTTRANSFER_TIME}, + {"size_header", VAR_HEADER_SIZE}, + {"size_request", VAR_REQUEST_SIZE}, + {"size_download", VAR_SIZE_DOWNLOAD}, + {"size_upload", VAR_SIZE_UPLOAD}, + {"speed_download", VAR_SPEED_DOWNLOAD}, + {"speed_upload", VAR_SPEED_UPLOAD}, + {"content_type", VAR_CONTENT_TYPE}, + {NULL, 0} +}; + +void ourWriteOut(CURL *curl, char *writeinfo) +{ + FILE *stream = stdout; + char *ptr=writeinfo; + char *stringp; + long longinfo; + double doubleinfo; + + while(*ptr) { + if('%' == *ptr) { + if('%' == ptr[1]) { + /* an escaped %-letter */ + fputc('%', stream); + ptr+=2; + } + else { + /* this is meant as a variable to output */ + char *end; + char keepit; + int i; + if(('{' == ptr[1]) && (end=strchr(ptr, '}'))) { + ptr+=2; /* pass the % and the { */ + keepit=*end; + *end=0; /* zero terminate */ + for(i=0; replacements[i].name; i++) { + if(strequal(ptr, replacements[i].name)) { + switch(replacements[i].id) { + case VAR_EFFECTIVE_URL: + if(CURLE_OK == + curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, &stringp)) + fputs(stringp, stream); + break; + case VAR_HTTP_CODE: + if(CURLE_OK == + curl_easy_getinfo(curl, CURLINFO_HTTP_CODE, &longinfo)) + fprintf(stream, "%03d", longinfo); + break; + case VAR_HEADER_SIZE: + if(CURLE_OK == + curl_easy_getinfo(curl, CURLINFO_HEADER_SIZE, &longinfo)) + fprintf(stream, "%d", longinfo); + break; + case VAR_REQUEST_SIZE: + if(CURLE_OK == + curl_easy_getinfo(curl, CURLINFO_REQUEST_SIZE, &longinfo)) + fprintf(stream, "%d", longinfo); + break; + case VAR_TOTAL_TIME: + if(CURLE_OK == + curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME, &doubleinfo)) + fprintf(stream, "%.3f", doubleinfo); + break; + case VAR_NAMELOOKUP_TIME: + if(CURLE_OK == + curl_easy_getinfo(curl, CURLINFO_NAMELOOKUP_TIME, + &doubleinfo)) + fprintf(stream, "%.3f", doubleinfo); + break; + case VAR_CONNECT_TIME: + if(CURLE_OK == + curl_easy_getinfo(curl, CURLINFO_CONNECT_TIME, &doubleinfo)) + fprintf(stream, "%.3f", doubleinfo); + break; + case VAR_PRETRANSFER_TIME: + if(CURLE_OK == + curl_easy_getinfo(curl, CURLINFO_PRETRANSFER_TIME, &doubleinfo)) + fprintf(stream, "%.3f", doubleinfo); + break; + case VAR_STARTTRANSFER_TIME: + if(CURLE_OK == + curl_easy_getinfo(curl, CURLINFO_STARTTRANSFER_TIME, &doubleinfo)) + fprintf(stream, "%.3f", doubleinfo); + break; + case VAR_SIZE_UPLOAD: + if(CURLE_OK == + curl_easy_getinfo(curl, CURLINFO_SIZE_UPLOAD, &doubleinfo)) + fprintf(stream, "%.0f", doubleinfo); + break; + case VAR_SIZE_DOWNLOAD: + if(CURLE_OK == + curl_easy_getinfo(curl, CURLINFO_SIZE_DOWNLOAD, &doubleinfo)) + fprintf(stream, "%.0f", doubleinfo); + break; + case VAR_SPEED_DOWNLOAD: + if(CURLE_OK == + curl_easy_getinfo(curl, CURLINFO_SPEED_DOWNLOAD, &doubleinfo)) + fprintf(stream, "%.3f", doubleinfo); + break; + case VAR_SPEED_UPLOAD: + if(CURLE_OK == + curl_easy_getinfo(curl, CURLINFO_SPEED_UPLOAD, &doubleinfo)) + fprintf(stream, "%.3f", doubleinfo); + break; + case VAR_CONTENT_TYPE: + if(CURLE_OK == + curl_easy_getinfo(curl, CURLINFO_CONTENT_TYPE, &stringp)) + fputs(stringp, stream); + break; + default: + break; + } + break; + } + } + ptr=end+1; /* pass the end */ + *end = keepit; + } + else { + /* illegal syntax, then just output the characters that are used */ + fputc('%', stream); + fputc(ptr[1], stream); + ptr+=2; + } + } + } + else if('\\' == *ptr) { + switch(ptr[1]) { + case 'r': + fputc('\r', stream); + break; + case 'n': + fputc('\n', stream); + break; + case 't': + fputc('\t', stream); + break; + default: + /* unknown, just output this */ + fputc(*ptr, stream); + fputc(ptr[1], stream); + break; + } + ptr+=2; + } + else { + fputc(*ptr, stream); + ptr++; + } + } + +} diff --git a/Build/source/libs/curl/src/writeout.h b/Build/source/libs/curl/src/writeout.h new file mode 100644 index 00000000000..621ad5daba1 --- /dev/null +++ b/Build/source/libs/curl/src/writeout.h @@ -0,0 +1,28 @@ +#ifndef __WRITEOUT_H +#define __WRITEOUT_H +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * In order to be useful for every potential user, curl and libcurl are + * dual-licensed under the MPL and the MIT/X-derivate licenses. + * + * 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 MPL or the MIT/X-derivate + * licenses. You may pick one of these licenses. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * $Id: writeout.h,v 1.2 2001/01/03 09:29:34 bagder Exp $ + *****************************************************************************/ + +void ourWriteOut(CURL *curl, char *out); + +#endif |