diff options
Diffstat (limited to 'plugins/FTPFileYM/curl-7.29.0/docs/examples')
71 files changed, 12085 insertions, 0 deletions
diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/10-at-a-time.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/10-at-a-time.c new file mode 100644 index 0000000000..a85fff46f0 --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/10-at-a-time.c @@ -0,0 +1,197 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +/* Example application source code using the multi interface to download many + * files, but with a capped maximum amount of simultaneous transfers. + * + * Written by Michael Wallner + */ + +#include <errno.h> +#include <stdlib.h> +#include <string.h> +#ifndef WIN32 +# include <unistd.h> +#endif +#include <curl/multi.h> + +static const char *urls[] = { + "http://www.microsoft.com", + "http://www.opensource.org", + "http://www.google.com", + "http://www.yahoo.com", + "http://www.ibm.com", + "http://www.mysql.com", + "http://www.oracle.com", + "http://www.ripe.net", + "http://www.iana.org", + "http://www.amazon.com", + "http://www.netcraft.com", + "http://www.heise.de", + "http://www.chip.de", + "http://www.ca.com", + "http://www.cnet.com", + "http://www.news.com", + "http://www.cnn.com", + "http://www.wikipedia.org", + "http://www.dell.com", + "http://www.hp.com", + "http://www.cert.org", + "http://www.mit.edu", + "http://www.nist.gov", + "http://www.ebay.com", + "http://www.playstation.com", + "http://www.uefa.com", + "http://www.ieee.org", + "http://www.apple.com", + "http://www.sony.com", + "http://www.symantec.com", + "http://www.zdnet.com", + "http://www.fujitsu.com", + "http://www.supermicro.com", + "http://www.hotmail.com", + "http://www.ecma.com", + "http://www.bbc.co.uk", + "http://news.google.com", + "http://www.foxnews.com", + "http://www.msn.com", + "http://www.wired.com", + "http://www.sky.com", + "http://www.usatoday.com", + "http://www.cbs.com", + "http://www.nbc.com", + "http://slashdot.org", + "http://www.bloglines.com", + "http://www.techweb.com", + "http://www.newslink.org", + "http://www.un.org", +}; + +#define MAX 10 /* number of simultaneous transfers */ +#define CNT sizeof(urls)/sizeof(char*) /* total number of transfers to do */ + +static size_t cb(char *d, size_t n, size_t l, void *p) +{ + /* take care of the data here, ignored in this example */ + (void)d; + (void)p; + return n*l; +} + +static void init(CURLM *cm, int i) +{ + CURL *eh = curl_easy_init(); + + curl_easy_setopt(eh, CURLOPT_WRITEFUNCTION, cb); + curl_easy_setopt(eh, CURLOPT_HEADER, 0L); + curl_easy_setopt(eh, CURLOPT_URL, urls[i]); + curl_easy_setopt(eh, CURLOPT_PRIVATE, urls[i]); + curl_easy_setopt(eh, CURLOPT_VERBOSE, 0L); + + curl_multi_add_handle(cm, eh); +} + +int main(void) +{ + CURLM *cm; + CURLMsg *msg; + long L; + unsigned int C=0; + int M, Q, U = -1; + fd_set R, W, E; + struct timeval T; + + curl_global_init(CURL_GLOBAL_ALL); + + cm = curl_multi_init(); + + /* we can optionally limit the total amount of connections this multi handle + uses */ + curl_multi_setopt(cm, CURLMOPT_MAXCONNECTS, (long)MAX); + + for (C = 0; C < MAX; ++C) { + init(cm, C); + } + + while (U) { + curl_multi_perform(cm, &U); + + if (U) { + FD_ZERO(&R); + FD_ZERO(&W); + FD_ZERO(&E); + + if (curl_multi_fdset(cm, &R, &W, &E, &M)) { + fprintf(stderr, "E: curl_multi_fdset\n"); + return EXIT_FAILURE; + } + + if (curl_multi_timeout(cm, &L)) { + fprintf(stderr, "E: curl_multi_timeout\n"); + return EXIT_FAILURE; + } + if (L == -1) + L = 100; + + if (M == -1) { +#ifdef WIN32 + Sleep(L); +#else + sleep(L / 1000); +#endif + } else { + T.tv_sec = L/1000; + T.tv_usec = (L%1000)*1000; + + if (0 > select(M+1, &R, &W, &E, &T)) { + fprintf(stderr, "E: select(%i,,,,%li): %i: %s\n", + M+1, L, errno, strerror(errno)); + return EXIT_FAILURE; + } + } + } + + while ((msg = curl_multi_info_read(cm, &Q))) { + if (msg->msg == CURLMSG_DONE) { + char *url; + CURL *e = msg->easy_handle; + curl_easy_getinfo(msg->easy_handle, CURLINFO_PRIVATE, &url); + fprintf(stderr, "R: %d - %s <%s>\n", + msg->data.result, curl_easy_strerror(msg->data.result), url); + curl_multi_remove_handle(cm, e); + curl_easy_cleanup(e); + } + else { + fprintf(stderr, "E: CURLMsg (%d)\n", msg->msg); + } + if (C < CNT) { + init(cm, C++); + U++; /* just to prevent it from remaining at 0 if there are more + URLs to get */ + } + } + } + + curl_multi_cleanup(cm); + curl_global_cleanup(); + + return EXIT_SUCCESS; +} diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/Makefile.am b/plugins/FTPFileYM/curl-7.29.0/docs/examples/Makefile.am new file mode 100644 index 0000000000..cbfdac5025 --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/Makefile.am @@ -0,0 +1,64 @@ +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at http://curl.haxx.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### + +AUTOMAKE_OPTIONS = foreign nostdinc + +EXTRA_DIST = README Makefile.example Makefile.inc Makefile.m32 \ + Makefile.netware makefile.dj $(COMPLICATED_EXAMPLES) + +# Specify our include paths here, and do it relative to $(top_srcdir) and +# $(top_builddir), to ensure that these paths which belong to the library +# being currently built and tested are searched before the library which +# might possibly already be installed in the system. +# +# $(top_builddir)/include/curl for generated curlbuild.h included from curl.h +# $(top_builddir)/include for generated curlbuild.h inc. from lib/curl_setup.h +# $(top_srcdir)/include is for libcurl's external include files + +AM_CPPFLAGS = -I$(top_builddir)/include/curl \ + -I$(top_builddir)/include \ + -I$(top_srcdir)/include + +LIBDIR = $(top_builddir)/lib + +# Avoid libcurl obsolete stuff +AM_CPPFLAGS += -DCURL_NO_OLDIES + +# Mostly for Windows build targets, when using static libcurl +if USE_CPPFLAG_CURL_STATICLIB +AM_CPPFLAGS += -DCURL_STATICLIB +endif + +# Prevent LIBS from being used for all link targets +LIBS = $(BLANK_AT_MAKETIME) + +# Dependencies +if USE_EXPLICIT_LIB_DEPS +LDADD = $(LIBDIR)/libcurl.la @LIBCURL_LIBS@ +else +LDADD = $(LIBDIR)/libcurl.la +endif + +# Makefile.inc provides the check_PROGRAMS and COMPLICATED_EXAMPLES defines +include Makefile.inc + +all: $(check_PROGRAMS) diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/Makefile.example b/plugins/FTPFileYM/curl-7.29.0/docs/examples/Makefile.example new file mode 100644 index 0000000000..dfd117873a --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/Makefile.example @@ -0,0 +1,53 @@ +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at http://curl.haxx.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### + +# What to call the final executable +TARGET = example + +# Which object files that the executable consists of +OBJS= ftpget.o + +# What compiler to use +CC = gcc + +# Compiler flags, -g for debug, -c to make an object file +CFLAGS = -c -g + +# This should point to a directory that holds libcurl, if it isn't +# in the system's standard lib dir +# We also set a -L to include the directory where we have the openssl +# libraries +LDFLAGS = -L/home/dast/lib -L/usr/local/ssl/lib + +# We need -lcurl for the curl stuff +# We need -lsocket and -lnsl when on Solaris +# We need -lssl and -lcrypto when using libcurl with SSL support +# We need -lpthread for the pthread example +LIBS = -lcurl -lsocket -lnsl -lssl -lcrypto + +# Link the target with all objects and libraries +$(TARGET) : $(OBJS) + $(CC) -o $(TARGET) $(OBJS) $(LDFLAGS) $(LIBS) + +# Compile the source files into object files +ftpget.o : ftpget.c + $(CC) $(CFLAGS) $< diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/Makefile.in b/plugins/FTPFileYM/curl-7.29.0/docs/examples/Makefile.in new file mode 100644 index 0000000000..77e07289f6 --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/Makefile.in @@ -0,0 +1,1153 @@ +# Makefile.in generated by automake 1.11.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at http://curl.haxx.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### +VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ + +# Mostly for Windows build targets, when using static libcurl +@USE_CPPFLAG_CURL_STATICLIB_TRUE@am__append_1 = -DCURL_STATICLIB +DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(srcdir)/Makefile.inc +check_PROGRAMS = 10-at-a-time$(EXEEXT) anyauthput$(EXEEXT) \ + cookie_interface$(EXEEXT) debug$(EXEEXT) fileupload$(EXEEXT) \ + fopen$(EXEEXT) ftpget$(EXEEXT) ftpgetresp$(EXEEXT) \ + ftpupload$(EXEEXT) getinfo$(EXEEXT) getinmemory$(EXEEXT) \ + http-post$(EXEEXT) httpput$(EXEEXT) https$(EXEEXT) \ + multi-app$(EXEEXT) multi-debugcallback$(EXEEXT) \ + multi-double$(EXEEXT) multi-post$(EXEEXT) \ + multi-single$(EXEEXT) persistant$(EXEEXT) \ + post-callback$(EXEEXT) postit2$(EXEEXT) sepheaders$(EXEEXT) \ + simple$(EXEEXT) simplepost$(EXEEXT) simplessl$(EXEEXT) \ + sendrecv$(EXEEXT) httpcustomheader$(EXEEXT) certinfo$(EXEEXT) \ + chkspeed$(EXEEXT) ftpgetinfo$(EXEEXT) ftp-wildcard$(EXEEXT) \ + smtp-multi$(EXEEXT) simplesmtp$(EXEEXT) smtp-tls$(EXEEXT) \ + rtsp$(EXEEXT) externalsocket$(EXEEXT) resolve$(EXEEXT) \ + progressfunc$(EXEEXT) pop3s$(EXEEXT) pop3slist$(EXEEXT) \ + imap$(EXEEXT) url2file$(EXEEXT) sftpget$(EXEEXT) \ + ftpsget$(EXEEXT) +subdir = docs/examples +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/curl-compilers.m4 \ + $(top_srcdir)/m4/curl-confopts.m4 \ + $(top_srcdir)/m4/curl-functions.m4 \ + $(top_srcdir)/m4/curl-openssl.m4 \ + $(top_srcdir)/m4/curl-override.m4 \ + $(top_srcdir)/m4/curl-reentrant.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/xc-cc-check.m4 \ + $(top_srcdir)/m4/xc-translit.m4 \ + $(top_srcdir)/m4/xc-val-flgs.m4 \ + $(top_srcdir)/m4/zz40-xc-ovr.m4 \ + $(top_srcdir)/m4/zz50-xc-ovr.m4 \ + $(top_srcdir)/m4/zz60-xc-ovr.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/lib/curl_config.h \ + $(top_builddir)/include/curl/curlbuild.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +10_at_a_time_SOURCES = 10-at-a-time.c +10_at_a_time_OBJECTS = 10-at-a-time.$(OBJEXT) +10_at_a_time_LDADD = $(LDADD) +@USE_EXPLICIT_LIB_DEPS_FALSE@10_at_a_time_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la +@USE_EXPLICIT_LIB_DEPS_TRUE@10_at_a_time_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la +anyauthput_SOURCES = anyauthput.c +anyauthput_OBJECTS = anyauthput.$(OBJEXT) +anyauthput_LDADD = $(LDADD) +@USE_EXPLICIT_LIB_DEPS_FALSE@anyauthput_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la +@USE_EXPLICIT_LIB_DEPS_TRUE@anyauthput_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la +certinfo_SOURCES = certinfo.c +certinfo_OBJECTS = certinfo.$(OBJEXT) +certinfo_LDADD = $(LDADD) +@USE_EXPLICIT_LIB_DEPS_FALSE@certinfo_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la +@USE_EXPLICIT_LIB_DEPS_TRUE@certinfo_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la +chkspeed_SOURCES = chkspeed.c +chkspeed_OBJECTS = chkspeed.$(OBJEXT) +chkspeed_LDADD = $(LDADD) +@USE_EXPLICIT_LIB_DEPS_FALSE@chkspeed_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la +@USE_EXPLICIT_LIB_DEPS_TRUE@chkspeed_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la +cookie_interface_SOURCES = cookie_interface.c +cookie_interface_OBJECTS = cookie_interface.$(OBJEXT) +cookie_interface_LDADD = $(LDADD) +@USE_EXPLICIT_LIB_DEPS_FALSE@cookie_interface_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la +@USE_EXPLICIT_LIB_DEPS_TRUE@cookie_interface_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la +debug_SOURCES = debug.c +debug_OBJECTS = debug.$(OBJEXT) +debug_LDADD = $(LDADD) +@USE_EXPLICIT_LIB_DEPS_FALSE@debug_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la +@USE_EXPLICIT_LIB_DEPS_TRUE@debug_DEPENDENCIES = $(LIBDIR)/libcurl.la +externalsocket_SOURCES = externalsocket.c +externalsocket_OBJECTS = externalsocket.$(OBJEXT) +externalsocket_LDADD = $(LDADD) +@USE_EXPLICIT_LIB_DEPS_FALSE@externalsocket_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la +@USE_EXPLICIT_LIB_DEPS_TRUE@externalsocket_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la +fileupload_SOURCES = fileupload.c +fileupload_OBJECTS = fileupload.$(OBJEXT) +fileupload_LDADD = $(LDADD) +@USE_EXPLICIT_LIB_DEPS_FALSE@fileupload_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la +@USE_EXPLICIT_LIB_DEPS_TRUE@fileupload_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la +fopen_SOURCES = fopen.c +fopen_OBJECTS = fopen.$(OBJEXT) +fopen_LDADD = $(LDADD) +@USE_EXPLICIT_LIB_DEPS_FALSE@fopen_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la +@USE_EXPLICIT_LIB_DEPS_TRUE@fopen_DEPENDENCIES = $(LIBDIR)/libcurl.la +ftp_wildcard_SOURCES = ftp-wildcard.c +ftp_wildcard_OBJECTS = ftp-wildcard.$(OBJEXT) +ftp_wildcard_LDADD = $(LDADD) +@USE_EXPLICIT_LIB_DEPS_FALSE@ftp_wildcard_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la +@USE_EXPLICIT_LIB_DEPS_TRUE@ftp_wildcard_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la +ftpget_SOURCES = ftpget.c +ftpget_OBJECTS = ftpget.$(OBJEXT) +ftpget_LDADD = $(LDADD) +@USE_EXPLICIT_LIB_DEPS_FALSE@ftpget_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la +@USE_EXPLICIT_LIB_DEPS_TRUE@ftpget_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la +ftpgetinfo_SOURCES = ftpgetinfo.c +ftpgetinfo_OBJECTS = ftpgetinfo.$(OBJEXT) +ftpgetinfo_LDADD = $(LDADD) +@USE_EXPLICIT_LIB_DEPS_FALSE@ftpgetinfo_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la +@USE_EXPLICIT_LIB_DEPS_TRUE@ftpgetinfo_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la +ftpgetresp_SOURCES = ftpgetresp.c +ftpgetresp_OBJECTS = ftpgetresp.$(OBJEXT) +ftpgetresp_LDADD = $(LDADD) +@USE_EXPLICIT_LIB_DEPS_FALSE@ftpgetresp_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la +@USE_EXPLICIT_LIB_DEPS_TRUE@ftpgetresp_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la +ftpsget_SOURCES = ftpsget.c +ftpsget_OBJECTS = ftpsget.$(OBJEXT) +ftpsget_LDADD = $(LDADD) +@USE_EXPLICIT_LIB_DEPS_FALSE@ftpsget_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la +@USE_EXPLICIT_LIB_DEPS_TRUE@ftpsget_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la +ftpupload_SOURCES = ftpupload.c +ftpupload_OBJECTS = ftpupload.$(OBJEXT) +ftpupload_LDADD = $(LDADD) +@USE_EXPLICIT_LIB_DEPS_FALSE@ftpupload_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la +@USE_EXPLICIT_LIB_DEPS_TRUE@ftpupload_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la +getinfo_SOURCES = getinfo.c +getinfo_OBJECTS = getinfo.$(OBJEXT) +getinfo_LDADD = $(LDADD) +@USE_EXPLICIT_LIB_DEPS_FALSE@getinfo_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la +@USE_EXPLICIT_LIB_DEPS_TRUE@getinfo_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la +getinmemory_SOURCES = getinmemory.c +getinmemory_OBJECTS = getinmemory.$(OBJEXT) +getinmemory_LDADD = $(LDADD) +@USE_EXPLICIT_LIB_DEPS_FALSE@getinmemory_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la +@USE_EXPLICIT_LIB_DEPS_TRUE@getinmemory_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la +http_post_SOURCES = http-post.c +http_post_OBJECTS = http-post.$(OBJEXT) +http_post_LDADD = $(LDADD) +@USE_EXPLICIT_LIB_DEPS_FALSE@http_post_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la +@USE_EXPLICIT_LIB_DEPS_TRUE@http_post_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la +httpcustomheader_SOURCES = httpcustomheader.c +httpcustomheader_OBJECTS = httpcustomheader.$(OBJEXT) +httpcustomheader_LDADD = $(LDADD) +@USE_EXPLICIT_LIB_DEPS_FALSE@httpcustomheader_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la +@USE_EXPLICIT_LIB_DEPS_TRUE@httpcustomheader_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la +httpput_SOURCES = httpput.c +httpput_OBJECTS = httpput.$(OBJEXT) +httpput_LDADD = $(LDADD) +@USE_EXPLICIT_LIB_DEPS_FALSE@httpput_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la +@USE_EXPLICIT_LIB_DEPS_TRUE@httpput_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la +https_SOURCES = https.c +https_OBJECTS = https.$(OBJEXT) +https_LDADD = $(LDADD) +@USE_EXPLICIT_LIB_DEPS_FALSE@https_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la +@USE_EXPLICIT_LIB_DEPS_TRUE@https_DEPENDENCIES = $(LIBDIR)/libcurl.la +imap_SOURCES = imap.c +imap_OBJECTS = imap.$(OBJEXT) +imap_LDADD = $(LDADD) +@USE_EXPLICIT_LIB_DEPS_FALSE@imap_DEPENDENCIES = $(LIBDIR)/libcurl.la +@USE_EXPLICIT_LIB_DEPS_TRUE@imap_DEPENDENCIES = $(LIBDIR)/libcurl.la +multi_app_SOURCES = multi-app.c +multi_app_OBJECTS = multi-app.$(OBJEXT) +multi_app_LDADD = $(LDADD) +@USE_EXPLICIT_LIB_DEPS_FALSE@multi_app_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la +@USE_EXPLICIT_LIB_DEPS_TRUE@multi_app_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la +multi_debugcallback_SOURCES = multi-debugcallback.c +multi_debugcallback_OBJECTS = multi-debugcallback.$(OBJEXT) +multi_debugcallback_LDADD = $(LDADD) +@USE_EXPLICIT_LIB_DEPS_FALSE@multi_debugcallback_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la +@USE_EXPLICIT_LIB_DEPS_TRUE@multi_debugcallback_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la +multi_double_SOURCES = multi-double.c +multi_double_OBJECTS = multi-double.$(OBJEXT) +multi_double_LDADD = $(LDADD) +@USE_EXPLICIT_LIB_DEPS_FALSE@multi_double_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la +@USE_EXPLICIT_LIB_DEPS_TRUE@multi_double_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la +multi_post_SOURCES = multi-post.c +multi_post_OBJECTS = multi-post.$(OBJEXT) +multi_post_LDADD = $(LDADD) +@USE_EXPLICIT_LIB_DEPS_FALSE@multi_post_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la +@USE_EXPLICIT_LIB_DEPS_TRUE@multi_post_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la +multi_single_SOURCES = multi-single.c +multi_single_OBJECTS = multi-single.$(OBJEXT) +multi_single_LDADD = $(LDADD) +@USE_EXPLICIT_LIB_DEPS_FALSE@multi_single_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la +@USE_EXPLICIT_LIB_DEPS_TRUE@multi_single_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la +persistant_SOURCES = persistant.c +persistant_OBJECTS = persistant.$(OBJEXT) +persistant_LDADD = $(LDADD) +@USE_EXPLICIT_LIB_DEPS_FALSE@persistant_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la +@USE_EXPLICIT_LIB_DEPS_TRUE@persistant_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la +pop3s_SOURCES = pop3s.c +pop3s_OBJECTS = pop3s.$(OBJEXT) +pop3s_LDADD = $(LDADD) +@USE_EXPLICIT_LIB_DEPS_FALSE@pop3s_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la +@USE_EXPLICIT_LIB_DEPS_TRUE@pop3s_DEPENDENCIES = $(LIBDIR)/libcurl.la +pop3slist_SOURCES = pop3slist.c +pop3slist_OBJECTS = pop3slist.$(OBJEXT) +pop3slist_LDADD = $(LDADD) +@USE_EXPLICIT_LIB_DEPS_FALSE@pop3slist_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la +@USE_EXPLICIT_LIB_DEPS_TRUE@pop3slist_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la +post_callback_SOURCES = post-callback.c +post_callback_OBJECTS = post-callback.$(OBJEXT) +post_callback_LDADD = $(LDADD) +@USE_EXPLICIT_LIB_DEPS_FALSE@post_callback_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la +@USE_EXPLICIT_LIB_DEPS_TRUE@post_callback_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la +postit2_SOURCES = postit2.c +postit2_OBJECTS = postit2.$(OBJEXT) +postit2_LDADD = $(LDADD) +@USE_EXPLICIT_LIB_DEPS_FALSE@postit2_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la +@USE_EXPLICIT_LIB_DEPS_TRUE@postit2_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la +progressfunc_SOURCES = progressfunc.c +progressfunc_OBJECTS = progressfunc.$(OBJEXT) +progressfunc_LDADD = $(LDADD) +@USE_EXPLICIT_LIB_DEPS_FALSE@progressfunc_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la +@USE_EXPLICIT_LIB_DEPS_TRUE@progressfunc_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la +resolve_SOURCES = resolve.c +resolve_OBJECTS = resolve.$(OBJEXT) +resolve_LDADD = $(LDADD) +@USE_EXPLICIT_LIB_DEPS_FALSE@resolve_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la +@USE_EXPLICIT_LIB_DEPS_TRUE@resolve_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la +rtsp_SOURCES = rtsp.c +rtsp_OBJECTS = rtsp.$(OBJEXT) +rtsp_LDADD = $(LDADD) +@USE_EXPLICIT_LIB_DEPS_FALSE@rtsp_DEPENDENCIES = $(LIBDIR)/libcurl.la +@USE_EXPLICIT_LIB_DEPS_TRUE@rtsp_DEPENDENCIES = $(LIBDIR)/libcurl.la +sendrecv_SOURCES = sendrecv.c +sendrecv_OBJECTS = sendrecv.$(OBJEXT) +sendrecv_LDADD = $(LDADD) +@USE_EXPLICIT_LIB_DEPS_FALSE@sendrecv_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la +@USE_EXPLICIT_LIB_DEPS_TRUE@sendrecv_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la +sepheaders_SOURCES = sepheaders.c +sepheaders_OBJECTS = sepheaders.$(OBJEXT) +sepheaders_LDADD = $(LDADD) +@USE_EXPLICIT_LIB_DEPS_FALSE@sepheaders_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la +@USE_EXPLICIT_LIB_DEPS_TRUE@sepheaders_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la +sftpget_SOURCES = sftpget.c +sftpget_OBJECTS = sftpget.$(OBJEXT) +sftpget_LDADD = $(LDADD) +@USE_EXPLICIT_LIB_DEPS_FALSE@sftpget_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la +@USE_EXPLICIT_LIB_DEPS_TRUE@sftpget_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la +simple_SOURCES = simple.c +simple_OBJECTS = simple.$(OBJEXT) +simple_LDADD = $(LDADD) +@USE_EXPLICIT_LIB_DEPS_FALSE@simple_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la +@USE_EXPLICIT_LIB_DEPS_TRUE@simple_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la +simplepost_SOURCES = simplepost.c +simplepost_OBJECTS = simplepost.$(OBJEXT) +simplepost_LDADD = $(LDADD) +@USE_EXPLICIT_LIB_DEPS_FALSE@simplepost_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la +@USE_EXPLICIT_LIB_DEPS_TRUE@simplepost_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la +simplesmtp_SOURCES = simplesmtp.c +simplesmtp_OBJECTS = simplesmtp.$(OBJEXT) +simplesmtp_LDADD = $(LDADD) +@USE_EXPLICIT_LIB_DEPS_FALSE@simplesmtp_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la +@USE_EXPLICIT_LIB_DEPS_TRUE@simplesmtp_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la +simplessl_SOURCES = simplessl.c +simplessl_OBJECTS = simplessl.$(OBJEXT) +simplessl_LDADD = $(LDADD) +@USE_EXPLICIT_LIB_DEPS_FALSE@simplessl_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la +@USE_EXPLICIT_LIB_DEPS_TRUE@simplessl_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la +smtp_multi_SOURCES = smtp-multi.c +smtp_multi_OBJECTS = smtp-multi.$(OBJEXT) +smtp_multi_LDADD = $(LDADD) +@USE_EXPLICIT_LIB_DEPS_FALSE@smtp_multi_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la +@USE_EXPLICIT_LIB_DEPS_TRUE@smtp_multi_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la +smtp_tls_SOURCES = smtp-tls.c +smtp_tls_OBJECTS = smtp-tls.$(OBJEXT) +smtp_tls_LDADD = $(LDADD) +@USE_EXPLICIT_LIB_DEPS_FALSE@smtp_tls_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la +@USE_EXPLICIT_LIB_DEPS_TRUE@smtp_tls_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la +url2file_SOURCES = url2file.c +url2file_OBJECTS = url2file.$(OBJEXT) +url2file_LDADD = $(LDADD) +@USE_EXPLICIT_LIB_DEPS_FALSE@url2file_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la +@USE_EXPLICIT_LIB_DEPS_TRUE@url2file_DEPENDENCIES = \ +@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la +DEFAULT_INCLUDES = +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = 10-at-a-time.c anyauthput.c certinfo.c chkspeed.c \ + cookie_interface.c debug.c externalsocket.c fileupload.c \ + fopen.c ftp-wildcard.c ftpget.c ftpgetinfo.c ftpgetresp.c \ + ftpsget.c ftpupload.c getinfo.c getinmemory.c http-post.c \ + httpcustomheader.c httpput.c https.c imap.c multi-app.c \ + multi-debugcallback.c multi-double.c multi-post.c \ + multi-single.c persistant.c pop3s.c pop3slist.c \ + post-callback.c postit2.c progressfunc.c resolve.c rtsp.c \ + sendrecv.c sepheaders.c sftpget.c simple.c simplepost.c \ + simplesmtp.c simplessl.c smtp-multi.c smtp-tls.c url2file.c +DIST_SOURCES = 10-at-a-time.c anyauthput.c certinfo.c chkspeed.c \ + cookie_interface.c debug.c externalsocket.c fileupload.c \ + fopen.c ftp-wildcard.c ftpget.c ftpgetinfo.c ftpgetresp.c \ + ftpsget.c ftpupload.c getinfo.c getinmemory.c http-post.c \ + httpcustomheader.c httpput.c https.c imap.c multi-app.c \ + multi-debugcallback.c multi-double.c multi-post.c \ + multi-single.c persistant.c pop3s.c pop3slist.c \ + post-callback.c postit2.c progressfunc.c resolve.c rtsp.c \ + sendrecv.c sepheaders.c sftpget.c simple.c simplepost.c \ + simplesmtp.c simplessl.c smtp-multi.c smtp-tls.c url2file.c +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BLANK_AT_MAKETIME = @BLANK_AT_MAKETIME@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CFLAG_CURL_SYMBOL_HIDING = @CFLAG_CURL_SYMBOL_HIDING@ +CONFIGURE_OPTIONS = @CONFIGURE_OPTIONS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CPPFLAG_CURL_STATICLIB = @CPPFLAG_CURL_STATICLIB@ +CURLVERSION = @CURLVERSION@ +CURL_CA_BUNDLE = @CURL_CA_BUNDLE@ +CURL_CFLAG_EXTRAS = @CURL_CFLAG_EXTRAS@ +CURL_DISABLE_DICT = @CURL_DISABLE_DICT@ +CURL_DISABLE_FILE = @CURL_DISABLE_FILE@ +CURL_DISABLE_FTP = @CURL_DISABLE_FTP@ +CURL_DISABLE_GOPHER = @CURL_DISABLE_GOPHER@ +CURL_DISABLE_HTTP = @CURL_DISABLE_HTTP@ +CURL_DISABLE_IMAP = @CURL_DISABLE_IMAP@ +CURL_DISABLE_LDAP = @CURL_DISABLE_LDAP@ +CURL_DISABLE_LDAPS = @CURL_DISABLE_LDAPS@ +CURL_DISABLE_POP3 = @CURL_DISABLE_POP3@ +CURL_DISABLE_PROXY = @CURL_DISABLE_PROXY@ +CURL_DISABLE_RTSP = @CURL_DISABLE_RTSP@ +CURL_DISABLE_SMTP = @CURL_DISABLE_SMTP@ +CURL_DISABLE_TELNET = @CURL_DISABLE_TELNET@ +CURL_DISABLE_TFTP = @CURL_DISABLE_TFTP@ +CURL_NETWORK_AND_TIME_LIBS = @CURL_NETWORK_AND_TIME_LIBS@ +CURL_NETWORK_LIBS = @CURL_NETWORK_LIBS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_SHARED = @ENABLE_SHARED@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +HAVE_GNUTLS_SRP = @HAVE_GNUTLS_SRP@ +HAVE_LDAP_SSL = @HAVE_LDAP_SSL@ +HAVE_LIBZ = @HAVE_LIBZ@ +HAVE_NSS_INITCONTEXT = @HAVE_NSS_INITCONTEXT@ +HAVE_SSLEAY_SRP = @HAVE_SSLEAY_SRP@ +IDN_ENABLED = @IDN_ENABLED@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +IPV6_ENABLED = @IPV6_ENABLED@ +KRB4_ENABLED = @KRB4_ENABLED@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBCURL_LIBS = @LIBCURL_LIBS@ +LIBMETALINK_CPPFLAGS = @LIBMETALINK_CPPFLAGS@ +LIBMETALINK_LDFLAGS = @LIBMETALINK_LDFLAGS@ +LIBMETALINK_LIBS = @LIBMETALINK_LIBS@ +LIBOBJS = @LIBOBJS@ + +# Prevent LIBS from being used for all link targets +LIBS = $(BLANK_AT_MAKETIME) +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MANOPT = @MANOPT@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NROFF = @NROFF@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +PKGADD_NAME = @PKGADD_NAME@ +PKGADD_PKG = @PKGADD_PKG@ +PKGADD_VENDOR = @PKGADD_VENDOR@ +PKGCONFIG = @PKGCONFIG@ +RANDOM_FILE = @RANDOM_FILE@ +RANLIB = @RANLIB@ +REQUIRE_LIB_DEPS = @REQUIRE_LIB_DEPS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SSL_ENABLED = @SSL_ENABLED@ +STRIP = @STRIP@ +SUPPORT_FEATURES = @SUPPORT_FEATURES@ +SUPPORT_PROTOCOLS = @SUPPORT_PROTOCOLS@ +USE_ARES = @USE_ARES@ +USE_AXTLS = @USE_AXTLS@ +USE_CYASSL = @USE_CYASSL@ +USE_DARWINSSL = @USE_DARWINSSL@ +USE_GNUTLS = @USE_GNUTLS@ +USE_GNUTLS_NETTLE = @USE_GNUTLS_NETTLE@ +USE_LIBRTMP = @USE_LIBRTMP@ +USE_LIBSSH2 = @USE_LIBSSH2@ +USE_NSS = @USE_NSS@ +USE_OPENLDAP = @USE_OPENLDAP@ +USE_POLARSSL = @USE_POLARSSL@ +USE_SCHANNEL = @USE_SCHANNEL@ +USE_SSLEAY = @USE_SSLEAY@ +USE_WINDOWS_SSPI = @USE_WINDOWS_SSPI@ +VERSION = @VERSION@ +VERSIONED_FLAVOUR = @VERSIONED_FLAVOUR@ +VERSIONNUM = @VERSIONNUM@ +ZLIB_LIBS = @ZLIB_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +libext = @libext@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +subdirs = @subdirs@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AUTOMAKE_OPTIONS = foreign nostdinc +EXTRA_DIST = README Makefile.example Makefile.inc Makefile.m32 \ + Makefile.netware makefile.dj $(COMPLICATED_EXAMPLES) + + +# Specify our include paths here, and do it relative to $(top_srcdir) and +# $(top_builddir), to ensure that these paths which belong to the library +# being currently built and tested are searched before the library which +# might possibly already be installed in the system. +# +# $(top_builddir)/include/curl for generated curlbuild.h included from curl.h +# $(top_builddir)/include for generated curlbuild.h inc. from lib/curl_setup.h +# $(top_srcdir)/include is for libcurl's external include files + +# Avoid libcurl obsolete stuff +AM_CPPFLAGS = -I$(top_builddir)/include/curl -I$(top_builddir)/include \ + -I$(top_srcdir)/include -DCURL_NO_OLDIES $(am__append_1) +LIBDIR = $(top_builddir)/lib +@USE_EXPLICIT_LIB_DEPS_FALSE@LDADD = $(LIBDIR)/libcurl.la + +# Dependencies +@USE_EXPLICIT_LIB_DEPS_TRUE@LDADD = $(LIBDIR)/libcurl.la @LIBCURL_LIBS@ + +# These examples require external dependencies that may not be commonly +# available on POSIX systems, so don't bother attempting to compile them here. +COMPLICATED_EXAMPLES = curlgtk.c curlx.c htmltitle.cpp cacertinmem.c \ + ftpuploadresume.c ghiper.c hiperfifo.c htmltidy.c multithread.c \ + opensslthreadlock.c sampleconv.c synctime.c threaded-ssl.c evhiperfifo.c \ + smooth-gtk-thread.c version-check.pl href_extractor.c asiohiper.cpp + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/Makefile.inc $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign docs/examples/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign docs/examples/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; +$(srcdir)/Makefile.inc: + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-checkPROGRAMS: + @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +10-at-a-time$(EXEEXT): $(10_at_a_time_OBJECTS) $(10_at_a_time_DEPENDENCIES) $(EXTRA_10_at_a_time_DEPENDENCIES) + @rm -f 10-at-a-time$(EXEEXT) + $(LINK) $(10_at_a_time_OBJECTS) $(10_at_a_time_LDADD) $(LIBS) +anyauthput$(EXEEXT): $(anyauthput_OBJECTS) $(anyauthput_DEPENDENCIES) $(EXTRA_anyauthput_DEPENDENCIES) + @rm -f anyauthput$(EXEEXT) + $(LINK) $(anyauthput_OBJECTS) $(anyauthput_LDADD) $(LIBS) +certinfo$(EXEEXT): $(certinfo_OBJECTS) $(certinfo_DEPENDENCIES) $(EXTRA_certinfo_DEPENDENCIES) + @rm -f certinfo$(EXEEXT) + $(LINK) $(certinfo_OBJECTS) $(certinfo_LDADD) $(LIBS) +chkspeed$(EXEEXT): $(chkspeed_OBJECTS) $(chkspeed_DEPENDENCIES) $(EXTRA_chkspeed_DEPENDENCIES) + @rm -f chkspeed$(EXEEXT) + $(LINK) $(chkspeed_OBJECTS) $(chkspeed_LDADD) $(LIBS) +cookie_interface$(EXEEXT): $(cookie_interface_OBJECTS) $(cookie_interface_DEPENDENCIES) $(EXTRA_cookie_interface_DEPENDENCIES) + @rm -f cookie_interface$(EXEEXT) + $(LINK) $(cookie_interface_OBJECTS) $(cookie_interface_LDADD) $(LIBS) +debug$(EXEEXT): $(debug_OBJECTS) $(debug_DEPENDENCIES) $(EXTRA_debug_DEPENDENCIES) + @rm -f debug$(EXEEXT) + $(LINK) $(debug_OBJECTS) $(debug_LDADD) $(LIBS) +externalsocket$(EXEEXT): $(externalsocket_OBJECTS) $(externalsocket_DEPENDENCIES) $(EXTRA_externalsocket_DEPENDENCIES) + @rm -f externalsocket$(EXEEXT) + $(LINK) $(externalsocket_OBJECTS) $(externalsocket_LDADD) $(LIBS) +fileupload$(EXEEXT): $(fileupload_OBJECTS) $(fileupload_DEPENDENCIES) $(EXTRA_fileupload_DEPENDENCIES) + @rm -f fileupload$(EXEEXT) + $(LINK) $(fileupload_OBJECTS) $(fileupload_LDADD) $(LIBS) +fopen$(EXEEXT): $(fopen_OBJECTS) $(fopen_DEPENDENCIES) $(EXTRA_fopen_DEPENDENCIES) + @rm -f fopen$(EXEEXT) + $(LINK) $(fopen_OBJECTS) $(fopen_LDADD) $(LIBS) +ftp-wildcard$(EXEEXT): $(ftp_wildcard_OBJECTS) $(ftp_wildcard_DEPENDENCIES) $(EXTRA_ftp_wildcard_DEPENDENCIES) + @rm -f ftp-wildcard$(EXEEXT) + $(LINK) $(ftp_wildcard_OBJECTS) $(ftp_wildcard_LDADD) $(LIBS) +ftpget$(EXEEXT): $(ftpget_OBJECTS) $(ftpget_DEPENDENCIES) $(EXTRA_ftpget_DEPENDENCIES) + @rm -f ftpget$(EXEEXT) + $(LINK) $(ftpget_OBJECTS) $(ftpget_LDADD) $(LIBS) +ftpgetinfo$(EXEEXT): $(ftpgetinfo_OBJECTS) $(ftpgetinfo_DEPENDENCIES) $(EXTRA_ftpgetinfo_DEPENDENCIES) + @rm -f ftpgetinfo$(EXEEXT) + $(LINK) $(ftpgetinfo_OBJECTS) $(ftpgetinfo_LDADD) $(LIBS) +ftpgetresp$(EXEEXT): $(ftpgetresp_OBJECTS) $(ftpgetresp_DEPENDENCIES) $(EXTRA_ftpgetresp_DEPENDENCIES) + @rm -f ftpgetresp$(EXEEXT) + $(LINK) $(ftpgetresp_OBJECTS) $(ftpgetresp_LDADD) $(LIBS) +ftpsget$(EXEEXT): $(ftpsget_OBJECTS) $(ftpsget_DEPENDENCIES) $(EXTRA_ftpsget_DEPENDENCIES) + @rm -f ftpsget$(EXEEXT) + $(LINK) $(ftpsget_OBJECTS) $(ftpsget_LDADD) $(LIBS) +ftpupload$(EXEEXT): $(ftpupload_OBJECTS) $(ftpupload_DEPENDENCIES) $(EXTRA_ftpupload_DEPENDENCIES) + @rm -f ftpupload$(EXEEXT) + $(LINK) $(ftpupload_OBJECTS) $(ftpupload_LDADD) $(LIBS) +getinfo$(EXEEXT): $(getinfo_OBJECTS) $(getinfo_DEPENDENCIES) $(EXTRA_getinfo_DEPENDENCIES) + @rm -f getinfo$(EXEEXT) + $(LINK) $(getinfo_OBJECTS) $(getinfo_LDADD) $(LIBS) +getinmemory$(EXEEXT): $(getinmemory_OBJECTS) $(getinmemory_DEPENDENCIES) $(EXTRA_getinmemory_DEPENDENCIES) + @rm -f getinmemory$(EXEEXT) + $(LINK) $(getinmemory_OBJECTS) $(getinmemory_LDADD) $(LIBS) +http-post$(EXEEXT): $(http_post_OBJECTS) $(http_post_DEPENDENCIES) $(EXTRA_http_post_DEPENDENCIES) + @rm -f http-post$(EXEEXT) + $(LINK) $(http_post_OBJECTS) $(http_post_LDADD) $(LIBS) +httpcustomheader$(EXEEXT): $(httpcustomheader_OBJECTS) $(httpcustomheader_DEPENDENCIES) $(EXTRA_httpcustomheader_DEPENDENCIES) + @rm -f httpcustomheader$(EXEEXT) + $(LINK) $(httpcustomheader_OBJECTS) $(httpcustomheader_LDADD) $(LIBS) +httpput$(EXEEXT): $(httpput_OBJECTS) $(httpput_DEPENDENCIES) $(EXTRA_httpput_DEPENDENCIES) + @rm -f httpput$(EXEEXT) + $(LINK) $(httpput_OBJECTS) $(httpput_LDADD) $(LIBS) +https$(EXEEXT): $(https_OBJECTS) $(https_DEPENDENCIES) $(EXTRA_https_DEPENDENCIES) + @rm -f https$(EXEEXT) + $(LINK) $(https_OBJECTS) $(https_LDADD) $(LIBS) +imap$(EXEEXT): $(imap_OBJECTS) $(imap_DEPENDENCIES) $(EXTRA_imap_DEPENDENCIES) + @rm -f imap$(EXEEXT) + $(LINK) $(imap_OBJECTS) $(imap_LDADD) $(LIBS) +multi-app$(EXEEXT): $(multi_app_OBJECTS) $(multi_app_DEPENDENCIES) $(EXTRA_multi_app_DEPENDENCIES) + @rm -f multi-app$(EXEEXT) + $(LINK) $(multi_app_OBJECTS) $(multi_app_LDADD) $(LIBS) +multi-debugcallback$(EXEEXT): $(multi_debugcallback_OBJECTS) $(multi_debugcallback_DEPENDENCIES) $(EXTRA_multi_debugcallback_DEPENDENCIES) + @rm -f multi-debugcallback$(EXEEXT) + $(LINK) $(multi_debugcallback_OBJECTS) $(multi_debugcallback_LDADD) $(LIBS) +multi-double$(EXEEXT): $(multi_double_OBJECTS) $(multi_double_DEPENDENCIES) $(EXTRA_multi_double_DEPENDENCIES) + @rm -f multi-double$(EXEEXT) + $(LINK) $(multi_double_OBJECTS) $(multi_double_LDADD) $(LIBS) +multi-post$(EXEEXT): $(multi_post_OBJECTS) $(multi_post_DEPENDENCIES) $(EXTRA_multi_post_DEPENDENCIES) + @rm -f multi-post$(EXEEXT) + $(LINK) $(multi_post_OBJECTS) $(multi_post_LDADD) $(LIBS) +multi-single$(EXEEXT): $(multi_single_OBJECTS) $(multi_single_DEPENDENCIES) $(EXTRA_multi_single_DEPENDENCIES) + @rm -f multi-single$(EXEEXT) + $(LINK) $(multi_single_OBJECTS) $(multi_single_LDADD) $(LIBS) +persistant$(EXEEXT): $(persistant_OBJECTS) $(persistant_DEPENDENCIES) $(EXTRA_persistant_DEPENDENCIES) + @rm -f persistant$(EXEEXT) + $(LINK) $(persistant_OBJECTS) $(persistant_LDADD) $(LIBS) +pop3s$(EXEEXT): $(pop3s_OBJECTS) $(pop3s_DEPENDENCIES) $(EXTRA_pop3s_DEPENDENCIES) + @rm -f pop3s$(EXEEXT) + $(LINK) $(pop3s_OBJECTS) $(pop3s_LDADD) $(LIBS) +pop3slist$(EXEEXT): $(pop3slist_OBJECTS) $(pop3slist_DEPENDENCIES) $(EXTRA_pop3slist_DEPENDENCIES) + @rm -f pop3slist$(EXEEXT) + $(LINK) $(pop3slist_OBJECTS) $(pop3slist_LDADD) $(LIBS) +post-callback$(EXEEXT): $(post_callback_OBJECTS) $(post_callback_DEPENDENCIES) $(EXTRA_post_callback_DEPENDENCIES) + @rm -f post-callback$(EXEEXT) + $(LINK) $(post_callback_OBJECTS) $(post_callback_LDADD) $(LIBS) +postit2$(EXEEXT): $(postit2_OBJECTS) $(postit2_DEPENDENCIES) $(EXTRA_postit2_DEPENDENCIES) + @rm -f postit2$(EXEEXT) + $(LINK) $(postit2_OBJECTS) $(postit2_LDADD) $(LIBS) +progressfunc$(EXEEXT): $(progressfunc_OBJECTS) $(progressfunc_DEPENDENCIES) $(EXTRA_progressfunc_DEPENDENCIES) + @rm -f progressfunc$(EXEEXT) + $(LINK) $(progressfunc_OBJECTS) $(progressfunc_LDADD) $(LIBS) +resolve$(EXEEXT): $(resolve_OBJECTS) $(resolve_DEPENDENCIES) $(EXTRA_resolve_DEPENDENCIES) + @rm -f resolve$(EXEEXT) + $(LINK) $(resolve_OBJECTS) $(resolve_LDADD) $(LIBS) +rtsp$(EXEEXT): $(rtsp_OBJECTS) $(rtsp_DEPENDENCIES) $(EXTRA_rtsp_DEPENDENCIES) + @rm -f rtsp$(EXEEXT) + $(LINK) $(rtsp_OBJECTS) $(rtsp_LDADD) $(LIBS) +sendrecv$(EXEEXT): $(sendrecv_OBJECTS) $(sendrecv_DEPENDENCIES) $(EXTRA_sendrecv_DEPENDENCIES) + @rm -f sendrecv$(EXEEXT) + $(LINK) $(sendrecv_OBJECTS) $(sendrecv_LDADD) $(LIBS) +sepheaders$(EXEEXT): $(sepheaders_OBJECTS) $(sepheaders_DEPENDENCIES) $(EXTRA_sepheaders_DEPENDENCIES) + @rm -f sepheaders$(EXEEXT) + $(LINK) $(sepheaders_OBJECTS) $(sepheaders_LDADD) $(LIBS) +sftpget$(EXEEXT): $(sftpget_OBJECTS) $(sftpget_DEPENDENCIES) $(EXTRA_sftpget_DEPENDENCIES) + @rm -f sftpget$(EXEEXT) + $(LINK) $(sftpget_OBJECTS) $(sftpget_LDADD) $(LIBS) +simple$(EXEEXT): $(simple_OBJECTS) $(simple_DEPENDENCIES) $(EXTRA_simple_DEPENDENCIES) + @rm -f simple$(EXEEXT) + $(LINK) $(simple_OBJECTS) $(simple_LDADD) $(LIBS) +simplepost$(EXEEXT): $(simplepost_OBJECTS) $(simplepost_DEPENDENCIES) $(EXTRA_simplepost_DEPENDENCIES) + @rm -f simplepost$(EXEEXT) + $(LINK) $(simplepost_OBJECTS) $(simplepost_LDADD) $(LIBS) +simplesmtp$(EXEEXT): $(simplesmtp_OBJECTS) $(simplesmtp_DEPENDENCIES) $(EXTRA_simplesmtp_DEPENDENCIES) + @rm -f simplesmtp$(EXEEXT) + $(LINK) $(simplesmtp_OBJECTS) $(simplesmtp_LDADD) $(LIBS) +simplessl$(EXEEXT): $(simplessl_OBJECTS) $(simplessl_DEPENDENCIES) $(EXTRA_simplessl_DEPENDENCIES) + @rm -f simplessl$(EXEEXT) + $(LINK) $(simplessl_OBJECTS) $(simplessl_LDADD) $(LIBS) +smtp-multi$(EXEEXT): $(smtp_multi_OBJECTS) $(smtp_multi_DEPENDENCIES) $(EXTRA_smtp_multi_DEPENDENCIES) + @rm -f smtp-multi$(EXEEXT) + $(LINK) $(smtp_multi_OBJECTS) $(smtp_multi_LDADD) $(LIBS) +smtp-tls$(EXEEXT): $(smtp_tls_OBJECTS) $(smtp_tls_DEPENDENCIES) $(EXTRA_smtp_tls_DEPENDENCIES) + @rm -f smtp-tls$(EXEEXT) + $(LINK) $(smtp_tls_OBJECTS) $(smtp_tls_LDADD) $(LIBS) +url2file$(EXEEXT): $(url2file_OBJECTS) $(url2file_DEPENDENCIES) $(EXTRA_url2file_DEPENDENCIES) + @rm -f url2file$(EXEEXT) + $(LINK) $(url2file_OBJECTS) $(url2file_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/10-at-a-time.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/anyauthput.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/certinfo.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chkspeed.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cookie_interface.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/debug.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/externalsocket.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fileupload.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fopen.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftp-wildcard.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftpget.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftpgetinfo.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftpgetresp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftpsget.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftpupload.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getinfo.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getinmemory.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/http-post.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/httpcustomheader.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/httpput.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/https.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/imap.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/multi-app.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/multi-debugcallback.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/multi-double.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/multi-post.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/multi-single.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/persistant.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pop3s.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pop3slist.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/post-callback.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/postit2.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/progressfunc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/resolve.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rtsp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sendrecv.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sepheaders.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sftpget.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simple.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simplepost.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simplesmtp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simplessl.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smtp-multi.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smtp-tls.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/url2file.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(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; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(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; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(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; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: check-am install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean \ + clean-checkPROGRAMS clean-generic clean-libtool ctags \ + distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am + + +# Makefile.inc provides the check_PROGRAMS and COMPLICATED_EXAMPLES defines + +all: $(check_PROGRAMS) + +# 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/plugins/FTPFileYM/curl-7.29.0/docs/examples/Makefile.inc b/plugins/FTPFileYM/curl-7.29.0/docs/examples/Makefile.inc new file mode 100644 index 0000000000..9aabfcabdc --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/Makefile.inc @@ -0,0 +1,15 @@ +# These are all libcurl example programs to be test compiled +check_PROGRAMS = 10-at-a-time anyauthput cookie_interface debug fileupload \ + fopen ftpget ftpgetresp ftpupload getinfo getinmemory http-post httpput \ + https multi-app multi-debugcallback multi-double multi-post multi-single \ + persistant post-callback postit2 sepheaders simple simplepost simplessl \ + sendrecv httpcustomheader certinfo chkspeed ftpgetinfo ftp-wildcard \ + smtp-multi simplesmtp smtp-tls rtsp externalsocket resolve \ + progressfunc pop3s pop3slist imap url2file sftpget ftpsget + +# These examples require external dependencies that may not be commonly +# available on POSIX systems, so don't bother attempting to compile them here. +COMPLICATED_EXAMPLES = curlgtk.c curlx.c htmltitle.cpp cacertinmem.c \ + ftpuploadresume.c ghiper.c hiperfifo.c htmltidy.c multithread.c \ + opensslthreadlock.c sampleconv.c synctime.c threaded-ssl.c evhiperfifo.c \ + smooth-gtk-thread.c version-check.pl href_extractor.c asiohiper.cpp diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/Makefile.m32 b/plugins/FTPFileYM/curl-7.29.0/docs/examples/Makefile.m32 new file mode 100644 index 0000000000..4e93093d60 --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/Makefile.m32 @@ -0,0 +1,282 @@ +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at http://curl.haxx.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### +# +## Makefile for building curl examples with MingW (GCC-3.2 or later) +## and optionally OpenSSL (0.9.8), libssh2 (1.3), zlib (1.2.5), librtmp (2.3) +## +## Usage: mingw32-make -f Makefile.m32 CFG=-feature1[-feature2][-feature3][...] +## Example: mingw32-make -f Makefile.m32 CFG=-zlib-ssl-spi-winidn +## +## Hint: you can also set environment vars to control the build, f.e.: +## set ZLIB_PATH=c:/zlib-1.2.7 +## set ZLIB=1 +# +########################################################################### + +# Edit the path below to point to the base of your Zlib sources. +ifndef ZLIB_PATH +ZLIB_PATH = ../../../zlib-1.2.7 +endif +# Edit the path below to point to the base of your OpenSSL package. +ifndef OPENSSL_PATH +OPENSSL_PATH = ../../../openssl-0.9.8x +endif +# Edit the path below to point to the base of your LibSSH2 package. +ifndef LIBSSH2_PATH +LIBSSH2_PATH = ../../../libssh2-1.4.3 +endif +# Edit the path below to point to the base of your librtmp package. +ifndef LIBRTMP_PATH +LIBRTMP_PATH = ../../../librtmp-2.3 +endif +# Edit the path below to point to the base of your libidn package. +ifndef LIBIDN_PATH +LIBIDN_PATH = ../../../libidn-1.18 +endif +# Edit the path below to point to the base of your MS IDN package. +# Microsoft Internationalized Domain Names (IDN) Mitigation APIs 1.1 +# http://www.microsoft.com/downloads/en/details.aspx?FamilyID=ad6158d7-ddba-416a-9109-07607425a815 +ifndef WINIDN_PATH +WINIDN_PATH = ../../../Microsoft IDN Mitigation APIs +endif +# Edit the path below to point to the base of your Novell LDAP NDK. +ifndef LDAP_SDK +LDAP_SDK = c:/novell/ndk/cldapsdk/win32 +endif + +PROOT = ../.. + +# Edit the path below to point to the base of your c-ares package. +ifndef LIBCARES_PATH +LIBCARES_PATH = $(PROOT)/ares +endif + +# Edit the var below to set to your architecture or set environment var. +ifndef ARCH +ARCH = w32 +endif + +CC = $(CROSSPREFIX)gcc +CFLAGS = -g -O2 -Wall +CFLAGS += -fno-strict-aliasing +ifeq ($(ARCH),w64) +CFLAGS += -D_AMD64_ +endif +# comment LDFLAGS below to keep debug info +LDFLAGS = -s +RC = $(CROSSPREFIX)windres +RCFLAGS = --include-dir=$(PROOT)/include -O COFF -i + +# Platform-dependent helper tool macros +ifeq ($(findstring /sh,$(SHELL)),/sh) +DEL = rm -f $1 +RMDIR = rm -fr $1 +MKDIR = mkdir -p $1 +COPY = -cp -afv $1 $2 +#COPYR = -cp -afr $1/* $2 +COPYR = -rsync -aC $1/* $2 +TOUCH = touch $1 +CAT = cat +ECHONL = echo "" +DL = ' +else +ifeq "$(OS)" "Windows_NT" +DEL = -del 2>NUL /q /f $(subst /,\,$1) +RMDIR = -rd 2>NUL /q /s $(subst /,\,$1) +else +DEL = -del 2>NUL $(subst /,\,$1) +RMDIR = -deltree 2>NUL /y $(subst /,\,$1) +endif +MKDIR = -md 2>NUL $(subst /,\,$1) +COPY = -copy 2>NUL /y $(subst /,\,$1) $(subst /,\,$2) +COPYR = -xcopy 2>NUL /q /y /e $(subst /,\,$1) $(subst /,\,$2) +TOUCH = copy 2>&1>NUL /b $(subst /,\,$1) +,, +CAT = type +ECHONL = $(ComSpec) /c echo. +endif + +######################################################## +## Nothing more to do below this line! + +ifeq ($(findstring -dyn,$(CFG)),-dyn) +DYN = 1 +endif +ifeq ($(findstring -ares,$(CFG)),-ares) +ARES = 1 +endif +ifeq ($(findstring -rtmp,$(CFG)),-rtmp) +RTMP = 1 +SSL = 1 +ZLIB = 1 +endif +ifeq ($(findstring -ssh2,$(CFG)),-ssh2) +SSH2 = 1 +SSL = 1 +ZLIB = 1 +endif +ifeq ($(findstring -ssl,$(CFG)),-ssl) +SSL = 1 +endif +ifeq ($(findstring -zlib,$(CFG)),-zlib) +ZLIB = 1 +endif +ifeq ($(findstring -idn,$(CFG)),-idn) +IDN = 1 +endif +ifeq ($(findstring -winidn,$(CFG)),-winidn) +WINIDN = 1 +endif +ifeq ($(findstring -sspi,$(CFG)),-sspi) +SSPI = 1 +endif +ifeq ($(findstring -spnego,$(CFG)),-spnego) +SPNEGO = 1 +endif +ifeq ($(findstring -ldaps,$(CFG)),-ldaps) +LDAPS = 1 +endif +ifeq ($(findstring -ipv6,$(CFG)),-ipv6) +IPV6 = 1 +endif +ifeq ($(findstring -metalink,$(CFG)),-metalink) +METALINK = 1 +endif +ifeq ($(findstring -winssl,$(CFG)),-winssl) +SCHANNEL = 1 +SSPI = 1 +endif + +INCLUDES = -I. -I$(PROOT) -I$(PROOT)/include -I$(PROOT)/lib + +ifdef DYN + curl_DEPENDENCIES = $(PROOT)/lib/libcurldll.a $(PROOT)/lib/libcurl.dll + curl_LDADD = -L$(PROOT)/lib -lcurldll +else + curl_DEPENDENCIES = $(PROOT)/lib/libcurl.a + curl_LDADD = -L$(PROOT)/lib -lcurl + CFLAGS += -DCURL_STATICLIB + LDFLAGS += -static +endif +ifdef ARES + ifndef DYN + curl_DEPENDENCIES += $(LIBCARES_PATH)/libcares.a + endif + CFLAGS += -DUSE_ARES + curl_LDADD += -L"$(LIBCARES_PATH)" -lcares +endif +ifdef RTMP + CFLAGS += -DUSE_LIBRTMP + curl_LDADD += -L"$(LIBRTMP_PATH)/librtmp" -lrtmp -lwinmm +endif +ifdef SSH2 + CFLAGS += -DUSE_LIBSSH2 -DHAVE_LIBSSH2_H + curl_LDADD += -L"$(LIBSSH2_PATH)/win32" -lssh2 +endif +ifdef SSL + ifndef OPENSSL_LIBPATH + OPENSSL_LIBS = -lssl -lcrypto + ifeq "$(wildcard $(OPENSSL_PATH)/out)" "$(OPENSSL_PATH)/out" + OPENSSL_LIBPATH = $(OPENSSL_PATH)/out + ifdef DYN + OPENSSL_LIBS = -lssl32 -leay32 + endif + endif + ifeq "$(wildcard $(OPENSSL_PATH)/lib)" "$(OPENSSL_PATH)/lib" + OPENSSL_LIBPATH = $(OPENSSL_PATH)/lib + endif + endif + ifndef DYN + OPENSSL_LIBS += -lgdi32 -lcrypt32 + endif + CFLAGS += -DUSE_SSLEAY + curl_LDADD += -L"$(OPENSSL_LIBPATH)" $(OPENSSL_LIBS) +endif +ifdef ZLIB + INCLUDES += -I"$(ZLIB_PATH)" + CFLAGS += -DHAVE_LIBZ -DHAVE_ZLIB_H + curl_LDADD += -L"$(ZLIB_PATH)" -lz +endif +ifdef IDN + CFLAGS += -DUSE_LIBIDN + curl_LDADD += -L"$(LIBIDN_PATH)/lib" -lidn +else +ifdef WINIDN + CFLAGS += -DUSE_WIN32_IDN + curl_LDADD += -L"$(WINIDN_PATH)" -lnormaliz +endif +endif +ifdef SSPI + CFLAGS += -DUSE_WINDOWS_SSPI + ifdef SCHANNEL + CFLAGS += -DUSE_SCHANNEL + endif +endif +ifdef SPNEGO + CFLAGS += -DHAVE_SPNEGO +endif +ifdef IPV6 + CFLAGS += -DENABLE_IPV6 -D_WIN32_WINNT=0x0501 +endif +ifdef LDAPS + CFLAGS += -DHAVE_LDAP_SSL +endif +ifdef USE_LDAP_NOVELL + CFLAGS += -DCURL_HAS_NOVELL_LDAPSDK + curl_LDADD += -L"$(LDAP_SDK)/lib/mscvc" -lldapsdk -lldapssl -lldapx +endif +ifdef USE_LDAP_OPENLDAP + CFLAGS += -DCURL_HAS_OPENLDAP_LDAPSDK + curl_LDADD += -L"$(LDAP_SDK)/lib" -lldap -llber +endif +ifndef USE_LDAP_NOVELL +ifndef USE_LDAP_OPENLDAP + curl_LDADD += -lwldap32 +endif +endif +curl_LDADD += -lws2_32 + +# Makefile.inc provides the check_PROGRAMS and COMPLICATED_EXAMPLES defines +include Makefile.inc + +check_PROGRAMS := $(patsubst %,%.exe,$(strip $(check_PROGRAMS))) +check_PROGRAMS += ftpuploadresume.exe synctime.exe + +.PRECIOUS: %.o + + +all: $(check_PROGRAMS) + +%.exe: %.o $(curl_DEPENDENCIES) + $(CC) $(LDFLAGS) -o $@ $< $(curl_LDADD) + +%.o: %.c + $(CC) $(INCLUDES) $(CFLAGS) -c $< + +%.res: %.rc + $(RC) $(RCFLAGS) $< -o $@ + +clean: + @$(call DEL, $(check_PROGRAMS:.exe=.o)) + +distclean vclean: clean + @$(call DEL, $(check_PROGRAMS)) + diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/Makefile.netware b/plugins/FTPFileYM/curl-7.29.0/docs/examples/Makefile.netware new file mode 100644 index 0000000000..e1a48b7d55 --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/Makefile.netware @@ -0,0 +1,441 @@ +################################################################# +# +## Makefile for building curl.nlm (NetWare version - gnu make) +## Use: make -f Makefile.netware +## +## Comments to: Guenter Knauf http://www.gknw.net/phpbb +# +################################################################# + +# Edit the path below to point to the base of your Novell NDK. +ifndef NDKBASE +NDKBASE = c:/novell +endif + +# Edit the path below to point to the base of your Zlib sources. +ifndef ZLIB_PATH +ZLIB_PATH = ../../../zlib-1.2.7 +endif + +# Edit the path below to point to the base of your OpenSSL package. +ifndef OPENSSL_PATH +OPENSSL_PATH = ../../../openssl-0.9.8x +endif + +# Edit the path below to point to the base of your LibSSH2 package. +ifndef LIBSSH2_PATH +LIBSSH2_PATH = ../../../libssh2-1.4.3 +endif + +# Edit the path below to point to the base of your axTLS package. +ifndef AXTLS_PATH +AXTLS_PATH = ../../../axTLS-1.2.7 +endif + +# Edit the path below to point to the base of your libidn package. +ifndef LIBIDN_PATH +LIBIDN_PATH = ../../../libidn-1.18 +endif + +# Edit the path below to point to the base of your librtmp package. +ifndef LIBRTMP_PATH +LIBRTMP_PATH = ../../../librtmp-2.3 +endif + +# Edit the path below to point to the base of your fbopenssl package. +ifndef FBOPENSSL_PATH +FBOPENSSL_PATH = ../../fbopenssl-0.4 +endif + +# Edit the path below to point to the base of your c-ares package. +ifndef LIBCARES_PATH +LIBCARES_PATH = ../../ares +endif + +ifndef INSTDIR +INSTDIR = ..$(DS)..$(DS)curl-$(LIBCURL_VERSION_STR)-bin-nw +endif + +# Edit the vars below to change NLM target settings. +TARGET = examples +VERSION = $(LIBCURL_VERSION) +COPYR = Copyright (C) $(LIBCURL_COPYRIGHT_STR) +DESCR = cURL ($(LIBARCH)) +MTSAFE = YES +STACK = 8192 +SCREEN = Example Program +# Comment the line below if you dont want to load protected automatically. +# LDRING = 3 + +# Uncomment the next line to enable linking with POSIX semantics. +# POSIXFL = 1 + +# Edit the var below to point to your lib architecture. +ifndef LIBARCH +LIBARCH = LIBC +endif + +# must be equal to NDEBUG or DEBUG, CURLDEBUG +ifndef DB +DB = NDEBUG +endif +# Optimization: -O<n> or debugging: -g +ifeq ($(DB),NDEBUG) + OPT = -O2 + OBJDIR = release +else + OPT = -g + OBJDIR = debug +endif + +# The following lines defines your compiler. +ifdef CWFolder + METROWERKS = $(CWFolder) +endif +ifdef METROWERKS + # MWCW_PATH = $(subst \,/,$(METROWERKS))/Novell Support + MWCW_PATH = $(subst \,/,$(METROWERKS))/Novell Support/Metrowerks Support + CC = mwccnlm +else + CC = gcc +endif +PERL = perl +# Here you can find a native Win32 binary of the original awk: +# http://www.gknw.net/development/prgtools/awk-20100523.zip +AWK = awk +CP = cp -afv +MKDIR = mkdir +# RM = rm -f +# If you want to mark the target as MTSAFE you will need a tool for +# generating the xdc data for the linker; here's a minimal tool: +# http://www.gknw.net/development/prgtools/mkxdc.zip +MPKXDC = mkxdc + +# LIBARCH_U = $(shell $(AWK) 'BEGIN {print toupper(ARGV[1])}' $(LIBARCH)) +LIBARCH_L = $(shell $(AWK) 'BEGIN {print tolower(ARGV[1])}' $(LIBARCH)) + +# Include the version info retrieved from curlver.h +-include $(OBJDIR)/version.inc + +# Global flags for all compilers +CFLAGS += $(OPT) -D$(DB) -DNETWARE -DHAVE_CONFIG_H -nostdinc + +ifeq ($(CC),mwccnlm) +LD = mwldnlm +LDFLAGS = -nostdlib $< $(PRELUDE) $(LDLIBS) -o $@ -commandfile +LIBEXT = lib +CFLAGS += -gccinc -inline off -opt nointrinsics -proc 586 +CFLAGS += -relax_pointers +#CFLAGS += -w on +ifeq ($(LIBARCH),LIBC) +ifeq ($(POSIXFL),1) + PRELUDE = $(NDK_LIBC)/imports/posixpre.o +else + PRELUDE = $(NDK_LIBC)/imports/libcpre.o +endif + CFLAGS += -align 4 +else + # PRELUDE = $(NDK_CLIB)/imports/clibpre.o + # to avoid the __init_* / __deinit_* whoes dont use prelude from NDK + PRELUDE = "$(MWCW_PATH)/libraries/runtime/prelude.obj" + # CFLAGS += -include "$(MWCW_PATH)/headers/nlm_clib_prefix.h" + CFLAGS += -align 1 +endif +else +LD = nlmconv +LDFLAGS = -T +LIBEXT = a +CFLAGS += -m32 +CFLAGS += -fno-builtin -fno-strict-aliasing +ifeq ($(findstring gcc,$(CC)),gcc) +CFLAGS += -fpcc-struct-return +endif +CFLAGS += -Wall # -pedantic +ifeq ($(LIBARCH),LIBC) +ifeq ($(POSIXFL),1) + PRELUDE = $(NDK_LIBC)/imports/posixpre.gcc.o +else + PRELUDE = $(NDK_LIBC)/imports/libcpre.gcc.o +endif +else + # PRELUDE = $(NDK_CLIB)/imports/clibpre.gcc.o + # to avoid the __init_* / __deinit_* whoes dont use prelude from NDK + # http://www.gknw.net/development/mk_nlm/gcc_pre.zip + PRELUDE = $(NDK_ROOT)/pre/prelude.o + CFLAGS += -include $(NDKBASE)/nlmconv/genlm.h +endif +endif + +NDK_ROOT = $(NDKBASE)/ndk +ifndef NDK_CLIB +NDK_CLIB = $(NDK_ROOT)/nwsdk +endif +ifndef NDK_LIBC +NDK_LIBC = $(NDK_ROOT)/libc +endif +ifndef NDK_LDAP +NDK_LDAP = $(NDK_ROOT)/cldapsdk/netware +endif +CURL_INC = ../../include +CURL_LIB = ../../lib + +INCLUDES = -I$(CURL_INC) + +ifeq ($(findstring -static,$(CFG)),-static) +LINK_STATIC = 1 +endif +ifeq ($(findstring -ares,$(CFG)),-ares) +WITH_ARES = 1 +endif +ifeq ($(findstring -rtmp,$(CFG)),-rtmp) +WITH_RTMP = 1 +WITH_SSL = 1 +WITH_ZLIB = 1 +endif +ifeq ($(findstring -ssh2,$(CFG)),-ssh2) +WITH_SSH2 = 1 +WITH_SSL = 1 +WITH_ZLIB = 1 +endif +ifeq ($(findstring -axtls,$(CFG)),-axtls) +WITH_AXTLS = 1 +WITH_SSL = +else +ifeq ($(findstring -ssl,$(CFG)),-ssl) +WITH_SSL = 1 +endif +endif +ifeq ($(findstring -zlib,$(CFG)),-zlib) +WITH_ZLIB = 1 +endif +ifeq ($(findstring -idn,$(CFG)),-idn) +WITH_IDN = 1 +endif +ifeq ($(findstring -spnego,$(CFG)),-spnego) +WITH_SPNEGO = 1 +endif +ifeq ($(findstring -ipv6,$(CFG)),-ipv6) +ENABLE_IPV6 = 1 +endif + +ifdef LINK_STATIC + LDLIBS = $(CURL_LIB)/libcurl.$(LIBEXT) +ifdef WITH_ARES + LDLIBS += $(LIBCARES_PATH)/libcares.$(LIBEXT) +endif +else + MODULES = libcurl.nlm + IMPORTS = @$(CURL_LIB)/libcurl.imp +endif +ifdef WITH_SSH2 + # INCLUDES += -I$(LIBSSH2_PATH)/include +ifdef LINK_STATIC + LDLIBS += $(LIBSSH2_PATH)/nw/libssh2.$(LIBEXT) +else + MODULES += libssh2.nlm + IMPORTS += @$(LIBSSH2_PATH)/nw/libssh2.imp +endif +endif +ifdef WITH_RTMP + # INCLUDES += -I$(LIBRTMP_PATH) +ifdef LINK_STATIC + LDLIBS += $(LIBRTMP_PATH)/librtmp/librtmp.$(LIBEXT) +endif +endif +ifdef WITH_SSL + INCLUDES += -I$(OPENSSL_PATH)/outinc_nw_$(LIBARCH_L) + LDLIBS += $(OPENSSL_PATH)/out_nw_$(LIBARCH_L)/ssl.$(LIBEXT) + LDLIBS += $(OPENSSL_PATH)/out_nw_$(LIBARCH_L)/crypto.$(LIBEXT) + IMPORTS += GetProcessSwitchCount RunningProcess +ifdef WITH_SPNEGO + # INCLUDES += -I$(FBOPENSSL_PATH)/include + LDLIBS += $(FBOPENSSL_PATH)/nw/fbopenssl.$(LIBEXT) +endif +else +ifdef WITH_AXTLS + INCLUDES += -I$(AXTLS_PATH)/inc +ifdef LINK_STATIC + LDLIBS += $(AXTLS_PATH)/lib/libaxtls.$(LIBEXT) +else + MODULES += libaxtls.nlm + IMPORTS += $(AXTLS_PATH)/lib/libaxtls.imp +endif +endif +endif +ifdef WITH_ZLIB + # INCLUDES += -I$(ZLIB_PATH) +ifdef LINK_STATIC + LDLIBS += $(ZLIB_PATH)/nw/$(LIBARCH)/libz.$(LIBEXT) +else + MODULES += libz.nlm + IMPORTS += @$(ZLIB_PATH)/nw/$(LIBARCH)/libz.imp +endif +endif +ifdef WITH_IDN + # INCLUDES += -I$(LIBIDN_PATH)/include + LDLIBS += $(LIBIDN_PATH)/lib/libidn.$(LIBEXT) +endif + +ifeq ($(LIBARCH),LIBC) + INCLUDES += -I$(NDK_LIBC)/include + # INCLUDES += -I$(NDK_LIBC)/include/nks + # INCLUDES += -I$(NDK_LIBC)/include/winsock + CFLAGS += -D_POSIX_SOURCE +else + INCLUDES += -I$(NDK_CLIB)/include/nlm + # INCLUDES += -I$(NDK_CLIB)/include +endif +ifndef DISABLE_LDAP + # INCLUDES += -I$(NDK_LDAP)/$(LIBARCH_L)/inc +endif +CFLAGS += $(INCLUDES) + +ifeq ($(MTSAFE),YES) + XDCOPT = -n +endif +ifeq ($(MTSAFE),NO) + XDCOPT = -u +endif +ifdef XDCOPT + XDCDATA = $(OBJDIR)/$(TARGET).xdc +endif + +ifeq ($(findstring /sh,$(SHELL)),/sh) +DL = ' +DS = / +PCT = % +#-include $(NDKBASE)/nlmconv/ncpfs.inc +else +DS = \\ +PCT = %% +endif + +# Makefile.inc provides the CSOURCES and HHEADERS defines +include Makefile.inc + +check_PROGRAMS := $(patsubst %,%.nlm,$(strip $(check_PROGRAMS))) + +.PRECIOUS: $(OBJDIR)/%.o $(OBJDIR)/%.def $(OBJDIR)/%.xdc + + +all: prebuild $(check_PROGRAMS) + +prebuild: $(OBJDIR) $(OBJDIR)/version.inc + +$(OBJDIR)/%.o: %.c + @echo Compiling $< + $(CC) $(CFLAGS) -c $< -o $@ + +$(OBJDIR)/version.inc: $(CURL_INC)/curl/curlver.h $(OBJDIR) + @echo Creating $@ + @$(AWK) -f ../../packages/NetWare/get_ver.awk $< > $@ + +install: $(INSTDIR) all + @$(CP) $(check_PROGRAMS) $(INSTDIR) + +clean: + -$(RM) -r $(OBJDIR) + +distclean vclean: clean + -$(RM) $(check_PROGRAMS) + +$(OBJDIR) $(INSTDIR): + @$(MKDIR) $@ + +%.nlm: $(OBJDIR)/%.o $(OBJDIR)/%.def $(XDCDATA) + @echo Linking $@ + @-$(RM) $@ + @$(LD) $(LDFLAGS) $(OBJDIR)/$(@:.nlm=.def) + +$(OBJDIR)/%.xdc: Makefile.netware + @echo Creating $@ + @$(MPKXDC) $(XDCOPT) $@ + +$(OBJDIR)/%.def: Makefile.netware + @echo $(DL)# DEF file for linking with $(LD)$(DL) > $@ + @echo $(DL)# Do not edit this file - it is created by Make!$(DL) >> $@ + @echo $(DL)# All your changes will be lost!!$(DL) >> $@ + @echo $(DL)#$(DL) >> $@ + @echo $(DL)copyright "$(COPYR)"$(DL) >> $@ + @echo $(DL)description "$(DESCR) $(notdir $(@:.def=)) Example"$(DL) >> $@ + @echo $(DL)version $(VERSION)$(DL) >> $@ +ifdef NLMTYPE + @echo $(DL)type $(NLMTYPE)$(DL) >> $@ +endif +ifdef STACK + @echo $(DL)stack $(STACK)$(DL) >> $@ +endif +ifdef SCREEN + @echo $(DL)screenname "$(DESCR) $(notdir $(@:.def=)) $(SCREEN)"$(DL) >> $@ +else + @echo $(DL)screenname "DEFAULT"$(DL) >> $@ +endif +ifneq ($(DB),NDEBUG) + @echo $(DL)debug$(DL) >> $@ +endif + @echo $(DL)threadname "_$(notdir $(@:.def=))"$(DL) >> $@ +ifdef XDCDATA + @echo $(DL)xdcdata $(XDCDATA)$(DL) >> $@ +endif +ifeq ($(LDRING),0) + @echo $(DL)flag_on 16$(DL) >> $@ +endif +ifeq ($(LDRING),3) + @echo $(DL)flag_on 512$(DL) >> $@ +endif +ifeq ($(LIBARCH),CLIB) + @echo $(DL)start _Prelude$(DL) >> $@ + @echo $(DL)exit _Stop$(DL) >> $@ + @echo $(DL)import @$(NDK_CLIB)/imports/clib.imp$(DL) >> $@ + @echo $(DL)import @$(NDK_CLIB)/imports/threads.imp$(DL) >> $@ + @echo $(DL)import @$(NDK_CLIB)/imports/nlmlib.imp$(DL) >> $@ + @echo $(DL)import @$(NDK_CLIB)/imports/socklib.imp$(DL) >> $@ + @echo $(DL)module clib$(DL) >> $@ +ifndef DISABLE_LDAP + @echo $(DL)import @$(NDK_LDAP)/clib/imports/ldapsdk.imp$(DL) >> $@ + @echo $(DL)import @$(NDK_LDAP)/clib/imports/ldapssl.imp$(DL) >> $@ +# @echo $(DL)import @$(NDK_LDAP)/clib/imports/ldapx.imp$(DL) >> $@ + @echo $(DL)module ldapsdk ldapssl$(DL) >> $@ +endif +else +ifeq ($(POSIXFL),1) + @echo $(DL)flag_on 4194304$(DL) >> $@ +endif + @echo $(DL)flag_on 64$(DL) >> $@ + @echo $(DL)pseudopreemption$(DL) >> $@ +ifeq ($(findstring posixpre,$(PRELUDE)),posixpre) + @echo $(DL)start POSIX_Start$(DL) >> $@ + @echo $(DL)exit POSIX_Stop$(DL) >> $@ + @echo $(DL)check POSIX_CheckUnload$(DL) >> $@ +else + @echo $(DL)start _LibCPrelude$(DL) >> $@ + @echo $(DL)exit _LibCPostlude$(DL) >> $@ + @echo $(DL)check _LibCCheckUnload$(DL) >> $@ +endif + @echo $(DL)import @$(NDK_LIBC)/imports/libc.imp$(DL) >> $@ + @echo $(DL)import @$(NDK_LIBC)/imports/netware.imp$(DL) >> $@ + @echo $(DL)module libc$(DL) >> $@ +ifndef DISABLE_LDAP + @echo $(DL)import @$(NDK_LDAP)/libc/imports/lldapsdk.imp$(DL) >> $@ + @echo $(DL)import @$(NDK_LDAP)/libc/imports/lldapssl.imp$(DL) >> $@ +# @echo $(DL)import @$(NDK_LDAP)/libc/imports/lldapx.imp$(DL) >> $@ + @echo $(DL)module lldapsdk lldapssl$(DL) >> $@ +endif +endif +ifdef MODULES + @echo $(DL)module $(MODULES)$(DL) >> $@ +endif +ifdef EXPORTS + @echo $(DL)export $(EXPORTS)$(DL) >> $@ +endif +ifdef IMPORTS + @echo $(DL)import $(IMPORTS)$(DL) >> $@ +endif +ifeq ($(findstring nlmconv,$(LD)),nlmconv) + @echo $(DL)input $(PRELUDE)$(DL) >> $@ + @echo $(DL)input $(@:.def=.o)$(DL) >> $@ +ifdef LDLIBS + @echo $(DL)input $(LDLIBS)$(DL) >> $@ +endif + @echo $(DL)output $(notdir $(@:.def=.nlm))$(DL) >> $@ +endif diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/README b/plugins/FTPFileYM/curl-7.29.0/docs/examples/README new file mode 100644 index 0000000000..270048a6c5 --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/README @@ -0,0 +1,80 @@ + _ _ ____ _ + ___| | | | _ \| | + / __| | | | |_) | | + | (__| |_| | _ <| |___ + \___|\___/|_| \_\_____| + +This directory is for libcurl programming examples. They are meant to show +some simple steps on how you can build your own application to take full +advantage of libcurl. + +If you end up with other small but still useful example sources, please mail +them for submission in future packages and on the web site. + +BUILDING + +The Makefile.example is an example makefile that could be used to build these +examples. Just edit the file according to your system and requirements first. + +Most examples should build fine using a command line like this: + + $ `curl-config --cc --cflags --libs` -o example example.c + +Some compilers don't like having the arguments in this order but instead +want you do reorganize them like: + + $ `curl-config --cc` -o example example.c `curl-config --cflags --libs` + +*PLEASE* do not use the curl.haxx.se site as a test target for your libcurl +applications/experiments. Even if some of the examples use that site as a URL +at some places, it doesn't mean that the URLs work or that we expect you to +actually torture our web site with your tests! Thanks. + +EXAMPLES + +anyauthput.c - HTTP PUT using "any" authentication method +cacertinmem.c - Use a built-in PEM certificate to retrieve a https page +cookie_interface.c - shows usage of simple cookie interface +curlgtk.c - download using a GTK progress bar +curlx.c - getting file info from the remote cert data +debug.c - showing how to use the debug callback +fileupload.c - uploading to a file:// URL +fopen.c - fopen() layer that supports opening URLs and files +ftpget.c - simple getting a file from FTP +ftpgetresp.c - get the response strings from the FTP server +ftpupload.c - upload a file to an FTP server +ftpuploadresume.c - resume an upload to an FTP server +getinfo.c - get the Content-Type from the recent transfer +getinmemory.c - download a file to memory only +ghiper.c - curl_multi_socket() using code with glib-2 +hiperfifo.c - downloads all URLs written to the fifo, using + curl_multi_socket() and libevent +htmltidy.c - download a document and use libtidy to parse the HTML +htmltitle.cc - download a HTML file and extract the <title> tag from a HTML + page using libxml +http-post.c - HTTP POST +httpput.c - HTTP PUT a local file +https.c - simple HTTPS transfer +imap.c - simple IMAP transfer +multi-app.c - a multi-interface app +multi-debugcallback.c - a multi-interface app using the debug callback +multi-double.c - a multi-interface app doing two simultaneous transfers +multi-post.c - a multi-interface app doing a multipart formpost +multi-single.c - a multi-interface app getting a single file +multithread.c - an example using multi-treading transferring multiple files +opensslthreadlock.c - show how to do locking when using OpenSSL multi-threaded +persistant.c - request two URLs with a persistent connection +pop3s.c - POP3S transfer +pop3slist.c - POP3S LIST +post-callback.c - send a HTTP POST using a callback +postit2.c - send a HTTP multipart formpost +sampleconv.c - showing how a program on a non-ASCII platform would invoke + callbacks to do its own codeset conversions instead of using + the built-in iconv functions in libcurl +sepheaders.c - download headers to a separate file +simple.c - the most simple download a URL source +simplepost.c - HTTP POST +simplessl.c - HTTPS example with certificates many options set +synctime.c - Sync local time by extracting date from remote HTTP servers +url2file.c - download a document and store it in a file +10-at-a-time.c - Download many files simultaneously, 10 at a time. diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/anyauthput.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/anyauthput.c new file mode 100644 index 0000000000..b89dca2e15 --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/anyauthput.c @@ -0,0 +1,185 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#include <stdio.h> +#include <fcntl.h> +#ifdef WIN32 +# include <io.h> +#else +# ifdef __VMS + typedef int intptr_t; +# endif +# if !defined(_AIX) && !defined(__sgi) && !defined(__osf__) +# include <stdint.h> +# endif +# include <unistd.h> +#endif +#include <sys/types.h> +#include <sys/stat.h> + +#ifdef _MSC_VER +# ifdef _WIN64 + typedef __int64 intptr_t; +# else + typedef int intptr_t; +# endif +#endif + +#include <curl/curl.h> + +#if LIBCURL_VERSION_NUM < 0x070c03 +#error "upgrade your libcurl to no less than 7.12.3" +#endif + +#ifndef TRUE +#define TRUE 1 +#endif + +#if defined(_AIX) || defined(__sgi) || defined(__osf__) +#ifndef intptr_t +#define intptr_t long +#endif +#endif + +/* + * This example shows a HTTP PUT operation with authentiction using "any" + * type. It PUTs a file given as a command line argument to the URL also given + * on the command line. + * + * Since libcurl 7.12.3, using "any" auth and POST/PUT requires a set ioctl + * function. + * + * This example also uses its own read callback. + */ + +/* ioctl callback function */ +static curlioerr my_ioctl(CURL *handle, curliocmd cmd, void *userp) +{ + intptr_t fd = (intptr_t)userp; + + (void)handle; /* not used in here */ + + switch(cmd) { + case CURLIOCMD_RESTARTREAD: + /* mr libcurl kindly asks as to rewind the read data stream to start */ + if(-1 == lseek(fd, 0, SEEK_SET)) + /* couldn't rewind */ + return CURLIOE_FAILRESTART; + + break; + + default: /* ignore unknown commands */ + return CURLIOE_UNKNOWNCMD; + } + return CURLIOE_OK; /* success! */ +} + +/* read callback function, fread() look alike */ +static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *stream) +{ + size_t retcode; + curl_off_t nread; + + intptr_t fd = (intptr_t)stream; + + retcode = read(fd, ptr, size * nmemb); + + nread = (curl_off_t)retcode; + + fprintf(stderr, "*** We read %" CURL_FORMAT_CURL_OFF_T + " bytes from file\n", nread); + + return retcode; +} + +int main(int argc, char **argv) +{ + CURL *curl; + CURLcode res; + intptr_t hd ; + struct stat file_info; + + char *file; + char *url; + + if(argc < 3) + return 1; + + file= argv[1]; + url = argv[2]; + + /* get the file size of the local file */ + hd = open(file, O_RDONLY) ; + fstat(hd, &file_info); + + /* In windows, this will init the winsock stuff */ + curl_global_init(CURL_GLOBAL_ALL); + + /* get a curl handle */ + curl = curl_easy_init(); + if(curl) { + /* we want to use our own read function */ + curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback); + + /* which file to upload */ + curl_easy_setopt(curl, CURLOPT_READDATA, (void*)hd); + + /* set the ioctl function */ + curl_easy_setopt(curl, CURLOPT_IOCTLFUNCTION, my_ioctl); + + /* pass the file descriptor to the ioctl callback as well */ + curl_easy_setopt(curl, CURLOPT_IOCTLDATA, (void*)hd); + + /* enable "uploading" (which means PUT when doing HTTP) */ + curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L) ; + + /* specify target URL, and note that this URL should also include a file + name, not only a directory (as you can do with GTP uploads) */ + curl_easy_setopt(curl,CURLOPT_URL, url); + + /* and give the size of the upload, this supports large file sizes + on systems that have general support for it */ + curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE, + (curl_off_t)file_info.st_size); + + /* tell libcurl we can use "any" auth, which lets the lib pick one, but it + also costs one extra round-trip and possibly sending of all the PUT + data twice!!! */ + curl_easy_setopt(curl, CURLOPT_HTTPAUTH, (long)CURLAUTH_ANY); + + /* set user name and password for the authentication */ + curl_easy_setopt(curl, CURLOPT_USERPWD, "user:password"); + + /* Now run off and do what you've been told! */ + res = curl_easy_perform(curl); + /* Check for errors */ + if(res != CURLE_OK) + fprintf(stderr, "curl_easy_perform() failed: %s\n", + curl_easy_strerror(res)); + + /* always cleanup */ + curl_easy_cleanup(curl); + } + close(hd); /* close the local file */ + + curl_global_cleanup(); + return 0; +} diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/asiohiper.cpp b/plugins/FTPFileYM/curl-7.29.0/docs/examples/asiohiper.cpp new file mode 100644 index 0000000000..44836fdc17 --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/asiohiper.cpp @@ -0,0 +1,454 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +/* + * file: asiohiper.cpp + * Example program to demonstrate the use of multi socket interface + * with boost::asio + * + * This program is in c++ and uses boost::asio instead of libevent/libev. + * Requires boost::asio, boost::bind and boost::system + * + * This is an adaptation of libcurl's "hiperfifo.c" and "evhiperfifo.c" + * sample programs. This example implements a subset of the functionality from + * hiperfifo.c, for full functionality refer hiperfifo.c or evhiperfifo.c + * + * Written by Lijo Antony based on hiperfifo.c by Jeff Pohlmeyer + * + * When running, the program creates an easy handle for a URL and + * uses the curl_multi API to fetch it. + * + * Note: + * For the sake of simplicity, URL is hard coded to "www.google.com" + * + * This is purely a demo app, all retrieved data is simply discarded by the write + * callback. + */ + + +#include <curl/curl.h> +#include <boost/asio.hpp> +#include <boost/bind.hpp> + +#define MSG_OUT stdout /* Send info to stdout, change to stderr if you want */ + +/* boost::asio related objects + * using global variables for simplicity + */ +boost::asio::io_service io_service; +boost::asio::deadline_timer timer(io_service); +std::map<curl_socket_t, boost::asio::ip::tcp::socket *> socket_map; + +/* Global information, common to all connections */ +typedef struct _GlobalInfo +{ + CURLM *multi; + int still_running; +} GlobalInfo; + +/* Information associated with a specific easy handle */ +typedef struct _ConnInfo +{ + CURL *easy; + char *url; + GlobalInfo *global; + char error[CURL_ERROR_SIZE]; +} ConnInfo; + +static void timer_cb(const boost::system::error_code & error, GlobalInfo *g); + +/* Update the event timer after curl_multi library calls */ +static int multi_timer_cb(CURLM *multi, long timeout_ms, GlobalInfo *g) +{ + fprintf(MSG_OUT, "\nmulti_timer_cb: timeout_ms %ld", timeout_ms); + + /* cancel running timer */ + timer.cancel(); + + if ( timeout_ms > 0 ) + { + /* update timer */ + timer.expires_from_now(boost::posix_time::millisec(timeout_ms)); + timer.async_wait(boost::bind(&timer_cb, _1, g)); + } + else + { + /* call timeout function immediately */ + boost::system::error_code error; /*success*/ + timer_cb(error, g); + } + + return 0; +} + +/* Die if we get a bad CURLMcode somewhere */ +static void mcode_or_die(const char *where, CURLMcode code) +{ + if ( CURLM_OK != code ) + { + const char *s; + switch ( code ) + { + case CURLM_CALL_MULTI_PERFORM: s="CURLM_CALL_MULTI_PERFORM"; break; + case CURLM_BAD_HANDLE: s="CURLM_BAD_HANDLE"; break; + case CURLM_BAD_EASY_HANDLE: s="CURLM_BAD_EASY_HANDLE"; break; + case CURLM_OUT_OF_MEMORY: s="CURLM_OUT_OF_MEMORY"; break; + case CURLM_INTERNAL_ERROR: s="CURLM_INTERNAL_ERROR"; break; + case CURLM_UNKNOWN_OPTION: s="CURLM_UNKNOWN_OPTION"; break; + case CURLM_LAST: s="CURLM_LAST"; break; + default: s="CURLM_unknown"; + break; + case CURLM_BAD_SOCKET: s="CURLM_BAD_SOCKET"; + fprintf(MSG_OUT, "\nERROR: %s returns %s", where, s); + /* ignore this error */ + return; + } + fprintf(MSG_OUT, "\nERROR: %s returns %s", where, s); + exit(code); + } +} + +/* Check for completed transfers, and remove their easy handles */ +static void check_multi_info(GlobalInfo *g) +{ + char *eff_url; + CURLMsg *msg; + int msgs_left; + ConnInfo *conn; + CURL *easy; + CURLcode res; + + fprintf(MSG_OUT, "\nREMAINING: %d", g->still_running); + + while ((msg = curl_multi_info_read(g->multi, &msgs_left))) + { + if (msg->msg == CURLMSG_DONE) + { + easy = msg->easy_handle; + res = msg->data.result; + curl_easy_getinfo(easy, CURLINFO_PRIVATE, &conn); + curl_easy_getinfo(easy, CURLINFO_EFFECTIVE_URL, &eff_url); + fprintf(MSG_OUT, "\nDONE: %s => (%d) %s", eff_url, res, conn->error); + curl_multi_remove_handle(g->multi, easy); + free(conn->url); + curl_easy_cleanup(easy); + free(conn); + } + } +} + +/* Called by asio when there is an action on a socket */ +static void event_cb(GlobalInfo * g, boost::asio::ip::tcp::socket * tcp_socket, int action) +{ + fprintf(MSG_OUT, "\nevent_cb: action=%d", action); + + CURLMcode rc; + rc = curl_multi_socket_action(g->multi, tcp_socket->native_handle(), action, &g->still_running); + + mcode_or_die("event_cb: curl_multi_socket_action", rc); + check_multi_info(g); + + if ( g->still_running <= 0 ) + { + fprintf(MSG_OUT, "\nlast transfer done, kill timeout"); + timer.cancel(); + } +} + +/* Called by asio when our timeout expires */ +static void timer_cb(const boost::system::error_code & error, GlobalInfo *g) +{ + if ( !error) + { + fprintf(MSG_OUT, "\ntimer_cb: "); + + CURLMcode rc; + rc = curl_multi_socket_action(g->multi, CURL_SOCKET_TIMEOUT, 0, &g->still_running); + + mcode_or_die("timer_cb: curl_multi_socket_action", rc); + check_multi_info(g); + } +} + +/* Clean up any data */ +static void remsock(int *f, GlobalInfo *g) +{ + fprintf(MSG_OUT, "\nremsock: "); + + if ( f ) + { + free(f); + } +} + +static void setsock(int *fdp, curl_socket_t s, CURL*e, int act, GlobalInfo*g) +{ + fprintf(MSG_OUT, "\nsetsock: socket=%d, act=%d, fdp=%p", s, act, fdp); + + std::map<curl_socket_t, boost::asio::ip::tcp::socket *>::iterator it = socket_map.find(s); + + if ( it == socket_map.end() ) + { + fprintf(MSG_OUT, "\nsocket %d is a c-ares socket, ignoring", s); + return; + } + + boost::asio::ip::tcp::socket * tcp_socket = it->second; + + *fdp = act; + + if ( act == CURL_POLL_IN ) + { + fprintf(MSG_OUT, "\nwatching for socket to become readable"); + + tcp_socket->async_read_some(boost::asio::null_buffers(), + boost::bind(&event_cb, g, + tcp_socket, + act)); + } + else if ( act == CURL_POLL_OUT ) + { + fprintf(MSG_OUT, "\nwatching for socket to become writable"); + + tcp_socket->async_write_some(boost::asio::null_buffers(), + boost::bind(&event_cb, g, + tcp_socket, + act)); + } + else if ( act == CURL_POLL_INOUT ) + { + fprintf(MSG_OUT, "\nwatching for socket to become readable & writable"); + + tcp_socket->async_read_some(boost::asio::null_buffers(), + boost::bind(&event_cb, g, + tcp_socket, + act)); + + tcp_socket->async_write_some(boost::asio::null_buffers(), + boost::bind(&event_cb, g, + tcp_socket, + act)); + } +} + + +static void addsock(curl_socket_t s, CURL *easy, int action, GlobalInfo *g) +{ + int *fdp = (int *)calloc(sizeof(int), 1); /* fdp is used to store current action */ + + setsock(fdp, s, easy, action, g); + curl_multi_assign(g->multi, s, fdp); +} + +/* CURLMOPT_SOCKETFUNCTION */ +static int sock_cb(CURL *e, curl_socket_t s, int what, void *cbp, void *sockp) +{ + fprintf(MSG_OUT, "\nsock_cb: socket=%d, what=%d, sockp=%p", s, what, sockp); + + GlobalInfo *g = (GlobalInfo*) cbp; + int *actionp = (int*) sockp; + const char *whatstr[]={ "none", "IN", "OUT", "INOUT", "REMOVE"}; + + fprintf(MSG_OUT, + "\nsocket callback: s=%d e=%p what=%s ", s, e, whatstr[what]); + + if ( what == CURL_POLL_REMOVE ) + { + fprintf(MSG_OUT, "\n"); + remsock(actionp, g); + } + else + { + if ( !actionp ) + { + fprintf(MSG_OUT, "\nAdding data: %s", whatstr[what]); + addsock(s, e, what, g); + } + else + { + fprintf(MSG_OUT, + "\nChanging action from %s to %s", + whatstr[*actionp], whatstr[what]); + setsock(actionp, s, e, what, g); + } + } + return 0; +} + + +/* CURLOPT_WRITEFUNCTION */ +static size_t write_cb(void *ptr, size_t size, size_t nmemb, void *data) +{ + + size_t written = size * nmemb; + char* pBuffer = (char*)malloc(written + 1); + + strncpy(pBuffer, (const char *)ptr, written); + pBuffer [written] = '\0'; + + fprintf(MSG_OUT, "%s", pBuffer); + + free(pBuffer); + + return written; +} + + +/* CURLOPT_PROGRESSFUNCTION */ +static int prog_cb (void *p, double dltotal, double dlnow, double ult, + double uln) +{ + ConnInfo *conn = (ConnInfo *)p; + (void)ult; + (void)uln; + + fprintf(MSG_OUT, "\nProgress: %s (%g/%g)", conn->url, dlnow, dltotal); + fprintf(MSG_OUT, "\nProgress: %s (%g)", conn->url, ult); + + return 0; +} + +/* CURLOPT_OPENSOCKETFUNCTION */ +static curl_socket_t opensocket(void *clientp, + curlsocktype purpose, + struct curl_sockaddr *address) +{ + fprintf(MSG_OUT, "\nopensocket :"); + + curl_socket_t sockfd = CURL_SOCKET_BAD; + + /* restrict to ipv4 */ + if (purpose == CURLSOCKTYPE_IPCXN && address->family == AF_INET) + { + /* create a tcp socket object */ + boost::asio::ip::tcp::socket *tcp_socket = new boost::asio::ip::tcp::socket(io_service); + + /* open it and get the native handle*/ + boost::system::error_code ec; + tcp_socket->open(boost::asio::ip::tcp::v4(), ec); + + if (ec) + { + //An error occurred + std::cout << std::endl << "Couldn't open socket [" << ec << "][" << ec.message() << "]"; + fprintf(MSG_OUT, "\nERROR: Returning CURL_SOCKET_BAD to signal error"); + } + else + { + sockfd = tcp_socket->native_handle(); + fprintf(MSG_OUT, "\nOpened socket %d", sockfd); + + /* save it for monitoring */ + socket_map.insert(std::pair<curl_socket_t, boost::asio::ip::tcp::socket *>(sockfd, tcp_socket)); + } + } + + return sockfd; +} + +/* CURLOPT_CLOSESOCKETFUNCTION */ +static int closesocket(void *clientp, curl_socket_t item) +{ + fprintf(MSG_OUT, "\nclosesocket : %d", item); + + std::map<curl_socket_t, boost::asio::ip::tcp::socket *>::iterator it = socket_map.find(item); + + if ( it != socket_map.end() ) + { + delete it->second; + socket_map.erase(it); + } + + return 0; +} + +/* Create a new easy handle, and add it to the global curl_multi */ +static void new_conn(char *url, GlobalInfo *g ) +{ + ConnInfo *conn; + CURLMcode rc; + + conn = (ConnInfo *)calloc(1, sizeof(ConnInfo)); + memset(conn, 0, sizeof(ConnInfo)); + conn->error[0]='\0'; + + conn->easy = curl_easy_init(); + + if ( !conn->easy ) + { + fprintf(MSG_OUT, "\ncurl_easy_init() failed, exiting!"); + exit(2); + } + conn->global = g; + conn->url = strdup(url); + curl_easy_setopt(conn->easy, CURLOPT_URL, conn->url); + curl_easy_setopt(conn->easy, CURLOPT_WRITEFUNCTION, write_cb); + curl_easy_setopt(conn->easy, CURLOPT_WRITEDATA, &conn); + curl_easy_setopt(conn->easy, CURLOPT_VERBOSE, 1L); + curl_easy_setopt(conn->easy, CURLOPT_ERRORBUFFER, conn->error); + curl_easy_setopt(conn->easy, CURLOPT_PRIVATE, conn); + curl_easy_setopt(conn->easy, CURLOPT_NOPROGRESS, 1L); + curl_easy_setopt(conn->easy, CURLOPT_PROGRESSFUNCTION, prog_cb); + curl_easy_setopt(conn->easy, CURLOPT_PROGRESSDATA, conn); + curl_easy_setopt(conn->easy, CURLOPT_LOW_SPEED_TIME, 3L); + curl_easy_setopt(conn->easy, CURLOPT_LOW_SPEED_LIMIT, 10L); + + /* call this function to get a socket */ + curl_easy_setopt(conn->easy, CURLOPT_OPENSOCKETFUNCTION, opensocket); + + /* call this function to close a socket */ + curl_easy_setopt(conn->easy, CURLOPT_CLOSESOCKETFUNCTION, closesocket); + + fprintf(MSG_OUT, + "\nAdding easy %p to multi %p (%s)", conn->easy, g->multi, url); + rc = curl_multi_add_handle(g->multi, conn->easy); + mcode_or_die("new_conn: curl_multi_add_handle", rc); + + /* note that the add_handle() will set a time-out to trigger very soon so + that the necessary socket_action() call will be called by this app */ +} + +int main(int argc, char **argv) +{ + GlobalInfo g; + CURLMcode rc; + (void)argc; + (void)argv; + + memset(&g, 0, sizeof(GlobalInfo)); + g.multi = curl_multi_init(); + + curl_multi_setopt(g.multi, CURLMOPT_SOCKETFUNCTION, sock_cb); + curl_multi_setopt(g.multi, CURLMOPT_SOCKETDATA, &g); + curl_multi_setopt(g.multi, CURLMOPT_TIMERFUNCTION, multi_timer_cb); + curl_multi_setopt(g.multi, CURLMOPT_TIMERDATA, &g); + + new_conn((char *)"www.google.com", &g); /* add a URL */ + + /* enter io_service run loop */ + io_service.run(); + + curl_multi_cleanup(g.multi); + + fprintf(MSG_OUT, "\ndone.\n"); + return 0; +} diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/cacertinmem.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/cacertinmem.c new file mode 100644 index 0000000000..051afbca9b --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/cacertinmem.c @@ -0,0 +1,151 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +/* Example using a "in core" PEM certificate to retrieve a https page. + * Written by Theo Borm + */ + +/* on a netBSD system with OPENSSL& LIBCURL installed from + * pkgsrc (using default paths) this program can be compiled using: + * gcc -I/usr/pkg/include -L/usr/pkg/lib -lcurl -Wl,-R/usr/pkg/lib -lssl + * -lcrypto -lz -o curlcacerttest curlcacerttest.c + * on other operating systems you may want to change paths to headers + * and libraries +*/ +#include <openssl/ssl.h> +#include <curl/curl.h> +#include <stdio.h> + +size_t writefunction( void *ptr, size_t size, size_t nmemb, void *stream) +{ + fwrite(ptr,size,nmemb,stream); + return(nmemb*size); +} + +static CURLcode sslctx_function(CURL * curl, void * sslctx, void * parm) +{ + X509_STORE * store; + X509 * cert=NULL; + BIO * bio; + char * mypem = /* www.cacert.org */ + "-----BEGIN CERTIFICATE-----\n"\ + "MIIHPTCCBSWgAwIBAgIBADANBgkqhkiG9w0BAQQFADB5MRAwDgYDVQQKEwdSb290\n"\ + "IENBMR4wHAYDVQQLExVodHRwOi8vd3d3LmNhY2VydC5vcmcxIjAgBgNVBAMTGUNB\n"\ + "IENlcnQgU2lnbmluZyBBdXRob3JpdHkxITAfBgkqhkiG9w0BCQEWEnN1cHBvcnRA\n"\ + "Y2FjZXJ0Lm9yZzAeFw0wMzAzMzAxMjI5NDlaFw0zMzAzMjkxMjI5NDlaMHkxEDAO\n"\ + "BgNVBAoTB1Jvb3QgQ0ExHjAcBgNVBAsTFWh0dHA6Ly93d3cuY2FjZXJ0Lm9yZzEi\n"\ + "MCAGA1UEAxMZQ0EgQ2VydCBTaWduaW5nIEF1dGhvcml0eTEhMB8GCSqGSIb3DQEJ\n"\ + "ARYSc3VwcG9ydEBjYWNlcnQub3JnMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIIC\n"\ + "CgKCAgEAziLA4kZ97DYoB1CW8qAzQIxL8TtmPzHlawI229Z89vGIj053NgVBlfkJ\n"\ + "8BLPRoZzYLdufujAWGSuzbCtRRcMY/pnCujW0r8+55jE8Ez64AO7NV1sId6eINm6\n"\ + "zWYyN3L69wj1x81YyY7nDl7qPv4coRQKFWyGhFtkZip6qUtTefWIonvuLwphK42y\n"\ + "fk1WpRPs6tqSnqxEQR5YYGUFZvjARL3LlPdCfgv3ZWiYUQXw8wWRBB0bF4LsyFe7\n"\ + "w2t6iPGwcswlWyCR7BYCEo8y6RcYSNDHBS4CMEK4JZwFaz+qOqfrU0j36NK2B5jc\n"\ + "G8Y0f3/JHIJ6BVgrCFvzOKKrF11myZjXnhCLotLddJr3cQxyYN/Nb5gznZY0dj4k\n"\ + "epKwDpUeb+agRThHqtdB7Uq3EvbXG4OKDy7YCbZZ16oE/9KTfWgu3YtLq1i6L43q\n"\ + "laegw1SJpfvbi1EinbLDvhG+LJGGi5Z4rSDTii8aP8bQUWWHIbEZAWV/RRyH9XzQ\n"\ + "QUxPKZgh/TMfdQwEUfoZd9vUFBzugcMd9Zi3aQaRIt0AUMyBMawSB3s42mhb5ivU\n"\ + "fslfrejrckzzAeVLIL+aplfKkQABi6F1ITe1Yw1nPkZPcCBnzsXWWdsC4PDSy826\n"\ + "YreQQejdIOQpvGQpQsgi3Hia/0PsmBsJUUtaWsJx8cTLc6nloQsCAwEAAaOCAc4w\n"\ + "ggHKMB0GA1UdDgQWBBQWtTIb1Mfz4OaO873SsDrusjkY0TCBowYDVR0jBIGbMIGY\n"\ + "gBQWtTIb1Mfz4OaO873SsDrusjkY0aF9pHsweTEQMA4GA1UEChMHUm9vdCBDQTEe\n"\ + "MBwGA1UECxMVaHR0cDovL3d3dy5jYWNlcnQub3JnMSIwIAYDVQQDExlDQSBDZXJ0\n"\ + "IFNpZ25pbmcgQXV0aG9yaXR5MSEwHwYJKoZIhvcNAQkBFhJzdXBwb3J0QGNhY2Vy\n"\ + "dC5vcmeCAQAwDwYDVR0TAQH/BAUwAwEB/zAyBgNVHR8EKzApMCegJaAjhiFodHRw\n"\ + "czovL3d3dy5jYWNlcnQub3JnL3Jldm9rZS5jcmwwMAYJYIZIAYb4QgEEBCMWIWh0\n"\ + "dHBzOi8vd3d3LmNhY2VydC5vcmcvcmV2b2tlLmNybDA0BglghkgBhvhCAQgEJxYl\n"\ + "aHR0cDovL3d3dy5jYWNlcnQub3JnL2luZGV4LnBocD9pZD0xMDBWBglghkgBhvhC\n"\ + "AQ0ESRZHVG8gZ2V0IHlvdXIgb3duIGNlcnRpZmljYXRlIGZvciBGUkVFIGhlYWQg\n"\ + "b3ZlciB0byBodHRwOi8vd3d3LmNhY2VydC5vcmcwDQYJKoZIhvcNAQEEBQADggIB\n"\ + "ACjH7pyCArpcgBLKNQodgW+JapnM8mgPf6fhjViVPr3yBsOQWqy1YPaZQwGjiHCc\n"\ + "nWKdpIevZ1gNMDY75q1I08t0AoZxPuIrA2jxNGJARjtT6ij0rPtmlVOKTV39O9lg\n"\ + "18p5aTuxZZKmxoGCXJzN600BiqXfEVWqFcofN8CCmHBh22p8lqOOLlQ+TyGpkO/c\n"\ + "gr/c6EWtTZBzCDyUZbAEmXZ/4rzCahWqlwQ3JNgelE5tDlG+1sSPypZt90Pf6DBl\n"\ + "Jzt7u0NDY8RD97LsaMzhGY4i+5jhe1o+ATc7iwiwovOVThrLm82asduycPAtStvY\n"\ + "sONvRUgzEv/+PDIqVPfE94rwiCPCR/5kenHA0R6mY7AHfqQv0wGP3J8rtsYIqQ+T\n"\ + "SCX8Ev2fQtzzxD72V7DX3WnRBnc0CkvSyqD/HMaMyRa+xMwyN2hzXwj7UfdJUzYF\n"\ + "CpUCTPJ5GhD22Dp1nPMd8aINcGeGG7MW9S/lpOt5hvk9C8JzC6WZrG/8Z7jlLwum\n"\ + "GCSNe9FINSkYQKyTYOGWhlC0elnYjyELn8+CkcY7v2vcB5G5l1YjqrZslMZIBjzk\n"\ + "zk6q5PYvCdxTby78dOs6Y5nCpqyJvKeyRKANihDjbPIky/qbn3BHLt4Ui9SyIAmW\n"\ + "omTxJBzcoTWcFbLUvFUufQb1nA5V9FrWk9p2rSVzTMVD\n"\ + "-----END CERTIFICATE-----\n"; + /* get a BIO */ + bio=BIO_new_mem_buf(mypem, -1); + /* use it to read the PEM formatted certificate from memory into an X509 + * structure that SSL can use + */ + PEM_read_bio_X509(bio, &cert, 0, NULL); + if (cert == NULL) + printf("PEM_read_bio_X509 failed...\n"); + + /* get a pointer to the X509 certificate store (which may be empty!) */ + store=SSL_CTX_get_cert_store((SSL_CTX *)sslctx); + + /* add our certificate to this store */ + if (X509_STORE_add_cert(store, cert)==0) + printf("error adding certificate\n"); + + /* all set to go */ + return CURLE_OK ; +} + +int main(void) +{ + CURL * ch; + CURLcode rv; + + rv=curl_global_init(CURL_GLOBAL_ALL); + ch=curl_easy_init(); + rv=curl_easy_setopt(ch,CURLOPT_VERBOSE, 0L); + rv=curl_easy_setopt(ch,CURLOPT_HEADER, 0L); + rv=curl_easy_setopt(ch,CURLOPT_NOPROGRESS, 1L); + rv=curl_easy_setopt(ch,CURLOPT_NOSIGNAL, 1L); + rv=curl_easy_setopt(ch,CURLOPT_WRITEFUNCTION, *writefunction); + rv=curl_easy_setopt(ch,CURLOPT_WRITEDATA, stdout); + rv=curl_easy_setopt(ch,CURLOPT_HEADERFUNCTION, *writefunction); + rv=curl_easy_setopt(ch,CURLOPT_WRITEHEADER, stderr); + rv=curl_easy_setopt(ch,CURLOPT_SSLCERTTYPE,"PEM"); + rv=curl_easy_setopt(ch,CURLOPT_SSL_VERIFYPEER,1L); + rv=curl_easy_setopt(ch, CURLOPT_URL, "https://www.example.com/"); + + /* first try: retrieve page without cacerts' certificate -> will fail + */ + rv=curl_easy_perform(ch); + if (rv==CURLE_OK) + printf("*** transfer succeeded ***\n"); + else + printf("*** transfer failed ***\n"); + + /* second try: retrieve page using cacerts' certificate -> will succeed + * load the certificate by installing a function doing the nescessary + * "modifications" to the SSL CONTEXT just before link init + */ + rv=curl_easy_setopt(ch,CURLOPT_SSL_CTX_FUNCTION, *sslctx_function); + rv=curl_easy_perform(ch); + if (rv==CURLE_OK) + printf("*** transfer succeeded ***\n"); + else + printf("*** transfer failed ***\n"); + + curl_easy_cleanup(ch); + curl_global_cleanup(); + return rv; +} diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/certinfo.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/certinfo.c new file mode 100644 index 0000000000..ac0109b071 --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/certinfo.c @@ -0,0 +1,86 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#include <stdio.h> + +#include <curl/curl.h> + +static size_t wrfu(void *ptr, size_t size, size_t nmemb, void *stream) +{ + (void)stream; + (void)ptr; + return size * nmemb; +} + +int main(void) +{ + CURL *curl; + CURLcode res; + + curl_global_init(CURL_GLOBAL_DEFAULT); + + curl = curl_easy_init(); + if(curl) { + curl_easy_setopt(curl, CURLOPT_URL, "https://www.example.com/"); + + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, wrfu); + + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L); + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L); + + curl_easy_setopt(curl, CURLOPT_VERBOSE, 0L); + curl_easy_setopt(curl, CURLOPT_CERTINFO, 1L); + + res = curl_easy_perform(curl); + + if(!res) { + union { + struct curl_slist *to_info; + struct curl_certinfo *to_certinfo; + } ptr; + + ptr.to_info = NULL; + + res = curl_easy_getinfo(curl, CURLINFO_CERTINFO, &ptr.to_info); + + if(!res && ptr.to_info) { + int i; + + printf("%d certs!\n", ptr.to_certinfo->num_of_certs); + + for(i = 0; i < ptr.to_certinfo->num_of_certs; i++) { + struct curl_slist *slist; + + for(slist = ptr.to_certinfo->certinfo[i]; slist; slist = slist->next) + printf("%s\n", slist->data); + + } + } + + } + + curl_easy_cleanup(curl); + } + + curl_global_cleanup(); + + return 0; +} diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/chkspeed.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/chkspeed.c new file mode 100644 index 0000000000..b5c397ab74 --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/chkspeed.c @@ -0,0 +1,176 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +/* Example source code to show how the callback function can be used to + * download data into a chunk of memory instead of storing it in a file. + * After successful download we use curl_easy_getinfo() calls to get the + * amount of downloaded bytes, the time used for the whole download, and + * the average download speed. + * On Linux you can create the download test files with: + * dd if=/dev/urandom of=file_1M.bin bs=1M count=1 + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <time.h> + +#include <curl/curl.h> + +#define URL_BASE "http://speedtest.your.domain/" +#define URL_1M URL_BASE "file_1M.bin" +#define URL_2M URL_BASE "file_2M.bin" +#define URL_5M URL_BASE "file_5M.bin" +#define URL_10M URL_BASE "file_10M.bin" +#define URL_20M URL_BASE "file_20M.bin" +#define URL_50M URL_BASE "file_50M.bin" +#define URL_100M URL_BASE "file_100M.bin" + +#define CHKSPEED_VERSION "1.0" + +static size_t WriteCallback(void *ptr, size_t size, size_t nmemb, void *data) +{ + /* we are not interested in the downloaded bytes itself, + so we only return the size we would have saved ... */ + (void)ptr; /* unused */ + (void)data; /* unused */ + return (size_t)(size * nmemb); +} + +int main(int argc, char *argv[]) +{ + CURL *curl_handle; + CURLcode res; + int prtsep = 0, prttime = 0; + const char *url = URL_1M; + char *appname = argv[0]; + + if (argc > 1) { + /* parse input parameters */ + for (argc--, argv++; *argv; argc--, argv++) { + if (strncasecmp(*argv, "-", 1) == 0) { + if (strncasecmp(*argv, "-H", 2) == 0) { + fprintf(stderr, + "\rUsage: %s [-m=1|2|5|10|20|50|100] [-t] [-x] [url]\n", + appname); + exit(1); + } else if (strncasecmp(*argv, "-V", 2) == 0) { + fprintf(stderr, "\r%s %s - %s\n", + appname, CHKSPEED_VERSION, curl_version()); + exit(1); + } else if (strncasecmp(*argv, "-X", 2) == 0) { + prtsep = 1; + } else if (strncasecmp(*argv, "-T", 2) == 0) { + prttime = 1; + } else if (strncasecmp(*argv, "-M=", 3) == 0) { + long m = strtol((*argv)+3, NULL, 10); + switch(m) { + case 1: url = URL_1M; + break; + case 2: url = URL_2M; + break; + case 5: url = URL_5M; + break; + case 10: url = URL_10M; + break; + case 20: url = URL_20M; + break; + case 50: url = URL_50M; + break; + case 100: url = URL_100M; + break; + default: fprintf(stderr, "\r%s: invalid parameter %s\n", + appname, *argv + 3); + exit(1); + } + } else { + fprintf(stderr, "\r%s: invalid or unknown option %s\n", + appname, *argv); + exit(1); + } + } else { + url = *argv; + } + } + } + + /* print separator line */ + if (prtsep) { + printf("-------------------------------------------------\n"); + } + /* print localtime */ + if (prttime) { + time_t t = time(NULL); + printf("Localtime: %s", ctime(&t)); + } + + /* init libcurl */ + curl_global_init(CURL_GLOBAL_ALL); + + /* init the curl session */ + curl_handle = curl_easy_init(); + + /* specify URL to get */ + curl_easy_setopt(curl_handle, CURLOPT_URL, url); + + /* send all data to this function */ + curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, WriteCallback); + + /* some servers don't like requests that are made without a user-agent + field, so we provide one */ + curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, + "libcurl-speedchecker/" CHKSPEED_VERSION); + + /* get it! */ + res = curl_easy_perform(curl_handle); + + if(CURLE_OK == res) { + double val; + + /* check for bytes downloaded */ + res = curl_easy_getinfo(curl_handle, CURLINFO_SIZE_DOWNLOAD, &val); + if((CURLE_OK == res) && (val>0)) + printf("Data downloaded: %0.0f bytes.\n", val); + + /* check for total download time */ + res = curl_easy_getinfo(curl_handle, CURLINFO_TOTAL_TIME, &val); + if((CURLE_OK == res) && (val>0)) + printf("Total download time: %0.3f sec.\n", val); + + /* check for average download speed */ + res = curl_easy_getinfo(curl_handle, CURLINFO_SPEED_DOWNLOAD, &val); + if((CURLE_OK == res) && (val>0)) + printf("Average download speed: %0.3f kbyte/sec.\n", val / 1024); + + } else { + fprintf(stderr, "Error while fetching '%s' : %s\n", + url, curl_easy_strerror(res)); + } + + /* cleanup curl stuff */ + curl_easy_cleanup(curl_handle); + + /* we're done with libcurl, so clean it up */ + curl_global_cleanup(); + + return 0; +} diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/cookie_interface.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/cookie_interface.c new file mode 100644 index 0000000000..2e7c66db2c --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/cookie_interface.c @@ -0,0 +1,124 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +/* This example shows usage of simple cookie interface. */ + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <errno.h> +#include <time.h> + +#include <curl/curl.h> + +static void +print_cookies(CURL *curl) +{ + CURLcode res; + struct curl_slist *cookies; + struct curl_slist *nc; + int i; + + printf("Cookies, curl knows:\n"); + res = curl_easy_getinfo(curl, CURLINFO_COOKIELIST, &cookies); + if (res != CURLE_OK) { + fprintf(stderr, "Curl curl_easy_getinfo failed: %s\n", curl_easy_strerror(res)); + exit(1); + } + nc = cookies, i = 1; + while (nc) { + printf("[%d]: %s\n", i, nc->data); + nc = nc->next; + i++; + } + if (i == 1) { + printf("(none)\n"); + } + curl_slist_free_all(cookies); +} + +int +main(void) +{ + CURL *curl; + CURLcode res; + + curl_global_init(CURL_GLOBAL_ALL); + curl = curl_easy_init(); + if (curl) { + char nline[256]; + + curl_easy_setopt(curl, CURLOPT_URL, "http://www.example.com/"); + curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); + curl_easy_setopt(curl, CURLOPT_COOKIEFILE, ""); /* just to start the cookie engine */ + res = curl_easy_perform(curl); + if (res != CURLE_OK) { + fprintf(stderr, "Curl perform failed: %s\n", curl_easy_strerror(res)); + return 1; + } + + print_cookies(curl); + + printf("Erasing curl's knowledge of cookies!\n"); + curl_easy_setopt(curl, CURLOPT_COOKIELIST, "ALL"); + + print_cookies(curl); + + printf("-----------------------------------------------\n" + "Setting a cookie \"PREF\" via cookie interface:\n"); +#ifdef WIN32 +#define snprintf _snprintf +#endif + /* Netscape format cookie */ + snprintf(nline, sizeof(nline), "%s\t%s\t%s\t%s\t%lu\t%s\t%s", + ".google.com", "TRUE", "/", "FALSE", (unsigned long)time(NULL) + 31337UL, "PREF", "hello google, i like you very much!"); + res = curl_easy_setopt(curl, CURLOPT_COOKIELIST, nline); + if (res != CURLE_OK) { + fprintf(stderr, "Curl curl_easy_setopt failed: %s\n", curl_easy_strerror(res)); + return 1; + } + + /* HTTP-header style cookie */ + snprintf(nline, sizeof(nline), + "Set-Cookie: OLD_PREF=3d141414bf4209321; " + "expires=Sun, 17-Jan-2038 19:14:07 GMT; path=/; domain=.google.com"); + res = curl_easy_setopt(curl, CURLOPT_COOKIELIST, nline); + if (res != CURLE_OK) { + fprintf(stderr, "Curl curl_easy_setopt failed: %s\n", curl_easy_strerror(res)); + return 1; + } + + print_cookies(curl); + + res = curl_easy_perform(curl); + if (res != CURLE_OK) { + fprintf(stderr, "Curl perform failed: %s\n", curl_easy_strerror(res)); + return 1; + } + } + else { + fprintf(stderr, "Curl init failed!\n"); + return 1; + } + + curl_global_cleanup(); + return 0; +} diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/curlgtk.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/curlgtk.c new file mode 100644 index 0000000000..8cb9914c60 --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/curlgtk.c @@ -0,0 +1,106 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + */ +/* Copyright (c) 2000 David Odin (aka DindinX) for MandrakeSoft */ +/* an attempt to use the curl library in concert with a gtk-threaded application */ + +#include <stdio.h> +#include <gtk/gtk.h> + +#include <curl/curl.h> + +GtkWidget *Bar; + +size_t my_write_func(void *ptr, size_t size, size_t nmemb, FILE *stream) +{ + return fwrite(ptr, size, nmemb, stream); +} + +size_t my_read_func(void *ptr, size_t size, size_t nmemb, FILE *stream) +{ + return fread(ptr, size, nmemb, stream); +} + +int my_progress_func(GtkWidget *bar, + double t, /* dltotal */ + double d, /* dlnow */ + double ultotal, + double ulnow) +{ +/* printf("%d / %d (%g %%)\n", d, t, d*100.0/t);*/ + gdk_threads_enter(); + gtk_progress_set_value(GTK_PROGRESS(bar), d*100.0/t); + gdk_threads_leave(); + return 0; +} + +void *my_thread(void *ptr) +{ + CURL *curl; + CURLcode res; + FILE *outfile; + gchar *url = ptr; + + curl = curl_easy_init(); + if(curl) + { + outfile = fopen("test.curl", "w"); + + curl_easy_setopt(curl, CURLOPT_URL, url); + curl_easy_setopt(curl, CURLOPT_WRITEDATA, outfile); + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, my_write_func); + curl_easy_setopt(curl, CURLOPT_READFUNCTION, my_read_func); + curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0L); + curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, my_progress_func); + curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, Bar); + + res = curl_easy_perform(curl); + + fclose(outfile); + /* always cleanup */ + curl_easy_cleanup(curl); + } + + return NULL; +} + +int main(int argc, char **argv) +{ + GtkWidget *Window, *Frame, *Frame2; + GtkAdjustment *adj; + + /* Must initialize libcurl before any threads are started */ + curl_global_init(CURL_GLOBAL_ALL); + + /* Init thread */ + g_thread_init(NULL); + + gtk_init(&argc, &argv); + Window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + Frame = gtk_frame_new(NULL); + gtk_frame_set_shadow_type(GTK_FRAME(Frame), GTK_SHADOW_OUT); + gtk_container_add(GTK_CONTAINER(Window), Frame); + Frame2 = gtk_frame_new(NULL); + gtk_frame_set_shadow_type(GTK_FRAME(Frame2), GTK_SHADOW_IN); + gtk_container_add(GTK_CONTAINER(Frame), Frame2); + gtk_container_set_border_width(GTK_CONTAINER(Frame2), 5); + adj = (GtkAdjustment*)gtk_adjustment_new(0, 0, 100, 0, 0, 0); + Bar = gtk_progress_bar_new_with_adjustment(adj); + gtk_container_add(GTK_CONTAINER(Frame2), Bar); + gtk_widget_show_all(Window); + + if (!g_thread_create(&my_thread, argv[1], FALSE, NULL) != 0) + g_warning("can't create the thread"); + + + gdk_threads_enter(); + gtk_main(); + gdk_threads_leave(); + return 0; +} + diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/curlx.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/curlx.c new file mode 100644 index 0000000000..89d5f407b9 --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/curlx.c @@ -0,0 +1,513 @@ +/* + curlx.c Authors: Peter Sylvester, Jean-Paul Merlin + + This is a little program to demonstrate the usage of + + - an ssl initialisation callback setting a user key and trustbases + coming from a pkcs12 file + - using an ssl application callback to find a URI in the + certificate presented during ssl session establishment. + +*/ + + +/* + * Copyright (c) 2003 The OpenEvidence Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, the following disclaimer, + * and the original OpenSSL and SSLeay Licences below. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, the following disclaimer + * and the original OpenSSL and SSLeay Licences below in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgments: + * "This product includes software developed by the Openevidence Project + * for use in the OpenEvidence Toolkit. (http://www.openevidence.org/)" + * This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com)." + * + * 4. The names "OpenEvidence Toolkit" and "OpenEvidence Project" must not be + * used to endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openevidence-core@openevidence.org. + * + * 5. Products derived from this software may not be called "OpenEvidence" + * nor may "OpenEvidence" appear in their names without prior written + * permission of the OpenEvidence Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgments: + * "This product includes software developed by the OpenEvidence Project + * for use in the OpenEvidence Toolkit (http://www.openevidence.org/) + * This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com)." + * + * THIS SOFTWARE IS PROVIDED BY THE OpenEvidence PROJECT ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenEvidence PROJECT OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * ==================================================================== + * + * This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/) + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <curl/curl.h> +#include <openssl/x509v3.h> +#include <openssl/x509_vfy.h> +#include <openssl/crypto.h> +#include <openssl/lhash.h> +#include <openssl/objects.h> +#include <openssl/err.h> +#include <openssl/evp.h> +#include <openssl/x509.h> +#include <openssl/pkcs12.h> +#include <openssl/bio.h> +#include <openssl/ssl.h> + +static const char *curlx_usage[]={ + "usage: curlx args\n", + " -p12 arg - tia file ", + " -envpass arg - environement variable which content the tia private key password", + " -out arg - output file (response)- default stdout", + " -in arg - input file (request)- default stdin", + " -connect arg - URL of the server for the connection ex: www.openevidence.org", + " -mimetype arg - MIME type for data in ex : application/timestamp-query or application/dvcs -default application/timestamp-query", + " -acceptmime arg - MIME type acceptable for the response ex : application/timestamp-response or application/dvcs -default none", + " -accesstype arg - an Object identifier in an AIA/SIA method, e.g. AD_DVCS or ad_timestamping", + NULL +}; + +/* + +./curlx -p12 psy.p12 -envpass XX -in request -verbose -accesstype AD_DVCS +-mimetype application/dvcs -acceptmime application/dvcs -out response + +*/ + +/* + * We use this ZERO_NULL to avoid picky compiler warnings, + * when assigning a NULL pointer to a function pointer var. + */ + +#define ZERO_NULL 0 + +/* This is a context that we pass to all callbacks */ + +typedef struct sslctxparm_st { + unsigned char * p12file ; + const char * pst ; + PKCS12 * p12 ; + EVP_PKEY * pkey ; + X509 * usercert ; + STACK_OF(X509) * ca ; + CURL * curl; + BIO * errorbio; + int accesstype ; + int verbose; + +} sslctxparm; + +/* some helper function. */ + +static char *i2s_ASN1_IA5STRING( ASN1_IA5STRING *ia5) +{ + char *tmp; + if(!ia5 || !ia5->length) + return NULL; + tmp = OPENSSL_malloc(ia5->length + 1); + memcpy(tmp, ia5->data, ia5->length); + tmp[ia5->length] = 0; + return tmp; +} + +/* A conveniance routine to get an access URI. */ + +static unsigned char *my_get_ext(X509 * cert, const int type, int extensiontype) { + + int i; + STACK_OF(ACCESS_DESCRIPTION) * accessinfo ; + accessinfo = X509_get_ext_d2i(cert, extensiontype, NULL, NULL) ; + + if (!sk_ACCESS_DESCRIPTION_num(accessinfo)) + return NULL; + for (i = 0; i < sk_ACCESS_DESCRIPTION_num(accessinfo); i++) { + ACCESS_DESCRIPTION * ad = sk_ACCESS_DESCRIPTION_value(accessinfo, i); + if (OBJ_obj2nid(ad->method) == type) { + if (ad->location->type == GEN_URI) { + return i2s_ASN1_IA5STRING(ad->location->d.ia5); + } + return NULL; + } + } + return NULL; +} + +/* This is an application verification call back, it does not + perform any addition verification but tries to find a URL + in the presented certificat. If found, this will become + the URL to be used in the POST. +*/ + +static int ssl_app_verify_callback(X509_STORE_CTX *ctx, void *arg) +{ + sslctxparm * p = (sslctxparm *) arg; + int ok; + + if (p->verbose > 2) + BIO_printf(p->errorbio,"entering ssl_app_verify_callback\n"); + + if ((ok= X509_verify_cert(ctx)) && ctx->cert) { + unsigned char * accessinfo ; + if (p->verbose > 1) + X509_print_ex(p->errorbio,ctx->cert,0,0); + + if (accessinfo = my_get_ext(ctx->cert,p->accesstype ,NID_sinfo_access)) { + if (p->verbose) + BIO_printf(p->errorbio,"Setting URL from SIA to: %s\n", accessinfo); + + curl_easy_setopt(p->curl, CURLOPT_URL,accessinfo); + } + else if (accessinfo = my_get_ext(ctx->cert,p->accesstype, + NID_info_access)) { + if (p->verbose) + BIO_printf(p->errorbio,"Setting URL from AIA to: %s\n", accessinfo); + + curl_easy_setopt(p->curl, CURLOPT_URL,accessinfo); + } + } + if (p->verbose > 2) + BIO_printf(p->errorbio,"leaving ssl_app_verify_callback with %d\n", ok); + return(ok); +} + + +/* This is an example of an curl SSL initialisation call back. The callback sets: + - a private key and certificate + - a trusted ca certificate + - a preferred cipherlist + - an application verification callback (the function above) +*/ + +static CURLcode sslctxfun(CURL * curl, void * sslctx, void * parm) { + + sslctxparm * p = (sslctxparm *) parm; + SSL_CTX * ctx = (SSL_CTX *) sslctx ; + + if (!SSL_CTX_use_certificate(ctx,p->usercert)) { + BIO_printf(p->errorbio, "SSL_CTX_use_certificate problem\n"); goto err; + } + if (!SSL_CTX_use_PrivateKey(ctx,p->pkey)) { + BIO_printf(p->errorbio, "SSL_CTX_use_PrivateKey\n"); goto err; + } + + if (!SSL_CTX_check_private_key(ctx)) { + BIO_printf(p->errorbio, "SSL_CTX_check_private_key\n"); goto err; + } + + SSL_CTX_set_quiet_shutdown(ctx,1); + SSL_CTX_set_cipher_list(ctx,"RC4-MD5"); + SSL_CTX_set_mode(ctx, SSL_MODE_AUTO_RETRY); + + X509_STORE_add_cert(SSL_CTX_get_cert_store(ctx), sk_X509_value(p->ca, sk_X509_num(p->ca)-1)); + + SSL_CTX_set_verify_depth(ctx,2); + + SSL_CTX_set_verify(ctx,SSL_VERIFY_PEER,ZERO_NULL); + + SSL_CTX_set_cert_verify_callback(ctx, ssl_app_verify_callback, parm); + + + return CURLE_OK ; + err: + ERR_print_errors(p->errorbio); + return CURLE_SSL_CERTPROBLEM; + +} + +int main(int argc, char **argv) { + + BIO* in=NULL; + BIO* out=NULL; + + char * outfile = NULL; + char * infile = NULL ; + + int tabLength=100; + char *binaryptr; + char* mimetype; + char* mimetypeaccept=NULL; + char* contenttype; + const char** pp; + unsigned char* hostporturl = NULL; + BIO * p12bio ; + char **args = argv + 1; + unsigned char * serverurl; + sslctxparm p; + char *response; + + CURLcode res; + struct curl_slist * headers=NULL; + int badarg=0; + + binaryptr = malloc(tabLength); + + p.verbose = 0; + p.errorbio = BIO_new_fp (stderr, BIO_NOCLOSE); + + curl_global_init(CURL_GLOBAL_DEFAULT); + + /* we need some more for the P12 decoding */ + + OpenSSL_add_all_ciphers(); + OpenSSL_add_all_digests(); + ERR_load_crypto_strings(); + + + + while (*args && *args[0] == '-') { + if (!strcmp (*args, "-in")) { + if (args[1]) { + infile=*(++args); + } else badarg=1; + } else if (!strcmp (*args, "-out")) { + if (args[1]) { + outfile=*(++args); + } else badarg=1; + } else if (!strcmp (*args, "-p12")) { + if (args[1]) { + p.p12file = *(++args); + } else badarg=1; + } else if (strcmp(*args,"-envpass") == 0) { + if (args[1]) { + p.pst = getenv(*(++args)); + } else badarg=1; + } else if (strcmp(*args,"-connect") == 0) { + if (args[1]) { + hostporturl = *(++args); + } else badarg=1; + } else if (strcmp(*args,"-mimetype") == 0) { + if (args[1]) { + mimetype = *(++args); + } else badarg=1; + } else if (strcmp(*args,"-acceptmime") == 0) { + if (args[1]) { + mimetypeaccept = *(++args); + } else badarg=1; + } else if (strcmp(*args,"-accesstype") == 0) { + if (args[1]) { + if ((p.accesstype = OBJ_obj2nid(OBJ_txt2obj(*++args,0))) == 0) badarg=1; + } else badarg=1; + } else if (strcmp(*args,"-verbose") == 0) { + p.verbose++; + } else badarg=1; + args++; + } + + if (mimetype==NULL || mimetypeaccept == NULL) badarg = 1; + + if (badarg) { + for (pp=curlx_usage; (*pp != NULL); pp++) + BIO_printf(p.errorbio,"%s\n",*pp); + BIO_printf(p.errorbio,"\n"); + goto err; + } + + + + /* set input */ + + if ((in=BIO_new(BIO_s_file())) == NULL) { + BIO_printf(p.errorbio, "Error setting input bio\n"); + goto err; + } else if (infile == NULL) + BIO_set_fp(in,stdin,BIO_NOCLOSE|BIO_FP_TEXT); + else if (BIO_read_filename(in,infile) <= 0) { + BIO_printf(p.errorbio, "Error opening input file %s\n", infile); + BIO_free(in); + goto err; + } + + /* set output */ + + if ((out=BIO_new(BIO_s_file())) == NULL) { + BIO_printf(p.errorbio, "Error setting output bio.\n"); + goto err; + } else if (outfile == NULL) + BIO_set_fp(out,stdout,BIO_NOCLOSE|BIO_FP_TEXT); + else if (BIO_write_filename(out,outfile) <= 0) { + BIO_printf(p.errorbio, "Error opening output file %s\n", outfile); + BIO_free(out); + goto err; + } + + + p.errorbio = BIO_new_fp (stderr, BIO_NOCLOSE); + + if (!(p.curl = curl_easy_init())) { + BIO_printf(p.errorbio, "Cannot init curl lib\n"); + goto err; + } + + + + if (!(p12bio = BIO_new_file(p.p12file , "rb"))) { + BIO_printf(p.errorbio, "Error opening P12 file %s\n", p.p12file); goto err; + } + if (!(p.p12 = d2i_PKCS12_bio (p12bio, NULL))) { + BIO_printf(p.errorbio, "Cannot decode P12 structure %s\n", p.p12file); goto err; + } + + p.ca= NULL; + if (!(PKCS12_parse (p.p12, p.pst, &(p.pkey), &(p.usercert), &(p.ca) ) )) { + BIO_printf(p.errorbio,"Invalid P12 structure in %s\n", p.p12file); goto err; + } + + if (sk_X509_num(p.ca) <= 0) { + BIO_printf(p.errorbio,"No trustworthy CA given.%s\n", p.p12file); goto err; + } + + if (p.verbose > 1) + X509_print_ex(p.errorbio,p.usercert,0,0); + + /* determine URL to go */ + + if (hostporturl) { + serverurl = malloc(9+strlen(hostporturl)); + sprintf(serverurl,"https://%s",hostporturl); + } + else if (p.accesstype != 0) { /* see whether we can find an AIA or SIA for a given access type */ + if (!(serverurl = my_get_ext(p.usercert,p.accesstype,NID_info_access))) { + int j=0; + BIO_printf(p.errorbio,"no service URL in user cert " + "cherching in others certificats\n"); + for (j=0;j<sk_X509_num(p.ca);j++) { + if ((serverurl = my_get_ext(sk_X509_value(p.ca,j),p.accesstype, + NID_info_access))) + break; + if ((serverurl = my_get_ext(sk_X509_value(p.ca,j),p.accesstype, + NID_sinfo_access))) + break; + } + } + } + + if (!serverurl) { + BIO_printf(p.errorbio, "no service URL in certificats," + " check '-accesstype (AD_DVCS | ad_timestamping)'" + " or use '-connect'\n"); + goto err; + } + + if (p.verbose) + BIO_printf(p.errorbio, "Service URL: <%s>\n", serverurl); + + curl_easy_setopt(p.curl, CURLOPT_URL, serverurl); + + /* Now specify the POST binary data */ + + curl_easy_setopt(p.curl, CURLOPT_POSTFIELDS, binaryptr); + curl_easy_setopt(p.curl, CURLOPT_POSTFIELDSIZE,(long)tabLength); + + /* pass our list of custom made headers */ + + contenttype = malloc(15+strlen(mimetype)); + sprintf(contenttype,"Content-type: %s",mimetype); + headers = curl_slist_append(headers,contenttype); + curl_easy_setopt(p.curl, CURLOPT_HTTPHEADER, headers); + + if (p.verbose) + BIO_printf(p.errorbio, "Service URL: <%s>\n", serverurl); + + { + FILE *outfp; + BIO_get_fp(out,&outfp); + curl_easy_setopt(p.curl, CURLOPT_WRITEDATA, outfp); + } + + res = curl_easy_setopt(p.curl, CURLOPT_SSL_CTX_FUNCTION, sslctxfun) ; + + if (res != CURLE_OK) + BIO_printf(p.errorbio,"%d %s=%d %d\n", __LINE__, "CURLOPT_SSL_CTX_FUNCTION",CURLOPT_SSL_CTX_FUNCTION,res); + + curl_easy_setopt(p.curl, CURLOPT_SSL_CTX_DATA, &p); + + { + int lu; int i=0; + while ((lu = BIO_read (in,&binaryptr[i],tabLength-i)) >0 ) { + i+=lu; + if (i== tabLength) { + tabLength+=100; + binaryptr=realloc(binaryptr,tabLength); /* should be more careful */ + } + } + tabLength = i; + } + /* Now specify the POST binary data */ + + curl_easy_setopt(p.curl, CURLOPT_POSTFIELDS, binaryptr); + curl_easy_setopt(p.curl, CURLOPT_POSTFIELDSIZE,(long)tabLength); + + + /* Perform the request, res will get the return code */ + + BIO_printf(p.errorbio,"%d %s %d\n", __LINE__, "curl_easy_perform", + res = curl_easy_perform(p.curl)); + { + int result =curl_easy_getinfo(p.curl,CURLINFO_CONTENT_TYPE,&response); + if( mimetypeaccept && p.verbose) + if(!strcmp(mimetypeaccept,response)) + BIO_printf(p.errorbio,"the response has a correct mimetype : %s\n", + response); + else + BIO_printf(p.errorbio,"the reponse doesn\'t has an acceptable " + "mime type, it is %s instead of %s\n", + response,mimetypeaccept); + } + + /*** code d'erreur si accept mime ***, egalement code return HTTP != 200 ***/ + +/* free the header list*/ + + curl_slist_free_all(headers); + + /* always cleanup */ + curl_easy_cleanup(p.curl); + + BIO_free(in); + BIO_free(out); + return (EXIT_SUCCESS); + + err: BIO_printf(p.errorbio,"error"); + exit(1); +} diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/debug.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/debug.c new file mode 100644 index 0000000000..36dd80d702 --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/debug.c @@ -0,0 +1,147 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#include <stdio.h> +#include <curl/curl.h> + +struct data { + char trace_ascii; /* 1 or 0 */ +}; + +static +void dump(const char *text, + FILE *stream, unsigned char *ptr, size_t size, + char nohex) +{ + size_t i; + size_t c; + + unsigned int width=0x10; + + if(nohex) + /* without the hex output, we can fit more on screen */ + width = 0x40; + + fprintf(stream, "%s, %10.10ld bytes (0x%8.8lx)\n", + text, (long)size, (long)size); + + for(i=0; i<size; i+= width) { + + fprintf(stream, "%4.4lx: ", (long)i); + + if(!nohex) { + /* hex not disabled, show it */ + for(c = 0; c < width; c++) + if(i+c < size) + fprintf(stream, "%02x ", ptr[i+c]); + else + fputs(" ", stream); + } + + for(c = 0; (c < width) && (i+c < size); c++) { + /* check for 0D0A; if found, skip past and start a new line of output */ + if (nohex && (i+c+1 < size) && ptr[i+c]==0x0D && ptr[i+c+1]==0x0A) { + i+=(c+2-width); + break; + } + fprintf(stream, "%c", + (ptr[i+c]>=0x20) && (ptr[i+c]<0x80)?ptr[i+c]:'.'); + /* check again for 0D0A, to avoid an extra \n if it's at width */ + if (nohex && (i+c+2 < size) && ptr[i+c+1]==0x0D && ptr[i+c+2]==0x0A) { + i+=(c+3-width); + break; + } + } + fputc('\n', stream); /* newline */ + } + fflush(stream); +} + +static +int my_trace(CURL *handle, curl_infotype type, + char *data, size_t size, + void *userp) +{ + struct data *config = (struct data *)userp; + const char *text; + (void)handle; /* prevent compiler warning */ + + switch (type) { + case CURLINFO_TEXT: + fprintf(stderr, "== Info: %s", data); + default: /* in case a new one is introduced to shock us */ + return 0; + + case CURLINFO_HEADER_OUT: + text = "=> Send header"; + break; + case CURLINFO_DATA_OUT: + text = "=> Send data"; + break; + case CURLINFO_SSL_DATA_OUT: + text = "=> Send SSL data"; + break; + case CURLINFO_HEADER_IN: + text = "<= Recv header"; + break; + case CURLINFO_DATA_IN: + text = "<= Recv data"; + break; + case CURLINFO_SSL_DATA_IN: + text = "<= Recv SSL data"; + break; + } + + dump(text, stderr, (unsigned char *)data, size, config->trace_ascii); + return 0; +} + +int main(void) +{ + CURL *curl; + CURLcode res; + struct data config; + + config.trace_ascii = 1; /* enable ascii tracing */ + + curl = curl_easy_init(); + if(curl) { + curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION, my_trace); + curl_easy_setopt(curl, CURLOPT_DEBUGDATA, &config); + + /* the DEBUGFUNCTION has no effect until we enable VERBOSE */ + curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); + + /* example.com is redirected, so we tell libcurl to follow redirection */ + curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); + + curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/"); + res = curl_easy_perform(curl); + /* Check for errors */ + if(res != CURLE_OK) + fprintf(stderr, "curl_easy_perform() failed: %s\n", + curl_easy_strerror(res)); + + /* always cleanup */ + curl_easy_cleanup(curl); + } + return 0; +} diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/evhiperfifo.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/evhiperfifo.c new file mode 100644 index 0000000000..c2e87fcc56 --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/evhiperfifo.c @@ -0,0 +1,442 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +/* Example application source code using the multi socket interface to + * download many files at once. + * + * This example features the same basic functionality as hiperfifo.c does, + * but this uses libev instead of libevent. + * + * Written by Jeff Pohlmeyer, converted to use libev by Markus Koetter + +Requires libev and a (POSIX?) system that has mkfifo(). + +This is an adaptation of libcurl's "hipev.c" and libevent's "event-test.c" +sample programs. + +When running, the program creates the named pipe "hiper.fifo" + +Whenever there is input into the fifo, the program reads the input as a list +of URL's and creates some new easy handles to fetch each URL via the +curl_multi "hiper" API. + + +Thus, you can try a single URL: + % echo http://www.yahoo.com > hiper.fifo + +Or a whole bunch of them: + % cat my-url-list > hiper.fifo + +The fifo buffer is handled almost instantly, so you can even add more URL's +while the previous requests are still being downloaded. + +Note: + For the sake of simplicity, URL length is limited to 1023 char's ! + +This is purely a demo app, all retrieved data is simply discarded by the write +callback. + +*/ + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <sys/time.h> +#include <time.h> +#include <unistd.h> +#include <sys/poll.h> +#include <curl/curl.h> +#include <ev.h> +#include <fcntl.h> +#include <sys/stat.h> +#include <errno.h> + +#define DPRINT(x...) printf(x) + +#define MSG_OUT stdout /* Send info to stdout, change to stderr if you want */ + + +/* Global information, common to all connections */ +typedef struct _GlobalInfo +{ + struct ev_loop *loop; + struct ev_io fifo_event; + struct ev_timer timer_event; + CURLM *multi; + int still_running; + FILE* input; +} GlobalInfo; + + +/* Information associated with a specific easy handle */ +typedef struct _ConnInfo +{ + CURL *easy; + char *url; + GlobalInfo *global; + char error[CURL_ERROR_SIZE]; +} ConnInfo; + + +/* Information associated with a specific socket */ +typedef struct _SockInfo +{ + curl_socket_t sockfd; + CURL *easy; + int action; + long timeout; + struct ev_io ev; + int evset; + GlobalInfo *global; +} SockInfo; + +static void timer_cb(EV_P_ struct ev_timer *w, int revents); + +/* Update the event timer after curl_multi library calls */ +static int multi_timer_cb(CURLM *multi, long timeout_ms, GlobalInfo *g) +{ + DPRINT("%s %li\n", __PRETTY_FUNCTION__, timeout_ms); + ev_timer_stop(g->loop, &g->timer_event); + if (timeout_ms > 0) + { + double t = timeout_ms / 1000; + ev_timer_init(&g->timer_event, timer_cb, t, 0.); + ev_timer_start(g->loop, &g->timer_event); + }else + timer_cb(g->loop, &g->timer_event, 0); + return 0; +} + +/* Die if we get a bad CURLMcode somewhere */ +static void mcode_or_die(const char *where, CURLMcode code) +{ + if ( CURLM_OK != code ) + { + const char *s; + switch ( code ) + { + case CURLM_CALL_MULTI_PERFORM: s="CURLM_CALL_MULTI_PERFORM"; break; + case CURLM_BAD_HANDLE: s="CURLM_BAD_HANDLE"; break; + case CURLM_BAD_EASY_HANDLE: s="CURLM_BAD_EASY_HANDLE"; break; + case CURLM_OUT_OF_MEMORY: s="CURLM_OUT_OF_MEMORY"; break; + case CURLM_INTERNAL_ERROR: s="CURLM_INTERNAL_ERROR"; break; + case CURLM_UNKNOWN_OPTION: s="CURLM_UNKNOWN_OPTION"; break; + case CURLM_LAST: s="CURLM_LAST"; break; + default: s="CURLM_unknown"; + break; + case CURLM_BAD_SOCKET: s="CURLM_BAD_SOCKET"; + fprintf(MSG_OUT, "ERROR: %s returns %s\n", where, s); + /* ignore this error */ + return; + } + fprintf(MSG_OUT, "ERROR: %s returns %s\n", where, s); + exit(code); + } +} + + + +/* Check for completed transfers, and remove their easy handles */ +static void check_multi_info(GlobalInfo *g) +{ + char *eff_url; + CURLMsg *msg; + int msgs_left; + ConnInfo *conn; + CURL *easy; + CURLcode res; + + fprintf(MSG_OUT, "REMAINING: %d\n", g->still_running); + while ((msg = curl_multi_info_read(g->multi, &msgs_left))) { + if (msg->msg == CURLMSG_DONE) { + easy = msg->easy_handle; + res = msg->data.result; + curl_easy_getinfo(easy, CURLINFO_PRIVATE, &conn); + curl_easy_getinfo(easy, CURLINFO_EFFECTIVE_URL, &eff_url); + fprintf(MSG_OUT, "DONE: %s => (%d) %s\n", eff_url, res, conn->error); + curl_multi_remove_handle(g->multi, easy); + free(conn->url); + curl_easy_cleanup(easy); + free(conn); + } + } +} + + + +/* Called by libevent when we get action on a multi socket */ +static void event_cb(EV_P_ struct ev_io *w, int revents) +{ + DPRINT("%s w %p revents %i\n", __PRETTY_FUNCTION__, w, revents); + GlobalInfo *g = (GlobalInfo*) w->data; + CURLMcode rc; + + int action = (revents&EV_READ?CURL_POLL_IN:0)| + (revents&EV_WRITE?CURL_POLL_OUT:0); + rc = curl_multi_socket_action(g->multi, w->fd, action, &g->still_running); + mcode_or_die("event_cb: curl_multi_socket_action", rc); + check_multi_info(g); + if ( g->still_running <= 0 ) + { + fprintf(MSG_OUT, "last transfer done, kill timeout\n"); + ev_timer_stop(g->loop, &g->timer_event); + } +} + +/* Called by libevent when our timeout expires */ +static void timer_cb(EV_P_ struct ev_timer *w, int revents) +{ + DPRINT("%s w %p revents %i\n", __PRETTY_FUNCTION__, w, revents); + + GlobalInfo *g = (GlobalInfo *)w->data; + CURLMcode rc; + + rc = curl_multi_socket_action(g->multi, CURL_SOCKET_TIMEOUT, 0, &g->still_running); + mcode_or_die("timer_cb: curl_multi_socket_action", rc); + check_multi_info(g); +} + +/* Clean up the SockInfo structure */ +static void remsock(SockInfo *f, GlobalInfo *g) +{ + printf("%s \n", __PRETTY_FUNCTION__); + if ( f ) + { + if ( f->evset ) + ev_io_stop(g->loop, &f->ev); + free(f); + } +} + + + +/* Assign information to a SockInfo structure */ +static void setsock(SockInfo*f, curl_socket_t s, CURL*e, int act, GlobalInfo*g) +{ + printf("%s \n", __PRETTY_FUNCTION__); + + int kind = (act&CURL_POLL_IN?EV_READ:0)|(act&CURL_POLL_OUT?EV_WRITE:0); + + f->sockfd = s; + f->action = act; + f->easy = e; + if ( f->evset ) + ev_io_stop(g->loop, &f->ev); + ev_io_init(&f->ev, event_cb, f->sockfd, kind); + f->ev.data = g; + f->evset=1; + ev_io_start(g->loop, &f->ev); +} + + + +/* Initialize a new SockInfo structure */ +static void addsock(curl_socket_t s, CURL *easy, int action, GlobalInfo *g) +{ + SockInfo *fdp = calloc(sizeof(SockInfo), 1); + + fdp->global = g; + setsock(fdp, s, easy, action, g); + curl_multi_assign(g->multi, s, fdp); +} + +/* CURLMOPT_SOCKETFUNCTION */ +static int sock_cb(CURL *e, curl_socket_t s, int what, void *cbp, void *sockp) +{ + DPRINT("%s e %p s %i what %i cbp %p sockp %p\n", + __PRETTY_FUNCTION__, e, s, what, cbp, sockp); + + GlobalInfo *g = (GlobalInfo*) cbp; + SockInfo *fdp = (SockInfo*) sockp; + const char *whatstr[]={ "none", "IN", "OUT", "INOUT", "REMOVE"}; + + fprintf(MSG_OUT, + "socket callback: s=%d e=%p what=%s ", s, e, whatstr[what]); + if ( what == CURL_POLL_REMOVE ) + { + fprintf(MSG_OUT, "\n"); + remsock(fdp, g); + } else + { + if ( !fdp ) + { + fprintf(MSG_OUT, "Adding data: %s\n", whatstr[what]); + addsock(s, e, what, g); + } else + { + fprintf(MSG_OUT, + "Changing action from %s to %s\n", + whatstr[fdp->action], whatstr[what]); + setsock(fdp, s, e, what, g); + } + } + return 0; +} + + +/* CURLOPT_WRITEFUNCTION */ +static size_t write_cb(void *ptr, size_t size, size_t nmemb, void *data) +{ + size_t realsize = size * nmemb; + ConnInfo *conn = (ConnInfo*) data; + (void)ptr; + (void)conn; + return realsize; +} + + +/* CURLOPT_PROGRESSFUNCTION */ +static int prog_cb (void *p, double dltotal, double dlnow, double ult, + double uln) +{ + ConnInfo *conn = (ConnInfo *)p; + (void)ult; + (void)uln; + + fprintf(MSG_OUT, "Progress: %s (%g/%g)\n", conn->url, dlnow, dltotal); + return 0; +} + + +/* Create a new easy handle, and add it to the global curl_multi */ +static void new_conn(char *url, GlobalInfo *g ) +{ + ConnInfo *conn; + CURLMcode rc; + + conn = calloc(1, sizeof(ConnInfo)); + memset(conn, 0, sizeof(ConnInfo)); + conn->error[0]='\0'; + + conn->easy = curl_easy_init(); + if ( !conn->easy ) + { + fprintf(MSG_OUT, "curl_easy_init() failed, exiting!\n"); + exit(2); + } + conn->global = g; + conn->url = strdup(url); + curl_easy_setopt(conn->easy, CURLOPT_URL, conn->url); + curl_easy_setopt(conn->easy, CURLOPT_WRITEFUNCTION, write_cb); + curl_easy_setopt(conn->easy, CURLOPT_WRITEDATA, conn); + curl_easy_setopt(conn->easy, CURLOPT_VERBOSE, 1L); + curl_easy_setopt(conn->easy, CURLOPT_ERRORBUFFER, conn->error); + curl_easy_setopt(conn->easy, CURLOPT_PRIVATE, conn); + curl_easy_setopt(conn->easy, CURLOPT_NOPROGRESS, 0L); + curl_easy_setopt(conn->easy, CURLOPT_PROGRESSFUNCTION, prog_cb); + curl_easy_setopt(conn->easy, CURLOPT_PROGRESSDATA, conn); + curl_easy_setopt(conn->easy, CURLOPT_LOW_SPEED_TIME, 3L); + curl_easy_setopt(conn->easy, CURLOPT_LOW_SPEED_LIMIT, 10L); + + fprintf(MSG_OUT, + "Adding easy %p to multi %p (%s)\n", conn->easy, g->multi, url); + rc = curl_multi_add_handle(g->multi, conn->easy); + mcode_or_die("new_conn: curl_multi_add_handle", rc); + + /* note that the add_handle() will set a time-out to trigger very soon so + that the necessary socket_action() call will be called by this app */ +} + +/* This gets called whenever data is received from the fifo */ +static void fifo_cb(EV_P_ struct ev_io *w, int revents) +{ + char s[1024]; + long int rv=0; + int n=0; + GlobalInfo *g = (GlobalInfo *)w->data; + + do + { + s[0]='\0'; + rv=fscanf(g->input, "%1023s%n", s, &n); + s[n]='\0'; + if ( n && s[0] ) + { + new_conn(s,g); /* if we read a URL, go get it! */ + } else break; + } while ( rv != EOF ); +} + +/* Create a named pipe and tell libevent to monitor it */ +static int init_fifo (GlobalInfo *g) +{ + struct stat st; + static const char *fifo = "hiper.fifo"; + curl_socket_t sockfd; + + fprintf(MSG_OUT, "Creating named pipe \"%s\"\n", fifo); + if ( lstat (fifo, &st) == 0 ) + { + if ( (st.st_mode & S_IFMT) == S_IFREG ) + { + errno = EEXIST; + perror("lstat"); + exit (1); + } + } + unlink(fifo); + if ( mkfifo (fifo, 0600) == -1 ) + { + perror("mkfifo"); + exit (1); + } + sockfd = open(fifo, O_RDWR | O_NONBLOCK, 0); + if ( sockfd == -1 ) + { + perror("open"); + exit (1); + } + g->input = fdopen(sockfd, "r"); + + fprintf(MSG_OUT, "Now, pipe some URL's into > %s\n", fifo); + ev_io_init(&g->fifo_event, fifo_cb, sockfd, EV_READ); + ev_io_start(g->loop, &g->fifo_event); + return(0); +} + +int main(int argc, char **argv) +{ + GlobalInfo g; + CURLMcode rc; + (void)argc; + (void)argv; + + memset(&g, 0, sizeof(GlobalInfo)); + g.loop = ev_default_loop(0); + + init_fifo(&g); + g.multi = curl_multi_init(); + + ev_timer_init(&g.timer_event, timer_cb, 0., 0.); + g.timer_event.data = &g; + g.fifo_event.data = &g; + curl_multi_setopt(g.multi, CURLMOPT_SOCKETFUNCTION, sock_cb); + curl_multi_setopt(g.multi, CURLMOPT_SOCKETDATA, &g); + curl_multi_setopt(g.multi, CURLMOPT_TIMERFUNCTION, multi_timer_cb); + curl_multi_setopt(g.multi, CURLMOPT_TIMERDATA, &g); + + /* we don't call any curl_multi_socket*() function yet as we have no handles + added! */ + + ev_loop(g.loop, 0); + curl_multi_cleanup(g.multi); + return 0; +} diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/externalsocket.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/externalsocket.c new file mode 100644 index 0000000000..1b326c8b29 --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/externalsocket.c @@ -0,0 +1,153 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +/* + * This is an example demonstrating how an application can pass in a custom + * socket to libcurl to use. This example also handles the connect itself. + */ +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <curl/curl.h> + +#ifdef WIN32 +#include <windows.h> +#include <winsock2.h> +#include <ws2tcpip.h> +#define close closesocket +#else +#include <sys/types.h> /* socket types */ +#include <sys/socket.h> /* socket definitions */ +#include <netinet/in.h> +#include <arpa/inet.h> /* inet (3) funtions */ +#include <unistd.h> /* misc. UNIX functions */ +#endif + +#include <errno.h> + +/* The IP address and port number to connect to */ +#define IPADDR "127.0.0.1" +#define PORTNUM 80 + +#ifndef INADDR_NONE +#define INADDR_NONE 0xffffffff +#endif + +static size_t write_data(void *ptr, size_t size, size_t nmemb, void *stream) +{ + int written = fwrite(ptr, size, nmemb, (FILE *)stream); + return written; +} + +static curl_socket_t opensocket(void *clientp, + curlsocktype purpose, + struct curl_sockaddr *address) +{ + curl_socket_t sockfd; + (void)purpose; + (void)address; + sockfd = *(curl_socket_t *)clientp; + /* the actual externally set socket is passed in via the OPENSOCKETDATA + option */ + return sockfd; +} + +static int sockopt_callback(void *clientp, curl_socket_t curlfd, + curlsocktype purpose) +{ + (void)clientp; + (void)curlfd; + (void)purpose; + /* This return code was added in libcurl 7.21.5 */ + return CURL_SOCKOPT_ALREADY_CONNECTED; +} + +int main(void) +{ + CURL *curl; + CURLcode res; + struct sockaddr_in servaddr; /* socket address structure */ + curl_socket_t sockfd; + +#ifdef WIN32 + WSADATA wsaData; + int initwsa; + + if((initwsa = WSAStartup(MAKEWORD(2,0), &wsaData)) != 0) { + printf("WSAStartup failed: %d\n", initwsa); + return 1; + } +#endif + + curl = curl_easy_init(); + if(curl) { + /* + * Note that libcurl will internally think that you connect to the host + * and port that you specify in the URL option. + */ + curl_easy_setopt(curl, CURLOPT_URL, "http://99.99.99.99:9999"); + + /* Create the socket "manually" */ + if( (sockfd = socket(AF_INET, SOCK_STREAM, 0)) == CURL_SOCKET_BAD ) { + printf("Error creating listening socket.\n"); + return 3; + } + + memset(&servaddr, 0, sizeof(servaddr)); + servaddr.sin_family = AF_INET; + servaddr.sin_port = htons(PORTNUM); + + if (INADDR_NONE == (servaddr.sin_addr.s_addr = inet_addr(IPADDR))) + return 2; + + if(connect(sockfd,(struct sockaddr *) &servaddr, sizeof(servaddr)) == + -1) { + close(sockfd); + printf("client error: connect: %s\n", strerror(errno)); + return 1; + } + + /* no progress meter please */ + curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 1L); + + /* send all data to this function */ + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data); + + /* call this function to get a socket */ + curl_easy_setopt(curl, CURLOPT_OPENSOCKETFUNCTION, opensocket); + curl_easy_setopt(curl, CURLOPT_OPENSOCKETDATA, &sockfd); + + /* call this function to set options for the socket */ + curl_easy_setopt(curl, CURLOPT_SOCKOPTFUNCTION, sockopt_callback); + + curl_easy_setopt(curl, CURLOPT_VERBOSE, 1); + + res = curl_easy_perform(curl); + + curl_easy_cleanup(curl); + + if(res) { + printf("libcurl error: %d\n", res); + return 4; + } + } + return 0; +} diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/fileupload.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/fileupload.c new file mode 100644 index 0000000000..665eca0af9 --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/fileupload.c @@ -0,0 +1,86 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#include <stdio.h> +#include <curl/curl.h> +#include <sys/stat.h> +#include <fcntl.h> + +int main(void) +{ + CURL *curl; + CURLcode res; + struct stat file_info; + double speed_upload, total_time; + FILE *fd; + + fd = fopen("debugit", "rb"); /* open file to upload */ + if(!fd) { + + return 1; /* can't continue */ + } + + /* to get the file size */ + if(fstat(fileno(fd), &file_info) != 0) { + + return 1; /* can't continue */ + } + + curl = curl_easy_init(); + if(curl) { + /* upload to this place */ + curl_easy_setopt(curl, CURLOPT_URL, + "file:///home/dast/src/curl/debug/new"); + + /* tell it to "upload" to the URL */ + curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L); + + /* set where to read from (on Windows you need to use READFUNCTION too) */ + curl_easy_setopt(curl, CURLOPT_READDATA, fd); + + /* and give the size of the upload (optional) */ + curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE, + (curl_off_t)file_info.st_size); + + /* enable verbose for easier tracing */ + curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); + + res = curl_easy_perform(curl); + /* Check for errors */ + if(res != CURLE_OK) { + fprintf(stderr, "curl_easy_perform() failed: %s\n", + curl_easy_strerror(res)); + + } + else { + /* now extract transfer info */ + curl_easy_getinfo(curl, CURLINFO_SPEED_UPLOAD, &speed_upload); + curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME, &total_time); + + fprintf(stderr, "Speed: %.3f bytes/sec during %.3f seconds\n", + speed_upload, total_time); + + } + /* always cleanup */ + curl_easy_cleanup(curl); + } + return 0; +} diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/fopen.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/fopen.c new file mode 100644 index 0000000000..6fe5c0f9fb --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/fopen.c @@ -0,0 +1,527 @@ +/***************************************************************************** + * + * This example source code introduces a c library buffered I/O interface to + * URL reads it supports fopen(), fread(), fgets(), feof(), fclose(), + * rewind(). Supported functions have identical prototypes to their normal c + * lib namesakes and are preceaded by url_ . + * + * Using this code you can replace your program's fopen() with url_fopen() + * and fread() with url_fread() and it become possible to read remote streams + * instead of (only) local files. Local files (ie those that can be directly + * fopened) will drop back to using the underlying clib implementations + * + * See the main() function at the bottom that shows an app that retrives from a + * specified url using fgets() and fread() and saves as two output files. + * + * Copyright (c) 2003 Simtec Electronics + * + * Re-implemented by Vincent Sanders <vince@kyllikki.org> with extensive + * reference to original curl example code + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * This example requires libcurl 7.9.7 or later. + */ + +#include <stdio.h> +#include <string.h> +#ifndef WIN32 +# include <sys/time.h> +#endif +#include <stdlib.h> +#include <errno.h> + +#include <curl/curl.h> + +enum fcurl_type_e { + CFTYPE_NONE=0, + CFTYPE_FILE=1, + CFTYPE_CURL=2 +}; + +struct fcurl_data +{ + enum fcurl_type_e type; /* type of handle */ + union { + CURL *curl; + FILE *file; + } handle; /* handle */ + + char *buffer; /* buffer to store cached data*/ + size_t buffer_len; /* currently allocated buffers length */ + size_t buffer_pos; /* end of data in buffer*/ + int still_running; /* Is background url fetch still in progress */ +}; + +typedef struct fcurl_data URL_FILE; + +/* exported functions */ +URL_FILE *url_fopen(const char *url,const char *operation); +int url_fclose(URL_FILE *file); +int url_feof(URL_FILE *file); +size_t url_fread(void *ptr, size_t size, size_t nmemb, URL_FILE *file); +char * url_fgets(char *ptr, size_t size, URL_FILE *file); +void url_rewind(URL_FILE *file); + +/* we use a global one for convenience */ +CURLM *multi_handle; + +/* curl calls this routine to get more data */ +static size_t write_callback(char *buffer, + size_t size, + size_t nitems, + void *userp) +{ + char *newbuff; + size_t rembuff; + + URL_FILE *url = (URL_FILE *)userp; + size *= nitems; + + rembuff=url->buffer_len - url->buffer_pos; /* remaining space in buffer */ + + if(size > rembuff) { + /* not enough space in buffer */ + newbuff=realloc(url->buffer,url->buffer_len + (size - rembuff)); + if(newbuff==NULL) { + fprintf(stderr,"callback buffer grow failed\n"); + size=rembuff; + } + else { + /* realloc suceeded increase buffer size*/ + url->buffer_len+=size - rembuff; + url->buffer=newbuff; + } + } + + memcpy(&url->buffer[url->buffer_pos], buffer, size); + url->buffer_pos += size; + + return size; +} + +/* use to attempt to fill the read buffer up to requested number of bytes */ +static int fill_buffer(URL_FILE *file, size_t want) +{ + fd_set fdread; + fd_set fdwrite; + fd_set fdexcep; + struct timeval timeout; + int rc; + + /* only attempt to fill buffer if transactions still running and buffer + * doesnt exceed required size already + */ + if((!file->still_running) || (file->buffer_pos > want)) + return 0; + + /* attempt to fill buffer */ + do { + int maxfd = -1; + long curl_timeo = -1; + + FD_ZERO(&fdread); + FD_ZERO(&fdwrite); + FD_ZERO(&fdexcep); + + /* set a suitable timeout to fail on */ + timeout.tv_sec = 60; /* 1 minute */ + timeout.tv_usec = 0; + + curl_multi_timeout(multi_handle, &curl_timeo); + if(curl_timeo >= 0) { + timeout.tv_sec = curl_timeo / 1000; + if(timeout.tv_sec > 1) + timeout.tv_sec = 1; + else + timeout.tv_usec = (curl_timeo % 1000) * 1000; + } + + /* get file descriptors from the transfers */ + curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd); + + /* In a real-world program you OF COURSE check the return code of the + function calls. On success, the value of maxfd is guaranteed to be + greater or equal than -1. We call select(maxfd + 1, ...), specially + in case of (maxfd == -1), we call select(0, ...), which is basically + equal to sleep. */ + + rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout); + + switch(rc) { + case -1: + /* select error */ + break; + + case 0: + default: + /* timeout or readable/writable sockets */ + curl_multi_perform(multi_handle, &file->still_running); + break; + } + } while(file->still_running && (file->buffer_pos < want)); + return 1; +} + +/* use to remove want bytes from the front of a files buffer */ +static int use_buffer(URL_FILE *file,int want) +{ + /* sort out buffer */ + if((file->buffer_pos - want) <=0) { + /* ditch buffer - write will recreate */ + if(file->buffer) + free(file->buffer); + + file->buffer=NULL; + file->buffer_pos=0; + file->buffer_len=0; + } + else { + /* move rest down make it available for later */ + memmove(file->buffer, + &file->buffer[want], + (file->buffer_pos - want)); + + file->buffer_pos -= want; + } + return 0; +} + +URL_FILE *url_fopen(const char *url,const char *operation) +{ + /* this code could check for URLs or types in the 'url' and + basicly use the real fopen() for standard files */ + + URL_FILE *file; + (void)operation; + + file = malloc(sizeof(URL_FILE)); + if(!file) + return NULL; + + memset(file, 0, sizeof(URL_FILE)); + + if((file->handle.file=fopen(url,operation))) + file->type = CFTYPE_FILE; /* marked as URL */ + + else { + file->type = CFTYPE_CURL; /* marked as URL */ + file->handle.curl = curl_easy_init(); + + curl_easy_setopt(file->handle.curl, CURLOPT_URL, url); + curl_easy_setopt(file->handle.curl, CURLOPT_WRITEDATA, file); + curl_easy_setopt(file->handle.curl, CURLOPT_VERBOSE, 0L); + curl_easy_setopt(file->handle.curl, CURLOPT_WRITEFUNCTION, write_callback); + + if(!multi_handle) + multi_handle = curl_multi_init(); + + curl_multi_add_handle(multi_handle, file->handle.curl); + + /* lets start the fetch */ + curl_multi_perform(multi_handle, &file->still_running); + + if((file->buffer_pos == 0) && (!file->still_running)) { + /* if still_running is 0 now, we should return NULL */ + + /* make sure the easy handle is not in the multi handle anymore */ + curl_multi_remove_handle(multi_handle, file->handle.curl); + + /* cleanup */ + curl_easy_cleanup(file->handle.curl); + + free(file); + + file = NULL; + } + } + return file; +} + +int url_fclose(URL_FILE *file) +{ + int ret=0;/* default is good return */ + + switch(file->type) { + case CFTYPE_FILE: + ret=fclose(file->handle.file); /* passthrough */ + break; + + case CFTYPE_CURL: + /* make sure the easy handle is not in the multi handle anymore */ + curl_multi_remove_handle(multi_handle, file->handle.curl); + + /* cleanup */ + curl_easy_cleanup(file->handle.curl); + break; + + default: /* unknown or supported type - oh dear */ + ret=EOF; + errno=EBADF; + break; + } + + if(file->buffer) + free(file->buffer);/* free any allocated buffer space */ + + free(file); + + return ret; +} + +int url_feof(URL_FILE *file) +{ + int ret=0; + + switch(file->type) { + case CFTYPE_FILE: + ret=feof(file->handle.file); + break; + + case CFTYPE_CURL: + if((file->buffer_pos == 0) && (!file->still_running)) + ret = 1; + break; + + default: /* unknown or supported type - oh dear */ + ret=-1; + errno=EBADF; + break; + } + return ret; +} + +size_t url_fread(void *ptr, size_t size, size_t nmemb, URL_FILE *file) +{ + size_t want; + + switch(file->type) { + case CFTYPE_FILE: + want=fread(ptr,size,nmemb,file->handle.file); + break; + + case CFTYPE_CURL: + want = nmemb * size; + + fill_buffer(file,want); + + /* check if theres data in the buffer - if not fill_buffer() + * either errored or EOF */ + if(!file->buffer_pos) + return 0; + + /* ensure only available data is considered */ + if(file->buffer_pos < want) + want = file->buffer_pos; + + /* xfer data to caller */ + memcpy(ptr, file->buffer, want); + + use_buffer(file,want); + + want = want / size; /* number of items */ + break; + + default: /* unknown or supported type - oh dear */ + want=0; + errno=EBADF; + break; + + } + return want; +} + +char *url_fgets(char *ptr, size_t size, URL_FILE *file) +{ + size_t want = size - 1;/* always need to leave room for zero termination */ + size_t loop; + + switch(file->type) { + case CFTYPE_FILE: + ptr = fgets(ptr,size,file->handle.file); + break; + + case CFTYPE_CURL: + fill_buffer(file,want); + + /* check if theres data in the buffer - if not fill either errored or + * EOF */ + if(!file->buffer_pos) + return NULL; + + /* ensure only available data is considered */ + if(file->buffer_pos < want) + want = file->buffer_pos; + + /*buffer contains data */ + /* look for newline or eof */ + for(loop=0;loop < want;loop++) { + if(file->buffer[loop] == '\n') { + want=loop+1;/* include newline */ + break; + } + } + + /* xfer data to caller */ + memcpy(ptr, file->buffer, want); + ptr[want]=0;/* allways null terminate */ + + use_buffer(file,want); + + break; + + default: /* unknown or supported type - oh dear */ + ptr=NULL; + errno=EBADF; + break; + } + + return ptr;/*success */ +} + +void url_rewind(URL_FILE *file) +{ + switch(file->type) { + case CFTYPE_FILE: + rewind(file->handle.file); /* passthrough */ + break; + + case CFTYPE_CURL: + /* halt transaction */ + curl_multi_remove_handle(multi_handle, file->handle.curl); + + /* restart */ + curl_multi_add_handle(multi_handle, file->handle.curl); + + /* ditch buffer - write will recreate - resets stream pos*/ + if(file->buffer) + free(file->buffer); + + file->buffer=NULL; + file->buffer_pos=0; + file->buffer_len=0; + + break; + + default: /* unknown or supported type - oh dear */ + break; + } +} + +/* Small main program to retrive from a url using fgets and fread saving the + * output to two test files (note the fgets method will corrupt binary files if + * they contain 0 chars */ +int main(int argc, char *argv[]) +{ + URL_FILE *handle; + FILE *outf; + + int nread; + char buffer[256]; + const char *url; + + if(argc < 2) + url="http://192.168.7.3/testfile";/* default to testurl */ + else + url=argv[1];/* use passed url */ + + /* copy from url line by line with fgets */ + outf=fopen("fgets.test","w+"); + if(!outf) { + perror("couldn't open fgets output file\n"); + return 1; + } + + handle = url_fopen(url, "r"); + if(!handle) { + printf("couldn't url_fopen() %s\n", url); + fclose(outf); + return 2; + } + + while(!url_feof(handle)) { + url_fgets(buffer,sizeof(buffer),handle); + fwrite(buffer,1,strlen(buffer),outf); + } + + url_fclose(handle); + + fclose(outf); + + + /* Copy from url with fread */ + outf=fopen("fread.test","w+"); + if(!outf) { + perror("couldn't open fread output file\n"); + return 1; + } + + handle = url_fopen("testfile", "r"); + if(!handle) { + printf("couldn't url_fopen() testfile\n"); + fclose(outf); + return 2; + } + + do { + nread = url_fread(buffer, 1,sizeof(buffer), handle); + fwrite(buffer,1,nread,outf); + } while(nread); + + url_fclose(handle); + + fclose(outf); + + + /* Test rewind */ + outf=fopen("rewind.test","w+"); + if(!outf) { + perror("couldn't open fread output file\n"); + return 1; + } + + handle = url_fopen("testfile", "r"); + if(!handle) { + printf("couldn't url_fopen() testfile\n"); + fclose(outf); + return 2; + } + + nread = url_fread(buffer, 1,sizeof(buffer), handle); + fwrite(buffer,1,nread,outf); + url_rewind(handle); + + buffer[0]='\n'; + fwrite(buffer,1,1,outf); + + nread = url_fread(buffer, 1,sizeof(buffer), handle); + fwrite(buffer,1,nread,outf); + + + url_fclose(handle); + + fclose(outf); + + + return 0;/* all done */ +} diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/ftp-wildcard.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/ftp-wildcard.c new file mode 100644 index 0000000000..5a2a10311b --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/ftp-wildcard.c @@ -0,0 +1,148 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#include <curl/curl.h> +#include <stdio.h> + +struct callback_data { + FILE *output; +}; + +static long file_is_comming(struct curl_fileinfo *finfo, + struct callback_data *data, + int remains); + +static long file_is_downloaded(struct callback_data *data); + +static size_t write_it(char *buff, size_t size, size_t nmemb, + void *cb_data); + +int main(int argc, char **argv) +{ + int rc = CURLE_OK; + + /* curl easy handle */ + CURL *handle; + + /* help data */ + struct callback_data data = { 0 }; + + /* global initialization */ + rc = curl_global_init(CURL_GLOBAL_ALL); + if(rc) + return rc; + + /* initialization of easy handle */ + handle = curl_easy_init(); + if(!handle) { + curl_global_cleanup(); + return CURLE_OUT_OF_MEMORY; + } + + /* turn on wildcard matching */ + curl_easy_setopt(handle, CURLOPT_WILDCARDMATCH, 1L); + + /* callback is called before download of concrete file started */ + curl_easy_setopt(handle, CURLOPT_CHUNK_BGN_FUNCTION, file_is_comming); + + /* callback is called after data from the file have been transferred */ + curl_easy_setopt(handle, CURLOPT_CHUNK_END_FUNCTION, file_is_downloaded); + + /* this callback will write contents into files */ + curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, write_it); + + /* put transfer data into callbacks */ + curl_easy_setopt(handle, CURLOPT_CHUNK_DATA, &data); + curl_easy_setopt(handle, CURLOPT_WRITEDATA, &data); + + /* curl_easy_setopt(handle, CURLOPT_VERBOSE, 1L); */ + + /* set an URL containing wildcard pattern (only in the last part) */ + if(argc == 2) + curl_easy_setopt(handle, CURLOPT_URL, argv[1]); + else + curl_easy_setopt(handle, CURLOPT_URL, "ftp://example.com/test/*"); + + /* and start transfer! */ + rc = curl_easy_perform(handle); + + curl_easy_cleanup(handle); + curl_global_cleanup(); + return rc; +} + +static long file_is_comming(struct curl_fileinfo *finfo, + struct callback_data *data, + int remains) +{ + printf("%3d %40s %10luB ", remains, finfo->filename, + (unsigned long)finfo->size); + + switch(finfo->filetype) { + case CURLFILETYPE_DIRECTORY: + printf(" DIR\n"); + break; + case CURLFILETYPE_FILE: + printf("FILE "); + break; + default: + printf("OTHER\n"); + break; + } + + if(finfo->filetype == CURLFILETYPE_FILE) { + /* do not transfer files >= 50B */ + if(finfo->size > 50) { + printf("SKIPPED\n"); + return CURL_CHUNK_BGN_FUNC_SKIP; + } + + data->output = fopen(finfo->filename, "w"); + if(!data->output) { + return CURL_CHUNK_BGN_FUNC_FAIL; + } + } + + return CURL_CHUNK_BGN_FUNC_OK; +} + +static long file_is_downloaded(struct callback_data *data) +{ + if(data->output) { + printf("DOWNLOADED\n"); + fclose(data->output); + data->output = 0x0; + } + return CURL_CHUNK_END_FUNC_OK; +} + +static size_t write_it(char *buff, size_t size, size_t nmemb, + void *cb_data) +{ + struct callback_data *data = cb_data; + size_t written = 0; + if(data->output) + written = fwrite(buff, size, nmemb, data->output); + else + /* listing output */ + written = fwrite(buff, size, nmemb, stdout); + return written; +} diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/ftpget.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/ftpget.c new file mode 100644 index 0000000000..bcb42bb302 --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/ftpget.c @@ -0,0 +1,94 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#include <stdio.h> + +#include <curl/curl.h> + +/* + * This is an example showing how to get a single file from an FTP server. + * It delays the actual destination file creation until the first write + * callback so that it won't create an empty file in case the remote file + * doesn't exist or something else fails. + */ + +struct FtpFile { + const char *filename; + FILE *stream; +}; + +static size_t my_fwrite(void *buffer, size_t size, size_t nmemb, void *stream) +{ + struct FtpFile *out=(struct FtpFile *)stream; + if(out && !out->stream) { + /* open file for writing */ + out->stream=fopen(out->filename, "wb"); + if(!out->stream) + return -1; /* failure, can't open file to write */ + } + return fwrite(buffer, size, nmemb, out->stream); +} + + +int main(void) +{ + CURL *curl; + CURLcode res; + struct FtpFile ftpfile={ + "curl.tar.gz", /* name to store the file as if succesful */ + NULL + }; + + curl_global_init(CURL_GLOBAL_DEFAULT); + + curl = curl_easy_init(); + if(curl) { + /* + * You better replace the URL with one that works! + */ + curl_easy_setopt(curl, CURLOPT_URL, + "ftp://ftp.example.com/pub/www/utilities/curl/curl-7.9.2.tar.gz"); + /* Define our callback to get called when there's data to be written */ + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, my_fwrite); + /* Set a pointer to our struct to pass to the callback */ + curl_easy_setopt(curl, CURLOPT_WRITEDATA, &ftpfile); + + /* Switch on full protocol/debug output */ + curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); + + res = curl_easy_perform(curl); + + /* always cleanup */ + curl_easy_cleanup(curl); + + if(CURLE_OK != res) { + /* we failed */ + fprintf(stderr, "curl told us %d\n", res); + } + } + + if(ftpfile.stream) + fclose(ftpfile.stream); /* close the local file */ + + curl_global_cleanup(); + + return 0; +} diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/ftpgetinfo.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/ftpgetinfo.c new file mode 100644 index 0000000000..dfdcf78b7c --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/ftpgetinfo.c @@ -0,0 +1,89 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#include <stdio.h> +#include <string.h> + +#include <curl/curl.h> + +/* + * This is an example showing how to check a single file's size and mtime + * from an FTP server. + */ + +static size_t throw_away(void *ptr, size_t size, size_t nmemb, void *data) +{ + (void)ptr; + (void)data; + /* we are not interested in the headers itself, + so we only return the size we would have saved ... */ + return (size_t)(size * nmemb); +} + +int main(void) +{ + char ftpurl[] = "ftp://ftp.example.com/gnu/binutils/binutils-2.19.1.tar.bz2"; + CURL *curl; + CURLcode res; + long filetime = -1; + double filesize = 0.0; + const char *filename = strrchr(ftpurl, '/') + 1; + + curl_global_init(CURL_GLOBAL_DEFAULT); + + curl = curl_easy_init(); + if(curl) { + curl_easy_setopt(curl, CURLOPT_URL, ftpurl); + /* No download if the file */ + curl_easy_setopt(curl, CURLOPT_NOBODY, 1L); + /* Ask for filetime */ + curl_easy_setopt(curl, CURLOPT_FILETIME, 1L); + /* No header output: TODO 14.1 http-style HEAD output for ftp */ + curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, throw_away); + curl_easy_setopt(curl, CURLOPT_HEADER, 0L); + /* Switch on full protocol/debug output */ + /* curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); */ + + res = curl_easy_perform(curl); + + if(CURLE_OK == res) { + /* http://curl.haxx.se/libcurl/c/curl_easy_getinfo.html */ + res = curl_easy_getinfo(curl, CURLINFO_FILETIME, &filetime); + if((CURLE_OK == res) && (filetime >= 0)) { + time_t file_time = (time_t)filetime; + printf("filetime %s: %s", filename, ctime(&file_time)); + } + res = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &filesize); + if((CURLE_OK == res) && (filesize>0.0)) + printf("filesize %s: %0.0f bytes\n", filename, filesize); + } else { + /* we failed */ + fprintf(stderr, "curl told us %d\n", res); + } + + /* always cleanup */ + curl_easy_cleanup(curl); + } + + curl_global_cleanup(); + + return 0; +} diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/ftpgetresp.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/ftpgetresp.c new file mode 100644 index 0000000000..db96a3a13b --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/ftpgetresp.c @@ -0,0 +1,76 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#include <stdio.h> + +#include <curl/curl.h> + +/* + * Similar to ftpget.c but this also stores the received response-lines + * in a separate file using our own callback! + * + * This functionality was introduced in libcurl 7.9.3. + */ + +static size_t +write_response(void *ptr, size_t size, size_t nmemb, void *data) +{ + FILE *writehere = (FILE *)data; + return fwrite(ptr, size, nmemb, writehere); +} + +int main(void) +{ + CURL *curl; + CURLcode res; + FILE *ftpfile; + FILE *respfile; + + /* local file name to store the file as */ + ftpfile = fopen("ftp-list", "wb"); /* b is binary, needed on win32 */ + + /* local file name to store the FTP server's response lines in */ + respfile = fopen("ftp-responses", "wb"); /* b is binary, needed on win32 */ + + curl = curl_easy_init(); + if(curl) { + /* Get a file listing from sunet */ + curl_easy_setopt(curl, CURLOPT_URL, "ftp://ftp.example.com/"); + curl_easy_setopt(curl, CURLOPT_WRITEDATA, ftpfile); + /* If you intend to use this on windows with a libcurl DLL, you must use + CURLOPT_WRITEFUNCTION as well */ + curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, write_response); + curl_easy_setopt(curl, CURLOPT_WRITEHEADER, respfile); + res = curl_easy_perform(curl); + /* Check for errors */ + if(res != CURLE_OK) + fprintf(stderr, "curl_easy_perform() failed: %s\n", + curl_easy_strerror(res)); + + /* always cleanup */ + curl_easy_cleanup(curl); + } + + fclose(ftpfile); /* close the local file */ + fclose(respfile); /* close the response file */ + + return 0; +} diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/ftpsget.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/ftpsget.c new file mode 100644 index 0000000000..0cfe32024a --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/ftpsget.c @@ -0,0 +1,101 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include <stdio.h> + +#include <curl/curl.h> + +/* + * This is an example showing how to get a single file from an FTPS server. + * It delays the actual destination file creation until the first write + * callback so that it won't create an empty file in case the remote file + * doesn't exist or something else fails. + */ + +struct FtpFile { + const char *filename; + FILE *stream; +}; + +static size_t my_fwrite(void *buffer, size_t size, size_t nmemb, + void *stream) +{ + struct FtpFile *out=(struct FtpFile *)stream; + if(out && !out->stream) { + /* open file for writing */ + out->stream=fopen(out->filename, "wb"); + if(!out->stream) + return -1; /* failure, can't open file to write */ + } + return fwrite(buffer, size, nmemb, out->stream); +} + + +int main(void) +{ + CURL *curl; + CURLcode res; + struct FtpFile ftpfile={ + "yourfile.bin", /* name to store the file as if succesful */ + NULL + }; + + curl_global_init(CURL_GLOBAL_DEFAULT); + + curl = curl_easy_init(); + if(curl) { + /* + * You better replace the URL with one that works! Note that we use an + * FTP:// URL with standard explicit FTPS. You can also do FTPS:// URLs if + * you want to do the rarer kind of transfers: implicit. + */ + curl_easy_setopt(curl, CURLOPT_URL, + "ftp://user@server/home/user/file.txt"); + /* Define our callback to get called when there's data to be written */ + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, my_fwrite); + /* Set a pointer to our struct to pass to the callback */ + curl_easy_setopt(curl, CURLOPT_WRITEDATA, &ftpfile); + + /* We activate SSL and we require it for both control and data */ + curl_easy_setopt(curl, CURLOPT_USE_SSL, CURLUSESSL_ALL); + + /* Switch on full protocol/debug output */ + curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); + + res = curl_easy_perform(curl); + + /* always cleanup */ + curl_easy_cleanup(curl); + + if(CURLE_OK != res) { + /* we failed */ + fprintf(stderr, "curl told us %d\n", res); + } + } + + if(ftpfile.stream) + fclose(ftpfile.stream); /* close the local file */ + + curl_global_cleanup(); + + return 0; +} diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/ftpupload.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/ftpupload.c new file mode 100644 index 0000000000..e79f8d842a --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/ftpupload.c @@ -0,0 +1,140 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#include <stdio.h> +#include <string.h> + +#include <curl/curl.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <errno.h> +#ifdef WIN32 +#include <io.h> +#else +#include <unistd.h> +#endif + +/* + * This example shows an FTP upload, with a rename of the file just after + * a successful upload. + * + * Example based on source code provided by Erick Nuwendam. Thanks! + */ + +#define LOCAL_FILE "/tmp/uploadthis.txt" +#define UPLOAD_FILE_AS "while-uploading.txt" +#define REMOTE_URL "ftp://example.com/" UPLOAD_FILE_AS +#define RENAME_FILE_TO "renamed-and-fine.txt" + +/* NOTE: if you want this example to work on Windows with libcurl as a + DLL, you MUST also provide a read callback with CURLOPT_READFUNCTION. + Failing to do so will give you a crash since a DLL may not use the + variable's memory when passed in to it from an app like this. */ +static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *stream) +{ + curl_off_t nread; + /* in real-world cases, this would probably get this data differently + as this fread() stuff is exactly what the library already would do + by default internally */ + size_t retcode = fread(ptr, size, nmemb, stream); + + nread = (curl_off_t)retcode; + + fprintf(stderr, "*** We read %" CURL_FORMAT_CURL_OFF_T + " bytes from file\n", nread); + return retcode; +} + +int main(void) +{ + CURL *curl; + CURLcode res; + FILE *hd_src; + struct stat file_info; + curl_off_t fsize; + + struct curl_slist *headerlist=NULL; + static const char buf_1 [] = "RNFR " UPLOAD_FILE_AS; + static const char buf_2 [] = "RNTO " RENAME_FILE_TO; + + /* get the file size of the local file */ + if(stat(LOCAL_FILE, &file_info)) { + printf("Couldnt open '%s': %s\n", LOCAL_FILE, strerror(errno)); + return 1; + } + fsize = (curl_off_t)file_info.st_size; + + printf("Local file size: %" CURL_FORMAT_CURL_OFF_T " bytes.\n", fsize); + + /* get a FILE * of the same file */ + hd_src = fopen(LOCAL_FILE, "rb"); + + /* In windows, this will init the winsock stuff */ + curl_global_init(CURL_GLOBAL_ALL); + + /* get a curl handle */ + curl = curl_easy_init(); + if(curl) { + /* build a list of commands to pass to libcurl */ + headerlist = curl_slist_append(headerlist, buf_1); + headerlist = curl_slist_append(headerlist, buf_2); + + /* we want to use our own read function */ + curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback); + + /* enable uploading */ + curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L); + + /* specify target */ + curl_easy_setopt(curl,CURLOPT_URL, REMOTE_URL); + + /* pass in that last of FTP commands to run after the transfer */ + curl_easy_setopt(curl, CURLOPT_POSTQUOTE, headerlist); + + /* now specify which file to upload */ + curl_easy_setopt(curl, CURLOPT_READDATA, hd_src); + + /* Set the size of the file to upload (optional). If you give a *_LARGE + option you MUST make sure that the type of the passed-in argument is a + curl_off_t. If you use CURLOPT_INFILESIZE (without _LARGE) you must + make sure that to pass in a type 'long' argument. */ + curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE, + (curl_off_t)fsize); + + /* Now run off and do what you've been told! */ + res = curl_easy_perform(curl); + /* Check for errors */ + if(res != CURLE_OK) + fprintf(stderr, "curl_easy_perform() failed: %s\n", + curl_easy_strerror(res)); + + /* clean up the FTP commands list */ + curl_slist_free_all (headerlist); + + /* always cleanup */ + curl_easy_cleanup(curl); + } + fclose(hd_src); /* close the local file */ + + curl_global_cleanup(); + return 0; +} diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/ftpuploadresume.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/ftpuploadresume.c new file mode 100644 index 0000000000..55b8986c7c --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/ftpuploadresume.c @@ -0,0 +1,174 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +/* Upload to FTP, resuming failed transfers + * + * Compile for MinGW like this: + * gcc -Wall -pedantic -std=c99 ftpuploadwithresume.c -o ftpuploadresume.exe + * -lcurl -lmsvcr70 + * + * Written by Philip Bock + */ + +#include <stdlib.h> +#include <stdio.h> + +#include <curl/curl.h> + +#if defined(_MSC_VER) && (_MSC_VER < 1300) +# error _snscanf requires MSVC 7.0 or later. +#endif + +/* The MinGW headers are missing a few Win32 function definitions, + you shouldn't need this if you use VC++ */ +#if defined(__MINGW32__) && !defined(__MINGW64__) +int __cdecl _snscanf(const char * input, size_t length, const char * format, ...); +#endif + + +/* parse headers for Content-Length */ +size_t getcontentlengthfunc(void *ptr, size_t size, size_t nmemb, void *stream) +{ + int r; + long len = 0; + + /* _snscanf() is Win32 specific */ + r = _snscanf(ptr, size * nmemb, "Content-Length: %ld\n", &len); + + if (r) /* Microsoft: we don't read the specs */ + *((long *) stream) = len; + + return size * nmemb; +} + +/* discard downloaded data */ +size_t discardfunc(void *ptr, size_t size, size_t nmemb, void *stream) +{ + return size * nmemb; +} + +/* read data to upload */ +size_t readfunc(void *ptr, size_t size, size_t nmemb, void *stream) +{ + FILE *f = stream; + size_t n; + + if (ferror(f)) + return CURL_READFUNC_ABORT; + + n = fread(ptr, size, nmemb, f) * size; + + return n; +} + + +int upload(CURL *curlhandle, const char * remotepath, const char * localpath, + long timeout, long tries) +{ + FILE *f; + long uploaded_len = 0; + CURLcode r = CURLE_GOT_NOTHING; + int c; + + f = fopen(localpath, "rb"); + if (f == NULL) { + perror(NULL); + return 0; + } + + curl_easy_setopt(curlhandle, CURLOPT_UPLOAD, 1L); + + curl_easy_setopt(curlhandle, CURLOPT_URL, remotepath); + + if (timeout) + curl_easy_setopt(curlhandle, CURLOPT_FTP_RESPONSE_TIMEOUT, timeout); + + curl_easy_setopt(curlhandle, CURLOPT_HEADERFUNCTION, getcontentlengthfunc); + curl_easy_setopt(curlhandle, CURLOPT_HEADERDATA, &uploaded_len); + + curl_easy_setopt(curlhandle, CURLOPT_WRITEFUNCTION, discardfunc); + + curl_easy_setopt(curlhandle, CURLOPT_READFUNCTION, readfunc); + curl_easy_setopt(curlhandle, CURLOPT_READDATA, f); + + curl_easy_setopt(curlhandle, CURLOPT_FTPPORT, "-"); /* disable passive mode */ + curl_easy_setopt(curlhandle, CURLOPT_FTP_CREATE_MISSING_DIRS, 1L); + + curl_easy_setopt(curlhandle, CURLOPT_VERBOSE, 1L); + + for (c = 0; (r != CURLE_OK) && (c < tries); c++) { + /* are we resuming? */ + if (c) { /* yes */ + /* determine the length of the file already written */ + + /* + * With NOBODY and NOHEADER, libcurl will issue a SIZE + * command, but the only way to retrieve the result is + * to parse the returned Content-Length header. Thus, + * getcontentlengthfunc(). We need discardfunc() above + * because HEADER will dump the headers to stdout + * without it. + */ + curl_easy_setopt(curlhandle, CURLOPT_NOBODY, 1L); + curl_easy_setopt(curlhandle, CURLOPT_HEADER, 1L); + + r = curl_easy_perform(curlhandle); + if (r != CURLE_OK) + continue; + + curl_easy_setopt(curlhandle, CURLOPT_NOBODY, 0L); + curl_easy_setopt(curlhandle, CURLOPT_HEADER, 0L); + + fseek(f, uploaded_len, SEEK_SET); + + curl_easy_setopt(curlhandle, CURLOPT_APPEND, 1L); + } + else { /* no */ + curl_easy_setopt(curlhandle, CURLOPT_APPEND, 0L); + } + + r = curl_easy_perform(curlhandle); + } + + fclose(f); + + if (r == CURLE_OK) + return 1; + else { + fprintf(stderr, "%s\n", curl_easy_strerror(r)); + return 0; + } +} + +int main(int c, char **argv) +{ + CURL *curlhandle = NULL; + + curl_global_init(CURL_GLOBAL_ALL); + curlhandle = curl_easy_init(); + + upload(curlhandle, "ftp://user:pass@example.com/path/file", "C:\\file", 0, 3); + + curl_easy_cleanup(curlhandle); + curl_global_cleanup(); + + return 0; +} diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/getinfo.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/getinfo.c new file mode 100644 index 0000000000..acbe1e1af8 --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/getinfo.c @@ -0,0 +1,53 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#include <stdio.h> +#include <curl/curl.h> + +int main(void) +{ + CURL *curl; + CURLcode res; + + /* http://curl.haxx.se/libcurl/c/curl_easy_init.html */ + curl = curl_easy_init(); + if(curl) { + /* http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTURL */ + curl_easy_setopt(curl, CURLOPT_URL, "http://www.example.com/"); + /* http://curl.haxx.se/libcurl/c/curl_easy_perform.html */ + res = curl_easy_perform(curl); + + if(CURLE_OK == res) { + char *ct; + /* ask for the content-type */ + /* http://curl.haxx.se/libcurl/c/curl_easy_getinfo.html */ + res = curl_easy_getinfo(curl, CURLINFO_CONTENT_TYPE, &ct); + + if((CURLE_OK == res) && ct) + printf("We received Content-Type: %s\n", ct); + } + + /* always cleanup */ + /* http://curl.haxx.se/libcurl/c/curl_easy_cleanup.html */ + curl_easy_cleanup(curl); + } + return 0; +} diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/getinmemory.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/getinmemory.c new file mode 100644 index 0000000000..78e6deb102 --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/getinmemory.c @@ -0,0 +1,112 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +/* Example source code to show how the callback function can be used to + * download data into a chunk of memory instead of storing it in a file. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include <curl/curl.h> + +struct MemoryStruct { + char *memory; + size_t size; +}; + + +static size_t +WriteMemoryCallback(void *contents, size_t size, size_t nmemb, void *userp) +{ + size_t realsize = size * nmemb; + struct MemoryStruct *mem = (struct MemoryStruct *)userp; + + mem->memory = realloc(mem->memory, mem->size + realsize + 1); + if (mem->memory == NULL) { + /* out of memory! */ + printf("not enough memory (realloc returned NULL)\n"); + exit(EXIT_FAILURE); + } + + memcpy(&(mem->memory[mem->size]), contents, realsize); + mem->size += realsize; + mem->memory[mem->size] = 0; + + return realsize; +} + + +int main(void) +{ + CURL *curl_handle; + + struct MemoryStruct chunk; + + chunk.memory = malloc(1); /* will be grown as needed by the realloc above */ + chunk.size = 0; /* no data at this point */ + + curl_global_init(CURL_GLOBAL_ALL); + + /* init the curl session */ + curl_handle = curl_easy_init(); + + /* specify URL to get */ + curl_easy_setopt(curl_handle, CURLOPT_URL, "http://www.example.com/"); + + /* send all data to this function */ + curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, WriteMemoryCallback); + + /* we pass our 'chunk' struct to the callback function */ + curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *)&chunk); + + /* some servers don't like requests that are made without a user-agent + field, so we provide one */ + curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, "libcurl-agent/1.0"); + + /* get it! */ + curl_easy_perform(curl_handle); + + /* cleanup curl stuff */ + curl_easy_cleanup(curl_handle); + + /* + * Now, our chunk.memory points to a memory block that is chunk.size + * bytes big and contains the remote file. + * + * Do something nice with it! + * + * You should be aware of the fact that at this point we might have an + * allocated data block, and nothing has yet deallocated that data. So when + * you're done with it, you should free() it as a nice application. + */ + + printf("%lu bytes retrieved\n", (long)chunk.size); + + if(chunk.memory) + free(chunk.memory); + + /* we're done with libcurl, so clean it up */ + curl_global_cleanup(); + + return 0; +} diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/ghiper.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/ghiper.c new file mode 100644 index 0000000000..9a3f46d3fa --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/ghiper.c @@ -0,0 +1,452 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +/* Example application source code using the multi socket interface to + * download many files at once. + * + * Written by Jeff Pohlmeyer + +Requires glib-2.x and a (POSIX?) system that has mkfifo(). + +This is an adaptation of libcurl's "hipev.c" and libevent's "event-test.c" +sample programs, adapted to use glib's g_io_channel in place of libevent. + +When running, the program creates the named pipe "hiper.fifo" + +Whenever there is input into the fifo, the program reads the input as a list +of URL's and creates some new easy handles to fetch each URL via the +curl_multi "hiper" API. + + +Thus, you can try a single URL: + % echo http://www.yahoo.com > hiper.fifo + +Or a whole bunch of them: + % cat my-url-list > hiper.fifo + +The fifo buffer is handled almost instantly, so you can even add more URL's +while the previous requests are still being downloaded. + +This is purely a demo app, all retrieved data is simply discarded by the write +callback. + +*/ + + +#include <glib.h> +#include <sys/stat.h> +#include <unistd.h> +#include <fcntl.h> +#include <stdlib.h> +#include <stdio.h> +#include <errno.h> +#include <curl/curl.h> + + +#define MSG_OUT g_print /* Change to "g_error" to write to stderr */ +#define SHOW_VERBOSE 0 /* Set to non-zero for libcurl messages */ +#define SHOW_PROGRESS 0 /* Set to non-zero to enable progress callback */ + + + +/* Global information, common to all connections */ +typedef struct _GlobalInfo { + CURLM *multi; + guint timer_event; + int still_running; +} GlobalInfo; + + + +/* Information associated with a specific easy handle */ +typedef struct _ConnInfo { + CURL *easy; + char *url; + GlobalInfo *global; + char error[CURL_ERROR_SIZE]; +} ConnInfo; + + +/* Information associated with a specific socket */ +typedef struct _SockInfo { + curl_socket_t sockfd; + CURL *easy; + int action; + long timeout; + GIOChannel *ch; + guint ev; + GlobalInfo *global; +} SockInfo; + + + + +/* Die if we get a bad CURLMcode somewhere */ +static void mcode_or_die(const char *where, CURLMcode code) { + if ( CURLM_OK != code ) { + const char *s; + switch (code) { + case CURLM_CALL_MULTI_PERFORM: s="CURLM_CALL_MULTI_PERFORM"; break; + case CURLM_BAD_HANDLE: s="CURLM_BAD_HANDLE"; break; + case CURLM_BAD_EASY_HANDLE: s="CURLM_BAD_EASY_HANDLE"; break; + case CURLM_OUT_OF_MEMORY: s="CURLM_OUT_OF_MEMORY"; break; + case CURLM_INTERNAL_ERROR: s="CURLM_INTERNAL_ERROR"; break; + case CURLM_BAD_SOCKET: s="CURLM_BAD_SOCKET"; break; + case CURLM_UNKNOWN_OPTION: s="CURLM_UNKNOWN_OPTION"; break; + case CURLM_LAST: s="CURLM_LAST"; break; + default: s="CURLM_unknown"; + } + MSG_OUT("ERROR: %s returns %s\n", where, s); + exit(code); + } +} + + + +/* Check for completed transfers, and remove their easy handles */ +static void check_multi_info(GlobalInfo *g) +{ + char *eff_url; + CURLMsg *msg; + int msgs_left; + ConnInfo *conn; + CURL *easy; + CURLcode res; + + MSG_OUT("REMAINING: %d\n", g->still_running); + while ((msg = curl_multi_info_read(g->multi, &msgs_left))) { + if (msg->msg == CURLMSG_DONE) { + easy = msg->easy_handle; + res = msg->data.result; + curl_easy_getinfo(easy, CURLINFO_PRIVATE, &conn); + curl_easy_getinfo(easy, CURLINFO_EFFECTIVE_URL, &eff_url); + MSG_OUT("DONE: %s => (%d) %s\n", eff_url, res, conn->error); + curl_multi_remove_handle(g->multi, easy); + free(conn->url); + curl_easy_cleanup(easy); + free(conn); + } + } +} + + + +/* Called by glib when our timeout expires */ +static gboolean timer_cb(gpointer data) +{ + GlobalInfo *g = (GlobalInfo *)data; + CURLMcode rc; + + rc = curl_multi_socket_action(g->multi, + CURL_SOCKET_TIMEOUT, 0, &g->still_running); + mcode_or_die("timer_cb: curl_multi_socket_action", rc); + check_multi_info(g); + return FALSE; +} + + + +/* Update the event timer after curl_multi library calls */ +static int update_timeout_cb(CURLM *multi, long timeout_ms, void *userp) +{ + struct timeval timeout; + GlobalInfo *g=(GlobalInfo *)userp; + timeout.tv_sec = timeout_ms/1000; + timeout.tv_usec = (timeout_ms%1000)*1000; + + MSG_OUT("*** update_timeout_cb %ld => %ld:%ld ***\n", + timeout_ms, timeout.tv_sec, timeout.tv_usec); + + g->timer_event = g_timeout_add(timeout_ms, timer_cb, g); + return 0; +} + + + + +/* Called by glib when we get action on a multi socket */ +static gboolean event_cb(GIOChannel *ch, GIOCondition condition, gpointer data) +{ + GlobalInfo *g = (GlobalInfo*) data; + CURLMcode rc; + int fd=g_io_channel_unix_get_fd(ch); + + int action = + (condition & G_IO_IN ? CURL_CSELECT_IN : 0) | + (condition & G_IO_OUT ? CURL_CSELECT_OUT : 0); + + rc = curl_multi_socket_action(g->multi, fd, action, &g->still_running); + mcode_or_die("event_cb: curl_multi_socket_action", rc); + + check_multi_info(g); + if(g->still_running) { + return TRUE; + } else { + MSG_OUT("last transfer done, kill timeout\n"); + if (g->timer_event) { g_source_remove(g->timer_event); } + return FALSE; + } +} + + + +/* Clean up the SockInfo structure */ +static void remsock(SockInfo *f) +{ + if (!f) { return; } + if (f->ev) { g_source_remove(f->ev); } + g_free(f); +} + + + +/* Assign information to a SockInfo structure */ +static void setsock(SockInfo*f, curl_socket_t s, CURL*e, int act, GlobalInfo*g) +{ + GIOCondition kind = + (act&CURL_POLL_IN?G_IO_IN:0)|(act&CURL_POLL_OUT?G_IO_OUT:0); + + f->sockfd = s; + f->action = act; + f->easy = e; + if (f->ev) { g_source_remove(f->ev); } + f->ev=g_io_add_watch(f->ch, kind, event_cb,g); + +} + + + +/* Initialize a new SockInfo structure */ +static void addsock(curl_socket_t s, CURL *easy, int action, GlobalInfo *g) +{ + SockInfo *fdp = g_malloc0(sizeof(SockInfo)); + + fdp->global = g; + fdp->ch=g_io_channel_unix_new(s); + setsock(fdp, s, easy, action, g); + curl_multi_assign(g->multi, s, fdp); +} + + + +/* CURLMOPT_SOCKETFUNCTION */ +static int sock_cb(CURL *e, curl_socket_t s, int what, void *cbp, void *sockp) +{ + GlobalInfo *g = (GlobalInfo*) cbp; + SockInfo *fdp = (SockInfo*) sockp; + static const char *whatstr[]={ "none", "IN", "OUT", "INOUT", "REMOVE" }; + + MSG_OUT("socket callback: s=%d e=%p what=%s ", s, e, whatstr[what]); + if (what == CURL_POLL_REMOVE) { + MSG_OUT("\n"); + remsock(fdp); + } else { + if (!fdp) { + MSG_OUT("Adding data: %s%s\n", + what&CURL_POLL_IN?"READ":"", + what&CURL_POLL_OUT?"WRITE":"" ); + addsock(s, e, what, g); + } + else { + MSG_OUT( + "Changing action from %d to %d\n", fdp->action, what); + setsock(fdp, s, e, what, g); + } + } + return 0; +} + + + +/* CURLOPT_WRITEFUNCTION */ +static size_t write_cb(void *ptr, size_t size, size_t nmemb, void *data) +{ + size_t realsize = size * nmemb; + ConnInfo *conn = (ConnInfo*) data; + (void)ptr; + (void)conn; + return realsize; +} + + + +/* CURLOPT_PROGRESSFUNCTION */ +static int prog_cb (void *p, double dltotal, double dlnow, double ult, double uln) +{ + ConnInfo *conn = (ConnInfo *)p; + MSG_OUT("Progress: %s (%g/%g)\n", conn->url, dlnow, dltotal); + return 0; +} + + + +/* Create a new easy handle, and add it to the global curl_multi */ +static void new_conn(char *url, GlobalInfo *g ) +{ + ConnInfo *conn; + CURLMcode rc; + + conn = g_malloc0(sizeof(ConnInfo)); + + conn->error[0]='\0'; + + conn->easy = curl_easy_init(); + if (!conn->easy) { + MSG_OUT("curl_easy_init() failed, exiting!\n"); + exit(2); + } + conn->global = g; + conn->url = g_strdup(url); + curl_easy_setopt(conn->easy, CURLOPT_URL, conn->url); + curl_easy_setopt(conn->easy, CURLOPT_WRITEFUNCTION, write_cb); + curl_easy_setopt(conn->easy, CURLOPT_WRITEDATA, &conn); + curl_easy_setopt(conn->easy, CURLOPT_VERBOSE, (long)SHOW_VERBOSE); + curl_easy_setopt(conn->easy, CURLOPT_ERRORBUFFER, conn->error); + curl_easy_setopt(conn->easy, CURLOPT_PRIVATE, conn); + curl_easy_setopt(conn->easy, CURLOPT_NOPROGRESS, SHOW_PROGRESS?0L:1L); + curl_easy_setopt(conn->easy, CURLOPT_PROGRESSFUNCTION, prog_cb); + curl_easy_setopt(conn->easy, CURLOPT_PROGRESSDATA, conn); + curl_easy_setopt(conn->easy, CURLOPT_FOLLOWLOCATION, 1L); + curl_easy_setopt(conn->easy, CURLOPT_CONNECTTIMEOUT, 30L); + curl_easy_setopt(conn->easy, CURLOPT_LOW_SPEED_LIMIT, 1L); + curl_easy_setopt(conn->easy, CURLOPT_LOW_SPEED_TIME, 30L); + + MSG_OUT("Adding easy %p to multi %p (%s)\n", conn->easy, g->multi, url); + rc =curl_multi_add_handle(g->multi, conn->easy); + mcode_or_die("new_conn: curl_multi_add_handle", rc); + + /* note that the add_handle() will set a time-out to trigger very soon so + that the necessary socket_action() call will be called by this app */ +} + + +/* This gets called by glib whenever data is received from the fifo */ +static gboolean fifo_cb (GIOChannel *ch, GIOCondition condition, gpointer data) +{ + #define BUF_SIZE 1024 + gsize len, tp; + gchar *buf, *tmp, *all=NULL; + GIOStatus rv; + + do { + GError *err=NULL; + rv = g_io_channel_read_line (ch,&buf,&len,&tp,&err); + if ( buf ) { + if (tp) { buf[tp]='\0'; } + new_conn(buf,(GlobalInfo*)data); + g_free(buf); + } else { + buf = g_malloc(BUF_SIZE+1); + while (TRUE) { + buf[BUF_SIZE]='\0'; + g_io_channel_read_chars(ch,buf,BUF_SIZE,&len,&err); + if (len) { + buf[len]='\0'; + if (all) { + tmp=all; + all=g_strdup_printf("%s%s", tmp, buf); + g_free(tmp); + } else { + all = g_strdup(buf); + } + } else { + break; + } + } + if (all) { + new_conn(all,(GlobalInfo*)data); + g_free(all); + } + g_free(buf); + } + if ( err ) { + g_error("fifo_cb: %s", err->message); + g_free(err); + break; + } + } while ( (len) && (rv == G_IO_STATUS_NORMAL) ); + return TRUE; +} + + + + +int init_fifo(void) +{ + struct stat st; + const char *fifo = "hiper.fifo"; + int socket; + + if (lstat (fifo, &st) == 0) { + if ((st.st_mode & S_IFMT) == S_IFREG) { + errno = EEXIST; + perror("lstat"); + exit (1); + } + } + + unlink (fifo); + if (mkfifo (fifo, 0600) == -1) { + perror("mkfifo"); + exit (1); + } + + socket = open (fifo, O_RDWR | O_NONBLOCK, 0); + + if (socket == -1) { + perror("open"); + exit (1); + } + MSG_OUT("Now, pipe some URL's into > %s\n", fifo); + + return socket; + +} + + + + +int main(int argc, char **argv) +{ + GlobalInfo *g; + CURLMcode rc; + GMainLoop*gmain; + int fd; + GIOChannel* ch; + g=g_malloc0(sizeof(GlobalInfo)); + + fd=init_fifo(); + ch=g_io_channel_unix_new(fd); + g_io_add_watch(ch,G_IO_IN,fifo_cb,g); + gmain=g_main_loop_new(NULL,FALSE); + g->multi = curl_multi_init(); + curl_multi_setopt(g->multi, CURLMOPT_SOCKETFUNCTION, sock_cb); + curl_multi_setopt(g->multi, CURLMOPT_SOCKETDATA, g); + curl_multi_setopt(g->multi, CURLMOPT_TIMERFUNCTION, update_timeout_cb); + curl_multi_setopt(g->multi, CURLMOPT_TIMERDATA, g); + + /* we don't call any curl_multi_socket*() function yet as we have no handles + added! */ + + g_main_loop_run(gmain); + curl_multi_cleanup(g->multi); + return 0; +} diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/hiperfifo.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/hiperfifo.c new file mode 100644 index 0000000000..6036643b16 --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/hiperfifo.c @@ -0,0 +1,418 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +/* Example application source code using the multi socket interface to + download many files at once. + +Written by Jeff Pohlmeyer + +Requires libevent and a (POSIX?) system that has mkfifo(). + +This is an adaptation of libcurl's "hipev.c" and libevent's "event-test.c" +sample programs. + +When running, the program creates the named pipe "hiper.fifo" + +Whenever there is input into the fifo, the program reads the input as a list +of URL's and creates some new easy handles to fetch each URL via the +curl_multi "hiper" API. + + +Thus, you can try a single URL: + % echo http://www.yahoo.com > hiper.fifo + +Or a whole bunch of them: + % cat my-url-list > hiper.fifo + +The fifo buffer is handled almost instantly, so you can even add more URL's +while the previous requests are still being downloaded. + +Note: + For the sake of simplicity, URL length is limited to 1023 char's ! + +This is purely a demo app, all retrieved data is simply discarded by the write +callback. + +*/ + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <sys/time.h> +#include <time.h> +#include <unistd.h> +#include <sys/poll.h> +#include <curl/curl.h> +#include <event.h> +#include <fcntl.h> +#include <sys/stat.h> +#include <errno.h> + + +#define MSG_OUT stdout /* Send info to stdout, change to stderr if you want */ + + +/* Global information, common to all connections */ +typedef struct _GlobalInfo { + struct event fifo_event; + struct event timer_event; + CURLM *multi; + int still_running; + FILE* input; +} GlobalInfo; + + +/* Information associated with a specific easy handle */ +typedef struct _ConnInfo { + CURL *easy; + char *url; + GlobalInfo *global; + char error[CURL_ERROR_SIZE]; +} ConnInfo; + + +/* Information associated with a specific socket */ +typedef struct _SockInfo { + curl_socket_t sockfd; + CURL *easy; + int action; + long timeout; + struct event ev; + int evset; + GlobalInfo *global; +} SockInfo; + + + +/* Update the event timer after curl_multi library calls */ +static int multi_timer_cb(CURLM *multi, long timeout_ms, GlobalInfo *g) +{ + struct timeval timeout; + (void)multi; /* unused */ + + timeout.tv_sec = timeout_ms/1000; + timeout.tv_usec = (timeout_ms%1000)*1000; + fprintf(MSG_OUT, "multi_timer_cb: Setting timeout to %ld ms\n", timeout_ms); + evtimer_add(&g->timer_event, &timeout); + return 0; +} + +/* Die if we get a bad CURLMcode somewhere */ +static void mcode_or_die(const char *where, CURLMcode code) +{ + if ( CURLM_OK != code ) { + const char *s; + switch (code) { + case CURLM_CALL_MULTI_PERFORM: s="CURLM_CALL_MULTI_PERFORM"; break; + case CURLM_BAD_HANDLE: s="CURLM_BAD_HANDLE"; break; + case CURLM_BAD_EASY_HANDLE: s="CURLM_BAD_EASY_HANDLE"; break; + case CURLM_OUT_OF_MEMORY: s="CURLM_OUT_OF_MEMORY"; break; + case CURLM_INTERNAL_ERROR: s="CURLM_INTERNAL_ERROR"; break; + case CURLM_UNKNOWN_OPTION: s="CURLM_UNKNOWN_OPTION"; break; + case CURLM_LAST: s="CURLM_LAST"; break; + default: s="CURLM_unknown"; + break; + case CURLM_BAD_SOCKET: s="CURLM_BAD_SOCKET"; + fprintf(MSG_OUT, "ERROR: %s returns %s\n", where, s); + /* ignore this error */ + return; + } + fprintf(MSG_OUT, "ERROR: %s returns %s\n", where, s); + exit(code); + } +} + + + +/* Check for completed transfers, and remove their easy handles */ +static void check_multi_info(GlobalInfo *g) +{ + char *eff_url; + CURLMsg *msg; + int msgs_left; + ConnInfo *conn; + CURL *easy; + CURLcode res; + + fprintf(MSG_OUT, "REMAINING: %d\n", g->still_running); + while ((msg = curl_multi_info_read(g->multi, &msgs_left))) { + if (msg->msg == CURLMSG_DONE) { + easy = msg->easy_handle; + res = msg->data.result; + curl_easy_getinfo(easy, CURLINFO_PRIVATE, &conn); + curl_easy_getinfo(easy, CURLINFO_EFFECTIVE_URL, &eff_url); + fprintf(MSG_OUT, "DONE: %s => (%d) %s\n", eff_url, res, conn->error); + curl_multi_remove_handle(g->multi, easy); + free(conn->url); + curl_easy_cleanup(easy); + free(conn); + } + } +} + + + +/* Called by libevent when we get action on a multi socket */ +static void event_cb(int fd, short kind, void *userp) +{ + GlobalInfo *g = (GlobalInfo*) userp; + CURLMcode rc; + + int action = + (kind & EV_READ ? CURL_CSELECT_IN : 0) | + (kind & EV_WRITE ? CURL_CSELECT_OUT : 0); + + rc = curl_multi_socket_action(g->multi, fd, action, &g->still_running); + mcode_or_die("event_cb: curl_multi_socket_action", rc); + + check_multi_info(g); + if ( g->still_running <= 0 ) { + fprintf(MSG_OUT, "last transfer done, kill timeout\n"); + if (evtimer_pending(&g->timer_event, NULL)) { + evtimer_del(&g->timer_event); + } + } +} + + + +/* Called by libevent when our timeout expires */ +static void timer_cb(int fd, short kind, void *userp) +{ + GlobalInfo *g = (GlobalInfo *)userp; + CURLMcode rc; + (void)fd; + (void)kind; + + rc = curl_multi_socket_action(g->multi, + CURL_SOCKET_TIMEOUT, 0, &g->still_running); + mcode_or_die("timer_cb: curl_multi_socket_action", rc); + check_multi_info(g); +} + + + +/* Clean up the SockInfo structure */ +static void remsock(SockInfo *f) +{ + if (f) { + if (f->evset) + event_del(&f->ev); + free(f); + } +} + + + +/* Assign information to a SockInfo structure */ +static void setsock(SockInfo*f, curl_socket_t s, CURL*e, int act, GlobalInfo*g) +{ + int kind = + (act&CURL_POLL_IN?EV_READ:0)|(act&CURL_POLL_OUT?EV_WRITE:0)|EV_PERSIST; + + f->sockfd = s; + f->action = act; + f->easy = e; + if (f->evset) + event_del(&f->ev); + event_set(&f->ev, f->sockfd, kind, event_cb, g); + f->evset=1; + event_add(&f->ev, NULL); +} + + + +/* Initialize a new SockInfo structure */ +static void addsock(curl_socket_t s, CURL *easy, int action, GlobalInfo *g) { + SockInfo *fdp = calloc(sizeof(SockInfo), 1); + + fdp->global = g; + setsock(fdp, s, easy, action, g); + curl_multi_assign(g->multi, s, fdp); +} + +/* CURLMOPT_SOCKETFUNCTION */ +static int sock_cb(CURL *e, curl_socket_t s, int what, void *cbp, void *sockp) +{ + GlobalInfo *g = (GlobalInfo*) cbp; + SockInfo *fdp = (SockInfo*) sockp; + const char *whatstr[]={ "none", "IN", "OUT", "INOUT", "REMOVE" }; + + fprintf(MSG_OUT, + "socket callback: s=%d e=%p what=%s ", s, e, whatstr[what]); + if (what == CURL_POLL_REMOVE) { + fprintf(MSG_OUT, "\n"); + remsock(fdp); + } + else { + if (!fdp) { + fprintf(MSG_OUT, "Adding data: %s\n", whatstr[what]); + addsock(s, e, what, g); + } + else { + fprintf(MSG_OUT, + "Changing action from %s to %s\n", + whatstr[fdp->action], whatstr[what]); + setsock(fdp, s, e, what, g); + } + } + return 0; +} + + + +/* CURLOPT_WRITEFUNCTION */ +static size_t write_cb(void *ptr, size_t size, size_t nmemb, void *data) +{ + size_t realsize = size * nmemb; + ConnInfo *conn = (ConnInfo*) data; + (void)ptr; + (void)conn; + return realsize; +} + + +/* CURLOPT_PROGRESSFUNCTION */ +static int prog_cb (void *p, double dltotal, double dlnow, double ult, + double uln) +{ + ConnInfo *conn = (ConnInfo *)p; + (void)ult; + (void)uln; + + fprintf(MSG_OUT, "Progress: %s (%g/%g)\n", conn->url, dlnow, dltotal); + return 0; +} + + +/* Create a new easy handle, and add it to the global curl_multi */ +static void new_conn(char *url, GlobalInfo *g ) +{ + ConnInfo *conn; + CURLMcode rc; + + conn = calloc(1, sizeof(ConnInfo)); + memset(conn, 0, sizeof(ConnInfo)); + conn->error[0]='\0'; + + conn->easy = curl_easy_init(); + if (!conn->easy) { + fprintf(MSG_OUT, "curl_easy_init() failed, exiting!\n"); + exit(2); + } + conn->global = g; + conn->url = strdup(url); + curl_easy_setopt(conn->easy, CURLOPT_URL, conn->url); + curl_easy_setopt(conn->easy, CURLOPT_WRITEFUNCTION, write_cb); + curl_easy_setopt(conn->easy, CURLOPT_WRITEDATA, &conn); + curl_easy_setopt(conn->easy, CURLOPT_VERBOSE, 1L); + curl_easy_setopt(conn->easy, CURLOPT_ERRORBUFFER, conn->error); + curl_easy_setopt(conn->easy, CURLOPT_PRIVATE, conn); + curl_easy_setopt(conn->easy, CURLOPT_NOPROGRESS, 0L); + curl_easy_setopt(conn->easy, CURLOPT_PROGRESSFUNCTION, prog_cb); + curl_easy_setopt(conn->easy, CURLOPT_PROGRESSDATA, conn); + fprintf(MSG_OUT, + "Adding easy %p to multi %p (%s)\n", conn->easy, g->multi, url); + rc = curl_multi_add_handle(g->multi, conn->easy); + mcode_or_die("new_conn: curl_multi_add_handle", rc); + + /* note that the add_handle() will set a time-out to trigger very soon so + that the necessary socket_action() call will be called by this app */ +} + +/* This gets called whenever data is received from the fifo */ +static void fifo_cb(int fd, short event, void *arg) +{ + char s[1024]; + long int rv=0; + int n=0; + GlobalInfo *g = (GlobalInfo *)arg; + (void)fd; /* unused */ + (void)event; /* unused */ + + do { + s[0]='\0'; + rv=fscanf(g->input, "%1023s%n", s, &n); + s[n]='\0'; + if ( n && s[0] ) { + new_conn(s,arg); /* if we read a URL, go get it! */ + } else break; + } while ( rv != EOF); +} + +/* Create a named pipe and tell libevent to monitor it */ +static int init_fifo (GlobalInfo *g) +{ + struct stat st; + static const char *fifo = "hiper.fifo"; + curl_socket_t sockfd; + + fprintf(MSG_OUT, "Creating named pipe \"%s\"\n", fifo); + if (lstat (fifo, &st) == 0) { + if ((st.st_mode & S_IFMT) == S_IFREG) { + errno = EEXIST; + perror("lstat"); + exit (1); + } + } + unlink(fifo); + if (mkfifo (fifo, 0600) == -1) { + perror("mkfifo"); + exit (1); + } + sockfd = open(fifo, O_RDWR | O_NONBLOCK, 0); + if (sockfd == -1) { + perror("open"); + exit (1); + } + g->input = fdopen(sockfd, "r"); + + fprintf(MSG_OUT, "Now, pipe some URL's into > %s\n", fifo); + event_set(&g->fifo_event, sockfd, EV_READ | EV_PERSIST, fifo_cb, g); + event_add(&g->fifo_event, NULL); + return (0); +} + +int main(int argc, char **argv) +{ + GlobalInfo g; + (void)argc; + (void)argv; + + memset(&g, 0, sizeof(GlobalInfo)); + event_init(); + init_fifo(&g); + g.multi = curl_multi_init(); + evtimer_set(&g.timer_event, timer_cb, &g); + + /* setup the generic multi interface options we want */ + curl_multi_setopt(g.multi, CURLMOPT_SOCKETFUNCTION, sock_cb); + curl_multi_setopt(g.multi, CURLMOPT_SOCKETDATA, &g); + curl_multi_setopt(g.multi, CURLMOPT_TIMERFUNCTION, multi_timer_cb); + curl_multi_setopt(g.multi, CURLMOPT_TIMERDATA, &g); + + /* we don't call any curl_multi_socket*() function yet as we have no handles + added! */ + + event_dispatch(); + curl_multi_cleanup(g.multi); + return 0; +} diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/href_extractor.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/href_extractor.c new file mode 100644 index 0000000000..4b307a29e4 --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/href_extractor.c @@ -0,0 +1,86 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +/* + * This example uses the "Streaming HTML parser" to extract the href pieces in + * a streaming manner from a downloaded HTML. Kindly donated by Michał + * Kowalczyk. + * + * The parser is found at + * http://code.google.com/p/htmlstreamparser/ + */ + +#include <stdio.h> +#include <curl/curl.h> +#include <htmlstreamparser.h> + + +static size_t write_callback(void *buffer, size_t size, size_t nmemb, + void *hsp) +{ + size_t realsize = size * nmemb, p; + for (p = 0; p < realsize; p++) { + html_parser_char_parse(hsp, ((char *)buffer)[p]); + if (html_parser_cmp_tag(hsp, "a", 1)) + if (html_parser_cmp_attr(hsp, "href", 4)) + if (html_parser_is_in(hsp, HTML_VALUE_ENDED)) { + html_parser_val(hsp)[html_parser_val_length(hsp)] = '\0'; + printf("%s\n", html_parser_val(hsp)); + } + } + return realsize; +} + +int main(int argc, char *argv[]) +{ + char tag[1], attr[4], val[128]; + CURL *curl; + HTMLSTREAMPARSER *hsp; + + if (argc != 2) { + printf("Usage: %s URL\n", argv[0]); + return EXIT_FAILURE; + } + + curl = curl_easy_init(); + + hsp = html_parser_init(); + + html_parser_set_tag_to_lower(hsp, 1); + html_parser_set_attr_to_lower(hsp, 1); + html_parser_set_tag_buffer(hsp, tag, sizeof(tag)); + html_parser_set_attr_buffer(hsp, attr, sizeof(attr)); + html_parser_set_val_buffer(hsp, val, sizeof(val)-1); + + curl_easy_setopt(curl, CURLOPT_URL, argv[1]); + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_callback); + curl_easy_setopt(curl, CURLOPT_WRITEDATA, hsp); + curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1); + + curl_easy_perform(curl); + + curl_easy_cleanup(curl); + + html_parser_cleanup(hsp); + + return EXIT_SUCCESS; +} diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/htmltidy.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/htmltidy.c new file mode 100644 index 0000000000..a36e331bfe --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/htmltidy.c @@ -0,0 +1,130 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +/* Download a document and use libtidy to parse the HTML. + * Written by Jeff Pohlmeyer + * + * LibTidy => http://tidy.sourceforge.net + * + * gcc -Wall -I/usr/local/include tidycurl.c -lcurl -ltidy -o tidycurl + * + */ + +#include <stdio.h> +#include <tidy/tidy.h> +#include <tidy/buffio.h> +#include <curl/curl.h> + +/* curl write callback, to fill tidy's input buffer... */ +uint write_cb(char *in, uint size, uint nmemb, TidyBuffer *out) +{ + uint r; + r = size * nmemb; + tidyBufAppend( out, in, r ); + return(r); +} + +/* Traverse the document tree */ +void dumpNode(TidyDoc doc, TidyNode tnod, int indent ) +{ + TidyNode child; + for ( child = tidyGetChild(tnod); child; child = tidyGetNext(child) ) + { + ctmbstr name = tidyNodeGetName( child ); + if ( name ) + { + /* if it has a name, then it's an HTML tag ... */ + TidyAttr attr; + printf( "%*.*s%s ", indent, indent, "<", name); + /* walk the attribute list */ + for ( attr=tidyAttrFirst(child); attr; attr=tidyAttrNext(attr) ) { + printf(tidyAttrName(attr)); + tidyAttrValue(attr)?printf("=\"%s\" ", + tidyAttrValue(attr)):printf(" "); + } + printf( ">\n"); + } + else { + /* if it doesn't have a name, then it's probably text, cdata, etc... */ + TidyBuffer buf; + tidyBufInit(&buf); + tidyNodeGetText(doc, child, &buf); + printf("%*.*s\n", indent, indent, buf.bp?(char *)buf.bp:""); + tidyBufFree(&buf); + } + dumpNode( doc, child, indent + 4 ); /* recursive */ + } +} + + +int main(int argc, char **argv ) +{ + CURL *curl; + char curl_errbuf[CURL_ERROR_SIZE]; + TidyDoc tdoc; + TidyBuffer docbuf = {0}; + TidyBuffer tidy_errbuf = {0}; + int err; + if ( argc == 2) { + curl = curl_easy_init(); + curl_easy_setopt(curl, CURLOPT_URL, argv[1]); + curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, curl_errbuf); + curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0L); + curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_cb); + + tdoc = tidyCreate(); + tidyOptSetBool(tdoc, TidyForceOutput, yes); /* try harder */ + tidyOptSetInt(tdoc, TidyWrapLen, 4096); + tidySetErrorBuffer( tdoc, &tidy_errbuf ); + tidyBufInit(&docbuf); + + curl_easy_setopt(curl, CURLOPT_WRITEDATA, &docbuf); + err=curl_easy_perform(curl); + if ( !err ) { + err = tidyParseBuffer(tdoc, &docbuf); /* parse the input */ + if ( err >= 0 ) { + err = tidyCleanAndRepair(tdoc); /* fix any problems */ + if ( err >= 0 ) { + err = tidyRunDiagnostics(tdoc); /* load tidy error buffer */ + if ( err >= 0 ) { + dumpNode( tdoc, tidyGetRoot(tdoc), 0 ); /* walk the tree */ + fprintf(stderr, "%s\n", tidy_errbuf.bp); /* show errors */ + } + } + } + } + else + fprintf(stderr, "%s\n", curl_errbuf); + + /* clean-up */ + curl_easy_cleanup(curl); + tidyBufFree(&docbuf); + tidyBufFree(&tidy_errbuf); + tidyRelease(tdoc); + return(err); + + } + else + printf( "usage: %s <url>\n", argv[0] ); + + return(0); +} diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/htmltitle.cpp b/plugins/FTPFileYM/curl-7.29.0/docs/examples/htmltitle.cpp new file mode 100644 index 0000000000..55a7935acc --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/htmltitle.cpp @@ -0,0 +1,313 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +// Get a web page, parse it with libxml. +// +// Written by Lars Nilsson +// +// GNU C++ compile command line suggestion (edit paths accordingly): +// +// g++ -Wall -I/opt/curl/include -I/opt/libxml/include/libxml2 htmltitle.cc \ +// -o htmltitle -L/opt/curl/lib -L/opt/libxml/lib -lcurl -lxml2 + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <string> +#include <curl/curl.h> +#include <libxml/HTMLparser.h> + +// +// Case-insensitive string comparison +// + +#ifdef _MSC_VER +#define COMPARE(a, b) (!stricmp((a), (b))) +#else +#define COMPARE(a, b) (!strcasecmp((a), (b))) +#endif + +// +// libxml callback context structure +// + +struct Context +{ + Context(): addTitle(false) { } + + bool addTitle; + std::string title; +}; + +// +// libcurl variables for error strings and returned data + +static char errorBuffer[CURL_ERROR_SIZE]; +static std::string buffer; + +// +// libcurl write callback function +// + +static int writer(char *data, size_t size, size_t nmemb, + std::string *writerData) +{ + if (writerData == NULL) + return 0; + + writerData->append(data, size*nmemb); + + return size * nmemb; +} + +// +// libcurl connection initialization +// + +static bool init(CURL *&conn, char *url) +{ + CURLcode code; + + conn = curl_easy_init(); + + if (conn == NULL) + { + fprintf(stderr, "Failed to create CURL connection\n"); + + exit(EXIT_FAILURE); + } + + code = curl_easy_setopt(conn, CURLOPT_ERRORBUFFER, errorBuffer); + if (code != CURLE_OK) + { + fprintf(stderr, "Failed to set error buffer [%d]\n", code); + + return false; + } + + code = curl_easy_setopt(conn, CURLOPT_URL, url); + if (code != CURLE_OK) + { + fprintf(stderr, "Failed to set URL [%s]\n", errorBuffer); + + return false; + } + + code = curl_easy_setopt(conn, CURLOPT_FOLLOWLOCATION, 1L); + if (code != CURLE_OK) + { + fprintf(stderr, "Failed to set redirect option [%s]\n", errorBuffer); + + return false; + } + + code = curl_easy_setopt(conn, CURLOPT_WRITEFUNCTION, writer); + if (code != CURLE_OK) + { + fprintf(stderr, "Failed to set writer [%s]\n", errorBuffer); + + return false; + } + + code = curl_easy_setopt(conn, CURLOPT_WRITEDATA, &buffer); + if (code != CURLE_OK) + { + fprintf(stderr, "Failed to set write data [%s]\n", errorBuffer); + + return false; + } + + return true; +} + +// +// libxml start element callback function +// + +static void StartElement(void *voidContext, + const xmlChar *name, + const xmlChar **attributes) +{ + Context *context = (Context *)voidContext; + + if (COMPARE((char *)name, "TITLE")) + { + context->title = ""; + context->addTitle = true; + } + (void) attributes; +} + +// +// libxml end element callback function +// + +static void EndElement(void *voidContext, + const xmlChar *name) +{ + Context *context = (Context *)voidContext; + + if (COMPARE((char *)name, "TITLE")) + context->addTitle = false; +} + +// +// Text handling helper function +// + +static void handleCharacters(Context *context, + const xmlChar *chars, + int length) +{ + if (context->addTitle) + context->title.append((char *)chars, length); +} + +// +// libxml PCDATA callback function +// + +static void Characters(void *voidContext, + const xmlChar *chars, + int length) +{ + Context *context = (Context *)voidContext; + + handleCharacters(context, chars, length); +} + +// +// libxml CDATA callback function +// + +static void cdata(void *voidContext, + const xmlChar *chars, + int length) +{ + Context *context = (Context *)voidContext; + + handleCharacters(context, chars, length); +} + +// +// libxml SAX callback structure +// + +static htmlSAXHandler saxHandler = +{ + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + StartElement, + EndElement, + NULL, + Characters, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + cdata, + NULL +}; + +// +// Parse given (assumed to be) HTML text and return the title +// + +static void parseHtml(const std::string &html, + std::string &title) +{ + htmlParserCtxtPtr ctxt; + Context context; + + ctxt = htmlCreatePushParserCtxt(&saxHandler, &context, "", 0, "", + XML_CHAR_ENCODING_NONE); + + htmlParseChunk(ctxt, html.c_str(), html.size(), 0); + htmlParseChunk(ctxt, "", 0, 1); + + htmlFreeParserCtxt(ctxt); + + title = context.title; +} + +int main(int argc, char *argv[]) +{ + CURL *conn = NULL; + CURLcode code; + std::string title; + + // Ensure one argument is given + + if (argc != 2) + { + fprintf(stderr, "Usage: %s <url>\n", argv[0]); + + exit(EXIT_FAILURE); + } + + curl_global_init(CURL_GLOBAL_DEFAULT); + + // Initialize CURL connection + + if (!init(conn, argv[1])) + { + fprintf(stderr, "Connection initializion failed\n"); + + exit(EXIT_FAILURE); + } + + // Retrieve content for the URL + + code = curl_easy_perform(conn); + curl_easy_cleanup(conn); + + if (code != CURLE_OK) + { + fprintf(stderr, "Failed to get '%s' [%s]\n", argv[1], errorBuffer); + + exit(EXIT_FAILURE); + } + + // Parse the (assumed) HTML code + + parseHtml(buffer, title); + + // Display the extracted title + + printf("Title: %s\n", title.c_str()); + + return EXIT_SUCCESS; +} diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/http-post.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/http-post.c new file mode 100644 index 0000000000..f1975b1ec3 --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/http-post.c @@ -0,0 +1,55 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#include <stdio.h> +#include <curl/curl.h> + +int main(void) +{ + CURL *curl; + CURLcode res; + + /* In windows, this will init the winsock stuff */ + curl_global_init(CURL_GLOBAL_ALL); + + /* get a curl handle */ + curl = curl_easy_init(); + if(curl) { + /* First set the URL that is about to receive our POST. This URL can + just as well be a https:// URL if that is what should receive the + data. */ + curl_easy_setopt(curl, CURLOPT_URL, "http://postit.example.com/moo.cgi"); + /* Now specify the POST data */ + curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "name=daniel&project=curl"); + + /* Perform the request, res will get the return code */ + res = curl_easy_perform(curl); + /* Check for errors */ + if(res != CURLE_OK) + fprintf(stderr, "curl_easy_perform() failed: %s\n", + curl_easy_strerror(res)); + + /* always cleanup */ + curl_easy_cleanup(curl); + } + curl_global_cleanup(); + return 0; +} diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/httpcustomheader.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/httpcustomheader.c new file mode 100644 index 0000000000..07ff95997f --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/httpcustomheader.c @@ -0,0 +1,61 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#include <stdio.h> +#include <curl/curl.h> + +int main(void) +{ + CURL *curl; + CURLcode res; + + curl = curl_easy_init(); + if(curl) { + struct curl_slist *chunk = NULL; + + chunk = curl_slist_append(chunk, "Accept: moo"); + chunk = curl_slist_append(chunk, "Another: yes"); + + /* request with the built-in Accept: */ + curl_easy_setopt(curl, CURLOPT_URL, "localhost"); + curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); + res = curl_easy_perform(curl); + /* Check for errors */ + if(res != CURLE_OK) + fprintf(stderr, "curl_easy_perform() failed: %s\n", + curl_easy_strerror(res)); + + /* redo request with our own custom Accept: */ + res = curl_easy_setopt(curl, CURLOPT_HTTPHEADER, chunk); + res = curl_easy_perform(curl); + /* Check for errors */ + if(res != CURLE_OK) + fprintf(stderr, "curl_easy_perform() failed: %s\n", + curl_easy_strerror(res)); + + /* always cleanup */ + curl_easy_cleanup(curl); + + /* free the custom headers */ + curl_slist_free_all(chunk); + } + return 0; +} diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/httpput.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/httpput.c new file mode 100644 index 0000000000..fbbca9448b --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/httpput.c @@ -0,0 +1,125 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#include <stdio.h> +#include <fcntl.h> +#include <sys/stat.h> +#include <unistd.h> + +#include <curl/curl.h> + +/* + * This example shows a HTTP PUT operation. PUTs a file given as a command + * line argument to the URL also given on the command line. + * + * This example also uses its own read callback. + * + * Here's an article on how to setup a PUT handler for Apache: + * http://www.apacheweek.com/features/put + */ + +static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *stream) +{ + size_t retcode; + curl_off_t nread; + + /* in real-world cases, this would probably get this data differently + as this fread() stuff is exactly what the library already would do + by default internally */ + retcode = fread(ptr, size, nmemb, stream); + + nread = (curl_off_t)retcode; + + fprintf(stderr, "*** We read %" CURL_FORMAT_CURL_OFF_T + " bytes from file\n", nread); + + return retcode; +} + +int main(int argc, char **argv) +{ + CURL *curl; + CURLcode res; + FILE * hd_src ; + int hd ; + struct stat file_info; + + char *file; + char *url; + + if(argc < 3) + return 1; + + file= argv[1]; + url = argv[2]; + + /* get the file size of the local file */ + hd = open(file, O_RDONLY) ; + fstat(hd, &file_info); + close(hd) ; + + /* get a FILE * of the same file, could also be made with + fdopen() from the previous descriptor, but hey this is just + an example! */ + hd_src = fopen(file, "rb"); + + /* In windows, this will init the winsock stuff */ + curl_global_init(CURL_GLOBAL_ALL); + + /* get a curl handle */ + curl = curl_easy_init(); + if(curl) { + /* we want to use our own read function */ + curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback); + + /* enable uploading */ + curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L); + + /* HTTP PUT please */ + curl_easy_setopt(curl, CURLOPT_PUT, 1L); + + /* specify target URL, and note that this URL should include a file + name, not only a directory */ + curl_easy_setopt(curl, CURLOPT_URL, url); + + /* now specify which file to upload */ + curl_easy_setopt(curl, CURLOPT_READDATA, hd_src); + + /* provide the size of the upload, we specicially typecast the value + to curl_off_t since we must be sure to use the correct data size */ + curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE, + (curl_off_t)file_info.st_size); + + /* Now run off and do what you've been told! */ + res = curl_easy_perform(curl); + /* Check for errors */ + if(res != CURLE_OK) + fprintf(stderr, "curl_easy_perform() failed: %s\n", + curl_easy_strerror(res)); + + /* always cleanup */ + curl_easy_cleanup(curl); + } + fclose(hd_src); /* close the local file */ + + curl_global_cleanup(); + return 0; +} diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/https.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/https.c new file mode 100644 index 0000000000..bd9a33ba6d --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/https.c @@ -0,0 +1,74 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#include <stdio.h> +#include <curl/curl.h> + +int main(void) +{ + CURL *curl; + CURLcode res; + + curl_global_init(CURL_GLOBAL_DEFAULT); + + curl = curl_easy_init(); + if(curl) { + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); + +#ifdef SKIP_PEER_VERIFICATION + /* + * If you want to connect to a site who isn't using a certificate that is + * signed by one of the certs in the CA bundle you have, you can skip the + * verification of the server's certificate. This makes the connection + * A LOT LESS SECURE. + * + * If you have a CA cert for the server stored someplace else than in the + * default bundle, then the CURLOPT_CAPATH option might come handy for + * you. + */ + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L); +#endif + +#ifdef SKIP_HOSTNAME_VERIFICATION + /* + * If the site you're connecting to uses a different host name that what + * they have mentioned in their server certificate's commonName (or + * subjectAltName) fields, libcurl will refuse to connect. You can skip + * this check, but this will make the connection less secure. + */ + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L); +#endif + + /* Perform the request, res will get the return code */ + res = curl_easy_perform(curl); + /* Check for errors */ + if(res != CURLE_OK) + fprintf(stderr, "curl_easy_perform() failed: %s\n", + curl_easy_strerror(res)); + + /* always cleanup */ + curl_easy_cleanup(curl); + } + + curl_global_cleanup(); + + return 0; +} diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/imap.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/imap.c new file mode 100644 index 0000000000..ba07f022aa --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/imap.c @@ -0,0 +1,44 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#include <stdio.h> +#include <curl/curl.h> + +int main(void) +{ + CURL *curl; + CURLcode res = CURLE_OK; + + curl = curl_easy_init(); + if(curl) { + /* Set username and password */ + curl_easy_setopt(curl, CURLOPT_USERPWD, "user:password"); + + /* This will fetch the mailbox named "foobar" */ + curl_easy_setopt(curl, CURLOPT_URL, "imap://imap.example.com/foobar"); + + res = curl_easy_perform(curl); + + /* always cleanup */ + curl_easy_cleanup(curl); + } + return (int)res; +} diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/makefile.dj b/plugins/FTPFileYM/curl-7.29.0/docs/examples/makefile.dj new file mode 100644 index 0000000000..c18ef8a708 --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/makefile.dj @@ -0,0 +1,60 @@ +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at http://curl.haxx.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### +# +# Adapted for djgpp / Watt-32 / DOS by +# Gisle Vanem <gvanem@broadpark.no> +# + +TOPDIR = ../.. + +include $(TOPDIR)/packages/DOS/common.dj + +CFLAGS += -DFALSE=0 -DTRUE=1 + +LIBS = $(TOPDIR)/lib/libcurl.a + +ifeq ($(USE_SSL),1) + LIBS += $(OPENSSL_ROOT)/lib/libssl.a $(OPENSSL_ROOT)/lib/libcrypt.a +endif + +ifeq ($(USE_IDNA),1) + LIBS += $(LIBIDN_ROOT)/lib/dj_obj/libidn.a -liconv +endif + +LIBS += $(WATT32_ROOT)/lib/libwatt.a $(ZLIB_ROOT)/libz.a + +include Makefile.inc + +PROGRAMS = $(patsubst %,%.exe,$(check_PROGRAMS)) + +all: $(PROGRAMS) + @echo Welcome to libcurl example program + +%.exe: %.c + $(CC) $(CFLAGS) -o $@ $^ $(LIBS) + @echo + +clean vclean realclean: + - rm -f $(PROGRAMS) depend.dj + +-include depend.dj + diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/multi-app.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/multi-app.c new file mode 100644 index 0000000000..a5f71c5ac6 --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/multi-app.c @@ -0,0 +1,153 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +/* This is an example application source code using the multi interface. */ + +#include <stdio.h> +#include <string.h> + +/* somewhat unix-specific */ +#include <sys/time.h> +#include <unistd.h> + +/* curl stuff */ +#include <curl/curl.h> + +/* + * Download a HTTP file and upload an FTP file simultaneously. + */ + +#define HANDLECOUNT 2 /* Number of simultaneous transfers */ +#define HTTP_HANDLE 0 /* Index for the HTTP transfer */ +#define FTP_HANDLE 1 /* Index for the FTP transfer */ + +int main(void) +{ + CURL *handles[HANDLECOUNT]; + CURLM *multi_handle; + + int still_running; /* keep number of running handles */ + int i; + + CURLMsg *msg; /* for picking up messages with the transfer status */ + int msgs_left; /* how many messages are left */ + + /* Allocate one CURL handle per transfer */ + for (i=0; i<HANDLECOUNT; i++) + handles[i] = curl_easy_init(); + + /* set the options (I left out a few, you'll get the point anyway) */ + curl_easy_setopt(handles[HTTP_HANDLE], CURLOPT_URL, "http://example.com"); + + curl_easy_setopt(handles[FTP_HANDLE], CURLOPT_URL, "ftp://example.com"); + curl_easy_setopt(handles[FTP_HANDLE], CURLOPT_UPLOAD, 1L); + + /* init a multi stack */ + multi_handle = curl_multi_init(); + + /* add the individual transfers */ + for (i=0; i<HANDLECOUNT; i++) + curl_multi_add_handle(multi_handle, handles[i]); + + /* we start some action by calling perform right away */ + curl_multi_perform(multi_handle, &still_running); + + do { + struct timeval timeout; + int rc; /* select() return code */ + + fd_set fdread; + fd_set fdwrite; + fd_set fdexcep; + int maxfd = -1; + + long curl_timeo = -1; + + FD_ZERO(&fdread); + FD_ZERO(&fdwrite); + FD_ZERO(&fdexcep); + + /* set a suitable timeout to play around with */ + timeout.tv_sec = 1; + timeout.tv_usec = 0; + + curl_multi_timeout(multi_handle, &curl_timeo); + if(curl_timeo >= 0) { + timeout.tv_sec = curl_timeo / 1000; + if(timeout.tv_sec > 1) + timeout.tv_sec = 1; + else + timeout.tv_usec = (curl_timeo % 1000) * 1000; + } + + /* get file descriptors from the transfers */ + curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd); + + /* In a real-world program you OF COURSE check the return code of the + function calls. On success, the value of maxfd is guaranteed to be + greater or equal than -1. We call select(maxfd + 1, ...), specially in + case of (maxfd == -1), we call select(0, ...), which is basically equal + to sleep. */ + + rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout); + + switch(rc) { + case -1: + /* select error */ + break; + case 0: /* timeout */ + default: /* action */ + curl_multi_perform(multi_handle, &still_running); + break; + } + } while(still_running); + + /* See how the transfers went */ + while ((msg = curl_multi_info_read(multi_handle, &msgs_left))) { + if (msg->msg == CURLMSG_DONE) { + int idx, found = 0; + + /* Find out which handle this message is about */ + for (idx=0; idx<HANDLECOUNT; idx++) { + found = (msg->easy_handle == handles[idx]); + if(found) + break; + } + + switch (idx) { + case HTTP_HANDLE: + printf("HTTP transfer completed with status %d\n", msg->data.result); + break; + case FTP_HANDLE: + printf("FTP transfer completed with status %d\n", msg->data.result); + break; + } + } + } + + curl_multi_cleanup(multi_handle); + + /* Free the CURL handles */ + for (i=0; i<HANDLECOUNT; i++) + curl_easy_cleanup(handles[i]); + + return 0; +} diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/multi-debugcallback.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/multi-debugcallback.c new file mode 100644 index 0000000000..8eedcee5b5 --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/multi-debugcallback.c @@ -0,0 +1,205 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +/* This is an example showing the multi interface and the debug callback. */ + +#include <stdio.h> +#include <string.h> + +/* somewhat unix-specific */ +#include <sys/time.h> +#include <unistd.h> + +/* curl stuff */ +#include <curl/curl.h> + +typedef char bool; +#define TRUE 1 + +static +void dump(const char *text, + FILE *stream, unsigned char *ptr, size_t size, + bool nohex) +{ + size_t i; + size_t c; + + unsigned int width=0x10; + + if(nohex) + /* without the hex output, we can fit more on screen */ + width = 0x40; + + fprintf(stream, "%s, %10.10ld bytes (0x%8.8lx)\n", + text, (long)size, (long)size); + + for(i=0; i<size; i+= width) { + + fprintf(stream, "%4.4lx: ", (long)i); + + if(!nohex) { + /* hex not disabled, show it */ + for(c = 0; c < width; c++) + if(i+c < size) + fprintf(stream, "%02x ", ptr[i+c]); + else + fputs(" ", stream); + } + + for(c = 0; (c < width) && (i+c < size); c++) { + /* check for 0D0A; if found, skip past and start a new line of output */ + if (nohex && (i+c+1 < size) && ptr[i+c]==0x0D && ptr[i+c+1]==0x0A) { + i+=(c+2-width); + break; + } + fprintf(stream, "%c", + (ptr[i+c]>=0x20) && (ptr[i+c]<0x80)?ptr[i+c]:'.'); + /* check again for 0D0A, to avoid an extra \n if it's at width */ + if (nohex && (i+c+2 < size) && ptr[i+c+1]==0x0D && ptr[i+c+2]==0x0A) { + i+=(c+3-width); + break; + } + } + fputc('\n', stream); /* newline */ + } + fflush(stream); +} + +static +int my_trace(CURL *handle, curl_infotype type, + unsigned char *data, size_t size, + void *userp) +{ + const char *text; + + (void)userp; + (void)handle; /* prevent compiler warning */ + + switch (type) { + case CURLINFO_TEXT: + fprintf(stderr, "== Info: %s", data); + default: /* in case a new one is introduced to shock us */ + return 0; + + case CURLINFO_HEADER_OUT: + text = "=> Send header"; + break; + case CURLINFO_DATA_OUT: + text = "=> Send data"; + break; + case CURLINFO_HEADER_IN: + text = "<= Recv header"; + break; + case CURLINFO_DATA_IN: + text = "<= Recv data"; + break; + } + + dump(text, stderr, data, size, TRUE); + return 0; +} + +/* + * Simply download a HTTP file. + */ +int main(void) +{ + CURL *http_handle; + CURLM *multi_handle; + + int still_running; /* keep number of running handles */ + + http_handle = curl_easy_init(); + + /* set the options (I left out a few, you'll get the point anyway) */ + curl_easy_setopt(http_handle, CURLOPT_URL, "http://www.example.com/"); + + curl_easy_setopt(http_handle, CURLOPT_DEBUGFUNCTION, my_trace); + curl_easy_setopt(http_handle, CURLOPT_VERBOSE, 1L); + + /* init a multi stack */ + multi_handle = curl_multi_init(); + + /* add the individual transfers */ + curl_multi_add_handle(multi_handle, http_handle); + + /* we start some action by calling perform right away */ + curl_multi_perform(multi_handle, &still_running); + + do { + struct timeval timeout; + int rc; /* select() return code */ + + fd_set fdread; + fd_set fdwrite; + fd_set fdexcep; + int maxfd = -1; + + long curl_timeo = -1; + + FD_ZERO(&fdread); + FD_ZERO(&fdwrite); + FD_ZERO(&fdexcep); + + /* set a suitable timeout to play around with */ + timeout.tv_sec = 1; + timeout.tv_usec = 0; + + curl_multi_timeout(multi_handle, &curl_timeo); + if(curl_timeo >= 0) { + timeout.tv_sec = curl_timeo / 1000; + if(timeout.tv_sec > 1) + timeout.tv_sec = 1; + else + timeout.tv_usec = (curl_timeo % 1000) * 1000; + } + + /* get file descriptors from the transfers */ + curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd); + + /* In a real-world program you OF COURSE check the return code of the + function calls. On success, the value of maxfd is guaranteed to be + greater or equal than -1. We call select(maxfd + 1, ...), specially in + case of (maxfd == -1), we call select(0, ...), which is basically equal + to sleep. */ + + rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout); + + switch(rc) { + case -1: + /* select error */ + still_running = 0; + printf("select() returns error, this is badness\n"); + break; + case 0: + default: + /* timeout or readable/writable sockets */ + curl_multi_perform(multi_handle, &still_running); + break; + } + } while(still_running); + + curl_multi_cleanup(multi_handle); + + curl_easy_cleanup(http_handle); + + return 0; +} diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/multi-double.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/multi-double.c new file mode 100644 index 0000000000..91422e6e2d --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/multi-double.c @@ -0,0 +1,119 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#include <stdio.h> +#include <string.h> + +/* somewhat unix-specific */ +#include <sys/time.h> +#include <unistd.h> + +/* curl stuff */ +#include <curl/curl.h> + +/* + * Simply download two HTTP files! + */ +int main(void) +{ + CURL *http_handle; + CURL *http_handle2; + CURLM *multi_handle; + + int still_running; /* keep number of running handles */ + + http_handle = curl_easy_init(); + http_handle2 = curl_easy_init(); + + /* set options */ + curl_easy_setopt(http_handle, CURLOPT_URL, "http://www.example.com/"); + + /* set options */ + curl_easy_setopt(http_handle2, CURLOPT_URL, "http://localhost/"); + + /* init a multi stack */ + multi_handle = curl_multi_init(); + + /* add the individual transfers */ + curl_multi_add_handle(multi_handle, http_handle); + curl_multi_add_handle(multi_handle, http_handle2); + + /* we start some action by calling perform right away */ + curl_multi_perform(multi_handle, &still_running); + + do { + struct timeval timeout; + int rc; /* select() return code */ + + fd_set fdread; + fd_set fdwrite; + fd_set fdexcep; + int maxfd = -1; + + long curl_timeo = -1; + + FD_ZERO(&fdread); + FD_ZERO(&fdwrite); + FD_ZERO(&fdexcep); + + /* set a suitable timeout to play around with */ + timeout.tv_sec = 1; + timeout.tv_usec = 0; + + curl_multi_timeout(multi_handle, &curl_timeo); + if(curl_timeo >= 0) { + timeout.tv_sec = curl_timeo / 1000; + if(timeout.tv_sec > 1) + timeout.tv_sec = 1; + else + timeout.tv_usec = (curl_timeo % 1000) * 1000; + } + + /* get file descriptors from the transfers */ + curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd); + + /* In a real-world program you OF COURSE check the return code of the + function calls. On success, the value of maxfd is guaranteed to be + greater or equal than -1. We call select(maxfd + 1, ...), specially in + case of (maxfd == -1), we call select(0, ...), which is basically equal + to sleep. */ + + rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout); + + switch(rc) { + case -1: + /* select error */ + break; + case 0: + default: + /* timeout or readable/writable sockets */ + curl_multi_perform(multi_handle, &still_running); + break; + } + } while(still_running); + + curl_multi_cleanup(multi_handle); + + curl_easy_cleanup(http_handle); + curl_easy_cleanup(http_handle2); + + return 0; +} diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/multi-post.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/multi-post.c new file mode 100644 index 0000000000..965a2c3f69 --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/multi-post.c @@ -0,0 +1,148 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +/* This is an example application source code using the multi interface + * to do a multipart formpost without "blocking". */ +#include <stdio.h> +#include <string.h> +#include <sys/time.h> + +#include <curl/curl.h> + +int main(void) +{ + CURL *curl; + + CURLM *multi_handle; + int still_running; + + struct curl_httppost *formpost=NULL; + struct curl_httppost *lastptr=NULL; + struct curl_slist *headerlist=NULL; + static const char buf[] = "Expect:"; + + /* Fill in the file upload field. This makes libcurl load data from + the given file name when curl_easy_perform() is called. */ + curl_formadd(&formpost, + &lastptr, + CURLFORM_COPYNAME, "sendfile", + CURLFORM_FILE, "postit2.c", + CURLFORM_END); + + /* Fill in the filename field */ + curl_formadd(&formpost, + &lastptr, + CURLFORM_COPYNAME, "filename", + CURLFORM_COPYCONTENTS, "postit2.c", + CURLFORM_END); + + /* Fill in the submit field too, even if this is rarely needed */ + curl_formadd(&formpost, + &lastptr, + CURLFORM_COPYNAME, "submit", + CURLFORM_COPYCONTENTS, "send", + CURLFORM_END); + + curl = curl_easy_init(); + multi_handle = curl_multi_init(); + + /* initalize custom header list (stating that Expect: 100-continue is not + wanted */ + headerlist = curl_slist_append(headerlist, buf); + if(curl && multi_handle) { + + /* what URL that receives this POST */ + curl_easy_setopt(curl, CURLOPT_URL, "http://www.example.com/upload.cgi"); + curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); + + curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headerlist); + curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost); + + curl_multi_add_handle(multi_handle, curl); + + curl_multi_perform(multi_handle, &still_running); + + do { + struct timeval timeout; + int rc; /* select() return code */ + + fd_set fdread; + fd_set fdwrite; + fd_set fdexcep; + int maxfd = -1; + + long curl_timeo = -1; + + FD_ZERO(&fdread); + FD_ZERO(&fdwrite); + FD_ZERO(&fdexcep); + + /* set a suitable timeout to play around with */ + timeout.tv_sec = 1; + timeout.tv_usec = 0; + + curl_multi_timeout(multi_handle, &curl_timeo); + if(curl_timeo >= 0) { + timeout.tv_sec = curl_timeo / 1000; + if(timeout.tv_sec > 1) + timeout.tv_sec = 1; + else + timeout.tv_usec = (curl_timeo % 1000) * 1000; + } + + /* get file descriptors from the transfers */ + curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd); + + /* In a real-world program you OF COURSE check the return code of the + function calls. On success, the value of maxfd is guaranteed to be + greater or equal than -1. We call select(maxfd + 1, ...), specially in + case of (maxfd == -1), we call select(0, ...), which is basically equal + to sleep. */ + + rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout); + + switch(rc) { + case -1: + /* select error */ + break; + case 0: + default: + /* timeout or readable/writable sockets */ + printf("perform!\n"); + curl_multi_perform(multi_handle, &still_running); + printf("running: %d!\n", still_running); + break; + } + } while(still_running); + + curl_multi_cleanup(multi_handle); + + /* always cleanup */ + curl_easy_cleanup(curl); + + /* then cleanup the formpost chain */ + curl_formfree(formpost); + + /* free slist */ + curl_slist_free_all (headerlist); + } + return 0; +} diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/multi-single.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/multi-single.c new file mode 100644 index 0000000000..aeda71419b --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/multi-single.c @@ -0,0 +1,116 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +/* This is a very simple example using the multi interface. */ + +#include <stdio.h> +#include <string.h> + +/* somewhat unix-specific */ +#include <sys/time.h> +#include <unistd.h> + +/* curl stuff */ +#include <curl/curl.h> + +/* + * Simply download a HTTP file. + */ +int main(void) +{ + CURL *http_handle; + CURLM *multi_handle; + + int still_running; /* keep number of running handles */ + + http_handle = curl_easy_init(); + + /* set the options (I left out a few, you'll get the point anyway) */ + curl_easy_setopt(http_handle, CURLOPT_URL, "http://www.example.com/"); + + /* init a multi stack */ + multi_handle = curl_multi_init(); + + /* add the individual transfers */ + curl_multi_add_handle(multi_handle, http_handle); + + /* we start some action by calling perform right away */ + curl_multi_perform(multi_handle, &still_running); + + do { + struct timeval timeout; + int rc; /* select() return code */ + + fd_set fdread; + fd_set fdwrite; + fd_set fdexcep; + int maxfd = -1; + + long curl_timeo = -1; + + FD_ZERO(&fdread); + FD_ZERO(&fdwrite); + FD_ZERO(&fdexcep); + + /* set a suitable timeout to play around with */ + timeout.tv_sec = 1; + timeout.tv_usec = 0; + + curl_multi_timeout(multi_handle, &curl_timeo); + if(curl_timeo >= 0) { + timeout.tv_sec = curl_timeo / 1000; + if(timeout.tv_sec > 1) + timeout.tv_sec = 1; + else + timeout.tv_usec = (curl_timeo % 1000) * 1000; + } + + /* get file descriptors from the transfers */ + curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd); + + /* In a real-world program you OF COURSE check the return code of the + function calls. On success, the value of maxfd is guaranteed to be + greater or equal than -1. We call select(maxfd + 1, ...), specially in + case of (maxfd == -1), we call select(0, ...), which is basically equal + to sleep. */ + + rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout); + + switch(rc) { + case -1: + /* select error */ + still_running = 0; + printf("select() returns error, this is badness\n"); + break; + case 0: + default: + /* timeout or readable/writable sockets */ + curl_multi_perform(multi_handle, &still_running); + break; + } + } while(still_running); + + curl_multi_cleanup(multi_handle); + + curl_easy_cleanup(http_handle); + + return 0; +} diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/multithread.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/multithread.c new file mode 100644 index 0000000000..831a07467a --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/multithread.c @@ -0,0 +1,93 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +/* A multi-threaded example that uses pthreads extensively to fetch + * X remote files at once */ + +#include <stdio.h> +#include <pthread.h> +#include <curl/curl.h> + +#define NUMT 4 + +/* + List of URLs to fetch. + + If you intend to use a SSL-based protocol here you MUST setup the OpenSSL + callback functions as described here: + + http://www.openssl.org/docs/crypto/threads.html#DESCRIPTION + +*/ +const char * const urls[NUMT]= { + "http://curl.haxx.se/", + "ftp://cool.haxx.se/", + "http://www.contactor.se/", + "www.haxx.se" +}; + +static void *pull_one_url(void *url) +{ + CURL *curl; + + curl = curl_easy_init(); + curl_easy_setopt(curl, CURLOPT_URL, url); + curl_easy_perform(curl); /* ignores error */ + curl_easy_cleanup(curl); + + return NULL; +} + + +/* + int pthread_create(pthread_t *new_thread_ID, + const pthread_attr_t *attr, + void * (*start_func)(void *), void *arg); +*/ + +int main(int argc, char **argv) +{ + pthread_t tid[NUMT]; + int i; + int error; + + /* Must initialize libcurl before any threads are started */ + curl_global_init(CURL_GLOBAL_ALL); + + for(i=0; i< NUMT; i++) { + error = pthread_create(&tid[i], + NULL, /* default attributes please */ + pull_one_url, + (void *)urls[i]); + if(0 != error) + fprintf(stderr, "Couldn't run thread number %d, errno %d\n", i, error); + else + fprintf(stderr, "Thread %d, gets %s\n", i, urls[i]); + } + + /* now wait for all threads to terminate */ + for(i=0; i< NUMT; i++) { + error = pthread_join(tid[i], NULL); + fprintf(stderr, "Thread %d terminated\n", i); + } + + return 0; +} diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/opensslthreadlock.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/opensslthreadlock.c new file mode 100644 index 0000000000..ad54f08ea5 --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/opensslthreadlock.c @@ -0,0 +1,94 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +/* Example source code to show one way to set the necessary OpenSSL locking + * callbacks if you want to do multi-threaded transfers with HTTPS/FTPS with + * libcurl built to use OpenSSL. + * + * This is not a complete stand-alone example. + * + * Author: Jeremy Brown + */ + + +#include <stdio.h> +#include <pthread.h> +#include <openssl/err.h> + +#define MUTEX_TYPE pthread_mutex_t +#define MUTEX_SETUP(x) pthread_mutex_init(&(x), NULL) +#define MUTEX_CLEANUP(x) pthread_mutex_destroy(&(x)) +#define MUTEX_LOCK(x) pthread_mutex_lock(&(x)) +#define MUTEX_UNLOCK(x) pthread_mutex_unlock(&(x)) +#define THREAD_ID pthread_self( ) + + +void handle_error(const char *file, int lineno, const char *msg){ + fprintf(stderr, "** %s:%d %s\n", file, lineno, msg); + ERR_print_errors_fp(stderr); + /* exit(-1); */ + } + +/* This array will store all of the mutexes available to OpenSSL. */ +static MUTEX_TYPE *mutex_buf= NULL; + + +static void locking_function(int mode, int n, const char * file, int line) +{ + if (mode & CRYPTO_LOCK) + MUTEX_LOCK(mutex_buf[n]); + else + MUTEX_UNLOCK(mutex_buf[n]); +} + +static unsigned long id_function(void) +{ + return ((unsigned long)THREAD_ID); +} + +int thread_setup(void) +{ + int i; + + mutex_buf = malloc(CRYPTO_num_locks( ) * sizeof(MUTEX_TYPE)); + if (!mutex_buf) + return 0; + for (i = 0; i < CRYPTO_num_locks( ); i++) + MUTEX_SETUP(mutex_buf[i]); + CRYPTO_set_id_callback(id_function); + CRYPTO_set_locking_callback(locking_function); + return 1; +} + +int thread_cleanup(void) +{ + int i; + + if (!mutex_buf) + return 0; + CRYPTO_set_id_callback(NULL); + CRYPTO_set_locking_callback(NULL); + for (i = 0; i < CRYPTO_num_locks( ); i++) + MUTEX_CLEANUP(mutex_buf[i]); + free(mutex_buf); + mutex_buf = NULL; + return 1; +} diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/persistant.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/persistant.c new file mode 100644 index 0000000000..0917dfdb81 --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/persistant.c @@ -0,0 +1,64 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#include <stdio.h> +#include <unistd.h> +#include <curl/curl.h> + +int main(void) +{ + CURL *curl; + CURLcode res; + + curl_global_init(CURL_GLOBAL_ALL); + + curl = curl_easy_init(); + if(curl) { + curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); + curl_easy_setopt(curl, CURLOPT_HEADER, 1L); + + /* get the first document */ + curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/"); + + /* Perform the request, res will get the return code */ + res = curl_easy_perform(curl); + /* Check for errors */ + if(res != CURLE_OK) + fprintf(stderr, "curl_easy_perform() failed: %s\n", + curl_easy_strerror(res)); + + /* get another document from the same server using the same + connection */ + curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/docs/"); + + /* Perform the request, res will get the return code */ + res = curl_easy_perform(curl); + /* Check for errors */ + if(res != CURLE_OK) + fprintf(stderr, "curl_easy_perform() failed: %s\n", + curl_easy_strerror(res)); + + /* always cleanup */ + curl_easy_cleanup(curl); + } + + return 0; +} diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/pop3s.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/pop3s.c new file mode 100644 index 0000000000..44d7c80d0f --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/pop3s.c @@ -0,0 +1,73 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#include <stdio.h> +#include <curl/curl.h> + +int main(void) +{ + CURL *curl; + CURLcode res; + + curl = curl_easy_init(); + if(curl) { + /* Set username and password */ + curl_easy_setopt(curl, CURLOPT_USERPWD, "user:password"); + + /* This will only fetch the message with ID "1" of the given mailbox */ + curl_easy_setopt(curl, CURLOPT_URL, "pop3s://user@pop.example.com/1"); + +#ifdef SKIP_PEER_VERIFICATION + /* + * If you want to connect to a site who isn't using a certificate that is + * signed by one of the certs in the CA bundle you have, you can skip the + * verification of the server's certificate. This makes the connection + * A LOT LESS SECURE. + * + * If you have a CA cert for the server stored someplace else than in the + * default bundle, then the CURLOPT_CAPATH option might come handy for + * you. + */ + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L); +#endif + +#ifdef SKIP_HOSTNAME_VERFICATION + /* + * If the site you're connecting to uses a different host name that what + * they have mentioned in their server certificate's commonName (or + * subjectAltName) fields, libcurl will refuse to connect. You can skip + * this check, but this will make the connection less secure. + */ + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L); +#endif + + /* Perform the request, res will get the return code */ + res = curl_easy_perform(curl); + /* Check for errors */ + if(res != CURLE_OK) + fprintf(stderr, "curl_easy_perform() failed: %s\n", + curl_easy_strerror(res)); + + /* always cleanup */ + curl_easy_cleanup(curl); + } + return 0; +} diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/pop3slist.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/pop3slist.c new file mode 100644 index 0000000000..9d9668fa0a --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/pop3slist.c @@ -0,0 +1,73 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#include <stdio.h> +#include <curl/curl.h> + +int main(void) +{ + CURL *curl; + CURLcode res; + + curl = curl_easy_init(); + if(curl) { + /* Set username and password */ + curl_easy_setopt(curl, CURLOPT_USERPWD, "user:password"); + + /* This will list every message of the given mailbox */ + curl_easy_setopt(curl, CURLOPT_URL, "pop3s://user@pop.example.com/"); + +#ifdef SKIP_PEER_VERIFICATION + /* + * If you want to connect to a site who isn't using a certificate that is + * signed by one of the certs in the CA bundle you have, you can skip the + * verification of the server's certificate. This makes the connection + * A LOT LESS SECURE. + * + * If you have a CA cert for the server stored someplace else than in the + * default bundle, then the CURLOPT_CAPATH option might come handy for + * you. + */ + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L); +#endif + +#ifdef SKIP_HOSTNAME_VERFICATION + /* + * If the site you're connecting to uses a different host name that what + * they have mentioned in their server certificate's commonName (or + * subjectAltName) fields, libcurl will refuse to connect. You can skip + * this check, but this will make the connection less secure. + */ + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L); +#endif + + /* Perform the request, res will get the return code */ + res = curl_easy_perform(curl); + /* Check for errors */ + if(res != CURLE_OK) + fprintf(stderr, "curl_easy_perform() failed: %s\n", + curl_easy_strerror(res)); + + /* always cleanup */ + curl_easy_cleanup(curl); + } + return 0; +} diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/post-callback.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/post-callback.c new file mode 100644 index 0000000000..3e1cfb0605 --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/post-callback.c @@ -0,0 +1,143 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +/* An example source code that issues a HTTP POST and we provide the actual + * data through a read callback. + */ +#include <stdio.h> +#include <string.h> +#include <curl/curl.h> + +const char data[]="this is what we post to the silly web server"; + +struct WriteThis { + const char *readptr; + long sizeleft; +}; + +static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *userp) +{ + struct WriteThis *pooh = (struct WriteThis *)userp; + + if(size*nmemb < 1) + return 0; + + if(pooh->sizeleft) { + *(char *)ptr = pooh->readptr[0]; /* copy one single byte */ + pooh->readptr++; /* advance pointer */ + pooh->sizeleft--; /* less data left */ + return 1; /* we return 1 byte at a time! */ + } + + return 0; /* no more data left to deliver */ +} + +int main(void) +{ + CURL *curl; + CURLcode res; + + struct WriteThis pooh; + + pooh.readptr = data; + pooh.sizeleft = (long)strlen(data); + + /* In windows, this will init the winsock stuff */ + res = curl_global_init(CURL_GLOBAL_DEFAULT); + /* Check for errors */ + if(res != CURLE_OK) { + fprintf(stderr, "curl_global_init() failed: %s\n", + curl_easy_strerror(res)); + return 1; + } + + /* get a curl handle */ + curl = curl_easy_init(); + if(curl) { + /* First set the URL that is about to receive our POST. */ + curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/index.cgi"); + + /* Now specify we want to POST data */ + curl_easy_setopt(curl, CURLOPT_POST, 1L); + + /* we want to use our own read function */ + curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback); + + /* pointer to pass to our read function */ + curl_easy_setopt(curl, CURLOPT_READDATA, &pooh); + + /* get verbose debug output please */ + curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); + + /* + If you use POST to a HTTP 1.1 server, you can send data without knowing + the size before starting the POST if you use chunked encoding. You + enable this by adding a header like "Transfer-Encoding: chunked" with + CURLOPT_HTTPHEADER. With HTTP 1.0 or without chunked transfer, you must + specify the size in the request. + */ +#ifdef USE_CHUNKED + { + struct curl_slist *chunk = NULL; + + chunk = curl_slist_append(chunk, "Transfer-Encoding: chunked"); + res = curl_easy_setopt(curl, CURLOPT_HTTPHEADER, chunk); + /* use curl_slist_free_all() after the *perform() call to free this + list again */ + } +#else + /* Set the expected POST size. If you want to POST large amounts of data, + consider CURLOPT_POSTFIELDSIZE_LARGE */ + curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, pooh.sizeleft); +#endif + +#ifdef DISABLE_EXPECT + /* + Using POST with HTTP 1.1 implies the use of a "Expect: 100-continue" + header. You can disable this header with CURLOPT_HTTPHEADER as usual. + NOTE: if you want chunked transfer too, you need to combine these two + since you can only set one list of headers with CURLOPT_HTTPHEADER. */ + + /* A less good option would be to enforce HTTP 1.0, but that might also + have other implications. */ + { + struct curl_slist *chunk = NULL; + + chunk = curl_slist_append(chunk, "Expect:"); + res = curl_easy_setopt(curl, CURLOPT_HTTPHEADER, chunk); + /* use curl_slist_free_all() after the *perform() call to free this + list again */ + } +#endif + + /* Perform the request, res will get the return code */ + res = curl_easy_perform(curl); + /* Check for errors */ + if(res != CURLE_OK) + fprintf(stderr, "curl_easy_perform() failed: %s\n", + curl_easy_strerror(res)); + + /* always cleanup */ + curl_easy_cleanup(curl); + } + curl_global_cleanup(); + return 0; +} diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/postit2.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/postit2.c new file mode 100644 index 0000000000..67dcc1330b --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/postit2.c @@ -0,0 +1,103 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +/* Example code that uploads a file name 'foo' to a remote script that accepts + * "HTML form based" (as described in RFC1738) uploads using HTTP POST. + * + * The imaginary form we'll fill in looks like: + * + * <form method="post" enctype="multipart/form-data" action="examplepost.cgi"> + * Enter file: <input type="file" name="sendfile" size="40"> + * Enter file name: <input type="text" name="filename" size="30"> + * <input type="submit" value="send" name="submit"> + * </form> + * + * This exact source code has not been verified to work. + */ + +#include <stdio.h> +#include <string.h> + +#include <curl/curl.h> + +int main(int argc, char *argv[]) +{ + CURL *curl; + CURLcode res; + + struct curl_httppost *formpost=NULL; + struct curl_httppost *lastptr=NULL; + struct curl_slist *headerlist=NULL; + static const char buf[] = "Expect:"; + + curl_global_init(CURL_GLOBAL_ALL); + + /* Fill in the file upload field */ + curl_formadd(&formpost, + &lastptr, + CURLFORM_COPYNAME, "sendfile", + CURLFORM_FILE, "postit2.c", + CURLFORM_END); + + /* Fill in the filename field */ + curl_formadd(&formpost, + &lastptr, + CURLFORM_COPYNAME, "filename", + CURLFORM_COPYCONTENTS, "postit2.c", + CURLFORM_END); + + + /* Fill in the submit field too, even if this is rarely needed */ + curl_formadd(&formpost, + &lastptr, + CURLFORM_COPYNAME, "submit", + CURLFORM_COPYCONTENTS, "send", + CURLFORM_END); + + curl = curl_easy_init(); + /* initalize custom header list (stating that Expect: 100-continue is not + wanted */ + headerlist = curl_slist_append(headerlist, buf); + if(curl) { + /* what URL that receives this POST */ + curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/examplepost.cgi"); + if ( (argc == 2) && (!strcmp(argv[1], "noexpectheader")) ) + /* only disable 100-continue header if explicitly requested */ + curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headerlist); + curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost); + + /* Perform the request, res will get the return code */ + res = curl_easy_perform(curl); + /* Check for errors */ + if(res != CURLE_OK) + fprintf(stderr, "curl_easy_perform() failed: %s\n", + curl_easy_strerror(res)); + + /* always cleanup */ + curl_easy_cleanup(curl); + + /* then cleanup the formpost chain */ + curl_formfree(formpost); + /* free slist */ + curl_slist_free_all (headerlist); + } + return 0; +} diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/progressfunc.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/progressfunc.c new file mode 100644 index 0000000000..51a9c9b5e5 --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/progressfunc.c @@ -0,0 +1,84 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#include <stdio.h> +#include <curl/curl.h> + +#define STOP_DOWNLOAD_AFTER_THIS_MANY_BYTES 6000 +#define MINIMAL_PROGRESS_FUNCTIONALITY_INTERVAL 3 + +struct myprogress { + double lastruntime; + CURL *curl; +}; + +static int progress(void *p, + double dltotal, double dlnow, + double ultotal, double ulnow) +{ + struct myprogress *myp = (struct myprogress *)p; + CURL *curl = myp->curl; + double curtime = 0; + + curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME, &curtime); + + /* under certain circumstances it may be desirable for certain functionality + to only run every N seconds, in order to do this the transaction time can + be used */ + if((curtime - myp->lastruntime) >= MINIMAL_PROGRESS_FUNCTIONALITY_INTERVAL) { + myp->lastruntime = curtime; + fprintf(stderr, "TOTAL TIME: %f \r\n", curtime); + } + + fprintf(stderr, "UP: %g of %g DOWN: %g of %g\r\n", + ulnow, ultotal, dlnow, dltotal); + + if(dlnow > STOP_DOWNLOAD_AFTER_THIS_MANY_BYTES) + return 1; + return 0; +} + +int main(void) +{ + CURL *curl; + CURLcode res = CURLE_OK; + struct myprogress prog; + + curl = curl_easy_init(); + if(curl) { + prog.lastruntime = 0; + prog.curl = curl; + + curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/"); + curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, progress); + /* pass the struct pointer into the progress function */ + curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, &prog); + curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0L); + res = curl_easy_perform(curl); + + if(res != CURLE_OK) + fprintf(stderr, "%s\n", curl_easy_strerror(res)); + + /* always cleanup */ + curl_easy_cleanup(curl); + } + return (int)res; +} diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/resolve.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/resolve.c new file mode 100644 index 0000000000..7b3e5656e0 --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/resolve.c @@ -0,0 +1,51 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#include <stdio.h> +#include <curl/curl.h> + +int main(void) +{ + CURL *curl; + CURLcode res = CURLE_OK; + struct curl_slist *host = NULL; + + /* Each single name resolve string should be written using the format + HOST:PORT:ADDRESS where HOST is the name libcurl will try to resolve, + PORT is the port number of the service where libcurl wants to connect to + the HOST and ADDRESS is the numerical IP address + */ + host = curl_slist_append(NULL, "example.com:80:127.0.0.1"); + + curl = curl_easy_init(); + if(curl) { + curl_easy_setopt(curl, CURLOPT_RESOLVE, host); + curl_easy_setopt(curl, CURLOPT_URL, "http://example.com"); + res = curl_easy_perform(curl); + + /* always cleanup */ + curl_easy_cleanup(curl); + } + + curl_slist_free_all(host); + + return (int)res; +} diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/rtsp.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/rtsp.c new file mode 100644 index 0000000000..669780a9bc --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/rtsp.c @@ -0,0 +1,271 @@ +/* + * Copyright (c) 2011, Jim Hollinger + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Jim Hollinger nor the names of its contributors + * may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#if defined (WIN32) +# include <conio.h> /* _getch() */ +#else +# include <termios.h> +# include <unistd.h> + +static int _getch(void) +{ + struct termios oldt, newt; + int ch; + tcgetattr( STDIN_FILENO, &oldt ); + newt = oldt; + newt.c_lflag &= ~( ICANON | ECHO ); + tcsetattr( STDIN_FILENO, TCSANOW, &newt ); + ch = getchar(); + tcsetattr( STDIN_FILENO, TCSANOW, &oldt ); + return ch; +} +#endif + +#include <curl/curl.h> + +#define VERSION_STR "V1.0" + +/* error handling macros */ +#define my_curl_easy_setopt(A, B, C) \ + if ((res = curl_easy_setopt((A), (B), (C))) != CURLE_OK) \ + fprintf(stderr, "curl_easy_setopt(%s, %s, %s) failed: %d\n", \ + #A, #B, #C, res); + +#define my_curl_easy_perform(A) \ + if ((res = curl_easy_perform((A))) != CURLE_OK) \ + fprintf(stderr, "curl_easy_perform(%s) failed: %d\n", #A, res); + + +/* send RTSP OPTIONS request */ +static void rtsp_options(CURL *curl, const char *uri) +{ + CURLcode res = CURLE_OK; + printf("\nRTSP: OPTIONS %s\n", uri); + my_curl_easy_setopt(curl, CURLOPT_RTSP_STREAM_URI, uri); + my_curl_easy_setopt(curl, CURLOPT_RTSP_REQUEST, (long)CURL_RTSPREQ_OPTIONS); + my_curl_easy_perform(curl); +} + + +/* send RTSP DESCRIBE request and write sdp response to a file */ +static void rtsp_describe(CURL *curl, const char *uri, + const char *sdp_filename) +{ + CURLcode res = CURLE_OK; + FILE *sdp_fp = fopen(sdp_filename, "wt"); + printf("\nRTSP: DESCRIBE %s\n", uri); + if (sdp_fp == NULL) { + fprintf(stderr, "Could not open '%s' for writing\n", sdp_filename); + sdp_fp = stdout; + } + else { + printf("Writing SDP to '%s'\n", sdp_filename); + } + my_curl_easy_setopt(curl, CURLOPT_WRITEDATA, sdp_fp); + my_curl_easy_setopt(curl, CURLOPT_RTSP_REQUEST, (long)CURL_RTSPREQ_DESCRIBE); + my_curl_easy_perform(curl); + my_curl_easy_setopt(curl, CURLOPT_WRITEDATA, stdout); + if (sdp_fp != stdout) { + fclose(sdp_fp); + } +} + +/* send RTSP SETUP request */ +static void rtsp_setup(CURL *curl, const char *uri, const char *transport) +{ + CURLcode res = CURLE_OK; + printf("\nRTSP: SETUP %s\n", uri); + printf(" TRANSPORT %s\n", transport); + my_curl_easy_setopt(curl, CURLOPT_RTSP_STREAM_URI, uri); + my_curl_easy_setopt(curl, CURLOPT_RTSP_TRANSPORT, transport); + my_curl_easy_setopt(curl, CURLOPT_RTSP_REQUEST, (long)CURL_RTSPREQ_SETUP); + my_curl_easy_perform(curl); +} + + +/* send RTSP PLAY request */ +static void rtsp_play(CURL *curl, const char *uri, const char *range) +{ + CURLcode res = CURLE_OK; + printf("\nRTSP: PLAY %s\n", uri); + my_curl_easy_setopt(curl, CURLOPT_RTSP_STREAM_URI, uri); + my_curl_easy_setopt(curl, CURLOPT_RANGE, range); + my_curl_easy_setopt(curl, CURLOPT_RTSP_REQUEST, (long)CURL_RTSPREQ_PLAY); + my_curl_easy_perform(curl); +} + + +/* send RTSP TEARDOWN request */ +static void rtsp_teardown(CURL *curl, const char *uri) +{ + CURLcode res = CURLE_OK; + printf("\nRTSP: TEARDOWN %s\n", uri); + my_curl_easy_setopt(curl, CURLOPT_RTSP_REQUEST, (long)CURL_RTSPREQ_TEARDOWN); + my_curl_easy_perform(curl); +} + + +/* convert url into an sdp filename */ +static void get_sdp_filename(const char *url, char *sdp_filename) +{ + const char *s = strrchr(url, '/'); + strcpy(sdp_filename, "video.sdp"); + if (s != NULL) { + s++; + if (s[0] != '\0') { + sprintf(sdp_filename, "%s.sdp", s); + } + } +} + + +/* scan sdp file for media control attribute */ +static void get_media_control_attribute(const char *sdp_filename, + char *control) +{ + int max_len = 256; + char *s = malloc(max_len); + FILE *sdp_fp = fopen(sdp_filename, "rt"); + control[0] = '\0'; + if (sdp_fp != NULL) { + while (fgets(s, max_len - 2, sdp_fp) != NULL) { + sscanf(s, " a = control: %s", control); + } + fclose(sdp_fp); + } + free(s); +} + + +/* main app */ +int main(int argc, char * const argv[]) +{ +#if 1 + const char *transport = "RTP/AVP;unicast;client_port=1234-1235"; /* UDP */ +#else + const char *transport = "RTP/AVP/TCP;unicast;client_port=1234-1235"; /* TCP */ +#endif + const char *range = "0.000-"; + int rc = EXIT_SUCCESS; + char *base_name = NULL; + + printf("\nRTSP request %s\n", VERSION_STR); + printf(" Project web site: http://code.google.com/p/rtsprequest/\n"); + printf(" Requires cURL V7.20 or greater\n\n"); + + /* check command line */ + if ((argc != 2) && (argc != 3)) { + base_name = strrchr(argv[0], '/'); + if (base_name == NULL) { + base_name = strrchr(argv[0], '\\'); + } + if (base_name == NULL) { + base_name = argv[0]; + } else { + base_name++; + } + printf("Usage: %s url [transport]\n", base_name); + printf(" url of video server\n"); + printf(" transport (optional) specifier for media stream protocol\n"); + printf(" default transport: %s\n", transport); + printf("Example: %s rtsp://192.168.0.2/media/video1\n\n", base_name); + rc = EXIT_FAILURE; + } else { + const char *url = argv[1]; + char *uri = malloc(strlen(url) + 32); + char *sdp_filename = malloc(strlen(url) + 32); + char *control = malloc(strlen(url) + 32); + CURLcode res; + get_sdp_filename(url, sdp_filename); + if (argc == 3) { + transport = argv[2]; + } + + /* initialize curl */ + res = curl_global_init(CURL_GLOBAL_ALL); + if (res == CURLE_OK) { + curl_version_info_data *data = curl_version_info(CURLVERSION_NOW); + CURL *curl; + fprintf(stderr, " cURL V%s loaded\n", data->version); + + /* initialize this curl session */ + curl = curl_easy_init(); + if (curl != NULL) { + my_curl_easy_setopt(curl, CURLOPT_VERBOSE, 0L); + my_curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 1L); + my_curl_easy_setopt(curl, CURLOPT_WRITEHEADER, stdout); + my_curl_easy_setopt(curl, CURLOPT_URL, url); + + /* request server options */ + sprintf(uri, "%s", url); + rtsp_options(curl, uri); + + /* request session description and write response to sdp file */ + rtsp_describe(curl, uri, sdp_filename); + + /* get media control attribute from sdp file */ + get_media_control_attribute(sdp_filename, control); + + /* setup media stream */ + sprintf(uri, "%s/%s", url, control); + rtsp_setup(curl, uri, transport); + + /* start playing media stream */ + sprintf(uri, "%s/", url); + rtsp_play(curl, uri, range); + printf("Playing video, press any key to stop ..."); + _getch(); + printf("\n"); + + /* teardown session */ + rtsp_teardown(curl, uri); + + /* cleanup */ + curl_easy_cleanup(curl); + curl = NULL; + } else { + fprintf(stderr, "curl_easy_init() failed\n"); + } + curl_global_cleanup(); + } else { + fprintf(stderr, "curl_global_init(%s) failed: %d\n", + "CURL_GLOBAL_ALL", res); + } + free(control); + free(sdp_filename); + free(uri); + } + + return rc; +} diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/sampleconv.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/sampleconv.c new file mode 100644 index 0000000000..3db316096c --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/sampleconv.c @@ -0,0 +1,107 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +/* + This is a simple example showing how a program on a non-ASCII platform + would invoke callbacks to do its own codeset conversions instead of + using the built-in iconv functions in libcurl. + + The IBM-1047 EBCDIC codeset is used for this example but the code + would be similar for other non-ASCII codesets. + + Three callback functions are created below: + my_conv_from_ascii_to_ebcdic, + my_conv_from_ebcdic_to_ascii, and + my_conv_from_utf8_to_ebcdic + + The "platform_xxx" calls represent platform-specific conversion routines. + + */ + +#include <stdio.h> +#include <curl/curl.h> + +CURLcode my_conv_from_ascii_to_ebcdic(char *buffer, size_t length) +{ + char *tempptrin, *tempptrout; + size_t bytes = length; + int rc; + tempptrin = tempptrout = buffer; + rc = platform_a2e(&tempptrin, &bytes, &tempptrout, &bytes); + if (rc == PLATFORM_CONV_OK) { + return(CURLE_OK); + } else { + return(CURLE_CONV_FAILED); + } +} + +CURLcode my_conv_from_ebcdic_to_ascii(char *buffer, size_t length) +{ + char *tempptrin, *tempptrout; + size_t bytes = length; + int rc; + tempptrin = tempptrout = buffer; + rc = platform_e2a(&tempptrin, &bytes, &tempptrout, &bytes); + if (rc == PLATFORM_CONV_OK) { + return(CURLE_OK); + } else { + return(CURLE_CONV_FAILED); + } +} + +CURLcode my_conv_from_utf8_to_ebcdic(char *buffer, size_t length) +{ + char *tempptrin, *tempptrout; + size_t bytes = length; + int rc; + tempptrin = tempptrout = buffer; + rc = platform_u2e(&tempptrin, &bytes, &tempptrout, &bytes); + if (rc == PLATFORM_CONV_OK) { + return(CURLE_OK); + } else { + return(CURLE_CONV_FAILED); + } +} + +int main(void) +{ + CURL *curl; + CURLcode res; + + curl = curl_easy_init(); + if(curl) { + curl_easy_setopt(curl, CURLOPT_URL, "http://example.com"); + + /* use platform-specific functions for codeset conversions */ + curl_easy_setopt(curl, CURLOPT_CONV_FROM_NETWORK_FUNCTION, + my_conv_from_ascii_to_ebcdic); + curl_easy_setopt(curl, CURLOPT_CONV_TO_NETWORK_FUNCTION, + my_conv_from_ebcdic_to_ascii); + curl_easy_setopt(curl, CURLOPT_CONV_FROM_UTF8_FUNCTION, + my_conv_from_utf8_to_ebcdic); + + res = curl_easy_perform(curl); + + /* always cleanup */ + curl_easy_cleanup(curl); + } + return 0; +} diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/sendrecv.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/sendrecv.c new file mode 100644 index 0000000000..88fddf59f8 --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/sendrecv.c @@ -0,0 +1,135 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +/* An example of curl_easy_send() and curl_easy_recv() usage. */ + +#include <stdio.h> +#include <string.h> +#include <curl/curl.h> + +/* Auxiliary function that waits on the socket. */ +static int wait_on_socket(curl_socket_t sockfd, int for_recv, long timeout_ms) +{ + struct timeval tv; + fd_set infd, outfd, errfd; + int res; + + tv.tv_sec = timeout_ms / 1000; + tv.tv_usec= (timeout_ms % 1000) * 1000; + + FD_ZERO(&infd); + FD_ZERO(&outfd); + FD_ZERO(&errfd); + + FD_SET(sockfd, &errfd); /* always check for error */ + + if(for_recv) + { + FD_SET(sockfd, &infd); + } + else + { + FD_SET(sockfd, &outfd); + } + + /* select() returns the number of signalled sockets or -1 */ + res = select(sockfd + 1, &infd, &outfd, &errfd, &tv); + return res; +} + +int main(void) +{ + CURL *curl; + CURLcode res; + /* Minimalistic http request */ + const char *request = "GET / HTTP/1.0\r\nHost: example.com\r\n\r\n"; + curl_socket_t sockfd; /* socket */ + long sockextr; + size_t iolen; + curl_off_t nread; + + curl = curl_easy_init(); + if(curl) { + curl_easy_setopt(curl, CURLOPT_URL, "http://example.com"); + /* Do not do the transfer - only connect to host */ + curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 1L); + res = curl_easy_perform(curl); + + if(CURLE_OK != res) + { + printf("Error: %s\n", strerror(res)); + return 1; + } + + /* Extract the socket from the curl handle - we'll need it for waiting. + * Note that this API takes a pointer to a 'long' while we use + * curl_socket_t for sockets otherwise. + */ + res = curl_easy_getinfo(curl, CURLINFO_LASTSOCKET, &sockextr); + + if(CURLE_OK != res) + { + printf("Error: %s\n", curl_easy_strerror(res)); + return 1; + } + + sockfd = sockextr; + + /* wait for the socket to become ready for sending */ + if(!wait_on_socket(sockfd, 0, 60000L)) + { + printf("Error: timeout.\n"); + return 1; + } + + puts("Sending request."); + /* Send the request. Real applications should check the iolen + * to see if all the request has been sent */ + res = curl_easy_send(curl, request, strlen(request), &iolen); + + if(CURLE_OK != res) + { + printf("Error: %s\n", curl_easy_strerror(res)); + return 1; + } + puts("Reading response."); + + /* read the response */ + for(;;) + { + char buf[1024]; + + wait_on_socket(sockfd, 1, 60000L); + res = curl_easy_recv(curl, buf, 1024, &iolen); + + if(CURLE_OK != res) + break; + + nread = (curl_off_t)iolen; + + printf("Received %" CURL_FORMAT_CURL_OFF_T " bytes.\n", nread); + } + + /* always cleanup */ + curl_easy_cleanup(curl); + } + return 0; +} diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/sepheaders.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/sepheaders.c new file mode 100644 index 0000000000..afa14fc85f --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/sepheaders.c @@ -0,0 +1,85 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + +#include <curl/curl.h> + +static size_t write_data(void *ptr, size_t size, size_t nmemb, void *stream) +{ + int written = fwrite(ptr, size, nmemb, (FILE *)stream); + return written; +} + +int main(void) +{ + CURL *curl_handle; + static const char *headerfilename = "head.out"; + FILE *headerfile; + static const char *bodyfilename = "body.out"; + FILE *bodyfile; + + curl_global_init(CURL_GLOBAL_ALL); + + /* init the curl session */ + curl_handle = curl_easy_init(); + + /* set URL to get */ + curl_easy_setopt(curl_handle, CURLOPT_URL, "http://example.com"); + + /* no progress meter please */ + curl_easy_setopt(curl_handle, CURLOPT_NOPROGRESS, 1L); + + /* send all data to this function */ + curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, write_data); + + /* open the files */ + headerfile = fopen(headerfilename,"w"); + if (headerfile == NULL) { + curl_easy_cleanup(curl_handle); + return -1; + } + bodyfile = fopen(bodyfilename,"w"); + if (bodyfile == NULL) { + curl_easy_cleanup(curl_handle); + return -1; + } + + /* we want the headers to this file handle */ + curl_easy_setopt(curl_handle, CURLOPT_WRITEHEADER, headerfile); + + /* + * Notice here that if you want the actual data sent anywhere else but + * stdout, you should consider using the CURLOPT_WRITEDATA option. */ + + /* get it! */ + curl_easy_perform(curl_handle); + + /* close the header file */ + fclose(headerfile); + + /* cleanup curl stuff */ + curl_easy_cleanup(curl_handle); + + return 0; +} diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/sftpget.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/sftpget.c new file mode 100644 index 0000000000..8317462e9c --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/sftpget.c @@ -0,0 +1,106 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include <stdio.h> + +#include <curl/curl.h> + +/* define this to switch off the use of ssh-agent in this program */ +#undef DISABLE_SSH_AGENT + +/* + * This is an example showing how to get a single file from an SFTP server. + * It delays the actual destination file creation until the first write + * callback so that it won't create an empty file in case the remote file + * doesn't exist or something else fails. + */ + +struct FtpFile { + const char *filename; + FILE *stream; +}; + +static size_t my_fwrite(void *buffer, size_t size, size_t nmemb, + void *stream) +{ + struct FtpFile *out=(struct FtpFile *)stream; + if(out && !out->stream) { + /* open file for writing */ + out->stream=fopen(out->filename, "wb"); + if(!out->stream) + return -1; /* failure, can't open file to write */ + } + return fwrite(buffer, size, nmemb, out->stream); +} + + +int main(void) +{ + CURL *curl; + CURLcode res; + struct FtpFile ftpfile={ + "yourfile.bin", /* name to store the file as if succesful */ + NULL + }; + + curl_global_init(CURL_GLOBAL_DEFAULT); + + curl = curl_easy_init(); + if(curl) { + /* + * You better replace the URL with one that works! + */ + curl_easy_setopt(curl, CURLOPT_URL, + "sftp://user@server/home/user/file.txt"); + /* Define our callback to get called when there's data to be written */ + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, my_fwrite); + /* Set a pointer to our struct to pass to the callback */ + curl_easy_setopt(curl, CURLOPT_WRITEDATA, &ftpfile); + +#ifndef DISABLE_SSH_AGENT + /* We activate ssh agent. For this to work you need + to have ssh-agent running (type set | grep SSH_AGENT to check) or + pageant on Windows (there is an icon in systray if so) */ + curl_easy_setopt(curl, CURLOPT_SSH_AUTH_TYPES, CURLSSH_AUTH_AGENT); +#endif + + /* Switch on full protocol/debug output */ + curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); + + res = curl_easy_perform(curl); + + /* always cleanup */ + curl_easy_cleanup(curl); + + if(CURLE_OK != res) { + /* we failed */ + fprintf(stderr, "curl told us %d\n", res); + } + } + + if(ftpfile.stream) + fclose(ftpfile.stream); /* close the local file */ + + curl_global_cleanup(); + + return 0; +} diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/simple.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/simple.c new file mode 100644 index 0000000000..1912ce66e9 --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/simple.c @@ -0,0 +1,47 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#include <stdio.h> +#include <curl/curl.h> + +int main(void) +{ + CURL *curl; + CURLcode res; + + curl = curl_easy_init(); + if(curl) { + curl_easy_setopt(curl, CURLOPT_URL, "http://example.com"); + /* example.com is redirected, so we tell libcurl to follow redirection */ + curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); + + /* Perform the request, res will get the return code */ + res = curl_easy_perform(curl); + /* Check for errors */ + if(res != CURLE_OK) + fprintf(stderr, "curl_easy_perform() failed: %s\n", + curl_easy_strerror(res)); + + /* always cleanup */ + curl_easy_cleanup(curl); + } + return 0; +} diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/simplepost.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/simplepost.c new file mode 100644 index 0000000000..8657771f46 --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/simplepost.c @@ -0,0 +1,53 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#include <stdio.h> +#include <string.h> +#include <curl/curl.h> + +int main(void) +{ + CURL *curl; + CURLcode res; + + static const char *postthis="moo mooo moo moo"; + + curl = curl_easy_init(); + if(curl) { + curl_easy_setopt(curl, CURLOPT_URL, "http://example.com"); + curl_easy_setopt(curl, CURLOPT_POSTFIELDS, postthis); + + /* if we don't provide POSTFIELDSIZE, libcurl will strlen() by + itself */ + curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, (long)strlen(postthis)); + + /* Perform the request, res will get the return code */ + res = curl_easy_perform(curl); + /* Check for errors */ + if(res != CURLE_OK) + fprintf(stderr, "curl_easy_perform() failed: %s\n", + curl_easy_strerror(res)); + + /* always cleanup */ + curl_easy_cleanup(curl); + } + return 0; +} diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/simplesmtp.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/simplesmtp.c new file mode 100644 index 0000000000..df85162424 --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/simplesmtp.c @@ -0,0 +1,87 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#include <stdio.h> +#include <string.h> +#include <curl/curl.h> + +int main(void) +{ + CURL *curl; + CURLcode res; + struct curl_slist *recipients = NULL; + + /* value for envelope reverse-path */ + static const char *from = "<bradh@example.com>"; + + /* this becomes the envelope forward-path */ + static const char *to = "<bradh@example.net>"; + + curl = curl_easy_init(); + if(curl) { + /* this is the URL for your mailserver - you can also use an smtps:// URL + * here */ + curl_easy_setopt(curl, CURLOPT_URL, "smtp://mail.example.net."); + + /* Note that this option isn't strictly required, omitting it will result in + * libcurl will sent the MAIL FROM command with no sender data. All + * autoresponses should have an empty reverse-path, and should be directed + * to the address in the reverse-path which triggered them. Otherwise, they + * could cause an endless loop. See RFC 5321 Section 4.5.5 for more details. + */ + curl_easy_setopt(curl, CURLOPT_MAIL_FROM, from); + + /* Note that the CURLOPT_MAIL_RCPT takes a list, not a char array. */ + recipients = curl_slist_append(recipients, to); + curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, recipients); + + /* You provide the payload (headers and the body of the message) as the + * "data" element. There are two choices, either: + * - provide a callback function and specify the function name using the + * CURLOPT_READFUNCTION option; or + * - just provide a FILE pointer that can be used to read the data from. + * The easiest case is just to read from standard input, (which is available + * as a FILE pointer) as shown here. + */ + curl_easy_setopt(curl, CURLOPT_READDATA, stdin); + + /* send the message (including headers) */ + res = curl_easy_perform(curl); + /* Check for errors */ + if(res != CURLE_OK) + fprintf(stderr, "curl_easy_perform() failed: %s\n", + curl_easy_strerror(res)); + + /* free the list of recipients */ + curl_slist_free_all(recipients); + + /* curl won't send the QUIT command until you call cleanup, so you should be + * able to re-use this connection for additional messages (setting + * CURLOPT_MAIL_FROM and CURLOPT_MAIL_RCPT as required, and calling + * curl_easy_perform() again. It may not be a good idea to keep the + * connection open for a very long time though (more than a few minutes may + * result in the server timing out the connection), and you do want to clean + * up in the end. + */ + curl_easy_cleanup(curl); + } + return 0; +} diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/simplessl.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/simplessl.c new file mode 100644 index 0000000000..74c58461a6 --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/simplessl.c @@ -0,0 +1,138 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#include <stdio.h> + +#include <curl/curl.h> + +/* some requirements for this to work: + 1. set pCertFile to the file with the client certificate + 2. if the key is passphrase protected, set pPassphrase to the + passphrase you use + 3. if you are using a crypto engine: + 3.1. set a #define USE_ENGINE + 3.2. set pEngine to the name of the crypto engine you use + 3.3. set pKeyName to the key identifier you want to use + 4. if you don't use a crypto engine: + 4.1. set pKeyName to the file name of your client key + 4.2. if the format of the key file is DER, set pKeyType to "DER" + + !! verify of the server certificate is not implemented here !! + + **** This example only works with libcurl 7.9.3 and later! **** + +*/ + +int main(void) +{ + int i; + CURL *curl; + CURLcode res; + FILE *headerfile; + const char *pPassphrase = NULL; + + static const char *pCertFile = "testcert.pem"; + static const char *pCACertFile="cacert.pem"; + + const char *pKeyName; + const char *pKeyType; + + const char *pEngine; + +#ifdef USE_ENGINE + pKeyName = "rsa_test"; + pKeyType = "ENG"; + pEngine = "chil"; /* for nChiper HSM... */ +#else + pKeyName = "testkey.pem"; + pKeyType = "PEM"; + pEngine = NULL; +#endif + + headerfile = fopen("dumpit", "w"); + + curl_global_init(CURL_GLOBAL_DEFAULT); + + curl = curl_easy_init(); + if(curl) { + /* what call to write: */ + curl_easy_setopt(curl, CURLOPT_URL, "HTTPS://your.favourite.ssl.site"); + curl_easy_setopt(curl, CURLOPT_WRITEHEADER, headerfile); + + for(i = 0; i < 1; i++) /* single-iteration loop, just to break out from */ + { + if (pEngine) /* use crypto engine */ + { + if (curl_easy_setopt(curl, CURLOPT_SSLENGINE,pEngine) != CURLE_OK) + { /* load the crypto engine */ + fprintf(stderr,"can't set crypto engine\n"); + break; + } + if (curl_easy_setopt(curl, CURLOPT_SSLENGINE_DEFAULT,1L) != CURLE_OK) + { /* set the crypto engine as default */ + /* only needed for the first time you load + a engine in a curl object... */ + fprintf(stderr,"can't set crypto engine as default\n"); + break; + } + } + /* cert is stored PEM coded in file... */ + /* since PEM is default, we needn't set it for PEM */ + curl_easy_setopt(curl,CURLOPT_SSLCERTTYPE,"PEM"); + + /* set the cert for client authentication */ + curl_easy_setopt(curl,CURLOPT_SSLCERT,pCertFile); + + /* sorry, for engine we must set the passphrase + (if the key has one...) */ + if (pPassphrase) + curl_easy_setopt(curl,CURLOPT_KEYPASSWD,pPassphrase); + + /* if we use a key stored in a crypto engine, + we must set the key type to "ENG" */ + curl_easy_setopt(curl,CURLOPT_SSLKEYTYPE,pKeyType); + + /* set the private key (file or ID in engine) */ + curl_easy_setopt(curl,CURLOPT_SSLKEY,pKeyName); + + /* set the file with the certs vaildating the server */ + curl_easy_setopt(curl,CURLOPT_CAINFO,pCACertFile); + + /* disconnect if we can't validate server's cert */ + curl_easy_setopt(curl,CURLOPT_SSL_VERIFYPEER,1L); + + /* Perform the request, res will get the return code */ + res = curl_easy_perform(curl); + /* Check for errors */ + if(res != CURLE_OK) + fprintf(stderr, "curl_easy_perform() failed: %s\n", + curl_easy_strerror(res)); + + /* we are done... */ + } + /* always cleanup */ + curl_easy_cleanup(curl); + } + + curl_global_cleanup(); + + return 0; +} diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/smooth-gtk-thread.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/smooth-gtk-thread.c new file mode 100644 index 0000000000..932f6e3963 --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/smooth-gtk-thread.c @@ -0,0 +1,228 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +/* This is a multi threaded application that uses a progress bar to show + * status. It uses Gtk+ to make a smooth pulse. + * + * Written by Jud Bishop after studying the other examples provided with + * libcurl. + * + * To compile (on a single line): + * gcc -ggdb `pkg-config --cflags --libs gtk+-2.0` -lcurl -lssl -lcrypto + * -lgthread-2.0 -dl smooth-gtk-thread.c -o smooth-gtk-thread + */ + +#include <stdio.h> +#include <gtk/gtk.h> +#include <glib.h> +#include <unistd.h> +#include <pthread.h> + +#include <curl/curl.h> + +#define NUMT 4 + +pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; +int j = 0; +gint num_urls = 9; /* Just make sure this is less than urls[]*/ +const char * const urls[]= { + "90022", + "90023", + "90024", + "90025", + "90026", + "90027", + "90028", + "90029", + "90030" +}; + +size_t write_file(void *ptr, size_t size, size_t nmemb, FILE *stream) +{ + /* printf("write_file\n"); */ + return fwrite(ptr, size, nmemb, stream); +} + +/* http://xoap.weather.com/weather/local/46214?cc=*&dayf=5&unit=i */ +void *pull_one_url(void *NaN) +{ + CURL *curl; + CURLcode res; + gchar *http; + FILE *outfile; + + /* Stop threads from entering unless j is incremented */ + pthread_mutex_lock(&lock); + while ( j < num_urls ) + { + printf("j = %d\n", j); + + http = + g_strdup_printf("xoap.weather.com/weather/local/%s?cc=*&dayf=5&unit=i\n", + urls[j]); + + printf( "http %s", http ); + + curl = curl_easy_init(); + if(curl) + { + + outfile = fopen(urls[j], "w"); + /* printf("fopen\n"); */ + + /* Set the URL and transfer type */ + curl_easy_setopt(curl, CURLOPT_URL, http); + + /* Write to the file */ + curl_easy_setopt(curl, CURLOPT_WRITEDATA, outfile); + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_file); + + j++; /* critical line */ + pthread_mutex_unlock(&lock); + + res = curl_easy_perform(curl); + + fclose(outfile); + printf("fclose\n"); + + curl_easy_cleanup(curl); + } + g_free (http); + + /* Adds more latency, testing the mutex.*/ + sleep(1); + + } /* end while */ + return NULL; +} + + +gboolean pulse_bar(gpointer data) +{ + gdk_threads_enter(); + gtk_progress_bar_pulse (GTK_PROGRESS_BAR (data)); + gdk_threads_leave(); + + /* Return true so the function will be called again; + * returning false removes this timeout function. + */ + return TRUE; +} + +void *create_thread(void *progress_bar) +{ + pthread_t tid[NUMT]; + int i; + int error; + + /* Make sure I don't create more threads than urls. */ + for(i=0; i < NUMT && i < num_urls ; i++) { + error = pthread_create(&tid[i], + NULL, /* default attributes please */ + pull_one_url, + NULL); + if(0 != error) + fprintf(stderr, "Couldn't run thread number %d, errno %d\n", i, error); + else + fprintf(stderr, "Thread %d, gets %s\n", i, urls[i]); + } + + /* Wait for all threads to terminate. */ + for(i=0; i < NUMT && i < num_urls; i++) { + error = pthread_join(tid[i], NULL); + fprintf(stderr, "Thread %d terminated\n", i); + } + + /* This stops the pulsing if you have it turned on in the progress bar + section */ + g_source_remove(GPOINTER_TO_INT(g_object_get_data(G_OBJECT(progress_bar), + "pulse_id"))); + + /* This destroys the progress bar */ + gtk_widget_destroy(progress_bar); + + /* [Un]Comment this out to kill the program rather than pushing close. */ + /* gtk_main_quit(); */ + + + return NULL; + +} + +static gboolean cb_delete(GtkWidget *window, gpointer data) +{ + gtk_main_quit(); + return FALSE; +} + +int main(int argc, char **argv) +{ + GtkWidget *top_window, *outside_frame, *inside_frame, *progress_bar; + + /* Must initialize libcurl before any threads are started */ + curl_global_init(CURL_GLOBAL_ALL); + + /* Init thread */ + g_thread_init(NULL); + gdk_threads_init (); + gdk_threads_enter (); + + gtk_init(&argc, &argv); + + /* Base window */ + top_window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + + /* Frame */ + outside_frame = gtk_frame_new(NULL); + gtk_frame_set_shadow_type(GTK_FRAME(outside_frame), GTK_SHADOW_OUT); + gtk_container_add(GTK_CONTAINER(top_window), outside_frame); + + /* Frame */ + inside_frame = gtk_frame_new(NULL); + gtk_frame_set_shadow_type(GTK_FRAME(inside_frame), GTK_SHADOW_IN); + gtk_container_set_border_width(GTK_CONTAINER(inside_frame), 5); + gtk_container_add(GTK_CONTAINER(outside_frame), inside_frame); + + /* Progress bar */ + progress_bar = gtk_progress_bar_new(); + gtk_progress_bar_pulse (GTK_PROGRESS_BAR (progress_bar)); + /* Make uniform pulsing */ + gint pulse_ref = g_timeout_add (300, pulse_bar, progress_bar); + g_object_set_data(G_OBJECT(progress_bar), "pulse_id", + GINT_TO_POINTER(pulse_ref)); + gtk_container_add(GTK_CONTAINER(inside_frame), progress_bar); + + gtk_widget_show_all(top_window); + printf("gtk_widget_show_all\n"); + + g_signal_connect(G_OBJECT (top_window), "delete-event", + G_CALLBACK(cb_delete), NULL); + + if (!g_thread_create(&create_thread, progress_bar, FALSE, NULL) != 0) + g_warning("can't create the thread"); + + gtk_main(); + gdk_threads_leave(); + printf("gdk_threads_leave\n"); + + return 0; +} + diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/smtp-multi.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/smtp-multi.c new file mode 100644 index 0000000000..6462aff2d5 --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/smtp-multi.c @@ -0,0 +1,203 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +/* This is an example application source code sending SMTP mail using the + * multi interface. + */ + +#include <string.h> +#include <curl/curl.h> + +/* + * This is the list of basic details you need to tweak to get things right. + */ +#define USERNAME "user@example.com" +#define PASSWORD "123qwerty" +#define SMTPSERVER "smtp.example.com" +#define SMTPPORT ":587" /* it is a colon+port string, but you can set it + to "" to use the default port */ +#define RECIPIENT "<recipient@example.com>" +#define MAILFROM "<realuser@example.com>" + +#define MULTI_PERFORM_HANG_TIMEOUT 60 * 1000 + +/* Note that you should include the actual meta data headers here as well if + you want the mail to have a Subject, another From:, show a To: or whatever + you think your mail should feature! */ +static const char *text[]={ + "one\n", + "two\n", + "three\n", + " Hello, this is CURL email SMTP\n", + NULL +}; + +struct WriteThis { + int counter; +}; + +static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *userp) +{ + struct WriteThis *pooh = (struct WriteThis *)userp; + const char *data; + + if(size*nmemb < 1) + return 0; + + data = text[pooh->counter]; + + if(data) { + size_t len = strlen(data); + memcpy(ptr, data, len); + pooh->counter++; /* advance pointer */ + return len; + } + return 0; /* no more data left to deliver */ +} + +static struct timeval tvnow(void) +{ + /* + ** time() returns the value of time in seconds since the Epoch. + */ + struct timeval now; + now.tv_sec = (long)time(NULL); + now.tv_usec = 0; + return now; +} + +static long tvdiff(struct timeval newer, struct timeval older) +{ + return (newer.tv_sec-older.tv_sec)*1000+ + (newer.tv_usec-older.tv_usec)/1000; +} + +int main(void) +{ + CURL *curl; + CURLM *mcurl; + int still_running = 1; + struct timeval mp_start; + struct WriteThis pooh; + struct curl_slist* rcpt_list = NULL; + + pooh.counter = 0; + + curl_global_init(CURL_GLOBAL_DEFAULT); + + curl = curl_easy_init(); + if(!curl) + return 1; + + mcurl = curl_multi_init(); + if(!mcurl) + return 2; + + rcpt_list = curl_slist_append(rcpt_list, RECIPIENT); + /* more addresses can be added here + rcpt_list = curl_slist_append(rcpt_list, "<others@example.com>"); + */ + + curl_easy_setopt(curl, CURLOPT_URL, "smtp://" SMTPSERVER SMTPPORT); + curl_easy_setopt(curl, CURLOPT_USERNAME, USERNAME); + curl_easy_setopt(curl, CURLOPT_PASSWORD, PASSWORD); + curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback); + curl_easy_setopt(curl, CURLOPT_MAIL_FROM, MAILFROM); + curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, rcpt_list); + curl_easy_setopt(curl, CURLOPT_USE_SSL, (long)CURLUSESSL_ALL); + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L); + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L); + curl_easy_setopt(curl, CURLOPT_READDATA, &pooh); + curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); + curl_easy_setopt(curl, CURLOPT_SSLVERSION, 0L); + curl_easy_setopt(curl, CURLOPT_SSL_SESSIONID_CACHE, 0L); + curl_multi_add_handle(mcurl, curl); + + mp_start = tvnow(); + + /* we start some action by calling perform right away */ + curl_multi_perform(mcurl, &still_running); + + while(still_running) { + struct timeval timeout; + int rc; /* select() return code */ + + fd_set fdread; + fd_set fdwrite; + fd_set fdexcep; + int maxfd = -1; + + long curl_timeo = -1; + + FD_ZERO(&fdread); + FD_ZERO(&fdwrite); + FD_ZERO(&fdexcep); + + /* set a suitable timeout to play around with */ + timeout.tv_sec = 1; + timeout.tv_usec = 0; + + curl_multi_timeout(mcurl, &curl_timeo); + if(curl_timeo >= 0) { + timeout.tv_sec = curl_timeo / 1000; + if(timeout.tv_sec > 1) + timeout.tv_sec = 1; + else + timeout.tv_usec = (curl_timeo % 1000) * 1000; + } + + /* get file descriptors from the transfers */ + curl_multi_fdset(mcurl, &fdread, &fdwrite, &fdexcep, &maxfd); + + /* In a real-world program you OF COURSE check the return code of the + function calls. On success, the value of maxfd is guaranteed to be + greater or equal than -1. We call select(maxfd + 1, ...), specially in + case of (maxfd == -1), we call select(0, ...), which is basically equal + to sleep. */ + + rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout); + + if (tvdiff(tvnow(), mp_start) > MULTI_PERFORM_HANG_TIMEOUT) { + fprintf(stderr, "ABORTING TEST, since it seems " + "that it would have run forever.\n"); + break; + } + + switch(rc) { + case -1: + /* select error */ + break; + case 0: /* timeout */ + default: /* action */ + curl_multi_perform(mcurl, &still_running); + break; + } + } + + curl_slist_free_all(rcpt_list); + curl_multi_remove_handle(mcurl, curl); + curl_multi_cleanup(mcurl); + curl_easy_cleanup(curl); + curl_global_cleanup(); + return 0; +} + + diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/smtp-tls.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/smtp-tls.c new file mode 100644 index 0000000000..3635c103f2 --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/smtp-tls.c @@ -0,0 +1,152 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#include <stdio.h> +#include <string.h> +#include <curl/curl.h> + +/* This is a simple example showing how to send mail using libcurl's SMTP + * capabilities. It builds on the simplesmtp.c example, adding some + * authentication and transport security. + */ + +#define FROM "<sender@example.org>" +#define TO "<addressee@example.net>" +#define CC "<info@example.org>" + +static const char *payload_text[]={ + "Date: Mon, 29 Nov 2010 21:54:29 +1100\n", + "To: " TO "\n", + "From: " FROM "(Example User)\n", + "Cc: " CC "(Another example User)\n", + "Message-ID: <dcd7cb36-11db-487a-9f3a-e652a9458efd@rfcpedant.example.org>\n", + "Subject: SMTP TLS example message\n", + "\n", /* empty line to divide headers from body, see RFC5322 */ + "The body of the message starts here.\n", + "\n", + "It could be a lot of lines, could be MIME encoded, whatever.\n", + "Check RFC5322.\n", + NULL +}; + +struct upload_status { + int lines_read; +}; + +static size_t payload_source(void *ptr, size_t size, size_t nmemb, void *userp) +{ + struct upload_status *upload_ctx = (struct upload_status *)userp; + const char *data; + + if ((size == 0) || (nmemb == 0) || ((size*nmemb) < 1)) { + return 0; + } + + data = payload_text[upload_ctx->lines_read]; + + if (data) { + size_t len = strlen(data); + memcpy(ptr, data, len); + upload_ctx->lines_read ++; + return len; + } + return 0; +} + + +int main(void) +{ + CURL *curl; + CURLcode res; + struct curl_slist *recipients = NULL; + struct upload_status upload_ctx; + + upload_ctx.lines_read = 0; + + curl = curl_easy_init(); + if (curl) { + /* This is the URL for your mailserver. Note the use of port 587 here, + * instead of the normal SMTP port (25). Port 587 is commonly used for + * secure mail submission (see RFC4403), but you should use whatever + * matches your server configuration. */ + curl_easy_setopt(curl, CURLOPT_URL, "smtp://mainserver.example.net:587"); + + /* In this example, we'll start with a plain text connection, and upgrade + * to Transport Layer Security (TLS) using the STARTTLS command. Be careful + * of using CURLUSESSL_TRY here, because if TLS upgrade fails, the transfer + * will continue anyway - see the security discussion in the libcurl + * tutorial for more details. */ + curl_easy_setopt(curl, CURLOPT_USE_SSL, (long)CURLUSESSL_ALL); + + /* If your server doesn't have a valid certificate, then you can disable + * part of the Transport Layer Security protection by setting the + * CURLOPT_SSL_VERIFYPEER and CURLOPT_SSL_VERIFYHOST options to 0 (false). + * curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L); + * curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L); + * That is, in general, a bad idea. It is still better than sending your + * authentication details in plain text though. + * Instead, you should get the issuer certificate (or the host certificate + * if the certificate is self-signed) and add it to the set of certificates + * that are known to libcurl using CURLOPT_CAINFO and/or CURLOPT_CAPATH. See + * docs/SSLCERTS for more information. + */ + curl_easy_setopt(curl, CURLOPT_CAINFO, "/path/to/certificate.pem"); + + /* A common reason for requiring transport security is to protect + * authentication details (user names and passwords) from being "snooped" + * on the network. Here is how the user name and password are provided: */ + curl_easy_setopt(curl, CURLOPT_USERNAME, "user@example.net"); + curl_easy_setopt(curl, CURLOPT_PASSWORD, "P@ssw0rd"); + + /* value for envelope reverse-path */ + curl_easy_setopt(curl, CURLOPT_MAIL_FROM, FROM); + /* Add two recipients, in this particular case they correspond to the + * To: and Cc: addressees in the header, but they could be any kind of + * recipient. */ + recipients = curl_slist_append(recipients, TO); + recipients = curl_slist_append(recipients, CC); + curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, recipients); + + /* In this case, we're using a callback function to specify the data. You + * could just use the CURLOPT_READDATA option to specify a FILE pointer to + * read from. + */ + curl_easy_setopt(curl, CURLOPT_READFUNCTION, payload_source); + curl_easy_setopt(curl, CURLOPT_READDATA, &upload_ctx); + + /* Since the traffic will be encrypted, it is very useful to turn on debug + * information within libcurl to see what is happening during the transfer. + */ + curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); + + /* send the message (including headers) */ + res = curl_easy_perform(curl); + /* Check for errors */ + if(res != CURLE_OK) + fprintf(stderr, "curl_easy_perform() failed: %s\n", + curl_easy_strerror(res)); + + /* free the list of recipients and clean up */ + curl_slist_free_all(recipients); + curl_easy_cleanup(curl); + } + return 0; +} diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/synctime.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/synctime.c new file mode 100644 index 0000000000..14d77de277 --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/synctime.c @@ -0,0 +1,366 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +/* This example code only builds as-is on Windows. + * + * While Unix/Linux user, you do not need this software. + * You can achieve the same result as synctime using curl, awk and date. + * Set proxy as according to your network, but beware of proxy Cache-Control. + * + * To set your system clock, root access is required. + * # date -s "`curl -sI http://nist.time.gov/timezone.cgi?UTC/s/0 \ + * | awk -F': ' '/Date: / {print $2}'`" + * + * To view remote webserver date and time. + * $ curl -sI http://nist.time.gov/timezone.cgi?UTC/s/0 \ + * | awk -F': ' '/Date: / {print $2}' + * + * Synchronising your computer clock via Internet time server usually relies + * on DAYTIME, TIME, or NTP protocols. These protocols provide good accurate + * time synchronisation but it does not work very well through a + * firewall/proxy. Some adjustment has to be made to the firewall/proxy for + * these protocols to work properly. + * + * There is an indirect method. Since most webserver provide server time in + * their HTTP header, therefore you could synchronise your computer clock + * using HTTP protocol which has no problem with firewall/proxy. + * + * For this software to work, you should take note of these items. + * 1. Your firewall/proxy must allow your computer to surf internet. + * 2. Webserver system time must in sync with the NTP time server, + * or at least provide an accurate time keeping. + * 3. Webserver HTTP header does not provide the milliseconds units, + * so there is no way to get very accurate time. + * 4. This software could only provide an accuracy of +- a few seconds, + * as Round-Trip delay time is not taken into consideration. + * Compensation of network, firewall/proxy delay cannot be simply divide + * the Round-Trip delay time by half. + * 5. Win32 SetSystemTime() API will set your computer clock according to + * GMT/UTC time. Therefore your computer timezone must be properly set. + * 6. Webserver data should not be cached by the proxy server. Some + * webserver provide Cache-Control to prevent caching. + * + * References: + * http://tf.nist.gov/timefreq/service/its.htm + * http://tf.nist.gov/timefreq/service/firewall.htm + * + * Usage: + * This software will synchronise your computer clock only when you issue + * it with --synctime. By default, it only display the webserver's clock. + * + * Written by: Frank (contributed to libcurl) + * + * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, + * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY + * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + * + * IN NO EVENT SHALL THE AUTHOR OF THIS SOFTWARE BE LIABLE FOR + * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF + * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + * + */ + +#include <stdio.h> +#include <time.h> +#ifndef __CYGWIN__ +#include <windows.h> +#endif +#include <curl/curl.h> + + +#define MAX_STRING 256 +#define MAX_STRING1 MAX_STRING+1 + +typedef struct +{ + char http_proxy[MAX_STRING1]; + char proxy_user[MAX_STRING1]; + char timeserver[MAX_STRING1]; +} conf_t; + +const char DefaultTimeServer[4][MAX_STRING1] = +{ + "http://nist.time.gov/timezone.cgi?UTC/s/0", + "http://www.google.com/", + "http://www.worldtimeserver.com/current_time_in_UTC.aspx", + "http://www.worldtime.com/cgi-bin/wt.cgi" +}; + +const char *DayStr[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; +const char *MthStr[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; + +int ShowAllHeader; +int AutoSyncTime; +SYSTEMTIME SYSTime; +SYSTEMTIME LOCALTime; + +#define HTTP_COMMAND_HEAD 0 +#define HTTP_COMMAND_GET 1 + + +size_t SyncTime_CURL_WriteOutput(void *ptr, size_t size, size_t nmemb, + void *stream) +{ + fwrite(ptr, size, nmemb, stream); + return(nmemb*size); +} + +size_t SyncTime_CURL_WriteHeader(void *ptr, size_t size, size_t nmemb, + void *stream) +{ + int i, RetVal; + char TmpStr1[26], TmpStr2[26]; + + if (ShowAllHeader == 1) + fprintf(stderr, "%s", (char *)(ptr)); + + if (strncmp((char *)(ptr), "Date:", 5) == 0) { + if (ShowAllHeader == 0) + fprintf(stderr, "HTTP Server. %s", (char *)(ptr)); + + if (AutoSyncTime == 1) { + *TmpStr1 = 0; + *TmpStr2 = 0; + if (strlen((char *)(ptr)) > 50) /* Can prevent buffer overflow to + TmpStr1 & 2? */ + AutoSyncTime = 0; + else { + RetVal = sscanf ((char *)(ptr), "Date: %s %hu %s %hu %hu:%hu:%hu", + TmpStr1, &SYSTime.wDay, TmpStr2, &SYSTime.wYear, + &SYSTime.wHour, &SYSTime.wMinute, &SYSTime.wSecond); + + if (RetVal == 7) { + + SYSTime.wMilliseconds = 500; /* adjust to midpoint, 0.5 sec */ + for (i=0; i<12; i++) { + if (strcmp(MthStr[i], TmpStr2) == 0) { + SYSTime.wMonth = i+1; + break; + } + } + AutoSyncTime = 3; /* Computer clock will be adjusted */ + } + else { + AutoSyncTime = 0; /* Error in sscanf() fields conversion */ + } + } + } + } + + if (strncmp((char *)(ptr), "X-Cache: HIT", 12) == 0) { + fprintf(stderr, "ERROR: HTTP Server data is cached." + " Server Date is no longer valid.\n"); + AutoSyncTime = 0; + } + return(nmemb*size); +} + +void SyncTime_CURL_Init(CURL *curl, char *proxy_port, + char *proxy_user_password) +{ + if (strlen(proxy_port) > 0) + curl_easy_setopt(curl, CURLOPT_PROXY, proxy_port); + + if (strlen(proxy_user_password) > 0) + curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD, proxy_user_password); + + /* Trick Webserver by claiming that you are using Microsoft WinXP SP2, IE6 */ + curl_easy_setopt(curl, CURLOPT_USERAGENT, + "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"); + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, *SyncTime_CURL_WriteOutput); + curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, *SyncTime_CURL_WriteHeader); +} + +int SyncTime_CURL_Fetch(CURL *curl, char *URL_Str, char *OutFileName, + int HttpGetBody) +{ + FILE *outfile; + CURLcode res; + + outfile = NULL; + if (HttpGetBody == HTTP_COMMAND_HEAD) + curl_easy_setopt(curl, CURLOPT_NOBODY, 1L); + else { + outfile = fopen(OutFileName, "wb"); + curl_easy_setopt(curl, CURLOPT_WRITEDATA, outfile); + } + + curl_easy_setopt(curl, CURLOPT_URL, URL_Str); + res = curl_easy_perform(curl); + if (outfile != NULL) + fclose(outfile); + return res; /* (CURLE_OK) */ +} + +void showUsage(void) +{ + fprintf(stderr, "SYNCTIME: Synchronising computer clock with time server" + " using HTTP protocol.\n"); + fprintf(stderr, "Usage : SYNCTIME [Option]\n"); + fprintf(stderr, "Options :\n"); + fprintf(stderr, " --server=WEBSERVER Use this time server instead" + " of default.\n"); + fprintf(stderr, " --showall Show all HTTP header.\n"); + fprintf(stderr, " --synctime Synchronising computer clock" + " with time server.\n"); + fprintf(stderr, " --proxy-user=USER[:PASS] Set proxy username and" + " password.\n"); + fprintf(stderr, " --proxy=HOST[:PORT] Use HTTP proxy on given" + " port.\n"); + fprintf(stderr, " --help Print this help.\n"); + fprintf(stderr, "\n"); + return; +} + +int conf_init(conf_t *conf) +{ + int i; + + *conf->http_proxy = 0; + for (i=0; i<MAX_STRING1; i++) + conf->proxy_user[i] = 0; /* Clean up password from memory */ + *conf->timeserver = 0; + return 1; +} + +int main(int argc, char *argv[]) +{ + CURL *curl; + conf_t conf[1]; + int OptionIndex; + struct tm *lt; + struct tm *gmt; + time_t tt; + time_t tt_local; + time_t tt_gmt; + double tzonediffFloat; + int tzonediffWord; + char timeBuf[61]; + char tzoneBuf[16]; + int RetValue; + + OptionIndex = 0; + ShowAllHeader = 0; /* Do not show HTTP Header */ + AutoSyncTime = 0; /* Do not synchronise computer clock */ + RetValue = 0; /* Successful Exit */ + conf_init(conf); + + if (argc > 1) { + while (OptionIndex < argc) { + if (strncmp(argv[OptionIndex], "--server=", 9) == 0) + snprintf(conf->timeserver, MAX_STRING, "%s", &argv[OptionIndex][9]); + + if (strcmp(argv[OptionIndex], "--showall") == 0) + ShowAllHeader = 1; + + if (strcmp(argv[OptionIndex], "--synctime") == 0) + AutoSyncTime = 1; + + if (strncmp(argv[OptionIndex], "--proxy-user=", 13) == 0) + snprintf(conf->proxy_user, MAX_STRING, "%s", &argv[OptionIndex][13]); + + if (strncmp(argv[OptionIndex], "--proxy=", 8) == 0) + snprintf(conf->http_proxy, MAX_STRING, "%s", &argv[OptionIndex][8]); + + if ((strcmp(argv[OptionIndex], "--help") == 0) || + (strcmp(argv[OptionIndex], "/?") == 0)) { + showUsage(); + return 0; + } + OptionIndex++; + } + } + + if (*conf->timeserver == 0) /* Use default server for time information */ + snprintf(conf->timeserver, MAX_STRING, "%s", DefaultTimeServer[0]); + + /* Init CURL before usage */ + curl_global_init(CURL_GLOBAL_ALL); + curl = curl_easy_init(); + if (curl) { + SyncTime_CURL_Init(curl, conf->http_proxy, conf->proxy_user); + + /* Calculating time diff between GMT and localtime */ + tt = time(0); + lt = localtime(&tt); + tt_local = mktime(lt); + gmt = gmtime(&tt); + tt_gmt = mktime(gmt); + tzonediffFloat = difftime(tt_local, tt_gmt); + tzonediffWord = (int)(tzonediffFloat/3600.0); + + if ((double)(tzonediffWord * 3600) == tzonediffFloat) + snprintf(tzoneBuf, 15, "%+03d'00'", tzonediffWord); + else + snprintf(tzoneBuf, 15, "%+03d'30'", tzonediffWord); + + /* Get current system time and local time */ + GetSystemTime(&SYSTime); + GetLocalTime(&LOCALTime); + snprintf(timeBuf, 60, "%s, %02d %s %04d %02d:%02d:%02d.%03d, ", + DayStr[LOCALTime.wDayOfWeek], LOCALTime.wDay, + MthStr[LOCALTime.wMonth-1], LOCALTime.wYear, + LOCALTime.wHour, LOCALTime.wMinute, LOCALTime.wSecond, + LOCALTime.wMilliseconds); + + fprintf(stderr, "Fetch: %s\n\n", conf->timeserver); + fprintf(stderr, "Before HTTP. Date: %s%s\n\n", timeBuf, tzoneBuf); + + /* HTTP HEAD command to the Webserver */ + SyncTime_CURL_Fetch(curl, conf->timeserver, "index.htm", + HTTP_COMMAND_HEAD); + + GetLocalTime(&LOCALTime); + snprintf(timeBuf, 60, "%s, %02d %s %04d %02d:%02d:%02d.%03d, ", + DayStr[LOCALTime.wDayOfWeek], LOCALTime.wDay, + MthStr[LOCALTime.wMonth-1], LOCALTime.wYear, + LOCALTime.wHour, LOCALTime.wMinute, LOCALTime.wSecond, + LOCALTime.wMilliseconds); + fprintf(stderr, "\nAfter HTTP. Date: %s%s\n", timeBuf, tzoneBuf); + + if (AutoSyncTime == 3) { + /* Synchronising computer clock */ + if (!SetSystemTime(&SYSTime)) { /* Set system time */ + fprintf(stderr, "ERROR: Unable to set system time.\n"); + RetValue = 1; + } + else { + /* Successfully re-adjusted computer clock */ + GetLocalTime(&LOCALTime); + snprintf(timeBuf, 60, "%s, %02d %s %04d %02d:%02d:%02d.%03d, ", + DayStr[LOCALTime.wDayOfWeek], LOCALTime.wDay, + MthStr[LOCALTime.wMonth-1], LOCALTime.wYear, + LOCALTime.wHour, LOCALTime.wMinute, LOCALTime.wSecond, + LOCALTime.wMilliseconds); + fprintf(stderr, "\nNew System's Date: %s%s\n", timeBuf, tzoneBuf); + } + } + + /* Cleanup before exit */ + conf_init(conf); + curl_easy_cleanup(curl); + } + return RetValue; +} diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/threaded-ssl.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/threaded-ssl.c new file mode 100644 index 0000000000..a7e9c2de16 --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/threaded-ssl.c @@ -0,0 +1,162 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +/* A multi-threaded example that uses pthreads and fetches 4 remote files at + * once over HTTPS. The lock callbacks and stuff assume OpenSSL or GnuTLS + * (libgcrypt) so far. + * + * OpenSSL docs for this: + * http://www.openssl.org/docs/crypto/threads.html + * gcrypt docs for this: + * http://gnupg.org/documentation/manuals/gcrypt/Multi_002dThreading.html + */ + +#define USE_OPENSSL /* or USE_GNUTLS accordingly */ + +#include <stdio.h> +#include <pthread.h> +#include <curl/curl.h> + +#define NUMT 4 + +/* we have this global to let the callback get easy access to it */ +static pthread_mutex_t *lockarray; + +#ifdef USE_OPENSSL +#include <openssl/crypto.h> +static void lock_callback(int mode, int type, char *file, int line) +{ + (void)file; + (void)line; + if (mode & CRYPTO_LOCK) { + pthread_mutex_lock(&(lockarray[type])); + } + else { + pthread_mutex_unlock(&(lockarray[type])); + } +} + +static unsigned long thread_id(void) +{ + unsigned long ret; + + ret=(unsigned long)pthread_self(); + return(ret); +} + +static void init_locks(void) +{ + int i; + + lockarray=(pthread_mutex_t *)OPENSSL_malloc(CRYPTO_num_locks() * + sizeof(pthread_mutex_t)); + for (i=0; i<CRYPTO_num_locks(); i++) { + pthread_mutex_init(&(lockarray[i]),NULL); + } + + CRYPTO_set_id_callback((unsigned long (*)())thread_id); + CRYPTO_set_locking_callback((void (*)())lock_callback); +} + +static void kill_locks(void) +{ + int i; + + CRYPTO_set_locking_callback(NULL); + for (i=0; i<CRYPTO_num_locks(); i++) + pthread_mutex_destroy(&(lockarray[i])); + + OPENSSL_free(lockarray); +} +#endif + +#ifdef USE_GNUTLS +#include <gcrypt.h> +#include <errno.h> + +GCRY_THREAD_OPTION_PTHREAD_IMPL; + +void init_locks(void) +{ + gcry_control(GCRYCTL_SET_THREAD_CBS); +} + +#define kill_locks() +#endif + +/* List of URLs to fetch.*/ +const char * const urls[]= { + "https://www.example.com/", + "https://www2.example.com/", + "https://www3.example.com/", + "https://www4.example.com/", +}; + +static void *pull_one_url(void *url) +{ + CURL *curl; + + curl = curl_easy_init(); + curl_easy_setopt(curl, CURLOPT_URL, url); + /* this example doesn't verify the server's certificate, which means we + might be downloading stuff from an impostor */ + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L); + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L); + curl_easy_perform(curl); /* ignores error */ + curl_easy_cleanup(curl); + + return NULL; +} + +int main(int argc, char **argv) +{ + pthread_t tid[NUMT]; + int i; + int error; + (void)argc; /* we don't use any arguments in this example */ + (void)argv; + + /* Must initialize libcurl before any threads are started */ + curl_global_init(CURL_GLOBAL_ALL); + + init_locks(); + + for(i=0; i< NUMT; i++) { + error = pthread_create(&tid[i], + NULL, /* default attributes please */ + pull_one_url, + (void *)urls[i]); + if(0 != error) + fprintf(stderr, "Couldn't run thread number %d, errno %d\n", i, error); + else + fprintf(stderr, "Thread %d, gets %s\n", i, urls[i]); + } + + /* now wait for all threads to terminate */ + for(i=0; i< NUMT; i++) { + error = pthread_join(tid[i], NULL); + fprintf(stderr, "Thread %d terminated\n", i); + } + + kill_locks(); + + return 0; +} diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/url2file.c b/plugins/FTPFileYM/curl-7.29.0/docs/examples/url2file.c new file mode 100644 index 0000000000..64d27c88f2 --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/url2file.c @@ -0,0 +1,81 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + +#include <curl/curl.h> + +static size_t write_data(void *ptr, size_t size, size_t nmemb, void *stream) +{ + size_t written = fwrite(ptr, size, nmemb, (FILE *)stream); + return written; +} + +int main(int argc, char *argv[]) +{ + CURL *curl_handle; + static const char *pagefilename = "page.out"; + FILE *pagefile; + + if(argc < 2 ) { + printf("Usage: %s <URL>\n", argv[0]); + return 1; + } + + curl_global_init(CURL_GLOBAL_ALL); + + /* init the curl session */ + curl_handle = curl_easy_init(); + + /* set URL to get here */ + curl_easy_setopt(curl_handle, CURLOPT_URL, argv[1]); + + /* Switch on full protocol/debug output while testing */ + curl_easy_setopt(curl_handle, CURLOPT_VERBOSE, 1L); + + /* disable progress meter, set to 0L to enable and disable debug output */ + curl_easy_setopt(curl_handle, CURLOPT_NOPROGRESS, 1L); + + /* send all data to this function */ + curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, write_data); + + /* open the file */ + pagefile = fopen(pagefilename, "wb"); + if (pagefile) { + + /* write the page body to this file handle. CURLOPT_FILE is also known as + CURLOPT_WRITEDATA*/ + curl_easy_setopt(curl_handle, CURLOPT_FILE, pagefile); + + /* get it! */ + curl_easy_perform(curl_handle); + + /* close the header file */ + fclose(pagefile); + } + + /* cleanup curl stuff */ + curl_easy_cleanup(curl_handle); + + return 0; +} diff --git a/plugins/FTPFileYM/curl-7.29.0/docs/examples/version-check.pl b/plugins/FTPFileYM/curl-7.29.0/docs/examples/version-check.pl new file mode 100644 index 0000000000..92f0808d61 --- /dev/null +++ b/plugins/FTPFileYM/curl-7.29.0/docs/examples/version-check.pl @@ -0,0 +1,105 @@ +#!/usr/bin/env perl +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at http://curl.haxx.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### + +# This script accepts a source file as input on the command line. +# +# It first loads the 'symbols-in-versions' document and stores a lookup +# table for all known symbols for which version they were introduced. +# +# It then scans the given source file to dig up all symbols starting with CURL. +# Finally, it sorts the internal list of found symbols (using the version +# number as sort key) and then it outputs the most recent version number and +# the symbols from that version that are used. +# +# Usage: +# +# version-check.pl [source file] +# + +open(S, "<../libcurl/symbols-in-versions") || die; + +my %doc; +my %rem; +while(<S>) { + if(/(^CURL[^ \n]*) *(.*)/) { + my ($sym, $rest)=($1, $2); + my @a=split(/ +/, $rest); + + $doc{$sym}=$a[0]; # when it was introduced + + if($a[2]) { + # this symbol is documented to have been present the last time + # in this release + $rem{$sym}=$a[2]; + } + } + +} + +close(S); + +sub age { + my ($ver)=@_; + + my @s=split(/\./, $ver); + return $s[0]*10000+$s[1]*100+$s[2]; +} + +my %used; +open(C, "<$ARGV[0]") || die; + +while(<C>) { + if(/\W(CURL[_A-Z0-9v]+)\W/) { + #print "$1\n"; + $used{$1}++; + } +} + +close(C); + +sub sortversions { + my $r = age($doc{$a}) <=> age($doc{$b}); + if(!$r) { + $r = $a cmp $b; + } + return $r; +} + +my @recent = reverse sort sortversions keys %used; + +# the most recent symbol +my $newsym = $recent[0]; +# the most recent version +my $newver = $doc{$newsym}; + +print "The scanned source uses these symbols introduced in $newver:\n"; + +for my $w (@recent) { + if($doc{$w} eq $newver) { + printf " $w\n"; + next; + } + last; +} + + |