Permalink
Browse files

dynamic generate curl include file

  • Loading branch information...
1 parent f51c056 commit 58acd92ea939122c06210b19d61fedecf4a678da @jiangmiao committed Mar 7, 2012
Showing with 28 additions and 226 deletions.
  1. +22 −0 LICENSE-MIT
  2. +2 −2 package.json
  3. +0 −16 src/double_infos.h
  4. +4 −1 src/generate_curl_options_list.sh
  5. +0 −21 src/integer_infos.h
  6. +0 −91 src/integer_options.h
  7. +0 −11 src/string_infos.h
  8. +0 −84 src/string_options.h
View
@@ -0,0 +1,22 @@
+Copyright (c) 2012 Miao Jiang
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
View
@@ -1,6 +1,6 @@
{
"name": "node-curl",
- "version": "0.1.1",
+ "version": "0.1.2",
"author" : "Jiang Miao <jiangfriend@gmail.com>",
"description": "node wrapper for multi curl, fully implemented.",
"keywords" : ["node-curl", "curl", "multi-curl", "mcurl"],
@@ -11,7 +11,7 @@
},
"main" : "./lib",
"scripts" : {
- "install" : "node-waf configure build || true"
+ "install" : "sh src/generate_curl_options_list.sh && node-waf configure build || true"
},
"engines" : { "node": ">= 0.6.0" }
}
View
@@ -1,16 +0,0 @@
-// generated by generate_curl_options_list.sh at Mon, 13 Feb 2012 21:40:10 +0800
-CurlOption double_infos[] = {
- {"TOTAL_TIME", CURLINFO_TOTAL_TIME},
- {"NAMELOOKUP_TIME", CURLINFO_NAMELOOKUP_TIME},
- {"CONNECT_TIME", CURLINFO_CONNECT_TIME},
- {"PRETRANSFER_TIME", CURLINFO_PRETRANSFER_TIME},
- {"SIZE_UPLOAD", CURLINFO_SIZE_UPLOAD},
- {"SIZE_DOWNLOAD", CURLINFO_SIZE_DOWNLOAD},
- {"SPEED_DOWNLOAD", CURLINFO_SPEED_DOWNLOAD},
- {"SPEED_UPLOAD", CURLINFO_SPEED_UPLOAD},
- {"CONTENT_LENGTH_DOWNLOAD", CURLINFO_CONTENT_LENGTH_DOWNLOAD},
- {"CONTENT_LENGTH_UPLOAD", CURLINFO_CONTENT_LENGTH_UPLOAD},
- {"STARTTRANSFER_TIME", CURLINFO_STARTTRANSFER_TIME},
- {"REDIRECT_TIME", CURLINFO_REDIRECT_TIME},
- {"APPCONNECT_TIME", CURLINFO_APPCONNECT_TIME},
-};
View
5 src/generate_curl_options_list.sh 100644 → 100755
@@ -1,15 +1,18 @@
#!/bin/sh
+root=`dirname $0`
+
generate() {
name=$1
pattern=$2
prefix=$3
+ echo "generate $root/$name.h"
(
echo "// generated by $0 at $(date -R)"
echo "CurlOption $name[] = {"
cat /usr/include/curl/curl.h|perl -ne "/$pattern/i && print \"\t{\\\"\$1\\\", CURL${prefix}_\$1},\n\""
echo '};'
- ) > $name.h
+ ) > $root/$name.h
}
generate integer_options 'CINIT\((\w+).*LONG' OPT
generate string_options 'CINIT\((\w+).*OBJECT' OPT
View
@@ -1,21 +0,0 @@
-// generated by generate_curl_options_list.sh at Mon, 13 Feb 2012 21:40:10 +0800
-CurlOption integer_infos[] = {
- {"RESPONSE_CODE", CURLINFO_RESPONSE_CODE},
- {"HEADER_SIZE", CURLINFO_HEADER_SIZE},
- {"REQUEST_SIZE", CURLINFO_REQUEST_SIZE},
- {"SSL_VERIFYRESULT", CURLINFO_SSL_VERIFYRESULT},
- {"FILETIME", CURLINFO_FILETIME},
- {"REDIRECT_COUNT", CURLINFO_REDIRECT_COUNT},
- {"HTTP_CONNECTCODE", CURLINFO_HTTP_CONNECTCODE},
- {"HTTPAUTH_AVAIL", CURLINFO_HTTPAUTH_AVAIL},
- {"PROXYAUTH_AVAIL", CURLINFO_PROXYAUTH_AVAIL},
- {"OS_ERRNO", CURLINFO_OS_ERRNO},
- {"NUM_CONNECTS", CURLINFO_NUM_CONNECTS},
- {"LASTSOCKET", CURLINFO_LASTSOCKET},
- {"CONDITION_UNMET", CURLINFO_CONDITION_UNMET},
- {"RTSP_CLIENT_CSEQ", CURLINFO_RTSP_CLIENT_CSEQ},
- {"RTSP_SERVER_CSEQ", CURLINFO_RTSP_SERVER_CSEQ},
- {"RTSP_CSEQ_RECV", CURLINFO_RTSP_CSEQ_RECV},
- {"PRIMARY_PORT", CURLINFO_PRIMARY_PORT},
- {"LOCAL_PORT", CURLINFO_LOCAL_PORT},
-};
View
@@ -1,91 +0,0 @@
-// generated by generate_curl_options_list.sh at Mon, 13 Feb 2012 21:40:10 +0800
-CurlOption integer_options[] = {
- {"PORT", CURLOPT_PORT},
- {"TIMEOUT", CURLOPT_TIMEOUT},
- {"INFILESIZE", CURLOPT_INFILESIZE},
- {"LOW_SPEED_LIMIT", CURLOPT_LOW_SPEED_LIMIT},
- {"LOW_SPEED_TIME", CURLOPT_LOW_SPEED_TIME},
- {"RESUME_FROM", CURLOPT_RESUME_FROM},
- {"CRLF", CURLOPT_CRLF},
- {"SSLVERSION", CURLOPT_SSLVERSION},
- {"TIMECONDITION", CURLOPT_TIMECONDITION},
- {"TIMEVALUE", CURLOPT_TIMEVALUE},
- {"VERBOSE", CURLOPT_VERBOSE},
- {"HEADER", CURLOPT_HEADER},
- {"NOPROGRESS", CURLOPT_NOPROGRESS},
- {"NOBODY", CURLOPT_NOBODY},
- {"FAILONERROR", CURLOPT_FAILONERROR},
- {"UPLOAD", CURLOPT_UPLOAD},
- {"POST", CURLOPT_POST},
- {"DIRLISTONLY", CURLOPT_DIRLISTONLY},
- {"APPEND", CURLOPT_APPEND},
- {"NETRC", CURLOPT_NETRC},
- {"FOLLOWLOCATION", CURLOPT_FOLLOWLOCATION},
- {"TRANSFERTEXT", CURLOPT_TRANSFERTEXT},
- {"PUT", CURLOPT_PUT},
- {"AUTOREFERER", CURLOPT_AUTOREFERER},
- {"PROXYPORT", CURLOPT_PROXYPORT},
- {"POSTFIELDSIZE", CURLOPT_POSTFIELDSIZE},
- {"HTTPPROXYTUNNEL", CURLOPT_HTTPPROXYTUNNEL},
- {"SSL_VERIFYPEER", CURLOPT_SSL_VERIFYPEER},
- {"MAXREDIRS", CURLOPT_MAXREDIRS},
- {"FILETIME", CURLOPT_FILETIME},
- {"MAXCONNECTS", CURLOPT_MAXCONNECTS},
- {"CLOSEPOLICY", CURLOPT_CLOSEPOLICY},
- {"FRESH_CONNECT", CURLOPT_FRESH_CONNECT},
- {"FORBID_REUSE", CURLOPT_FORBID_REUSE},
- {"CONNECTTIMEOUT", CURLOPT_CONNECTTIMEOUT},
- {"HTTPGET", CURLOPT_HTTPGET},
- {"SSL_VERIFYHOST", CURLOPT_SSL_VERIFYHOST},
- {"HTTP_VERSION", CURLOPT_HTTP_VERSION},
- {"FTP_USE_EPSV", CURLOPT_FTP_USE_EPSV},
- {"SSLENGINE_DEFAULT", CURLOPT_SSLENGINE_DEFAULT},
- {"DNS_USE_GLOBAL_CACHE", CURLOPT_DNS_USE_GLOBAL_CACHE},
- {"DNS_CACHE_TIMEOUT", CURLOPT_DNS_CACHE_TIMEOUT},
- {"COOKIESESSION", CURLOPT_COOKIESESSION},
- {"BUFFERSIZE", CURLOPT_BUFFERSIZE},
- {"NOSIGNAL", CURLOPT_NOSIGNAL},
- {"PROXYTYPE", CURLOPT_PROXYTYPE},
- {"UNRESTRICTED_AUTH", CURLOPT_UNRESTRICTED_AUTH},
- {"FTP_USE_EPRT", CURLOPT_FTP_USE_EPRT},
- {"HTTPAUTH", CURLOPT_HTTPAUTH},
- {"FTP_CREATE_MISSING_DIRS", CURLOPT_FTP_CREATE_MISSING_DIRS},
- {"PROXYAUTH", CURLOPT_PROXYAUTH},
- {"FTP_RESPONSE_TIMEOUT", CURLOPT_FTP_RESPONSE_TIMEOUT},
- {"IPRESOLVE", CURLOPT_IPRESOLVE},
- {"MAXFILESIZE", CURLOPT_MAXFILESIZE},
- {"USE_SSL", CURLOPT_USE_SSL},
- {"TCP_NODELAY", CURLOPT_TCP_NODELAY},
- {"FTPSSLAUTH", CURLOPT_FTPSSLAUTH},
- {"IGNORE_CONTENT_LENGTH", CURLOPT_IGNORE_CONTENT_LENGTH},
- {"FTP_SKIP_PASV_IP", CURLOPT_FTP_SKIP_PASV_IP},
- {"FTP_FILEMETHOD", CURLOPT_FTP_FILEMETHOD},
- {"LOCALPORT", CURLOPT_LOCALPORT},
- {"LOCALPORTRANGE", CURLOPT_LOCALPORTRANGE},
- {"CONNECT_ONLY", CURLOPT_CONNECT_ONLY},
- {"SSL_SESSIONID_CACHE", CURLOPT_SSL_SESSIONID_CACHE},
- {"SSH_AUTH_TYPES", CURLOPT_SSH_AUTH_TYPES},
- {"FTP_SSL_CCC", CURLOPT_FTP_SSL_CCC},
- {"TIMEOUT_MS", CURLOPT_TIMEOUT_MS},
- {"CONNECTTIMEOUT_MS", CURLOPT_CONNECTTIMEOUT_MS},
- {"HTTP_TRANSFER_DECODING", CURLOPT_HTTP_TRANSFER_DECODING},
- {"HTTP_CONTENT_DECODING", CURLOPT_HTTP_CONTENT_DECODING},
- {"NEW_FILE_PERMS", CURLOPT_NEW_FILE_PERMS},
- {"NEW_DIRECTORY_PERMS", CURLOPT_NEW_DIRECTORY_PERMS},
- {"POSTREDIR", CURLOPT_POSTREDIR},
- {"PROXY_TRANSFER_MODE", CURLOPT_PROXY_TRANSFER_MODE},
- {"ADDRESS_SCOPE", CURLOPT_ADDRESS_SCOPE},
- {"CERTINFO", CURLOPT_CERTINFO},
- {"TFTP_BLKSIZE", CURLOPT_TFTP_BLKSIZE},
- {"SOCKS5_GSSAPI_NEC", CURLOPT_SOCKS5_GSSAPI_NEC},
- {"PROTOCOLS", CURLOPT_PROTOCOLS},
- {"REDIR_PROTOCOLS", CURLOPT_REDIR_PROTOCOLS},
- {"FTP_USE_PRET", CURLOPT_FTP_USE_PRET},
- {"RTSP_REQUEST", CURLOPT_RTSP_REQUEST},
- {"RTSP_CLIENT_CSEQ", CURLOPT_RTSP_CLIENT_CSEQ},
- {"RTSP_SERVER_CSEQ", CURLOPT_RTSP_SERVER_CSEQ},
- {"WILDCARDMATCH", CURLOPT_WILDCARDMATCH},
- {"TRANSFER_ENCODING", CURLOPT_TRANSFER_ENCODING},
- {"GSSAPI_DELEGATION", CURLOPT_GSSAPI_DELEGATION},
- {"ACCEPTTIMEOUT_MS", CURLOPT_ACCEPTTIMEOUT_MS},
-};
View
@@ -1,11 +0,0 @@
-// generated by generate_curl_options_list.sh at Mon, 13 Feb 2012 21:40:10 +0800
-CurlOption string_infos[] = {
- {"EFFECTIVE_URL", CURLINFO_EFFECTIVE_URL},
- {"CONTENT_TYPE", CURLINFO_CONTENT_TYPE},
- {"PRIVATE", CURLINFO_PRIVATE},
- {"FTP_ENTRY_PATH", CURLINFO_FTP_ENTRY_PATH},
- {"REDIRECT_URL", CURLINFO_REDIRECT_URL},
- {"PRIMARY_IP", CURLINFO_PRIMARY_IP},
- {"RTSP_SESSION_ID", CURLINFO_RTSP_SESSION_ID},
- {"LOCAL_IP", CURLINFO_LOCAL_IP},
-};
View
@@ -1,84 +0,0 @@
-// generated by generate_curl_options_list.sh at Mon, 13 Feb 2012 21:40:10 +0800
-CurlOption string_options[] = {
- {"FILE", CURLOPT_FILE},
- {"URL", CURLOPT_URL},
- {"PROXY", CURLOPT_PROXY},
- {"USERPWD", CURLOPT_USERPWD},
- {"PROXYUSERPWD", CURLOPT_PROXYUSERPWD},
- {"RANGE", CURLOPT_RANGE},
- {"INFILE", CURLOPT_INFILE},
- {"ERRORBUFFER", CURLOPT_ERRORBUFFER},
- {"POSTFIELDS", CURLOPT_POSTFIELDS},
- {"REFERER", CURLOPT_REFERER},
- {"FTPPORT", CURLOPT_FTPPORT},
- {"USERAGENT", CURLOPT_USERAGENT},
- {"COOKIE", CURLOPT_COOKIE},
- {"HTTPHEADER", CURLOPT_HTTPHEADER},
- {"HTTPPOST", CURLOPT_HTTPPOST},
- {"SSLCERT", CURLOPT_SSLCERT},
- {"KEYPASSWD", CURLOPT_KEYPASSWD},
- {"QUOTE", CURLOPT_QUOTE},
- {"WRITEHEADER", CURLOPT_WRITEHEADER},
- {"COOKIEFILE", CURLOPT_COOKIEFILE},
- {"CUSTOMREQUEST", CURLOPT_CUSTOMREQUEST},
- {"STDERR", CURLOPT_STDERR},
- {"POSTQUOTE", CURLOPT_POSTQUOTE},
- {"WRITEINFO", CURLOPT_WRITEINFO},
- {"PROGRESSDATA", CURLOPT_PROGRESSDATA},
- {"INTERFACE", CURLOPT_INTERFACE},
- {"KRBLEVEL", CURLOPT_KRBLEVEL},
- {"CAINFO", CURLOPT_CAINFO},
- {"TELNETOPTIONS", CURLOPT_TELNETOPTIONS},
- {"RANDOM_FILE", CURLOPT_RANDOM_FILE},
- {"EGDSOCKET", CURLOPT_EGDSOCKET},
- {"COOKIEJAR", CURLOPT_COOKIEJAR},
- {"SSL_CIPHER_LIST", CURLOPT_SSL_CIPHER_LIST},
- {"SSLCERTTYPE", CURLOPT_SSLCERTTYPE},
- {"SSLKEY", CURLOPT_SSLKEY},
- {"SSLKEYTYPE", CURLOPT_SSLKEYTYPE},
- {"SSLENGINE", CURLOPT_SSLENGINE},
- {"PREQUOTE", CURLOPT_PREQUOTE},
- {"DEBUGDATA", CURLOPT_DEBUGDATA},
- {"CAPATH", CURLOPT_CAPATH},
- {"SHARE", CURLOPT_SHARE},
- {"ACCEPT_ENCODING", CURLOPT_ACCEPT_ENCODING},
- {"PRIVATE", CURLOPT_PRIVATE},
- {"HTTP200ALIASES", CURLOPT_HTTP200ALIASES},
- {"SSL_CTX_DATA", CURLOPT_SSL_CTX_DATA},
- {"NETRC_FILE", CURLOPT_NETRC_FILE},
- {"IOCTLDATA", CURLOPT_IOCTLDATA},
- {"FTP_ACCOUNT", CURLOPT_FTP_ACCOUNT},
- {"COOKIELIST", CURLOPT_COOKIELIST},
- {"FTP_ALTERNATIVE_TO_USER", CURLOPT_FTP_ALTERNATIVE_TO_USER},
- {"SOCKOPTDATA", CURLOPT_SOCKOPTDATA},
- {"SSH_PUBLIC_KEYFILE", CURLOPT_SSH_PUBLIC_KEYFILE},
- {"SSH_PRIVATE_KEYFILE", CURLOPT_SSH_PRIVATE_KEYFILE},
- {"SSH_HOST_PUBLIC_KEY_MD5", CURLOPT_SSH_HOST_PUBLIC_KEY_MD5},
- {"OPENSOCKETDATA", CURLOPT_OPENSOCKETDATA},
- {"COPYPOSTFIELDS", CURLOPT_COPYPOSTFIELDS},
- {"SEEKDATA", CURLOPT_SEEKDATA},
- {"CRLFILE", CURLOPT_CRLFILE},
- {"ISSUERCERT", CURLOPT_ISSUERCERT},
- {"USERNAME", CURLOPT_USERNAME},
- {"PASSWORD", CURLOPT_PASSWORD},
- {"PROXYUSERNAME", CURLOPT_PROXYUSERNAME},
- {"PROXYPASSWORD", CURLOPT_PROXYPASSWORD},
- {"NOPROXY", CURLOPT_NOPROXY},
- {"SOCKS5_GSSAPI_SERVICE", CURLOPT_SOCKS5_GSSAPI_SERVICE},
- {"SSH_KNOWNHOSTS", CURLOPT_SSH_KNOWNHOSTS},
- {"SSH_KEYDATA", CURLOPT_SSH_KEYDATA},
- {"MAIL_FROM", CURLOPT_MAIL_FROM},
- {"MAIL_RCPT", CURLOPT_MAIL_RCPT},
- {"RTSP_SESSION_ID", CURLOPT_RTSP_SESSION_ID},
- {"RTSP_STREAM_URI", CURLOPT_RTSP_STREAM_URI},
- {"RTSP_TRANSPORT", CURLOPT_RTSP_TRANSPORT},
- {"INTERLEAVEDATA", CURLOPT_INTERLEAVEDATA},
- {"CHUNK_DATA", CURLOPT_CHUNK_DATA},
- {"FNMATCH_DATA", CURLOPT_FNMATCH_DATA},
- {"RESOLVE", CURLOPT_RESOLVE},
- {"TLSAUTH_USERNAME", CURLOPT_TLSAUTH_USERNAME},
- {"TLSAUTH_PASSWORD", CURLOPT_TLSAUTH_PASSWORD},
- {"TLSAUTH_TYPE", CURLOPT_TLSAUTH_TYPE},
- {"CLOSESOCKETDATA", CURLOPT_CLOSESOCKETDATA},
- {"DNS_SERVERS", CURLOPT_DNS_SERVERS},
-};

0 comments on commit 58acd92

Please sign in to comment.