You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2015/11/21 01:42:44 UTC
[19/42] incubator-mynewt-newt git commit: Move newt source into a
"newt" subdirectory.
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/e95057f4/newt/Godeps/_workspace/src/github.com/andelf/go-curl/compat.h
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/andelf/go-curl/compat.h b/newt/Godeps/_workspace/src/github.com/andelf/go-curl/compat.h
new file mode 100644
index 0000000..5550970
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/andelf/go-curl/compat.h
@@ -0,0 +1,380 @@
+
+/* generated by compatgen.py */
+#include<curl/curl.h>
+
+
+
+#if (LIBCURL_VERSION_MINOR == 36 && LIBCURL_VERSION_PATCH < 0) || LIBCURL_VERSION_MINOR < 36
+#define CURLOPT_SSL_ENABLE_NPN 0
+#define CURLOPT_SSL_ENABLE_ALPN 0
+#define CURLOPT_EXPECT_100_TIMEOUT_MS 0
+#if (LIBCURL_VERSION_MINOR == 35 && LIBCURL_VERSION_PATCH < 0) || LIBCURL_VERSION_MINOR < 35
+#if (LIBCURL_VERSION_MINOR == 34 && LIBCURL_VERSION_PATCH < 0) || LIBCURL_VERSION_MINOR < 34
+#define CURLOPT_LOGIN_OPTIONS 0
+#define CURLINFO_TLS_SESSION 0
+#if (LIBCURL_VERSION_MINOR == 33 && LIBCURL_VERSION_PATCH < 0) || LIBCURL_VERSION_MINOR < 33
+#define CURLOPT_XOAUTH2_BEARER 0
+#define CURLOPT_DNS_INTERFACE 0
+#define CURLOPT_DNS_LOCAL_IP4 0
+#define CURLOPT_DNS_LOCAL_IP6 0
+#define CURL_VERSION_HTTP2 0
+#if (LIBCURL_VERSION_MINOR == 32 && LIBCURL_VERSION_PATCH < 0) || LIBCURL_VERSION_MINOR < 32
+#define CURLOPT_XFERINFODATA 0
+#define CURLOPT_XFERINFOFUNCTION 0
+#if (LIBCURL_VERSION_MINOR == 31 && LIBCURL_VERSION_PATCH < 0) || LIBCURL_VERSION_MINOR < 31
+#define CURLOPT_SASL_IR 0
+#if (LIBCURL_VERSION_MINOR == 30 && LIBCURL_VERSION_PATCH < 0) || LIBCURL_VERSION_MINOR < 30
+#define CURLE_NO_CONNECTION_AVAILABLE -1
+#if (LIBCURL_VERSION_MINOR == 29 && LIBCURL_VERSION_PATCH < 0) || LIBCURL_VERSION_MINOR < 29
+#if (LIBCURL_VERSION_MINOR == 28 && LIBCURL_VERSION_PATCH < 1) || LIBCURL_VERSION_MINOR < 28
+#if (LIBCURL_VERSION_MINOR == 28 && LIBCURL_VERSION_PATCH < 0) || LIBCURL_VERSION_MINOR < 28
+#if (LIBCURL_VERSION_MINOR == 27 && LIBCURL_VERSION_PATCH < 0) || LIBCURL_VERSION_MINOR < 27
+#if (LIBCURL_VERSION_MINOR == 26 && LIBCURL_VERSION_PATCH < 0) || LIBCURL_VERSION_MINOR < 26
+#if (LIBCURL_VERSION_MINOR == 25 && LIBCURL_VERSION_PATCH < 0) || LIBCURL_VERSION_MINOR < 25
+#define CURLOPT_TCP_KEEPALIVE 0
+#define CURLOPT_TCP_KEEPIDLE 0
+#define CURLOPT_TCP_KEEPINTVL 0
+#define CURLOPT_SSL_OPTIONS 0
+#define CURLOPT_MAIL_AUTH 0
+#if (LIBCURL_VERSION_MINOR == 24 && LIBCURL_VERSION_PATCH < 0) || LIBCURL_VERSION_MINOR < 24
+#define CURLOPT_DNS_SERVERS 0
+#define CURLOPT_ACCEPTTIMEOUT_MS 0
+#define CURLE_FTP_ACCEPT_FAILED -1
+#define CURLE_FTP_ACCEPT_TIMEOUT -1
+#if (LIBCURL_VERSION_MINOR == 23 && LIBCURL_VERSION_PATCH < 1) || LIBCURL_VERSION_MINOR < 23
+#if (LIBCURL_VERSION_MINOR == 23 && LIBCURL_VERSION_PATCH < 0) || LIBCURL_VERSION_MINOR < 23
+#if (LIBCURL_VERSION_MINOR == 22 && LIBCURL_VERSION_PATCH < 0) || LIBCURL_VERSION_MINOR < 22
+#define CURLOPT_GSSAPI_DELEGATION 0
+#define CURL_VERSION_NTLM_WB 0
+#if (LIBCURL_VERSION_MINOR == 21 && LIBCURL_VERSION_PATCH < 7) || LIBCURL_VERSION_MINOR < 21
+#define CURLOPT_CLOSESOCKETFUNCTION 0
+#define CURLOPT_CLOSESOCKETDATA 0
+#if (LIBCURL_VERSION_MINOR == 21 && LIBCURL_VERSION_PATCH < 6) || LIBCURL_VERSION_MINOR < 21
+#define CURLOPT_ACCEPT_ENCODING 0
+#define CURLOPT_TRANSFER_ENCODING 0
+#if (LIBCURL_VERSION_MINOR == 21 && LIBCURL_VERSION_PATCH < 5) || LIBCURL_VERSION_MINOR < 21
+#define CURLE_NOT_BUILT_IN -1
+#define CURLE_UNKNOWN_OPTION -1
+#if (LIBCURL_VERSION_MINOR == 21 && LIBCURL_VERSION_PATCH < 4) || LIBCURL_VERSION_MINOR < 21
+#define CURLOPT_TLSAUTH_USERNAME 0
+#define CURLOPT_TLSAUTH_PASSWORD 0
+#define CURLOPT_TLSAUTH_TYPE 0
+#define CURL_VERSION_TLSAUTH_SRP 0
+#if (LIBCURL_VERSION_MINOR == 21 && LIBCURL_VERSION_PATCH < 3) || LIBCURL_VERSION_MINOR < 21
+#define CURLOPT_RESOLVE 0
+#if (LIBCURL_VERSION_MINOR == 21 && LIBCURL_VERSION_PATCH < 2) || LIBCURL_VERSION_MINOR < 21
+#if (LIBCURL_VERSION_MINOR == 21 && LIBCURL_VERSION_PATCH < 1) || LIBCURL_VERSION_MINOR < 21
+#if (LIBCURL_VERSION_MINOR == 21 && LIBCURL_VERSION_PATCH < 0) || LIBCURL_VERSION_MINOR < 21
+#define CURLOPT_WILDCARDMATCH 0
+#define CURLOPT_CHUNK_BGN_FUNCTION 0
+#define CURLOPT_CHUNK_END_FUNCTION 0
+#define CURLOPT_FNMATCH_FUNCTION 0
+#define CURLOPT_CHUNK_DATA 0
+#define CURLOPT_FNMATCH_DATA 0
+#define CURLE_FTP_BAD_FILE_LIST -1
+#define CURLE_CHUNK_FAILED -1
+#define CURLINFO_PRIMARY_PORT 0
+#define CURLINFO_LOCAL_IP 0
+#define CURLINFO_LOCAL_PORT 0
+#if (LIBCURL_VERSION_MINOR == 20 && LIBCURL_VERSION_PATCH < 1) || LIBCURL_VERSION_MINOR < 20
+#if (LIBCURL_VERSION_MINOR == 20 && LIBCURL_VERSION_PATCH < 0) || LIBCURL_VERSION_MINOR < 20
+#define CURLOPT_SERVER_RESPONSE_TIMEOUT 0
+#define CURLOPT_MAIL_FROM 0
+#define CURLOPT_MAIL_RCPT 0
+#define CURLOPT_FTP_USE_PRET 0
+#define CURLOPT_RTSP_REQUEST 0
+#define CURLOPT_RTSP_SESSION_ID 0
+#define CURLOPT_RTSP_STREAM_URI 0
+#define CURLOPT_RTSP_TRANSPORT 0
+#define CURLOPT_RTSP_CLIENT_CSEQ 0
+#define CURLOPT_RTSP_SERVER_CSEQ 0
+#define CURLOPT_INTERLEAVEDATA 0
+#define CURLOPT_INTERLEAVEFUNCTION 0
+#define CURLOPT_RTSPHEADER 0
+#define CURLE_FTP_PRET_FAILED -1
+#define CURLE_RTSP_CSEQ_ERROR -1
+#define CURLE_RTSP_SESSION_ERROR -1
+#define CURLINFO_RTSP_SESSION_ID 0
+#define CURLINFO_RTSP_CLIENT_CSEQ 0
+#define CURLINFO_RTSP_SERVER_CSEQ 0
+#define CURLINFO_RTSP_CSEQ_RECV 0
+#if (LIBCURL_VERSION_MINOR == 19 && LIBCURL_VERSION_PATCH < 7) || LIBCURL_VERSION_MINOR < 19
+#if (LIBCURL_VERSION_MINOR == 19 && LIBCURL_VERSION_PATCH < 6) || LIBCURL_VERSION_MINOR < 19
+#define CURLOPT_SSH_KNOWNHOSTS 0
+#define CURLOPT_SSH_KEYFUNCTION 0
+#define CURLOPT_SSH_KEYDATA 0
+#define CURL_VERSION_CURLDEBUG 0
+#if (LIBCURL_VERSION_MINOR == 19 && LIBCURL_VERSION_PATCH < 5) || LIBCURL_VERSION_MINOR < 19
+#if (LIBCURL_VERSION_MINOR == 19 && LIBCURL_VERSION_PATCH < 4) || LIBCURL_VERSION_MINOR < 19
+#define CURLOPT_NOPROXY 0
+#define CURLOPT_TFTP_BLKSIZE 0
+#define CURLOPT_SOCKS5_GSSAPI_SERVICE 0
+#define CURLOPT_SOCKS5_GSSAPI_NEC 0
+#define CURLOPT_PROTOCOLS 0
+#define CURLOPT_REDIR_PROTOCOLS 0
+#define CURLINFO_CONDITION_UNMET 0
+#if (LIBCURL_VERSION_MINOR == 19 && LIBCURL_VERSION_PATCH < 3) || LIBCURL_VERSION_MINOR < 19
+#if (LIBCURL_VERSION_MINOR == 19 && LIBCURL_VERSION_PATCH < 2) || LIBCURL_VERSION_MINOR < 19
+#if (LIBCURL_VERSION_MINOR == 19 && LIBCURL_VERSION_PATCH < 1) || LIBCURL_VERSION_MINOR < 19
+#define CURLOPT_POSTREDIR 0
+#define CURLOPT_CERTINFO 0
+#define CURLOPT_USERNAME 0
+#define CURLOPT_PASSWORD 0
+#define CURLOPT_PROXYUSERNAME 0
+#define CURLOPT_PROXYPASSWORD 0
+#define CURLINFO_CERTINFO 0
+#if (LIBCURL_VERSION_MINOR == 19 && LIBCURL_VERSION_PATCH < 0) || LIBCURL_VERSION_MINOR < 19
+#define CURLOPT_CRLFILE 0
+#define CURLOPT_ISSUERCERT 0
+#define CURLOPT_ADDRESS_SCOPE 0
+#define CURLE_SSL_CRL_BADFILE -1
+#define CURLE_SSL_ISSUER_ERROR -1
+#define CURLINFO_PRIMARY_IP 0
+#define CURLINFO_APPCONNECT_TIME 0
+#if (LIBCURL_VERSION_MINOR == 18 && LIBCURL_VERSION_PATCH < 2) || LIBCURL_VERSION_MINOR < 18
+#define CURLE_AGAIN -1
+#define CURLINFO_REDIRECT_URL 0
+#if (LIBCURL_VERSION_MINOR == 18 && LIBCURL_VERSION_PATCH < 1) || LIBCURL_VERSION_MINOR < 18
+#if (LIBCURL_VERSION_MINOR == 18 && LIBCURL_VERSION_PATCH < 0) || LIBCURL_VERSION_MINOR < 18
+#define CURLOPT_PROXY_TRANSFER_MODE 0
+#define CURLOPT_SEEKFUNCTION 0
+#define CURLOPT_SEEKDATA 0
+#if (LIBCURL_VERSION_MINOR == 17 && LIBCURL_VERSION_PATCH < 1) || LIBCURL_VERSION_MINOR < 17
+#define CURLOPT_POST301 0
+#define CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 0
+#define CURLOPT_OPENSOCKETFUNCTION 0
+#define CURLOPT_OPENSOCKETDATA 0
+#define CURLOPT_COPYPOSTFIELDS 0
+#define CURLE_PEER_FAILED_VERIFICATION -1
+#if (LIBCURL_VERSION_MINOR == 17 && LIBCURL_VERSION_PATCH < 0) || LIBCURL_VERSION_MINOR < 17
+#define CURLOPT_LOW_SPEED_LIMIT 0
+#define CURLOPT_KEYPASSWD 0
+#define CURLOPT_DIRLISTONLY 0
+#define CURLOPT_APPEND 0
+#define CURLOPT_FTP_RESPONSE_TIMEOUT 0
+#define CURLOPT_USE_SSL 0
+#define CURLE_OBSOLETE4 -1
+#define CURLE_REMOTE_ACCESS_DENIED -1
+#define CURLE_OBSOLETE10 -1
+#define CURLE_OBSOLETE12 -1
+#define CURLE_OBSOLETE16 -1
+#define CURLE_FTP_COULDNT_SET_TYPE -1
+#define CURLE_OBSOLETE20 -1
+#define CURLE_QUOTE_ERROR -1
+#define CURLE_OBSOLETE24 -1
+#define CURLE_OBSOLETE29 -1
+#define CURLE_OBSOLETE32 -1
+#define CURLE_RANGE_ERROR -1
+#define CURLE_OBSOLETE40 -1
+#define CURLE_OBSOLETE44 -1
+#define CURLE_OBSOLETE46 -1
+#define CURLE_OBSOLETE50 -1
+#define CURLE_OBSOLETE57 -1
+#define CURLE_USE_SSL_FAILED -1
+#define CURLE_REMOTE_DISK_FULL -1
+#define CURLE_REMOTE_FILE_EXISTS -1
+#if (LIBCURL_VERSION_MINOR == 16 && LIBCURL_VERSION_PATCH < 4) || LIBCURL_VERSION_MINOR < 16
+#define CURLOPT_KRBLEVEL 0
+#define CURLOPT_NEW_FILE_PERMS 0
+#define CURLOPT_NEW_DIRECTORY_PERMS 0
+#if (LIBCURL_VERSION_MINOR == 16 && LIBCURL_VERSION_PATCH < 3) || LIBCURL_VERSION_MINOR < 16
+#define CURLE_UPLOAD_FAILED -1
+#if (LIBCURL_VERSION_MINOR == 16 && LIBCURL_VERSION_PATCH < 2) || LIBCURL_VERSION_MINOR < 16
+#define CURLOPT_TIMEOUT_MS 0
+#define CURLOPT_CONNECTTIMEOUT_MS 0
+#define CURLOPT_HTTP_TRANSFER_DECODING 0
+#define CURLOPT_HTTP_CONTENT_DECODING 0
+#if (LIBCURL_VERSION_MINOR == 16 && LIBCURL_VERSION_PATCH < 1) || LIBCURL_VERSION_MINOR < 16
+#define CURLOPT_SSH_AUTH_TYPES 0
+#define CURLOPT_SSH_PUBLIC_KEYFILE 0
+#define CURLOPT_SSH_PRIVATE_KEYFILE 0
+#define CURLOPT_FTP_SSL_CCC 0
+#define CURLE_REMOTE_FILE_NOT_FOUND -1
+#define CURLE_SSH -1
+#define CURLE_SSL_SHUTDOWN_FAILED -1
+#if (LIBCURL_VERSION_MINOR == 16 && LIBCURL_VERSION_PATCH < 0) || LIBCURL_VERSION_MINOR < 16
+#define CURLOPT_SOCKOPTFUNCTION 0
+#define CURLOPT_SOCKOPTDATA 0
+#define CURLOPT_SSL_SESSIONID_CACHE 0
+#define CURLE_SSL_CACERT_BADFILE -1
+#if (LIBCURL_VERSION_MINOR == 15 && LIBCURL_VERSION_PATCH < 5) || LIBCURL_VERSION_MINOR < 15
+#define CURLOPT_MAX_SEND_SPEED_LARGE 0
+#define CURLOPT_MAX_RECV_SPEED_LARGE 0
+#define CURLOPT_FTP_ALTERNATIVE_TO_USER 0
+#if (LIBCURL_VERSION_MINOR == 15 && LIBCURL_VERSION_PATCH < 4) || LIBCURL_VERSION_MINOR < 15
+#define CURLOPT_CONV_FROM_NETWORK_FUNCTION 0
+#define CURLOPT_CONV_TO_NETWORK_FUNCTION 0
+#define CURLOPT_CONV_FROM_UTF8_FUNCTION 0
+#define CURLE_CONV_FAILED -1
+#define CURLE_CONV_REQD -1
+#define CURLINFO_FTP_ENTRY_PATH 0
+#define CURL_VERSION_CONV 0
+#if (LIBCURL_VERSION_MINOR == 15 && LIBCURL_VERSION_PATCH < 3) || LIBCURL_VERSION_MINOR < 15
+#if (LIBCURL_VERSION_MINOR == 15 && LIBCURL_VERSION_PATCH < 2) || LIBCURL_VERSION_MINOR < 15
+#define CURLOPT_LOCALPORT 0
+#define CURLOPT_LOCALPORTRANGE 0
+#define CURLOPT_CONNECT_ONLY 0
+#define CURLINFO_LASTSOCKET 0
+#if (LIBCURL_VERSION_MINOR == 15 && LIBCURL_VERSION_PATCH < 1) || LIBCURL_VERSION_MINOR < 15
+#define CURLOPT_FTP_FILEMETHOD 0
+#if (LIBCURL_VERSION_MINOR == 15 && LIBCURL_VERSION_PATCH < 0) || LIBCURL_VERSION_MINOR < 15
+#define CURLOPT_FTP_SKIP_PASV_IP 0
+#define CURLE_TFTP_NOTFOUND -1
+#define CURLE_TFTP_PERM -1
+#define CURLE_TFTP_DISKFULL -1
+#define CURLE_TFTP_ILLEGAL -1
+#define CURLE_TFTP_UNKNOWNID -1
+#define CURLE_TFTP_EXISTS -1
+#define CURLE_TFTP_NOSUCHUSER -1
+#if (LIBCURL_VERSION_MINOR == 14 && LIBCURL_VERSION_PATCH < 1) || LIBCURL_VERSION_MINOR < 14
+#define CURLOPT_COOKIELIST 0
+#define CURLOPT_IGNORE_CONTENT_LENGTH 0
+#define CURLINFO_COOKIELIST 0
+#if (LIBCURL_VERSION_MINOR == 14 && LIBCURL_VERSION_PATCH < 0) || LIBCURL_VERSION_MINOR < 14
+#if (LIBCURL_VERSION_MINOR == 13 && LIBCURL_VERSION_PATCH < 2) || LIBCURL_VERSION_MINOR < 13
+#define CURL_VERSION_SSPI 0
+#if (LIBCURL_VERSION_MINOR == 13 && LIBCURL_VERSION_PATCH < 1) || LIBCURL_VERSION_MINOR < 13
+#define CURLE_LOGIN_DENIED -1
+#if (LIBCURL_VERSION_MINOR == 13 && LIBCURL_VERSION_PATCH < 0) || LIBCURL_VERSION_MINOR < 13
+#define CURLOPT_SOURCE_URL 0
+#define CURLOPT_SOURCE_QUOTE 0
+#define CURLOPT_FTP_ACCOUNT 0
+#if (LIBCURL_VERSION_MINOR == 12 && LIBCURL_VERSION_PATCH < 3) || LIBCURL_VERSION_MINOR < 12
+#define CURLOPT_IOCTLFUNCTION 0
+#define CURLOPT_IOCTLDATA 0
+#define CURLE_SEND_FAIL_REWIND -1
+#define CURLE_SSL_ENGINE_INITFAILED -1
+#define CURLINFO_NUM_CONNECTS 0
+#define CURLINFO_SSL_ENGINES 0
+#if (LIBCURL_VERSION_MINOR == 12 && LIBCURL_VERSION_PATCH < 2) || LIBCURL_VERSION_MINOR < 12
+#define CURLOPT_FTPSSLAUTH 0
+#define CURLINFO_OS_ERRNO 0
+#if (LIBCURL_VERSION_MINOR == 12 && LIBCURL_VERSION_PATCH < 1) || LIBCURL_VERSION_MINOR < 12
+#define CURLOPT_SOURCE_HOST 0
+#define CURLOPT_SOURCE_USERPWD 0
+#define CURLOPT_SOURCE_PATH 0
+#define CURLOPT_SOURCE_PORT 0
+#define CURLOPT_PASV_HOST 0
+#define CURLOPT_SOURCE_PREQUOTE 0
+#define CURLOPT_SOURCE_POSTQUOTE 0
+#if (LIBCURL_VERSION_MINOR == 12 && LIBCURL_VERSION_PATCH < 0) || LIBCURL_VERSION_MINOR < 12
+#define CURLE_INTERFACE_FAILED -1
+#define CURL_VERSION_IDN 0
+#if (LIBCURL_VERSION_MINOR == 11 && LIBCURL_VERSION_PATCH < 2) || LIBCURL_VERSION_MINOR < 11
+#define CURLOPT_TCP_NODELAY 0
+#if (LIBCURL_VERSION_MINOR == 11 && LIBCURL_VERSION_PATCH < 1) || LIBCURL_VERSION_MINOR < 11
+#define CURLOPT_POSTFIELDSIZE_LARGE 0
+#define CURL_VERSION_LARGEFILE 0
+#if (LIBCURL_VERSION_MINOR == 11 && LIBCURL_VERSION_PATCH < 0) || LIBCURL_VERSION_MINOR < 11
+#define CURLOPT_INFILESIZE_LARGE 0
+#define CURLOPT_RESUME_FROM_LARGE 0
+#define CURLOPT_MAXFILESIZE_LARGE 0
+#define CURLOPT_NETRC_FILE 0
+#define CURLOPT_FTP_SSL 0
+#define CURLE_FTP_SSL_FAILED -1
+#if (LIBCURL_VERSION_MINOR == 10 && LIBCURL_VERSION_PATCH < 8) || LIBCURL_VERSION_MINOR < 10
+#define CURLOPT_IPRESOLVE 0
+#define CURLOPT_MAXFILESIZE 0
+#define CURLE_LDAP_INVALID_URL -1
+#define CURLE_FILESIZE_EXCEEDED -1
+#define CURLINFO_RESPONSE_CODE 0
+#define CURLINFO_HTTPAUTH_AVAIL 0
+#define CURLINFO_PROXYAUTH_AVAIL 0
+#define CURL_VERSION_SPNEGO 0
+#if (LIBCURL_VERSION_MINOR == 10 && LIBCURL_VERSION_PATCH < 7) || LIBCURL_VERSION_MINOR < 10
+#define CURLOPT_FTP_CREATE_MISSING_DIRS 0
+#define CURLOPT_PROXYAUTH 0
+#define CURLINFO_HTTP_CONNECTCODE 0
+#define CURL_VERSION_ASYNCHDNS 0
+#if (LIBCURL_VERSION_MINOR == 10 && LIBCURL_VERSION_PATCH < 6) || LIBCURL_VERSION_MINOR < 10
+#define CURLOPT_HTTPAUTH 0
+#define CURLOPT_SSL_CTX_FUNCTION 0
+#define CURLOPT_SSL_CTX_DATA 0
+#define CURL_VERSION_NTLM 0
+#define CURL_VERSION_GSSNEGOTIATE 0
+#define CURL_VERSION_DEBUG 0
+#if (LIBCURL_VERSION_MINOR == 10 && LIBCURL_VERSION_PATCH < 5) || LIBCURL_VERSION_MINOR < 10
+#define CURLOPT_FTP_USE_EPRT 0
+#if (LIBCURL_VERSION_MINOR == 10 && LIBCURL_VERSION_PATCH < 4) || LIBCURL_VERSION_MINOR < 10
+#define CURLOPT_UNRESTRICTED_AUTH 0
+#if (LIBCURL_VERSION_MINOR == 10 && LIBCURL_VERSION_PATCH < 3) || LIBCURL_VERSION_MINOR < 10
+#define CURLOPT_PRIVATE 0
+#define CURLOPT_HTTP200ALIASES 0
+#define CURLE_HTTP_RETURNED_ERROR -1
+#define CURLINFO_PRIVATE 0
+#if (LIBCURL_VERSION_MINOR == 10 && LIBCURL_VERSION_PATCH < 2) || LIBCURL_VERSION_MINOR < 10
+#define CURLE_OPERATION_TIMEDOUT -1
+#if (LIBCURL_VERSION_MINOR == 10 && LIBCURL_VERSION_PATCH < 1) || LIBCURL_VERSION_MINOR < 10
+#error your version is TOOOOOOOO low
+#endif /* 7.10.1 */
+#endif /* 7.10.2 */
+#endif /* 7.10.3 */
+#endif /* 7.10.4 */
+#endif /* 7.10.5 */
+#endif /* 7.10.6 */
+#endif /* 7.10.7 */
+#endif /* 7.10.8 */
+#endif /* 7.11.0 */
+#endif /* 7.11.1 */
+#endif /* 7.11.2 */
+#endif /* 7.12.0 */
+#endif /* 7.12.1 */
+#endif /* 7.12.2 */
+#endif /* 7.12.3 */
+#endif /* 7.13.0 */
+#endif /* 7.13.1 */
+#endif /* 7.13.2 */
+#endif /* 7.14.0 */
+#endif /* 7.14.1 */
+#endif /* 7.15.0 */
+#endif /* 7.15.1 */
+#endif /* 7.15.2 */
+#endif /* 7.15.3 */
+#endif /* 7.15.4 */
+#endif /* 7.15.5 */
+#endif /* 7.16.0 */
+#endif /* 7.16.1 */
+#endif /* 7.16.2 */
+#endif /* 7.16.3 */
+#endif /* 7.16.4 */
+#endif /* 7.17.0 */
+#endif /* 7.17.1 */
+#endif /* 7.18.0 */
+#endif /* 7.18.1 */
+#endif /* 7.18.2 */
+#endif /* 7.19.0 */
+#endif /* 7.19.1 */
+#endif /* 7.19.2 */
+#endif /* 7.19.3 */
+#endif /* 7.19.4 */
+#endif /* 7.19.5 */
+#endif /* 7.19.6 */
+#endif /* 7.19.7 */
+#endif /* 7.20.0 */
+#endif /* 7.20.1 */
+#endif /* 7.21.0 */
+#endif /* 7.21.1 */
+#endif /* 7.21.2 */
+#endif /* 7.21.3 */
+#endif /* 7.21.4 */
+#endif /* 7.21.5 */
+#endif /* 7.21.6 */
+#endif /* 7.21.7 */
+#endif /* 7.22.0 */
+#endif /* 7.23.0 */
+#endif /* 7.23.1 */
+#endif /* 7.24.0 */
+#endif /* 7.25.0 */
+#endif /* 7.26.0 */
+#endif /* 7.27.0 */
+#endif /* 7.28.0 */
+#endif /* 7.28.1 */
+#endif /* 7.29.0 */
+#endif /* 7.30.0 */
+#endif /* 7.31.0 */
+#endif /* 7.32.0 */
+#endif /* 7.33.0 */
+#endif /* 7.34.0 */
+#endif /* 7.35.0 */
+#endif /* 7.36.0 */
+/* generated ends */
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/e95057f4/newt/Godeps/_workspace/src/github.com/andelf/go-curl/const.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/andelf/go-curl/const.go b/newt/Godeps/_workspace/src/github.com/andelf/go-curl/const.go
new file mode 100644
index 0000000..8635486
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/andelf/go-curl/const.go
@@ -0,0 +1,179 @@
+package curl
+
+/*
+#include <curl/curl.h>
+#include "compat.h"
+
+*/
+import "C"
+
+// for GlobalInit(flag)
+const (
+ GLOBAL_SSL = C.CURL_GLOBAL_SSL
+ GLOBAL_WIN32 = C.CURL_GLOBAL_WIN32
+ GLOBAL_ALL = C.CURL_GLOBAL_ALL
+ GLOBAL_NOTHING = C.CURL_GLOBAL_NOTHING
+ GLOBAL_DEFAULT = C.CURL_GLOBAL_DEFAULT
+)
+
+// CURLMcode
+const (
+ M_CALL_MULTI_PERFORM = C.CURLM_CALL_MULTI_PERFORM
+ // M_OK = C.CURLM_OK
+ M_BAD_HANDLE = C.CURLM_BAD_HANDLE
+ M_BAD_EASY_HANDLE = C.CURLM_BAD_EASY_HANDLE
+ M_OUT_OF_MEMORY = C.CURLM_OUT_OF_MEMORY
+ M_INTERNAL_ERROR = C.CURLM_INTERNAL_ERROR
+ M_BAD_SOCKET = C.CURLM_BAD_SOCKET
+ M_UNKNOWN_OPTION = C.CURLM_UNKNOWN_OPTION
+)
+
+// for multi.Setopt(flag, ...)
+const (
+ MOPT_SOCKETFUNCTION = C.CURLMOPT_SOCKETFUNCTION
+ MOPT_SOCKETDATA = C.CURLMOPT_SOCKETDATA
+ MOPT_PIPELINING = C.CURLMOPT_PIPELINING
+ MOPT_TIMERFUNCTION = C.CURLMOPT_TIMERFUNCTION
+ MOPT_TIMERDATA = C.CURLMOPT_TIMERDATA
+ MOPT_MAXCONNECTS = C.CURLMOPT_MAXCONNECTS
+)
+
+// CURLSHcode
+const (
+ // SHE_OK = C.CURLSHE_OK
+ SHE_BAD_OPTION = C.CURLSHE_BAD_OPTION
+ SHE_IN_USE = C.CURLSHE_IN_USE
+ SHE_INVALID = C.CURLSHE_INVALID
+ SHE_NOMEM = C.CURLSHE_NOMEM
+)
+
+// for share.Setopt(flat, ...)
+const (
+ SHOPT_SHARE = C.CURLSHOPT_SHARE
+ SHOPT_UNSHARE = C.CURLSHOPT_UNSHARE
+ SHOPT_LOCKFUNC = C.CURLSHOPT_LOCKFUNC
+ SHOPT_UNLOCKFUNC = C.CURLSHOPT_UNLOCKFUNC
+ SHOPT_USERDATA = C.CURLSHOPT_USERDATA
+)
+
+// for share.Setopt(SHOPT_SHARE/SHOPT_UNSHARE, flag)
+const (
+ LOCK_DATA_SHARE = C.CURL_LOCK_DATA_SHARE
+ LOCK_DATA_COOKIE = C.CURL_LOCK_DATA_COOKIE
+ LOCK_DATA_DNS = C.CURL_LOCK_DATA_DNS
+ LOCK_DATA_SSL_SESSION = C.CURL_LOCK_DATA_SSL_SESSION
+ LOCK_DATA_CONNECT = C.CURL_LOCK_DATA_CONNECT
+)
+
+// for VersionInfo(flag)
+const (
+ VERSION_FIRST = C.CURLVERSION_FIRST
+ VERSION_SECOND = C.CURLVERSION_SECOND
+ VERSION_THIRD = C.CURLVERSION_THIRD
+ // VERSION_FOURTH = C.CURLVERSION_FOURTH
+ VERSION_LAST = C.CURLVERSION_LAST
+ VERSION_NOW = C.CURLVERSION_NOW
+)
+
+// for VersionInfo(...).Features mask flag
+const (
+ VERSION_IPV6 = C.CURL_VERSION_IPV6
+ VERSION_KERBEROS4 = C.CURL_VERSION_KERBEROS4
+ VERSION_SSL = C.CURL_VERSION_SSL
+ VERSION_LIBZ = C.CURL_VERSION_LIBZ
+ VERSION_NTLM = C.CURL_VERSION_NTLM
+ VERSION_GSSNEGOTIATE = C.CURL_VERSION_GSSNEGOTIATE
+ VERSION_DEBUG = C.CURL_VERSION_DEBUG
+ VERSION_ASYNCHDNS = C.CURL_VERSION_ASYNCHDNS
+ VERSION_SPNEGO = C.CURL_VERSION_SPNEGO
+ VERSION_LARGEFILE = C.CURL_VERSION_LARGEFILE
+ VERSION_IDN = C.CURL_VERSION_IDN
+ VERSION_SSPI = C.CURL_VERSION_SSPI
+ VERSION_CONV = C.CURL_VERSION_CONV
+ VERSION_CURLDEBUG = C.CURL_VERSION_CURLDEBUG
+ VERSION_TLSAUTH_SRP = C.CURL_VERSION_TLSAUTH_SRP
+ VERSION_NTLM_WB = C.CURL_VERSION_NTLM_WB
+)
+
+// for OPT_READFUNCTION, return a int flag
+const (
+ READFUNC_ABORT = C.CURL_READFUNC_ABORT
+ READFUNC_PAUSE = C.CURL_READFUNC_PAUSE
+)
+
+// for easy.Setopt(OPT_HTTP_VERSION, flag)
+const (
+ HTTP_VERSION_NONE = C.CURL_HTTP_VERSION_NONE
+ HTTP_VERSION_1_0 = C.CURL_HTTP_VERSION_1_0
+ HTTP_VERSION_1_1 = C.CURL_HTTP_VERSION_1_1
+)
+
+// for easy.Setopt(OPT_PROXYTYPE, flag)
+const (
+ PROXY_HTTP = C.CURLPROXY_HTTP /* added in 7.10, new in 7.19.4 default is to use CONNECT HTTP/1.1 */
+ PROXY_HTTP_1_0 = C.CURLPROXY_HTTP_1_0 /* added in 7.19.4, force to use CONNECT HTTP/1.0 */
+ PROXY_SOCKS4 = C.CURLPROXY_SOCKS4 /* support added in 7.15.2, enum existed already in 7.10 */
+ PROXY_SOCKS5 = C.CURLPROXY_SOCKS5 /* added in 7.10 */
+ PROXY_SOCKS4A = C.CURLPROXY_SOCKS4A /* added in 7.18.0 */
+ // Use the SOCKS5 protocol but pass along the host name rather than the IP address.
+ PROXY_SOCKS5_HOSTNAME = C.CURLPROXY_SOCKS5_HOSTNAME
+)
+
+// for easy.Setopt(OPT_SSLVERSION, flag)
+const (
+ SSLVERSION_DEFAULT = C.CURL_SSLVERSION_DEFAULT
+ SSLVERSION_TLSv1 = C.CURL_SSLVERSION_TLSv1
+ SSLVERSION_SSLv2 = C.CURL_SSLVERSION_SSLv2
+ SSLVERSION_SSLv3 = C.CURL_SSLVERSION_SSLv3
+)
+
+// for easy.Setopt(OPT_TIMECONDITION, flag)
+const (
+ TIMECOND_NONE = C.CURL_TIMECOND_NONE
+ TIMECOND_IFMODSINCE = C.CURL_TIMECOND_IFMODSINCE
+ TIMECOND_IFUNMODSINCE = C.CURL_TIMECOND_IFUNMODSINCE
+ TIMECOND_LASTMOD = C.CURL_TIMECOND_LASTMOD
+)
+
+// for easy.Setopt(OPT_NETRC, flag)
+const (
+ NETRC_IGNORED = C.CURL_NETRC_IGNORED
+ NETRC_OPTIONAL = C.CURL_NETRC_OPTIONAL
+ NETRC_REQUIRED = C.CURL_NETRC_REQUIRED
+)
+
+// for easy.Setopt(OPT_FTP_CREATE_MISSING_DIRS, flag)
+const (
+ FTP_CREATE_DIR_NONE = C.CURLFTP_CREATE_DIR_NONE
+ FTP_CREATE_DIR = C.CURLFTP_CREATE_DIR
+ FTP_CREATE_DIR_RETRY = C.CURLFTP_CREATE_DIR_RETRY
+)
+
+// for easy.Setopt(OPT_IPRESOLVE, flag)
+const (
+ IPRESOLVE_WHATEVER = C.CURL_IPRESOLVE_WHATEVER
+ IPRESOLVE_V4 = C.CURL_IPRESOLVE_V4
+ IPRESOLVE_V6 = C.CURL_IPRESOLVE_V6
+)
+
+// for easy.Setopt(OPT_SSL_OPTIONS, flag)
+const (
+ SSLOPT_ALLOW_BEAST = 1
+)
+
+// for easy.Pause(flat)
+const (
+ PAUSE_RECV = C.CURLPAUSE_RECV
+ PAUSE_RECV_CONT = C.CURLPAUSE_RECV_CONT
+ PAUSE_SEND = C.CURLPAUSE_SEND
+ PAUSE_SEND_CONT = C.CURLPAUSE_SEND_CONT
+ PAUSE_ALL = C.CURLPAUSE_ALL
+ PAUSE_CONT = C.CURLPAUSE_CONT
+)
+
+// for multi.Info_read()
+const (
+ CURLMSG_NONE = C.CURLMSG_NONE
+ CURLMSG_DONE = C.CURLMSG_DONE
+ CURLMSG_LAST = C.CURLMSG_LAST
+)
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/e95057f4/newt/Godeps/_workspace/src/github.com/andelf/go-curl/const_gen.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/andelf/go-curl/const_gen.go b/newt/Godeps/_workspace/src/github.com/andelf/go-curl/const_gen.go
new file mode 100644
index 0000000..872138f
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/andelf/go-curl/const_gen.go
@@ -0,0 +1,410 @@
+
+// generated by codegen.py
+
+package curl
+/*
+#include <curl/curl.h>
+#include "compat.h"
+*/
+import "C"
+
+// CURLcode
+const (
+ E_UNSUPPORTED_PROTOCOL = C.CURLE_UNSUPPORTED_PROTOCOL
+ E_FAILED_INIT = C.CURLE_FAILED_INIT
+ E_URL_MALFORMAT = C.CURLE_URL_MALFORMAT
+ E_NOT_BUILT_IN = C.CURLE_NOT_BUILT_IN
+ E_COULDNT_RESOLVE_PROXY = C.CURLE_COULDNT_RESOLVE_PROXY
+ E_COULDNT_RESOLVE_HOST = C.CURLE_COULDNT_RESOLVE_HOST
+ E_COULDNT_CONNECT = C.CURLE_COULDNT_CONNECT
+ E_FTP_WEIRD_SERVER_REPLY = C.CURLE_FTP_WEIRD_SERVER_REPLY
+ E_REMOTE_ACCESS_DENIED = C.CURLE_REMOTE_ACCESS_DENIED
+ E_FTP_ACCEPT_FAILED = C.CURLE_FTP_ACCEPT_FAILED
+ E_FTP_WEIRD_PASS_REPLY = C.CURLE_FTP_WEIRD_PASS_REPLY
+ E_FTP_ACCEPT_TIMEOUT = C.CURLE_FTP_ACCEPT_TIMEOUT
+ E_FTP_WEIRD_PASV_REPLY = C.CURLE_FTP_WEIRD_PASV_REPLY
+ E_FTP_WEIRD_227_FORMAT = C.CURLE_FTP_WEIRD_227_FORMAT
+ E_FTP_CANT_GET_HOST = C.CURLE_FTP_CANT_GET_HOST
+ E_OBSOLETE16 = C.CURLE_OBSOLETE16
+ E_FTP_COULDNT_SET_TYPE = C.CURLE_FTP_COULDNT_SET_TYPE
+ E_PARTIAL_FILE = C.CURLE_PARTIAL_FILE
+ E_FTP_COULDNT_RETR_FILE = C.CURLE_FTP_COULDNT_RETR_FILE
+ E_OBSOLETE20 = C.CURLE_OBSOLETE20
+ E_QUOTE_ERROR = C.CURLE_QUOTE_ERROR
+ E_HTTP_RETURNED_ERROR = C.CURLE_HTTP_RETURNED_ERROR
+ E_WRITE_ERROR = C.CURLE_WRITE_ERROR
+ E_OBSOLETE24 = C.CURLE_OBSOLETE24
+ E_UPLOAD_FAILED = C.CURLE_UPLOAD_FAILED
+ E_READ_ERROR = C.CURLE_READ_ERROR
+ E_OUT_OF_MEMORY = C.CURLE_OUT_OF_MEMORY
+ E_OPERATION_TIMEDOUT = C.CURLE_OPERATION_TIMEDOUT
+ E_OBSOLETE29 = C.CURLE_OBSOLETE29
+ E_FTP_PORT_FAILED = C.CURLE_FTP_PORT_FAILED
+ E_FTP_COULDNT_USE_REST = C.CURLE_FTP_COULDNT_USE_REST
+ E_OBSOLETE32 = C.CURLE_OBSOLETE32
+ E_RANGE_ERROR = C.CURLE_RANGE_ERROR
+ E_HTTP_POST_ERROR = C.CURLE_HTTP_POST_ERROR
+ E_SSL_CONNECT_ERROR = C.CURLE_SSL_CONNECT_ERROR
+ E_BAD_DOWNLOAD_RESUME = C.CURLE_BAD_DOWNLOAD_RESUME
+ E_FILE_COULDNT_READ_FILE = C.CURLE_FILE_COULDNT_READ_FILE
+ E_LDAP_CANNOT_BIND = C.CURLE_LDAP_CANNOT_BIND
+ E_LDAP_SEARCH_FAILED = C.CURLE_LDAP_SEARCH_FAILED
+ E_OBSOLETE40 = C.CURLE_OBSOLETE40
+ E_FUNCTION_NOT_FOUND = C.CURLE_FUNCTION_NOT_FOUND
+ E_ABORTED_BY_CALLBACK = C.CURLE_ABORTED_BY_CALLBACK
+ E_BAD_FUNCTION_ARGUMENT = C.CURLE_BAD_FUNCTION_ARGUMENT
+ E_OBSOLETE44 = C.CURLE_OBSOLETE44
+ E_INTERFACE_FAILED = C.CURLE_INTERFACE_FAILED
+ E_OBSOLETE46 = C.CURLE_OBSOLETE46
+ E_UNKNOWN_OPTION = C.CURLE_UNKNOWN_OPTION
+ E_OBSOLETE50 = C.CURLE_OBSOLETE50
+ E_PEER_FAILED_VERIFICATION = C.CURLE_PEER_FAILED_VERIFICATION
+ E_GOT_NOTHING = C.CURLE_GOT_NOTHING
+ E_SSL_ENGINE_NOTFOUND = C.CURLE_SSL_ENGINE_NOTFOUND
+ E_SSL_ENGINE_SETFAILED = C.CURLE_SSL_ENGINE_SETFAILED
+ E_SEND_ERROR = C.CURLE_SEND_ERROR
+ E_RECV_ERROR = C.CURLE_RECV_ERROR
+ E_OBSOLETE57 = C.CURLE_OBSOLETE57
+ E_SSL_CERTPROBLEM = C.CURLE_SSL_CERTPROBLEM
+ E_SSL_CIPHER = C.CURLE_SSL_CIPHER
+ E_SSL_CACERT = C.CURLE_SSL_CACERT
+ E_BAD_CONTENT_ENCODING = C.CURLE_BAD_CONTENT_ENCODING
+ E_LDAP_INVALID_URL = C.CURLE_LDAP_INVALID_URL
+ E_FILESIZE_EXCEEDED = C.CURLE_FILESIZE_EXCEEDED
+ E_USE_SSL_FAILED = C.CURLE_USE_SSL_FAILED
+ E_SEND_FAIL_REWIND = C.CURLE_SEND_FAIL_REWIND
+ E_SSL_ENGINE_INITFAILED = C.CURLE_SSL_ENGINE_INITFAILED
+ E_LOGIN_DENIED = C.CURLE_LOGIN_DENIED
+ E_TFTP_NOTFOUND = C.CURLE_TFTP_NOTFOUND
+ E_TFTP_PERM = C.CURLE_TFTP_PERM
+ E_REMOTE_DISK_FULL = C.CURLE_REMOTE_DISK_FULL
+ E_TFTP_ILLEGAL = C.CURLE_TFTP_ILLEGAL
+ E_TFTP_UNKNOWNID = C.CURLE_TFTP_UNKNOWNID
+ E_REMOTE_FILE_EXISTS = C.CURLE_REMOTE_FILE_EXISTS
+ E_TFTP_NOSUCHUSER = C.CURLE_TFTP_NOSUCHUSER
+ E_CONV_FAILED = C.CURLE_CONV_FAILED
+ E_CONV_REQD = C.CURLE_CONV_REQD
+ E_SSL_CACERT_BADFILE = C.CURLE_SSL_CACERT_BADFILE
+ E_REMOTE_FILE_NOT_FOUND = C.CURLE_REMOTE_FILE_NOT_FOUND
+ E_SSH = C.CURLE_SSH
+ E_SSL_SHUTDOWN_FAILED = C.CURLE_SSL_SHUTDOWN_FAILED
+ E_AGAIN = C.CURLE_AGAIN
+ E_SSL_CRL_BADFILE = C.CURLE_SSL_CRL_BADFILE
+ E_SSL_ISSUER_ERROR = C.CURLE_SSL_ISSUER_ERROR
+ E_FTP_PRET_FAILED = C.CURLE_FTP_PRET_FAILED
+ E_RTSP_CSEQ_ERROR = C.CURLE_RTSP_CSEQ_ERROR
+ E_RTSP_SESSION_ERROR = C.CURLE_RTSP_SESSION_ERROR
+ E_FTP_BAD_FILE_LIST = C.CURLE_FTP_BAD_FILE_LIST
+ E_CHUNK_FAILED = C.CURLE_CHUNK_FAILED
+ E_NO_CONNECTION_AVAILABLE = C.CURLE_NO_CONNECTION_AVAILABLE
+ E_OBSOLETE10 = C.CURLE_OBSOLETE10
+ E_OBSOLETE12 = C.CURLE_OBSOLETE12
+ E_UNKNOWN_TELNET_OPTION = C.CURLE_UNKNOWN_TELNET_OPTION
+ E_SSL_PEER_CERTIFICATE = C.CURLE_SSL_PEER_CERTIFICATE
+ E_OBSOLETE = C.CURLE_OBSOLETE
+ E_BAD_PASSWORD_ENTERED = C.CURLE_BAD_PASSWORD_ENTERED
+ E_BAD_CALLING_ORDER = C.CURLE_BAD_CALLING_ORDER
+ E_FTP_USER_PASSWORD_INCORRECT = C.CURLE_FTP_USER_PASSWORD_INCORRECT
+ E_FTP_CANT_RECONNECT = C.CURLE_FTP_CANT_RECONNECT
+ E_FTP_COULDNT_GET_SIZE = C.CURLE_FTP_COULDNT_GET_SIZE
+ E_FTP_COULDNT_SET_ASCII = C.CURLE_FTP_COULDNT_SET_ASCII
+ E_FTP_WEIRD_USER_REPLY = C.CURLE_FTP_WEIRD_USER_REPLY
+ E_FTP_WRITE_ERROR = C.CURLE_FTP_WRITE_ERROR
+ E_LIBRARY_NOT_FOUND = C.CURLE_LIBRARY_NOT_FOUND
+ E_MALFORMAT_USER = C.CURLE_MALFORMAT_USER
+ E_SHARE_IN_USE = C.CURLE_SHARE_IN_USE
+ E_URL_MALFORMAT_USER = C.CURLE_URL_MALFORMAT_USER
+ E_FTP_ACCESS_DENIED = C.CURLE_FTP_ACCESS_DENIED
+ E_FTP_COULDNT_SET_BINARY = C.CURLE_FTP_COULDNT_SET_BINARY
+ E_FTP_QUOTE_ERROR = C.CURLE_FTP_QUOTE_ERROR
+ E_TFTP_DISKFULL = C.CURLE_TFTP_DISKFULL
+ E_TFTP_EXISTS = C.CURLE_TFTP_EXISTS
+ E_HTTP_RANGE_ERROR = C.CURLE_HTTP_RANGE_ERROR
+ E_FTP_SSL_FAILED = C.CURLE_FTP_SSL_FAILED
+ E_OPERATION_TIMEOUTED = C.CURLE_OPERATION_TIMEOUTED
+ E_HTTP_NOT_FOUND = C.CURLE_HTTP_NOT_FOUND
+ E_HTTP_PORT_FAILED = C.CURLE_HTTP_PORT_FAILED
+ E_FTP_COULDNT_STOR_FILE = C.CURLE_FTP_COULDNT_STOR_FILE
+ E_FTP_PARTIAL_FILE = C.CURLE_FTP_PARTIAL_FILE
+ E_FTP_BAD_DOWNLOAD_RESUME = C.CURLE_FTP_BAD_DOWNLOAD_RESUME
+ E_ALREADY_COMPLETE = C.CURLE_ALREADY_COMPLETE
+)
+
+// easy.Setopt(flag, ...)
+const (
+ OPT_ENCODING = C.CURLOPT_ENCODING
+ OPT_FILE = C.CURLOPT_FILE
+ OPT_URL = C.CURLOPT_URL
+ OPT_PORT = C.CURLOPT_PORT
+ OPT_PROXY = C.CURLOPT_PROXY
+ OPT_USERPWD = C.CURLOPT_USERPWD
+ OPT_PROXYUSERPWD = C.CURLOPT_PROXYUSERPWD
+ OPT_RANGE = C.CURLOPT_RANGE
+ OPT_INFILE = C.CURLOPT_INFILE
+ OPT_ERRORBUFFER = C.CURLOPT_ERRORBUFFER
+ OPT_WRITEFUNCTION = C.CURLOPT_WRITEFUNCTION
+ OPT_READFUNCTION = C.CURLOPT_READFUNCTION
+ OPT_TIMEOUT = C.CURLOPT_TIMEOUT
+ OPT_INFILESIZE = C.CURLOPT_INFILESIZE
+ OPT_POSTFIELDS = C.CURLOPT_POSTFIELDS
+ OPT_REFERER = C.CURLOPT_REFERER
+ OPT_FTPPORT = C.CURLOPT_FTPPORT
+ OPT_USERAGENT = C.CURLOPT_USERAGENT
+ OPT_LOW_SPEED_LIMIT = C.CURLOPT_LOW_SPEED_LIMIT
+ OPT_LOW_SPEED_TIME = C.CURLOPT_LOW_SPEED_TIME
+ OPT_RESUME_FROM = C.CURLOPT_RESUME_FROM
+ OPT_COOKIE = C.CURLOPT_COOKIE
+ OPT_HTTPHEADER = C.CURLOPT_HTTPHEADER
+ OPT_HTTPPOST = C.CURLOPT_HTTPPOST
+ OPT_SSLCERT = C.CURLOPT_SSLCERT
+ OPT_KEYPASSWD = C.CURLOPT_KEYPASSWD
+ OPT_CRLF = C.CURLOPT_CRLF
+ OPT_QUOTE = C.CURLOPT_QUOTE
+ OPT_WRITEHEADER = C.CURLOPT_WRITEHEADER
+ OPT_COOKIEFILE = C.CURLOPT_COOKIEFILE
+ OPT_SSLVERSION = C.CURLOPT_SSLVERSION
+ OPT_TIMECONDITION = C.CURLOPT_TIMECONDITION
+ OPT_TIMEVALUE = C.CURLOPT_TIMEVALUE
+ OPT_CUSTOMREQUEST = C.CURLOPT_CUSTOMREQUEST
+ OPT_STDERR = C.CURLOPT_STDERR
+ OPT_POSTQUOTE = C.CURLOPT_POSTQUOTE
+ OPT_WRITEINFO = C.CURLOPT_WRITEINFO
+ OPT_VERBOSE = C.CURLOPT_VERBOSE
+ OPT_HEADER = C.CURLOPT_HEADER
+ OPT_NOPROGRESS = C.CURLOPT_NOPROGRESS
+ OPT_NOBODY = C.CURLOPT_NOBODY
+ OPT_FAILONERROR = C.CURLOPT_FAILONERROR
+ OPT_UPLOAD = C.CURLOPT_UPLOAD
+ OPT_POST = C.CURLOPT_POST
+ OPT_DIRLISTONLY = C.CURLOPT_DIRLISTONLY
+ OPT_APPEND = C.CURLOPT_APPEND
+ OPT_NETRC = C.CURLOPT_NETRC
+ OPT_FOLLOWLOCATION = C.CURLOPT_FOLLOWLOCATION
+ OPT_TRANSFERTEXT = C.CURLOPT_TRANSFERTEXT
+ OPT_PUT = C.CURLOPT_PUT
+ OPT_PROGRESSFUNCTION = C.CURLOPT_PROGRESSFUNCTION
+ OPT_PROGRESSDATA = C.CURLOPT_PROGRESSDATA
+ OPT_XFERINFODATA = C.CURLOPT_XFERINFODATA
+ OPT_AUTOREFERER = C.CURLOPT_AUTOREFERER
+ OPT_PROXYPORT = C.CURLOPT_PROXYPORT
+ OPT_POSTFIELDSIZE = C.CURLOPT_POSTFIELDSIZE
+ OPT_HTTPPROXYTUNNEL = C.CURLOPT_HTTPPROXYTUNNEL
+ OPT_INTERFACE = C.CURLOPT_INTERFACE
+ OPT_KRBLEVEL = C.CURLOPT_KRBLEVEL
+ OPT_SSL_VERIFYPEER = C.CURLOPT_SSL_VERIFYPEER
+ OPT_CAINFO = C.CURLOPT_CAINFO
+ OPT_MAXREDIRS = C.CURLOPT_MAXREDIRS
+ OPT_FILETIME = C.CURLOPT_FILETIME
+ OPT_TELNETOPTIONS = C.CURLOPT_TELNETOPTIONS
+ OPT_MAXCONNECTS = C.CURLOPT_MAXCONNECTS
+ OPT_CLOSEPOLICY = C.CURLOPT_CLOSEPOLICY
+ OPT_FRESH_CONNECT = C.CURLOPT_FRESH_CONNECT
+ OPT_FORBID_REUSE = C.CURLOPT_FORBID_REUSE
+ OPT_RANDOM_FILE = C.CURLOPT_RANDOM_FILE
+ OPT_EGDSOCKET = C.CURLOPT_EGDSOCKET
+ OPT_CONNECTTIMEOUT = C.CURLOPT_CONNECTTIMEOUT
+ OPT_HEADERFUNCTION = C.CURLOPT_HEADERFUNCTION
+ OPT_HTTPGET = C.CURLOPT_HTTPGET
+ OPT_SSL_VERIFYHOST = C.CURLOPT_SSL_VERIFYHOST
+ OPT_COOKIEJAR = C.CURLOPT_COOKIEJAR
+ OPT_SSL_CIPHER_LIST = C.CURLOPT_SSL_CIPHER_LIST
+ OPT_HTTP_VERSION = C.CURLOPT_HTTP_VERSION
+ OPT_FTP_USE_EPSV = C.CURLOPT_FTP_USE_EPSV
+ OPT_SSLCERTTYPE = C.CURLOPT_SSLCERTTYPE
+ OPT_SSLKEY = C.CURLOPT_SSLKEY
+ OPT_SSLKEYTYPE = C.CURLOPT_SSLKEYTYPE
+ OPT_SSLENGINE = C.CURLOPT_SSLENGINE
+ OPT_SSLENGINE_DEFAULT = C.CURLOPT_SSLENGINE_DEFAULT
+ OPT_DNS_USE_GLOBAL_CACHE = C.CURLOPT_DNS_USE_GLOBAL_CACHE
+ OPT_DNS_CACHE_TIMEOUT = C.CURLOPT_DNS_CACHE_TIMEOUT
+ OPT_PREQUOTE = C.CURLOPT_PREQUOTE
+ OPT_DEBUGFUNCTION = C.CURLOPT_DEBUGFUNCTION
+ OPT_DEBUGDATA = C.CURLOPT_DEBUGDATA
+ OPT_COOKIESESSION = C.CURLOPT_COOKIESESSION
+ OPT_CAPATH = C.CURLOPT_CAPATH
+ OPT_BUFFERSIZE = C.CURLOPT_BUFFERSIZE
+ OPT_NOSIGNAL = C.CURLOPT_NOSIGNAL
+ OPT_SHARE = C.CURLOPT_SHARE
+ OPT_PROXYTYPE = C.CURLOPT_PROXYTYPE
+ OPT_ACCEPT_ENCODING = C.CURLOPT_ACCEPT_ENCODING
+ OPT_PRIVATE = C.CURLOPT_PRIVATE
+ OPT_HTTP200ALIASES = C.CURLOPT_HTTP200ALIASES
+ OPT_UNRESTRICTED_AUTH = C.CURLOPT_UNRESTRICTED_AUTH
+ OPT_FTP_USE_EPRT = C.CURLOPT_FTP_USE_EPRT
+ OPT_HTTPAUTH = C.CURLOPT_HTTPAUTH
+ OPT_SSL_CTX_FUNCTION = C.CURLOPT_SSL_CTX_FUNCTION
+ OPT_SSL_CTX_DATA = C.CURLOPT_SSL_CTX_DATA
+ OPT_FTP_CREATE_MISSING_DIRS = C.CURLOPT_FTP_CREATE_MISSING_DIRS
+ OPT_PROXYAUTH = C.CURLOPT_PROXYAUTH
+ OPT_FTP_RESPONSE_TIMEOUT = C.CURLOPT_FTP_RESPONSE_TIMEOUT
+ OPT_SERVER_RESPONSE_TIMEOUT = C.CURLOPT_SERVER_RESPONSE_TIMEOUT
+ OPT_IPRESOLVE = C.CURLOPT_IPRESOLVE
+ OPT_MAXFILESIZE = C.CURLOPT_MAXFILESIZE
+ OPT_INFILESIZE_LARGE = C.CURLOPT_INFILESIZE_LARGE
+ OPT_RESUME_FROM_LARGE = C.CURLOPT_RESUME_FROM_LARGE
+ OPT_MAXFILESIZE_LARGE = C.CURLOPT_MAXFILESIZE_LARGE
+ OPT_NETRC_FILE = C.CURLOPT_NETRC_FILE
+ OPT_USE_SSL = C.CURLOPT_USE_SSL
+ OPT_POSTFIELDSIZE_LARGE = C.CURLOPT_POSTFIELDSIZE_LARGE
+ OPT_TCP_NODELAY = C.CURLOPT_TCP_NODELAY
+ OPT_FTPSSLAUTH = C.CURLOPT_FTPSSLAUTH
+ OPT_IOCTLFUNCTION = C.CURLOPT_IOCTLFUNCTION
+ OPT_IOCTLDATA = C.CURLOPT_IOCTLDATA
+ OPT_FTP_ACCOUNT = C.CURLOPT_FTP_ACCOUNT
+ OPT_COOKIELIST = C.CURLOPT_COOKIELIST
+ OPT_IGNORE_CONTENT_LENGTH = C.CURLOPT_IGNORE_CONTENT_LENGTH
+ OPT_FTP_SKIP_PASV_IP = C.CURLOPT_FTP_SKIP_PASV_IP
+ OPT_FTP_FILEMETHOD = C.CURLOPT_FTP_FILEMETHOD
+ OPT_LOCALPORT = C.CURLOPT_LOCALPORT
+ OPT_LOCALPORTRANGE = C.CURLOPT_LOCALPORTRANGE
+ OPT_CONNECT_ONLY = C.CURLOPT_CONNECT_ONLY
+ OPT_CONV_FROM_NETWORK_FUNCTION = C.CURLOPT_CONV_FROM_NETWORK_FUNCTION
+ OPT_CONV_TO_NETWORK_FUNCTION = C.CURLOPT_CONV_TO_NETWORK_FUNCTION
+ OPT_CONV_FROM_UTF8_FUNCTION = C.CURLOPT_CONV_FROM_UTF8_FUNCTION
+ OPT_MAX_SEND_SPEED_LARGE = C.CURLOPT_MAX_SEND_SPEED_LARGE
+ OPT_MAX_RECV_SPEED_LARGE = C.CURLOPT_MAX_RECV_SPEED_LARGE
+ OPT_FTP_ALTERNATIVE_TO_USER = C.CURLOPT_FTP_ALTERNATIVE_TO_USER
+ OPT_SOCKOPTFUNCTION = C.CURLOPT_SOCKOPTFUNCTION
+ OPT_SOCKOPTDATA = C.CURLOPT_SOCKOPTDATA
+ OPT_SSL_SESSIONID_CACHE = C.CURLOPT_SSL_SESSIONID_CACHE
+ OPT_SSH_AUTH_TYPES = C.CURLOPT_SSH_AUTH_TYPES
+ OPT_SSH_PUBLIC_KEYFILE = C.CURLOPT_SSH_PUBLIC_KEYFILE
+ OPT_SSH_PRIVATE_KEYFILE = C.CURLOPT_SSH_PRIVATE_KEYFILE
+ OPT_FTP_SSL_CCC = C.CURLOPT_FTP_SSL_CCC
+ OPT_TIMEOUT_MS = C.CURLOPT_TIMEOUT_MS
+ OPT_CONNECTTIMEOUT_MS = C.CURLOPT_CONNECTTIMEOUT_MS
+ OPT_HTTP_TRANSFER_DECODING = C.CURLOPT_HTTP_TRANSFER_DECODING
+ OPT_HTTP_CONTENT_DECODING = C.CURLOPT_HTTP_CONTENT_DECODING
+ OPT_NEW_FILE_PERMS = C.CURLOPT_NEW_FILE_PERMS
+ OPT_NEW_DIRECTORY_PERMS = C.CURLOPT_NEW_DIRECTORY_PERMS
+ OPT_POSTREDIR = C.CURLOPT_POSTREDIR
+ OPT_SSH_HOST_PUBLIC_KEY_MD5 = C.CURLOPT_SSH_HOST_PUBLIC_KEY_MD5
+ OPT_OPENSOCKETFUNCTION = C.CURLOPT_OPENSOCKETFUNCTION
+ OPT_OPENSOCKETDATA = C.CURLOPT_OPENSOCKETDATA
+ OPT_COPYPOSTFIELDS = C.CURLOPT_COPYPOSTFIELDS
+ OPT_PROXY_TRANSFER_MODE = C.CURLOPT_PROXY_TRANSFER_MODE
+ OPT_SEEKFUNCTION = C.CURLOPT_SEEKFUNCTION
+ OPT_SEEKDATA = C.CURLOPT_SEEKDATA
+ OPT_CRLFILE = C.CURLOPT_CRLFILE
+ OPT_ISSUERCERT = C.CURLOPT_ISSUERCERT
+ OPT_ADDRESS_SCOPE = C.CURLOPT_ADDRESS_SCOPE
+ OPT_CERTINFO = C.CURLOPT_CERTINFO
+ OPT_USERNAME = C.CURLOPT_USERNAME
+ OPT_PASSWORD = C.CURLOPT_PASSWORD
+ OPT_PROXYUSERNAME = C.CURLOPT_PROXYUSERNAME
+ OPT_PROXYPASSWORD = C.CURLOPT_PROXYPASSWORD
+ OPT_NOPROXY = C.CURLOPT_NOPROXY
+ OPT_TFTP_BLKSIZE = C.CURLOPT_TFTP_BLKSIZE
+ OPT_SOCKS5_GSSAPI_SERVICE = C.CURLOPT_SOCKS5_GSSAPI_SERVICE
+ OPT_SOCKS5_GSSAPI_NEC = C.CURLOPT_SOCKS5_GSSAPI_NEC
+ OPT_PROTOCOLS = C.CURLOPT_PROTOCOLS
+ OPT_REDIR_PROTOCOLS = C.CURLOPT_REDIR_PROTOCOLS
+ OPT_SSH_KNOWNHOSTS = C.CURLOPT_SSH_KNOWNHOSTS
+ OPT_SSH_KEYFUNCTION = C.CURLOPT_SSH_KEYFUNCTION
+ OPT_SSH_KEYDATA = C.CURLOPT_SSH_KEYDATA
+ OPT_MAIL_FROM = C.CURLOPT_MAIL_FROM
+ OPT_MAIL_RCPT = C.CURLOPT_MAIL_RCPT
+ OPT_FTP_USE_PRET = C.CURLOPT_FTP_USE_PRET
+ OPT_RTSP_REQUEST = C.CURLOPT_RTSP_REQUEST
+ OPT_RTSP_SESSION_ID = C.CURLOPT_RTSP_SESSION_ID
+ OPT_RTSP_STREAM_URI = C.CURLOPT_RTSP_STREAM_URI
+ OPT_RTSP_TRANSPORT = C.CURLOPT_RTSP_TRANSPORT
+ OPT_RTSP_CLIENT_CSEQ = C.CURLOPT_RTSP_CLIENT_CSEQ
+ OPT_RTSP_SERVER_CSEQ = C.CURLOPT_RTSP_SERVER_CSEQ
+ OPT_INTERLEAVEDATA = C.CURLOPT_INTERLEAVEDATA
+ OPT_INTERLEAVEFUNCTION = C.CURLOPT_INTERLEAVEFUNCTION
+ OPT_WILDCARDMATCH = C.CURLOPT_WILDCARDMATCH
+ OPT_CHUNK_BGN_FUNCTION = C.CURLOPT_CHUNK_BGN_FUNCTION
+ OPT_CHUNK_END_FUNCTION = C.CURLOPT_CHUNK_END_FUNCTION
+ OPT_FNMATCH_FUNCTION = C.CURLOPT_FNMATCH_FUNCTION
+ OPT_CHUNK_DATA = C.CURLOPT_CHUNK_DATA
+ OPT_FNMATCH_DATA = C.CURLOPT_FNMATCH_DATA
+ OPT_RESOLVE = C.CURLOPT_RESOLVE
+ OPT_TLSAUTH_USERNAME = C.CURLOPT_TLSAUTH_USERNAME
+ OPT_TLSAUTH_PASSWORD = C.CURLOPT_TLSAUTH_PASSWORD
+ OPT_TLSAUTH_TYPE = C.CURLOPT_TLSAUTH_TYPE
+ OPT_TRANSFER_ENCODING = C.CURLOPT_TRANSFER_ENCODING
+ OPT_CLOSESOCKETFUNCTION = C.CURLOPT_CLOSESOCKETFUNCTION
+ OPT_CLOSESOCKETDATA = C.CURLOPT_CLOSESOCKETDATA
+ OPT_GSSAPI_DELEGATION = C.CURLOPT_GSSAPI_DELEGATION
+ OPT_DNS_SERVERS = C.CURLOPT_DNS_SERVERS
+ OPT_ACCEPTTIMEOUT_MS = C.CURLOPT_ACCEPTTIMEOUT_MS
+ OPT_TCP_KEEPALIVE = C.CURLOPT_TCP_KEEPALIVE
+ OPT_TCP_KEEPIDLE = C.CURLOPT_TCP_KEEPIDLE
+ OPT_TCP_KEEPINTVL = C.CURLOPT_TCP_KEEPINTVL
+ OPT_SSL_OPTIONS = C.CURLOPT_SSL_OPTIONS
+ OPT_MAIL_AUTH = C.CURLOPT_MAIL_AUTH
+ OPT_SASL_IR = C.CURLOPT_SASL_IR
+ OPT_XFERINFOFUNCTION = C.CURLOPT_XFERINFOFUNCTION
+ OPT_XOAUTH2_BEARER = C.CURLOPT_XOAUTH2_BEARER
+ OPT_DNS_INTERFACE = C.CURLOPT_DNS_INTERFACE
+ OPT_DNS_LOCAL_IP4 = C.CURLOPT_DNS_LOCAL_IP4
+ OPT_DNS_LOCAL_IP6 = C.CURLOPT_DNS_LOCAL_IP6
+ OPT_LOGIN_OPTIONS = C.CURLOPT_LOGIN_OPTIONS
+ OPT_SSL_ENABLE_NPN = C.CURLOPT_SSL_ENABLE_NPN
+ OPT_SSL_ENABLE_ALPN = C.CURLOPT_SSL_ENABLE_ALPN
+ OPT_EXPECT_100_TIMEOUT_MS = C.CURLOPT_EXPECT_100_TIMEOUT_MS
+ OPT_POST301 = C.CURLOPT_POST301
+ OPT_SSLKEYPASSWD = C.CURLOPT_SSLKEYPASSWD
+ OPT_FTPAPPEND = C.CURLOPT_FTPAPPEND
+ OPT_FTPLISTONLY = C.CURLOPT_FTPLISTONLY
+ OPT_FTP_SSL = C.CURLOPT_FTP_SSL
+ OPT_SSLCERTPASSWD = C.CURLOPT_SSLCERTPASSWD
+ OPT_KRB4LEVEL = C.CURLOPT_KRB4LEVEL
+ OPT_WRITEDATA = C.CURLOPT_WRITEDATA
+ OPT_READDATA = C.CURLOPT_READDATA
+ OPT_HEADERDATA = C.CURLOPT_HEADERDATA
+ OPT_RTSPHEADER = C.CURLOPT_RTSPHEADER
+)
+
+// easy.Getinfo(flag)
+const (
+ INFO_TEXT = C.CURLINFO_TEXT
+ INFO_EFFECTIVE_URL = C.CURLINFO_EFFECTIVE_URL
+ INFO_RESPONSE_CODE = C.CURLINFO_RESPONSE_CODE
+ INFO_TOTAL_TIME = C.CURLINFO_TOTAL_TIME
+ INFO_NAMELOOKUP_TIME = C.CURLINFO_NAMELOOKUP_TIME
+ INFO_CONNECT_TIME = C.CURLINFO_CONNECT_TIME
+ INFO_PRETRANSFER_TIME = C.CURLINFO_PRETRANSFER_TIME
+ INFO_SIZE_UPLOAD = C.CURLINFO_SIZE_UPLOAD
+ INFO_SIZE_DOWNLOAD = C.CURLINFO_SIZE_DOWNLOAD
+ INFO_SPEED_DOWNLOAD = C.CURLINFO_SPEED_DOWNLOAD
+ INFO_SPEED_UPLOAD = C.CURLINFO_SPEED_UPLOAD
+ INFO_HEADER_SIZE = C.CURLINFO_HEADER_SIZE
+ INFO_REQUEST_SIZE = C.CURLINFO_REQUEST_SIZE
+ INFO_SSL_VERIFYRESULT = C.CURLINFO_SSL_VERIFYRESULT
+ INFO_FILETIME = C.CURLINFO_FILETIME
+ INFO_CONTENT_LENGTH_DOWNLOAD = C.CURLINFO_CONTENT_LENGTH_DOWNLOAD
+ INFO_CONTENT_LENGTH_UPLOAD = C.CURLINFO_CONTENT_LENGTH_UPLOAD
+ INFO_STARTTRANSFER_TIME = C.CURLINFO_STARTTRANSFER_TIME
+ INFO_CONTENT_TYPE = C.CURLINFO_CONTENT_TYPE
+ INFO_REDIRECT_TIME = C.CURLINFO_REDIRECT_TIME
+ INFO_REDIRECT_COUNT = C.CURLINFO_REDIRECT_COUNT
+ INFO_PRIVATE = C.CURLINFO_PRIVATE
+ INFO_HTTP_CONNECTCODE = C.CURLINFO_HTTP_CONNECTCODE
+ INFO_HTTPAUTH_AVAIL = C.CURLINFO_HTTPAUTH_AVAIL
+ INFO_PROXYAUTH_AVAIL = C.CURLINFO_PROXYAUTH_AVAIL
+ INFO_OS_ERRNO = C.CURLINFO_OS_ERRNO
+ INFO_NUM_CONNECTS = C.CURLINFO_NUM_CONNECTS
+ INFO_SSL_ENGINES = C.CURLINFO_SSL_ENGINES
+ INFO_COOKIELIST = C.CURLINFO_COOKIELIST
+ INFO_LASTSOCKET = C.CURLINFO_LASTSOCKET
+ INFO_FTP_ENTRY_PATH = C.CURLINFO_FTP_ENTRY_PATH
+ INFO_REDIRECT_URL = C.CURLINFO_REDIRECT_URL
+ INFO_PRIMARY_IP = C.CURLINFO_PRIMARY_IP
+ INFO_APPCONNECT_TIME = C.CURLINFO_APPCONNECT_TIME
+ INFO_CERTINFO = C.CURLINFO_CERTINFO
+ INFO_CONDITION_UNMET = C.CURLINFO_CONDITION_UNMET
+ INFO_RTSP_SESSION_ID = C.CURLINFO_RTSP_SESSION_ID
+ INFO_RTSP_CLIENT_CSEQ = C.CURLINFO_RTSP_CLIENT_CSEQ
+ INFO_RTSP_SERVER_CSEQ = C.CURLINFO_RTSP_SERVER_CSEQ
+ INFO_RTSP_CSEQ_RECV = C.CURLINFO_RTSP_CSEQ_RECV
+ INFO_PRIMARY_PORT = C.CURLINFO_PRIMARY_PORT
+ INFO_LOCAL_IP = C.CURLINFO_LOCAL_IP
+ INFO_LOCAL_PORT = C.CURLINFO_LOCAL_PORT
+ INFO_TLS_SESSION = C.CURLINFO_TLS_SESSION
+ INFO_LASTONE = C.CURLINFO_LASTONE
+ INFO_HTTP_CODE = C.CURLINFO_HTTP_CODE
+)
+
+// generated ends
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/e95057f4/newt/Godeps/_workspace/src/github.com/andelf/go-curl/core.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/andelf/go-curl/core.go b/newt/Godeps/_workspace/src/github.com/andelf/go-curl/core.go
new file mode 100644
index 0000000..a4e0fc5
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/andelf/go-curl/core.go
@@ -0,0 +1,118 @@
+// libcurl go bingding
+package curl
+
+/*
+#cgo linux pkg-config: libcurl
+#cgo darwin LDFLAGS: -lcurl
+#cgo windows LDFLAGS: -lcurl
+#include <stdlib.h>
+#include <curl/curl.h>
+
+static char *string_array_index(char **p, int i) {
+ return p[i];
+}
+*/
+import "C"
+
+import (
+ "time"
+ "unsafe"
+)
+
+// curl_global_init - Global libcurl initialisation
+func GlobalInit(flags int) error {
+ return newCurlError(C.curl_global_init(C.long(flags)))
+}
+
+// curl_global_cleanup - global libcurl cleanup
+func GlobalCleanup() {
+ C.curl_global_cleanup()
+}
+
+type VersionInfoData struct {
+ Age C.CURLversion
+ // age >= 0
+ Version string
+ VersionNum uint
+ Host string
+ Features int
+ SslVersion string
+ SslVersionNum int
+ LibzVersion string
+ Protocols []string
+ // age >= 1
+ Ares string
+ AresNum int
+ // age >= 2
+ Libidn string
+ // age >= 3
+ IconvVerNum int
+ LibsshVersion string
+}
+
+// curl_version - returns the libcurl version string
+func Version() string {
+ return C.GoString(C.curl_version())
+}
+
+// curl_version_info - returns run-time libcurl version info
+func VersionInfo(ver C.CURLversion) *VersionInfoData {
+ data := C.curl_version_info(ver)
+ ret := new(VersionInfoData)
+ ret.Age = data.age
+ switch age := ret.Age; {
+ case age >= 0:
+ ret.Version = string(C.GoString(data.version))
+ ret.VersionNum = uint(data.version_num)
+ ret.Host = C.GoString(data.host)
+ ret.Features = int(data.features)
+ ret.SslVersion = C.GoString(data.ssl_version)
+ ret.SslVersionNum = int(data.ssl_version_num)
+ ret.LibzVersion = C.GoString(data.libz_version)
+ // ugly but works
+ ret.Protocols = []string{}
+ for i := C.int(0); C.string_array_index(data.protocols, i) != nil; i++ {
+ p := C.string_array_index(data.protocols, i)
+ ret.Protocols = append(ret.Protocols, C.GoString(p))
+ }
+ fallthrough
+ case age >= 1:
+ ret.Ares = C.GoString(data.ares)
+ ret.AresNum = int(data.ares_num)
+ fallthrough
+ case age >= 2:
+ ret.Libidn = C.GoString(data.libidn)
+ fallthrough
+ case age >= 3:
+ ret.IconvVerNum = int(data.iconv_ver_num)
+ ret.LibsshVersion = C.GoString(data.libssh_version)
+ }
+ return ret
+}
+
+// curl_getdate - Convert a date string to number of seconds since January 1, 1970
+// In golang, we convert it to a *time.Time
+func Getdate(date string) *time.Time {
+ datestr := C.CString(date)
+ defer C.free(unsafe.Pointer(datestr))
+ t := C.curl_getdate(datestr, nil)
+ if t == -1 {
+ return nil
+ }
+ unix := time.Unix(int64(t), 0).UTC()
+ return &unix
+
+ /*
+ // curl_getenv - return value for environment name
+ func Getenv(name string) string {
+ namestr := C.CString(name)
+ defer C.free(unsafe.Pointer(namestr))
+ ret := C.curl_getenv(unsafe.Pointer(namestr))
+ defer C.free(unsafe.Pointer(ret))
+
+ return C.GoString(ret)
+ }
+ */
+}
+
+// TODO: curl_global_init_mem
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/e95057f4/newt/Godeps/_workspace/src/github.com/andelf/go-curl/core_test.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/andelf/go-curl/core_test.go b/newt/Godeps/_workspace/src/github.com/andelf/go-curl/core_test.go
new file mode 100644
index 0000000..a10425a
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/andelf/go-curl/core_test.go
@@ -0,0 +1,23 @@
+package curl
+
+import (
+ "testing"
+)
+
+func TestVersionInfo(t *testing.T) {
+ info := VersionInfo(VERSION_FIRST)
+ expectedProtocols := []string{"dict", "file", "ftp", "ftps", "gopher", "http", "https", "imap", "imaps", "ldap", "ldaps", "pop3", "pop3s", "rtmp", "rtsp", "smtp", "smtps", "telnet", "tftp", "scp", "sftp"}
+ protocols := info.Protocols
+ for _, protocol := range protocols {
+ found := false
+ for _, expectedProtocol := range expectedProtocols {
+ if expectedProtocol == protocol {
+ found = true
+ break
+ }
+ }
+ if !found {
+ t.Errorf("protocol should be in %v and is %v.", expectedProtocols, protocol)
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/e95057f4/newt/Godeps/_workspace/src/github.com/andelf/go-curl/easy.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/andelf/go-curl/easy.go b/newt/Godeps/_workspace/src/github.com/andelf/go-curl/easy.go
new file mode 100644
index 0000000..4593590
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/andelf/go-curl/easy.go
@@ -0,0 +1,495 @@
+package curl
+
+/*
+#include <stdlib.h>
+#include <curl/curl.h>
+#include "callback.h"
+#include "compat.h"
+
+static CURLcode curl_easy_setopt_long(CURL *handle, CURLoption option, long parameter) {
+ return curl_easy_setopt(handle, option, parameter);
+}
+static CURLcode curl_easy_setopt_string(CURL *handle, CURLoption option, char *parameter) {
+ return curl_easy_setopt(handle, option, parameter);
+}
+static CURLcode curl_easy_setopt_slist(CURL *handle, CURLoption option, struct curl_slist *parameter) {
+ return curl_easy_setopt(handle, option, parameter);
+}
+static CURLcode curl_easy_setopt_pointer(CURL *handle, CURLoption option, void *parameter) {
+ return curl_easy_setopt(handle, option, parameter);
+}
+static CURLcode curl_easy_setopt_off_t(CURL *handle, CURLoption option, off_t parameter) {
+ return curl_easy_setopt(handle, option, parameter);
+}
+
+static CURLcode curl_easy_getinfo_string(CURL *curl, CURLINFO info, char **p) {
+ return curl_easy_getinfo(curl, info, p);
+}
+static CURLcode curl_easy_getinfo_long(CURL *curl, CURLINFO info, long *p) {
+ return curl_easy_getinfo(curl, info, p);
+}
+static CURLcode curl_easy_getinfo_double(CURL *curl, CURLINFO info, double *p) {
+ return curl_easy_getinfo(curl, info, p);
+}
+static CURLcode curl_easy_getinfo_slist(CURL *curl, CURLINFO info, struct curl_slist **p) {
+ return curl_easy_getinfo(curl, info, p);
+}
+
+static CURLFORMcode curl_formadd_name_content_length(
+ struct curl_httppost **httppost, struct curl_httppost **last_post, char *name, char *content, int length) {
+ return curl_formadd(httppost, last_post,
+ CURLFORM_COPYNAME, name,
+ CURLFORM_COPYCONTENTS, content,
+ CURLFORM_CONTENTSLENGTH, length, CURLFORM_END);
+}
+static CURLFORMcode curl_formadd_name_content_length_type(
+ struct curl_httppost **httppost, struct curl_httppost **last_post, char *name, char *content, int length, char *type) {
+ return curl_formadd(httppost, last_post,
+ CURLFORM_COPYNAME, name,
+ CURLFORM_COPYCONTENTS, content,
+ CURLFORM_CONTENTSLENGTH, length,
+ CURLFORM_CONTENTTYPE, type, CURLFORM_END);
+}
+static CURLFORMcode curl_formadd_name_file_type(
+ struct curl_httppost **httppost, struct curl_httppost **last_post, char *name, char *filename, char *type) {
+ return curl_formadd(httppost, last_post,
+ CURLFORM_COPYNAME, name,
+ CURLFORM_FILE, filename,
+ CURLFORM_CONTENTTYPE, type, CURLFORM_END);
+}
+ // TODO: support multi file
+
+*/
+import "C"
+
+import (
+ "fmt"
+ "mime"
+ "path"
+ "reflect"
+ "unsafe"
+)
+
+type CurlInfo C.CURLINFO
+type CurlError C.CURLcode
+
+type CurlString *C.char
+
+func NewCurlString(s string) CurlString {
+ return CurlString(unsafe.Pointer(C.CString(s)))
+}
+
+func FreeCurlString(s CurlString) {
+ C.free(unsafe.Pointer(s))
+}
+
+func (e CurlError) Error() string {
+ // ret is const char*, no need to free
+ ret := C.curl_easy_strerror(C.CURLcode(e))
+ return fmt.Sprintf("curl: %s", C.GoString(ret))
+}
+
+func newCurlError(errno C.CURLcode) error {
+ if errno == C.CURLE_OK { // if nothing wrong
+ return nil
+ }
+ return CurlError(errno)
+}
+
+// curl_easy interface
+type CURL struct {
+ handle unsafe.Pointer
+ // callback functions, bool ret means ok or not
+ headerFunction, writeFunction *func([]byte, interface{}) bool
+ readFunction *func([]byte, interface{}) int // return num of bytes writed to buf
+ progressFunction *func(float64, float64, float64, float64, interface{}) bool
+ fnmatchFunction *func(string, string, interface{}) int
+ // callback datas
+ headerData, writeData, readData, progressData, fnmatchData *interface{}
+ // list of C allocs
+ mallocAllocs []*C.char
+}
+
+// curl_easy_init - Start a libcurl easy session
+func EasyInit() *CURL {
+ p := C.curl_easy_init()
+ return &CURL{handle: p, mallocAllocs: make([]*C.char, 0)} // other field defaults to nil
+}
+
+// curl_easy_duphandle - Clone a libcurl session handle
+func (curl *CURL) Duphandle() *CURL {
+ p := curl.handle
+ return &CURL{handle: C.curl_easy_duphandle(p)}
+}
+
+// curl_easy_cleanup - End a libcurl easy session
+func (curl *CURL) Cleanup() {
+ p := curl.handle
+ C.curl_easy_cleanup(p)
+ curl.MallocFreeAfter(0)
+}
+
+// curl_easy_setopt - set options for a curl easy handle
+// WARNING: a function pointer is &fun, but function addr is reflect.ValueOf(fun).Pointer()
+func (curl *CURL) Setopt(opt int, param interface{}) error {
+ p := curl.handle
+ if param == nil {
+ // NOTE: some option will crash program when got a nil param
+ return newCurlError(C.curl_easy_setopt_pointer(p, C.CURLoption(opt), nil))
+ }
+ switch {
+ // not really set
+ case opt == OPT_READDATA: // OPT_INFILE
+ curl.readData = ¶m
+ return nil
+ case opt == OPT_PROGRESSDATA:
+ curl.progressData = ¶m
+ return nil
+ case opt == OPT_HEADERDATA: // also known as OPT_WRITEHEADER
+ curl.headerData = ¶m
+ return nil
+ case opt == OPT_WRITEDATA: // OPT_FILE
+ curl.writeData = ¶m
+ return nil
+
+ case opt == OPT_READFUNCTION:
+ fun := param.(func([]byte, interface{}) int)
+ curl.readFunction = &fun
+
+ ptr := C.return_read_function()
+ if err := newCurlError(C.curl_easy_setopt_pointer(p, C.CURLoption(opt), ptr)); err == nil {
+ return newCurlError(C.curl_easy_setopt_pointer(p, OPT_READDATA,
+ unsafe.Pointer(reflect.ValueOf(curl).Pointer())))
+ } else {
+ return err
+ }
+
+ case opt == OPT_PROGRESSFUNCTION:
+ fun := param.(func(float64, float64, float64, float64, interface{}) bool)
+ curl.progressFunction = &fun
+
+ ptr := C.return_progress_function()
+ if err := newCurlError(C.curl_easy_setopt_pointer(p, C.CURLoption(opt), ptr)); err == nil {
+ return newCurlError(C.curl_easy_setopt_pointer(p, OPT_PROGRESSDATA,
+ unsafe.Pointer(reflect.ValueOf(curl).Pointer())))
+ } else {
+ return err
+ }
+
+ case opt == OPT_HEADERFUNCTION:
+ fun := param.(func([]byte, interface{}) bool)
+ curl.headerFunction = &fun
+
+ ptr := C.return_header_function()
+ if err := newCurlError(C.curl_easy_setopt_pointer(p, C.CURLoption(opt), ptr)); err == nil {
+ return newCurlError(C.curl_easy_setopt_pointer(p, OPT_HEADERDATA,
+ unsafe.Pointer(reflect.ValueOf(curl).Pointer())))
+ } else {
+ return err
+ }
+
+ case opt == OPT_WRITEFUNCTION:
+ fun := param.(func([]byte, interface{}) bool)
+ curl.writeFunction = &fun
+
+ ptr := C.return_write_function()
+ if err := newCurlError(C.curl_easy_setopt_pointer(p, C.CURLoption(opt), ptr)); err == nil {
+ return newCurlError(C.curl_easy_setopt_pointer(p, OPT_WRITEDATA,
+ unsafe.Pointer(reflect.ValueOf(curl).Pointer())))
+ } else {
+ return err
+ }
+
+ // for OPT_HTTPPOST, use struct Form
+ case opt == OPT_HTTPPOST:
+ post := param.(*Form)
+ ptr := post.head
+ return newCurlError(C.curl_easy_setopt_pointer(p, C.CURLoption(opt), unsafe.Pointer(ptr)))
+
+ case opt >= C.CURLOPTTYPE_OFF_T:
+ val := C.off_t(0)
+ switch t := param.(type) {
+ case int:
+ val = C.off_t(t)
+ case uint64:
+ val = C.off_t(t)
+ default:
+ panic("OFF_T conversion not supported")
+ }
+ return newCurlError(C.curl_easy_setopt_off_t(p, C.CURLoption(opt), val))
+
+ case opt >= C.CURLOPTTYPE_FUNCTIONPOINT:
+ // function pointer
+ panic("function pointer not implemented yet!")
+
+ case opt >= C.CURLOPTTYPE_OBJECTPOINT:
+ switch t := param.(type) {
+ case string:
+ ptr := C.CString(t)
+ curl.mallocAddPtr(ptr)
+ return newCurlError(C.curl_easy_setopt_string(p, C.CURLoption(opt), ptr))
+ case CurlString:
+ ptr := (*C.char)(t)
+ return newCurlError(C.curl_easy_setopt_string(p, C.CURLoption(opt), ptr))
+ case []string:
+ if len(t) > 0 {
+ ptr := C.CString(t[0])
+ curl.mallocAddPtr(ptr)
+ a_slist := C.curl_slist_append(nil, ptr)
+ for _, s := range t[1:] {
+ ptr := C.CString(s)
+ curl.mallocAddPtr(ptr)
+ a_slist = C.curl_slist_append(a_slist, ptr)
+ }
+ return newCurlError(C.curl_easy_setopt_slist(p, C.CURLoption(opt), a_slist))
+ } else {
+ return newCurlError(C.curl_easy_setopt_slist(p, C.CURLoption(opt), nil))
+ }
+ case []CurlString:
+ if len(t) > 0 {
+ ptr := (*C.char)(t[0])
+ a_slist := C.curl_slist_append(nil, ptr)
+ for _, s := range t[1:] {
+ ptr := (*C.char)(s)
+ a_slist = C.curl_slist_append(a_slist, ptr)
+ }
+ return newCurlError(C.curl_easy_setopt_slist(p, C.CURLoption(opt), a_slist))
+ } else {
+ return newCurlError(C.curl_easy_setopt_slist(p, C.CURLoption(opt), nil))
+ }
+ default:
+ // It panics if v's Kind is not Chan, Func, Map, Ptr, Slice, or UnsafePointer.
+ // val := reflect.ValueOf(param)
+ //fmt.Printf("DEBUG(Setopt): param=%x\n", val.Pointer())
+ //println("DEBUG can addr =", val.Pointer(), "opt=", opt)
+ // pass a pointer to GoInterface
+ return newCurlError(C.curl_easy_setopt_pointer(p, C.CURLoption(opt),
+ unsafe.Pointer(¶m)))
+ }
+ case opt >= C.CURLOPTTYPE_LONG:
+ val := C.long(0)
+ switch t := param.(type) {
+ case int:
+ val = C.long(t)
+ case bool:
+ if t {
+ val = 1
+ }
+ case int64:
+ val = C.long(t)
+ case int32:
+ val = C.long(t)
+ default:
+ panic("not supported converstion to c long")
+ }
+ return newCurlError(C.curl_easy_setopt_long(p, C.CURLoption(opt), val))
+ }
+ panic("opt param error!")
+}
+
+// curl_easy_send - sends raw data over an "easy" connection
+func (curl *CURL) Send(buffer []byte) (int, error) {
+ p := curl.handle
+ buflen := len(buffer)
+ n := C.size_t(0)
+ ret := C.curl_easy_send(p, unsafe.Pointer(&buffer[0]), C.size_t(buflen), &n)
+ return int(n), newCurlError(ret)
+}
+
+// curl_easy_recv - receives raw data on an "easy" connection
+func (curl *CURL) Recv(buffer []byte) (int, error) {
+ p := curl.handle
+ buflen := len(buffer)
+ buf := C.CString(string(buffer))
+ n := C.size_t(0)
+ ret := C.curl_easy_recv(p, unsafe.Pointer(buf), C.size_t(buflen), &n)
+ return copy(buffer, C.GoStringN(buf, C.int(n))), newCurlError(ret)
+}
+
+// curl_easy_perform - Perform a file transfer
+func (curl *CURL) Perform() error {
+ p := curl.handle
+ return newCurlError(C.curl_easy_perform(p))
+}
+
+// curl_easy_pause - pause and unpause a connection
+func (curl *CURL) Pause(bitmask int) error {
+ p := curl.handle
+ return newCurlError(C.curl_easy_pause(p, C.int(bitmask)))
+}
+
+// curl_easy_reset - reset all options of a libcurl session handle
+func (curl *CURL) Reset() {
+ p := curl.handle
+ C.curl_easy_reset(p)
+}
+
+// curl_easy_escape - URL encodes the given string
+func (curl *CURL) Escape(url string) string {
+ p := curl.handle
+ oldUrl := C.CString(url)
+ defer C.free(unsafe.Pointer(oldUrl))
+ newUrl := C.curl_easy_escape(p, oldUrl, 0)
+ defer C.curl_free(unsafe.Pointer(newUrl))
+ return C.GoString(newUrl)
+}
+
+// curl_easy_unescape - URL decodes the given string
+func (curl *CURL) Unescape(url string) string {
+ p := curl.handle
+ oldUrl := C.CString(url)
+ outlength := C.int(0)
+ defer C.free(unsafe.Pointer(oldUrl))
+ // If outlength is non-NULL, the function will write the length of the
+ // returned string in the integer it points to. This allows an
+ // escaped string containing %00 to still get used properly after unescaping.
+ newUrl := C.curl_easy_unescape(p, oldUrl, 0, &outlength)
+ defer C.curl_free(unsafe.Pointer(newUrl))
+ return C.GoStringN(newUrl, outlength)
+}
+
+// curl_easy_getinfo - extract information from a curl handle
+func (curl *CURL) Getinfo(info CurlInfo) (ret interface{}, err error) {
+ p := curl.handle
+ cInfo := C.CURLINFO(info)
+ switch cInfo & C.CURLINFO_TYPEMASK {
+ case C.CURLINFO_STRING:
+ a_string := C.CString("")
+ defer C.free(unsafe.Pointer(a_string))
+ err := newCurlError(C.curl_easy_getinfo_string(p, cInfo, &a_string))
+ ret := C.GoString(a_string)
+ debugf("Getinfo %s", ret)
+ return ret, err
+ case C.CURLINFO_LONG:
+ a_long := C.long(-1)
+ err := newCurlError(C.curl_easy_getinfo_long(p, cInfo, &a_long))
+ ret := int(a_long)
+ debugf("Getinfo %s", ret)
+ return ret, err
+ case C.CURLINFO_DOUBLE:
+ a_double := C.double(0.0)
+ err := newCurlError(C.curl_easy_getinfo_double(p, cInfo, &a_double))
+ ret := float64(a_double)
+ debugf("Getinfo %s", ret)
+ return ret, err
+ case C.CURLINFO_SLIST:
+ a_ptr_slist := new(_Ctype_struct_curl_slist)
+ err := newCurlError(C.curl_easy_getinfo_slist(p, cInfo, &a_ptr_slist))
+ ret := []string{}
+ for a_ptr_slist != nil {
+ debugf("Getinfo %s %v", C.GoString(a_ptr_slist.data), a_ptr_slist.next)
+ ret = append(ret, C.GoString(a_ptr_slist.data))
+ a_ptr_slist = a_ptr_slist.next
+ }
+ return ret, err
+ default:
+ panic("error calling Getinfo\n")
+ }
+ panic("not implemented yet!")
+ return nil, nil
+}
+
+func (curl *CURL) GetHandle() unsafe.Pointer {
+ return curl.handle
+}
+
+func (curl *CURL) MallocGetPos() int {
+ return len(curl.mallocAllocs)
+}
+
+func (curl *CURL) MallocFreeAfter(from int) {
+ l := len(curl.mallocAllocs)
+ for idx := from; idx < l; idx++ {
+ C.free(unsafe.Pointer(curl.mallocAllocs[idx]))
+ curl.mallocAllocs[idx] = nil
+ }
+ curl.mallocAllocs = curl.mallocAllocs[0:from]
+}
+
+func (curl *CURL) mallocAddPtr(ptr *C.char) {
+ curl.mallocAllocs = append(curl.mallocAllocs, ptr)
+}
+
+// A multipart/formdata HTTP POST form
+type Form struct {
+ head, last *C.struct_curl_httppost
+}
+
+func NewForm() *Form {
+ return &Form{}
+}
+
+func (form *Form) Add(name string, content interface{}) error {
+ head, last := form.head, form.last
+ namestr := C.CString(name)
+ defer C.free(unsafe.Pointer(namestr))
+ var (
+ buffer *C.char
+ length C.int
+ )
+ switch t := content.(type) {
+ case string:
+ buffer = C.CString(t)
+ length = C.int(len(t))
+ case []byte:
+ buffer = C.CString(string(t))
+ length = C.int(len(t))
+ default:
+ panic("not implemented")
+ }
+ defer C.free(unsafe.Pointer(buffer))
+ C.curl_formadd_name_content_length(&head, &last, namestr, buffer, length)
+ form.head, form.last = head, last
+ return nil
+}
+
+func (form *Form) AddWithType(name string, content interface{}, content_type string) error {
+ head, last := form.head, form.last
+ namestr := C.CString(name)
+ typestr := C.CString(content_type)
+ defer C.free(unsafe.Pointer(namestr))
+ defer C.free(unsafe.Pointer(typestr))
+ var (
+ buffer *C.char
+ length C.int
+ )
+ switch t := content.(type) {
+ case string:
+ buffer = C.CString(t)
+ length = C.int(len(t))
+ case []byte:
+ buffer = C.CString(string(t))
+ length = C.int(len(t))
+ default:
+ panic("not implemented")
+ }
+ defer C.free(unsafe.Pointer(buffer))
+ C.curl_formadd_name_content_length_type(&head, &last, namestr, buffer, length, typestr)
+ form.head, form.last = head, last
+ return nil
+}
+
+func (form *Form) AddFile(name, filename string) error {
+ head, last := form.head, form.last
+ namestr := C.CString(name)
+ pathstr := C.CString(filename)
+ typestr := C.CString(guessType(filename))
+ defer C.free(unsafe.Pointer(namestr))
+ defer C.free(unsafe.Pointer(pathstr))
+ defer C.free(unsafe.Pointer(typestr))
+ C.curl_formadd_name_file_type(&head, &last, namestr, pathstr, typestr)
+ form.head, form.last = head, last
+ return nil
+}
+
+func (form *Form) AddFromFile(name, filename string) {
+}
+
+func guessType(filename string) string {
+ ext := path.Ext(filename)
+ file_type := mime.TypeByExtension(ext)
+ if file_type == "" {
+ return "application/octet-stream"
+ }
+ return file_type
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/e95057f4/newt/Godeps/_workspace/src/github.com/andelf/go-curl/easy_test.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/andelf/go-curl/easy_test.go b/newt/Godeps/_workspace/src/github.com/andelf/go-curl/easy_test.go
new file mode 100644
index 0000000..071245c
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/andelf/go-curl/easy_test.go
@@ -0,0 +1,61 @@
+package curl
+
+import (
+ "fmt"
+ "net/http"
+ "net/http/httptest"
+ "testing"
+)
+
+func setupTestServer(serverContent string) *httptest.Server {
+ return httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ fmt.Fprintln(w, serverContent)
+ }))
+}
+
+func TestEasyInterface(t *testing.T) {
+ ts := setupTestServer("")
+ defer ts.Close()
+
+ easy := EasyInit()
+ defer easy.Cleanup()
+
+ easy.Setopt(OPT_URL, ts.URL)
+ if err := easy.Perform(); err != nil {
+ t.Fatal(err)
+ }
+}
+
+func TestCallbackFunction(t *testing.T) {
+ serverContent := "A random string"
+ ts := setupTestServer(serverContent)
+ defer ts.Close()
+
+ easy := EasyInit()
+ defer easy.Cleanup()
+
+ easy.Setopt(OPT_URL, ts.URL)
+ easy.Setopt(OPT_WRITEFUNCTION, func(buf []byte, userdata interface{}) bool {
+ result := string(buf)
+ expected := serverContent + "\n"
+ if result != expected {
+ t.Errorf("output should be %q and is %q.", expected, result)
+ }
+ return true
+ })
+ if err := easy.Perform(); err != nil {
+ t.Fatal(err)
+ }
+}
+
+func TestEscape(t *testing.T) {
+ easy := EasyInit()
+ defer easy.Cleanup()
+
+ payload := `payload={"msg": "First line\nSecond Line"}`
+ expected := `payload%3D%7B%22msg%22%3A%20%22First%20line%5CnSecond%20Line%22%7D`
+ result := easy.Escape(payload)
+ if result != expected {
+ t.Errorf("escaped output should be %q and is %q.", expected, result)
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/e95057f4/newt/Godeps/_workspace/src/github.com/andelf/go-curl/examples/channal_callback.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/andelf/go-curl/examples/channal_callback.go b/newt/Godeps/_workspace/src/github.com/andelf/go-curl/examples/channal_callback.go
new file mode 100644
index 0000000..c9c93f6
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/andelf/go-curl/examples/channal_callback.go
@@ -0,0 +1,47 @@
+package main
+
+import (
+ curl "github.com/andelf/go-curl"
+ "time"
+)
+
+func write_data(ptr []byte, userdata interface{}) bool {
+ ch, ok := userdata.(chan string)
+ if ok {
+ ch <- string(ptr)
+ return true // ok
+ } else {
+ println("ERROR!")
+ return false
+ }
+ return false
+}
+
+func main() {
+ curl.GlobalInit(curl.GLOBAL_ALL)
+
+ // init the curl session
+ easy := curl.EasyInit()
+ defer easy.Cleanup()
+
+ easy.Setopt(curl.OPT_URL, "http://cn.bing.com/")
+
+ easy.Setopt(curl.OPT_WRITEFUNCTION, write_data)
+
+ // make a chan
+ ch := make(chan string, 100)
+ go func(ch chan string) {
+ for {
+ data := <-ch
+ println("Got data size=", len(data))
+ }
+ }(ch)
+
+ easy.Setopt(curl.OPT_WRITEDATA, ch)
+
+ if err := easy.Perform(); err != nil {
+ println("ERROR: ", err.Error())
+ }
+
+ time.Sleep(10000) // wait gorotine
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/e95057f4/newt/Godeps/_workspace/src/github.com/andelf/go-curl/examples/ftpget.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/andelf/go-curl/examples/ftpget.go b/newt/Godeps/_workspace/src/github.com/andelf/go-curl/examples/ftpget.go
new file mode 100644
index 0000000..1c1502d
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/andelf/go-curl/examples/ftpget.go
@@ -0,0 +1,37 @@
+package main
+
+import (
+ curl "github.com/andelf/go-curl"
+ "os"
+)
+
+const filename = "README"
+
+func main() {
+ curl.GlobalInit(curl.GLOBAL_DEFAULT)
+ defer curl.GlobalCleanup()
+ easy := curl.EasyInit()
+ defer easy.Cleanup()
+
+ easy.Setopt(curl.OPT_URL, "ftp://ftp.gnu.org/README")
+
+ // define our callback use lambda function
+ easy.Setopt(curl.OPT_WRITEFUNCTION, func(ptr []byte, userdata interface{}) bool {
+ file := userdata.(*os.File)
+ if _, err := file.Write(ptr); err != nil {
+ return false
+ }
+ return true
+ })
+
+ fp, _ := os.OpenFile(filename, os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0777)
+ defer fp.Close() // defer close
+
+ easy.Setopt(curl.OPT_WRITEDATA, fp)
+
+ easy.Setopt(curl.OPT_VERBOSE, true)
+
+ if err := easy.Perform(); err != nil {
+ println("ERROR", err.Error())
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/e95057f4/newt/Godeps/_workspace/src/github.com/andelf/go-curl/examples/https.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/andelf/go-curl/examples/https.go b/newt/Godeps/_workspace/src/github.com/andelf/go-curl/examples/https.go
new file mode 100644
index 0000000..0a4e031
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/andelf/go-curl/examples/https.go
@@ -0,0 +1,17 @@
+package main
+
+import (
+ curl "github.com/andelf/go-curl"
+)
+
+func main() {
+ easy := curl.EasyInit()
+ defer easy.Cleanup()
+ if easy != nil {
+ easy.Setopt(curl.OPT_URL, "https://mail.google.com/")
+ // skip_peer_verification
+ easy.Setopt(curl.OPT_SSL_VERIFYPEER, false) // 0 is ok
+
+ easy.Perform()
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/e95057f4/newt/Godeps/_workspace/src/github.com/andelf/go-curl/examples/misc.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/andelf/go-curl/examples/misc.go b/newt/Godeps/_workspace/src/github.com/andelf/go-curl/examples/misc.go
new file mode 100644
index 0000000..d66d2b7
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/andelf/go-curl/examples/misc.go
@@ -0,0 +1,104 @@
+package main
+
+import (
+ "fmt"
+ curl "github.com/andelf/go-curl"
+ "os"
+ "reflect"
+)
+
+const endl = "\n"
+
+func main() {
+ println("DEBUG chdir=>", os.Chdir("/sadf"))
+ ret := curl.EasyInit()
+ defer ret.Cleanup()
+ print("init =>", ret, " ", reflect.TypeOf(ret).String(), endl)
+ ret = ret.Duphandle()
+ defer ret.Cleanup()
+
+ print("dup =>", ret, " ", reflect.TypeOf(ret).String(), endl)
+ print("global init =>", curl.GlobalInit(curl.GLOBAL_ALL), endl)
+ print("version =>", curl.Version(), endl)
+ // debug
+ //print("set verbose =>", ret.Setopt(curl.OPT_VERBOSE, true), endl)
+
+ //print("set header =>", ret.Setopt(curl.OPT_HEADER, true), endl)
+
+ // auto calculate port
+ // print("set port =>", ret.EasySetopt(curl.OPT_PORT, 6060), endl)
+ fmt.Printf("XXXX debug setopt %#v \n", ret.Setopt(30000, 19).Error())
+
+ print("set timeout =>", ret.Setopt(curl.OPT_TIMEOUT, 20), endl)
+
+ //print("set post size =>", ret.Setopt(curl.OPT_POSTFIELDSIZE, 10), endl)
+ if ret.Setopt(curl.OPT_URL, "http://www.baidu.com:8000/") != nil {
+ println("set url ok!")
+ }
+ //print("set url =>", ret.Setopt(curl.OPT_URL, "http://commondatastorage.googleapis.com/chromium-browser-continuous/Linux_x64/104547/chrome-linux.zip"), endl)
+
+ print("set user_agent =>", ret.Setopt(curl.OPT_USERAGENT, "go-curl v0.0.1") == nil, endl)
+ // add to DNS cache
+ print("set resolve =>", ret.Setopt(curl.OPT_RESOLVE, []string{"www.baidu.com:8000:127.0.0.1"}) == nil, endl)
+ // ret.EasyReset() clean seted
+
+ // currently not finished!
+ //
+ fooTest := func(buf []byte, userdata interface{}) bool {
+ // buf := ptr.([]byte)
+ println("size=>", len(buf))
+ println("DEBUG(in callback)", buf, userdata)
+ println("data = >", string(buf))
+ return true
+ }
+
+ ret.Setopt(curl.OPT_WRITEFUNCTION, fooTest) // curl.CallbackWriteFunction(fooTest))
+ println("set opt!")
+ // for test only
+
+ code := ret.Perform()
+ // dump.Dump(code)
+ fmt.Printf("code -> %v\n", code)
+
+ println("================================")
+ print("pause =>", ret.Pause(curl.PAUSE_ALL), endl)
+
+ print("escape =>", ret.Escape("http://baidu.com/"), endl)
+ print("unescape =>", ret.Unescape("http://baidu.com/-%00-%5c"), endl)
+
+ print("unescape lenght =>", len(ret.Unescape("http://baidu.com/-%00-%5c")), endl)
+ // print("version info data =>", curl.VersionInfo(1), endl)
+ ver := curl.VersionInfo(curl.VERSION_NOW)
+ fmt.Printf("VersionInfo: Age: %d, Version:%s, Host:%s, Features:%d, SslVer: %s, LibzV: %s, ssh: %s\n",
+ ver.Age, ver.Version, ver.Host, ver.Features, ver.SslVersion, ver.LibzVersion, ver.LibsshVersion)
+
+ print("Protocols:")
+ for _, p := range ver.Protocols {
+ print(p, ", ")
+ }
+ print(endl)
+ println(curl.Getdate("20111002 15:05:58 +0800").String())
+ ret.Getinfo(curl.INFO_EFFECTIVE_URL)
+ ret.Getinfo(curl.INFO_RESPONSE_CODE)
+
+ ret.Getinfo(curl.INFO_FILETIME)
+ ret.Getinfo(curl.INFO_SSL_ENGINES)
+
+ ret.Getinfo(curl.INFO_TOTAL_TIME)
+
+ println("================================")
+
+ // ret.Getinfo(curl.INFO_SSL_ENGINES)
+
+ /* mret := curl.MultiInit()
+ mret.AddHandle(ret) // works
+ defer mret.Cleanup()
+ if ok, handles := mret.Perform(); ok == curl.OK {
+ fmt.Printf("ok=%s, handles=%d\n", ok, handles)
+ } else {
+ fmt.Printf("error calling multi\n")
+ }
+ */
+ println("================================")
+ //println(curl.GlobalInit(curl.GLOBAL_SSL))
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/e95057f4/newt/Godeps/_workspace/src/github.com/andelf/go-curl/examples/multi_and_select.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/andelf/go-curl/examples/multi_and_select.go b/newt/Godeps/_workspace/src/github.com/andelf/go-curl/examples/multi_and_select.go
new file mode 100644
index 0000000..950da36
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/andelf/go-curl/examples/multi_and_select.go
@@ -0,0 +1,101 @@
+package main
+
+/*
+#include <stdlib.h>
+#include <sys/select.h>
+static void _FD_ZERO(void *set) {
+ FD_ZERO((fd_set*)set);
+}
+static void _FD_SET(int sysfd, void *set) {
+ FD_SET(sysfd, (fd_set*)set);
+}
+static int _FD_ISSET (int sysfd, void *set) {
+ return FD_ISSET(sysfd, (fd_set*)set);
+}
+*/
+import "C"
+
+import (
+ curl "github.com/Pyrrvs/go-curl"
+ "syscall"
+ "unsafe"
+ "fmt"
+)
+
+func FD_ZERO(set *syscall.FdSet) {
+ s := unsafe.Pointer(set)
+ C._FD_ZERO(s)
+}
+
+func FD_SET(sysfd int, set *syscall.FdSet) {
+ s := unsafe.Pointer(set)
+ fd := C.int(sysfd)
+ C._FD_SET(fd, s)
+}
+
+func FD_ISSET(sysfd int, set *syscall.FdSet) bool {
+ s := unsafe.Pointer(set)
+ fd := C.int(sysfd)
+ return C._FD_ISSET(fd, s) != 0
+}
+
+func main() {
+ var (
+ rset, wset, eset syscall.FdSet
+ still_running, curl_timeout int = 0, 0
+ err error
+ )
+
+ ch1 := curl.EasyInit()
+ ch2 := curl.EasyInit()
+
+ ch1.Setopt(curl.OPT_URL, "http://www.163.com")
+ ch1.Setopt(curl.OPT_HEADER, 0)
+ ch1.Setopt(curl.OPT_VERBOSE, true)
+ ch2.Setopt(curl.OPT_URL, "http://www.baidu.com")
+ ch2.Setopt(curl.OPT_HEADER, 0)
+ ch2.Setopt(curl.OPT_VERBOSE, true)
+
+ mh := curl.MultiInit()
+
+ mh.AddHandle(ch1)
+ mh.AddHandle(ch2)
+
+ for {
+ FD_ZERO(&rset)
+ FD_ZERO(&wset)
+ FD_ZERO(&eset)
+
+ timeout := syscall.Timeval{Sec:1, Usec:0}
+ curl_timeout, err = mh.Timeout()
+ if err != nil {
+ fmt.Printf("Error multi_timeout: %s\n", err)
+ }
+ if curl_timeout >= 0 {
+ timeout.Sec = int64(curl_timeout / 1000)
+ if timeout.Sec > 1 {
+ timeout.Sec = 1
+ } else {
+ timeout.Usec = int64((curl_timeout % 1000)) * 1000
+ }
+ }
+
+ max_fd, err := mh.Fdset(&rset, &wset, &eset)
+ if err != nil {
+ fmt.Printf("Error FDSET: %s\n", err)
+ }
+
+ _, err = syscall.Select(int(max_fd + 1), &rset, &wset, &eset, &timeout)
+ if err != nil {
+ fmt.Printf("Error select: %s\n", err)
+ } else {
+ still_running, err = mh.Perform()
+ if still_running > 0 {
+ fmt.Printf("Still running: %d\n", still_running)
+ } else {
+ break
+ }
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/e95057f4/newt/Godeps/_workspace/src/github.com/andelf/go-curl/examples/multi_sample.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/andelf/go-curl/examples/multi_sample.go b/newt/Godeps/_workspace/src/github.com/andelf/go-curl/examples/multi_sample.go
new file mode 100644
index 0000000..a0563a8
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/andelf/go-curl/examples/multi_sample.go
@@ -0,0 +1,36 @@
+
+package main
+
+import (
+ curl "github.com/andelf/go-curl"
+ "time"
+)
+
+func main() {
+
+ ch1 := curl.EasyInit()
+ ch2 := curl.EasyInit()
+
+ ch1.Setopt(curl.OPT_URL, "http://www.163.com")
+ ch1.Setopt(curl.OPT_HEADER, 0)
+ ch1.Setopt(curl.OPT_VERBOSE, true)
+ ch2.Setopt(curl.OPT_URL, "http://www.baidu.com")
+ ch2.Setopt(curl.OPT_HEADER, 0)
+ ch2.Setopt(curl.OPT_VERBOSE, true)
+
+ mh := curl.MultiInit()
+
+ mh.AddHandle(ch1)
+ mh.AddHandle(ch2)
+
+ for {
+ nRunning, _ := mh.Perform()
+ // println("n =", nRunning)
+ if nRunning == 0 {
+ println("ok")
+ break
+ }
+ time.Sleep(1000)
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/e95057f4/newt/Godeps/_workspace/src/github.com/andelf/go-curl/examples/post-callback.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/andelf/go-curl/examples/post-callback.go b/newt/Godeps/_workspace/src/github.com/andelf/go-curl/examples/post-callback.go
new file mode 100644
index 0000000..3b02802
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/andelf/go-curl/examples/post-callback.go
@@ -0,0 +1,43 @@
+package main
+
+import (
+ curl "github.com/andelf/go-curl"
+ "time"
+)
+
+const POST_DATA = "a_test_data_only"
+
+var sent = false
+
+func main() {
+ // init the curl session
+ easy := curl.EasyInit()
+ defer easy.Cleanup()
+
+ easy.Setopt(curl.OPT_URL, "http://www.google.com")
+
+ easy.Setopt(curl.OPT_POST, true)
+ easy.Setopt(curl.OPT_VERBOSE, true)
+
+ easy.Setopt(curl.OPT_READFUNCTION,
+ func(ptr []byte, userdata interface{}) int {
+ // WARNING: never use append()
+ if !sent {
+ sent = true
+ ret := copy(ptr, POST_DATA)
+ return ret
+ }
+ return 0 // sent ok
+ })
+
+ // disable HTTP/1.1 Expect 100
+ easy.Setopt(curl.OPT_HTTPHEADER, []string{"Expect:"})
+ // must set
+ easy.Setopt(curl.OPT_POSTFIELDSIZE, len(POST_DATA))
+
+ if err := easy.Perform(); err != nil {
+ println("ERROR: ", err.Error())
+ }
+
+ time.Sleep(10000) // wait gorotine
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/e95057f4/newt/Godeps/_workspace/src/github.com/andelf/go-curl/examples/progress.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/andelf/go-curl/examples/progress.go b/newt/Godeps/_workspace/src/github.com/andelf/go-curl/examples/progress.go
new file mode 100644
index 0000000..09efcf5
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/andelf/go-curl/examples/progress.go
@@ -0,0 +1,47 @@
+// A sample program to show how to use PROGRESS callback to calculate
+// downloading percentage and speed
+package main
+
+import (
+ "fmt"
+ curl "github.com/andelf/go-curl"
+ "time"
+)
+
+func write_data(ptr []byte, userdata interface{}) bool {
+ // make it ok, do nothing
+ return true
+}
+
+func main() {
+ curl.GlobalInit(curl.GLOBAL_ALL)
+
+ // init the curl session
+ easy := curl.EasyInit()
+ defer easy.Cleanup()
+
+ easy.Setopt(curl.OPT_URL, "http://curl.haxx.se/download/curl-7.22.0.tar.gz")
+
+ easy.Setopt(curl.OPT_WRITEFUNCTION, write_data)
+
+ easy.Setopt(curl.OPT_NOPROGRESS, false)
+
+ started := int64(0)
+ easy.Setopt(curl.OPT_PROGRESSFUNCTION, func(dltotal, dlnow, ultotal, ulnow float64, userdata interface{}) bool {
+ // canceled when 50% finished
+ if dlnow/dltotal > 0.5 {
+ println("")
+ // abort downloading
+ return false
+ }
+ if started == 0 {
+ started = time.Now().Unix()
+ }
+ fmt.Printf("Downloaded: %3.2f%%, Speed: %.1fKiB/s \r", dlnow/dltotal*100, dlnow/1000/float64((time.Now().Unix()-started)))
+ return true
+ })
+
+ if err := easy.Perform(); err != nil {
+ fmt.Printf("ERROR: %v\n", err)
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/e95057f4/newt/Godeps/_workspace/src/github.com/andelf/go-curl/examples/renren_login.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/andelf/go-curl/examples/renren_login.go b/newt/Godeps/_workspace/src/github.com/andelf/go-curl/examples/renren_login.go
new file mode 100644
index 0000000..60ef84c
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/andelf/go-curl/examples/renren_login.go
@@ -0,0 +1,36 @@
+// 测试人人网登录, 并保存cookiejar
+package main
+
+import (
+ "flag"
+ curl "github.com/andelf/go-curl"
+)
+
+func main() {
+ // init the curl session
+
+ var username *string = flag.String("username", "test", "renren.com email")
+ var password *string = flag.String("password", "test", "renren.com password")
+
+ flag.Parse()
+
+ easy := curl.EasyInit()
+ defer easy.Cleanup()
+
+ easy.Setopt(curl.OPT_URL, "http://m.renren.com/home.do")
+
+ easy.Setopt(curl.OPT_PORT, 80)
+ easy.Setopt(curl.OPT_VERBOSE, true)
+
+ easy.Setopt(curl.OPT_COOKIEJAR, "./cookie.jar")
+
+ // disable HTTP/1.1 Expect: 100-continue
+ easy.Setopt(curl.OPT_HTTPHEADER, []string{"Expect:"})
+
+ postdata := "email=" + *username + "&password=" + *password + "&login=" + easy.Escape("登录")
+ easy.Setopt(curl.OPT_POSTFIELDS, postdata)
+
+ if err := easy.Perform(); err != nil {
+ println("ERROR: ", err.Error())
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/e95057f4/newt/Godeps/_workspace/src/github.com/andelf/go-curl/examples/renren_upload.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/andelf/go-curl/examples/renren_upload.go b/newt/Godeps/_workspace/src/github.com/andelf/go-curl/examples/renren_upload.go
new file mode 100644
index 0000000..d02e320
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/andelf/go-curl/examples/renren_upload.go
@@ -0,0 +1,77 @@
+// 人人网图片上传
+package main
+
+import (
+ "fmt"
+ curl "github.com/andelf/go-curl"
+ "regexp"
+ "time"
+)
+
+func getUploadUrl() string {
+ page := ""
+ easy := curl.EasyInit()
+ defer easy.Cleanup()
+
+ u := "http://3g.renren.com/album/wuploadphoto.do"
+ easy.Setopt(curl.OPT_URL, u)
+ easy.Setopt(curl.OPT_COOKIEFILE, "./cookie.jar")
+ easy.Setopt(curl.OPT_COOKIEJAR, "./cookie.jar")
+ easy.Setopt(curl.OPT_VERBOSE, true)
+ easy.Setopt(curl.OPT_WRITEFUNCTION, func(ptr []byte, _ interface{}) bool {
+ page += string(ptr)
+ return true
+ })
+ easy.Perform()
+ // extract url from
+ // <form enctype="multipart/form-data" action="http://3g.renren.com/album/wuploadphoto.do?type=3&sid=zv3tiXTZr6Cu1rj5dhgX_X"
+ pattern, _ := regexp.Compile(`action="(.*?)"`)
+
+ if matches := pattern.FindStringSubmatch(page); len(matches) == 2 {
+ return matches[1]
+ }
+ return ""
+}
+
+func main() {
+ // init the curl session
+
+ easy := curl.EasyInit()
+ defer easy.Cleanup()
+
+ posturl := getUploadUrl()
+
+ easy.Setopt(curl.OPT_URL, posturl)
+
+ easy.Setopt(curl.OPT_PORT, 80)
+ easy.Setopt(curl.OPT_VERBOSE, true)
+
+ // save cookie and load cookie
+ easy.Setopt(curl.OPT_COOKIEFILE, "./cookie.jar")
+ easy.Setopt(curl.OPT_COOKIEJAR, "./cookie.jar")
+
+ // disable HTTP/1.1 Expect: 100-continue
+ easy.Setopt(curl.OPT_HTTPHEADER, []string{"Expect:"})
+
+ form := curl.NewForm()
+ form.Add("albumid", "452618633") // your album id
+ form.AddFile("theFile", "./test.jpg")
+ form.Add("description", "我就尝试下这段代码靠谱不。。截图下看看")
+ form.Add("post", "上传照片")
+
+ easy.Setopt(curl.OPT_HTTPPOST, form)
+
+ // print upload progress
+ easy.Setopt(curl.OPT_NOPROGRESS, false)
+ easy.Setopt(curl.OPT_PROGRESSFUNCTION, func(dltotal, dlnow, ultotal, ulnow float64, _ interface{}) bool {
+ fmt.Printf("Download %3.2f%%, Uploading %3.2f%%\r", dlnow/dltotal*100, ulnow/ultotal*100)
+ return true
+ })
+
+ if err := easy.Perform(); err != nil {
+ println("ERROR: ", err.Error())
+ }
+
+ time.Sleep(1000000000) // wait gorotine
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/e95057f4/newt/Godeps/_workspace/src/github.com/andelf/go-curl/examples/sendrecv.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/andelf/go-curl/examples/sendrecv.go b/newt/Godeps/_workspace/src/github.com/andelf/go-curl/examples/sendrecv.go
new file mode 100644
index 0000000..841825c
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/andelf/go-curl/examples/sendrecv.go
@@ -0,0 +1,44 @@
+package main
+
+import (
+ "fmt"
+ curl "github.com/andelf/go-curl"
+ "time"
+)
+
+const POST_DATA = "a_test_data_only"
+
+var sent = false
+
+func main() {
+ // init the curl session
+
+ easy := curl.EasyInit()
+ defer easy.Cleanup()
+
+ easy.Setopt(curl.OPT_URL, "http://www.renren.com")
+
+ easy.Setopt(curl.OPT_PORT, 80)
+ easy.Setopt(curl.OPT_VERBOSE, true)
+ easy.Setopt(curl.OPT_CONNECT_ONLY, true)
+
+ easy.Setopt(curl.OPT_WRITEFUNCTION, nil)
+
+ if err := easy.Perform(); err != nil {
+ println("ERROR: ", err.Error())
+ }
+
+ easy.Send([]byte("HEAD / HTTP/1.0\r\nHost: www.renren.com\r\n\r\n"))
+
+ buf := make([]byte, 1000)
+ time.Sleep(1000000000) // wait gorotine
+ num, err := easy.Recv(buf)
+ if err != nil {
+ println("ERROR:", err.Error())
+ }
+ println("recv num = ", num)
+ // NOTE: must use buf[:num]
+ println(string(buf[:num]))
+
+ fmt.Printf("got:\n%#v\n", string(buf[:num]))
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/e95057f4/newt/Godeps/_workspace/src/github.com/andelf/go-curl/examples/sepheaders.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/andelf/go-curl/examples/sepheaders.go b/newt/Godeps/_workspace/src/github.com/andelf/go-curl/examples/sepheaders.go
new file mode 100644
index 0000000..b7603e3
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/andelf/go-curl/examples/sepheaders.go
@@ -0,0 +1,49 @@
+package main
+
+import (
+ curl "github.com/andelf/go-curl"
+ "os"
+)
+
+const (
+ headerfilename = "head.out"
+ bodyfilename = "body.out"
+)
+
+func write_data(ptr []byte, userdata interface{}) bool {
+ //println("DEBUG(write_data): ", userdata)
+ //println("DEBUG", userdata.(interface{}))
+ fp := userdata.(*os.File)
+ if _, err := fp.Write(ptr); err == nil {
+ return true
+ }
+ return false
+}
+
+func main() {
+ curl.GlobalInit(curl.GLOBAL_ALL)
+
+ // init the curl session
+ easy := curl.EasyInit()
+ defer easy.Cleanup()
+
+ // set URL to get
+ easy.Setopt(curl.OPT_URL, "http://cn.bing.com/")
+
+ // no progress meter
+ easy.Setopt(curl.OPT_NOPROGRESS, true)
+
+ easy.Setopt(curl.OPT_WRITEFUNCTION, write_data)
+
+ // write file
+ fp, _ := os.OpenFile(bodyfilename, os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0777)
+ defer fp.Close()
+ easy.Setopt(curl.OPT_WRITEDATA, fp)
+
+ // easy.Setopt(curl.OPT_WRITEHEADER, 0)
+
+ if err := easy.Perform(); err != nil {
+ println("ERROR: ", err.Error())
+ }
+
+}