From a77b640cc0ddace57758946881294db6f03db16e Mon Sep 17 00:00:00 2001 From: Patrick Monnerat Date: Mon, 5 Nov 2018 15:37:23 +0100 Subject: OS400: add URL API ccsid wrappers and sync ILE/RPG bindings --- packages/OS400/README.OS400 | 1 + packages/OS400/ccsidcurl.c | 46 ++++++++++++++- packages/OS400/ccsidcurl.h | 6 ++ packages/OS400/curl.inc.in | 140 +++++++++++++++++++++++++++++++++++++++++++- 4 files changed, 189 insertions(+), 4 deletions(-) (limited to 'packages') diff --git a/packages/OS400/README.OS400 b/packages/OS400/README.OS400 index 2f9910377..967c26f68 100644 --- a/packages/OS400/README.OS400 +++ b/packages/OS400/README.OS400 @@ -75,6 +75,7 @@ options: CURLOPT_CUSTOMREQUEST CURLOPT_DEFAULT_PROTOCOL CURLOPT_DNS_SERVERS + CURLOPT_DOH_URL CURLOPT_EGDSOCKET CURLOPT_ENCODING CURLOPT_FTPPORT diff --git a/packages/OS400/ccsidcurl.c b/packages/OS400/ccsidcurl.c index af53f6761..b1d3ba845 100644 --- a/packages/OS400/ccsidcurl.c +++ b/packages/OS400/ccsidcurl.c @@ -1125,7 +1125,7 @@ curl_easy_setopt_ccsid(CURL * curl, CURLoption tag, ...) if(testwarn) { testwarn = 0; - if((int) STRING_LASTZEROTERMINATED != (int) STRING_TARGET + 1 || + if((int) STRING_LASTZEROTERMINATED != (int) STRING_DOH + 1 || (int) STRING_LAST != (int) STRING_COPYPOSTFIELDS + 1) curl_mfprintf(stderr, "*** WARNING: curl_easy_setopt_ccsid() should be reworked ***\n"); @@ -1147,6 +1147,7 @@ curl_easy_setopt_ccsid(CURL * curl, CURLoption tag, ...) case CURLOPT_CUSTOMREQUEST: case CURLOPT_DEFAULT_PROTOCOL: case CURLOPT_DNS_SERVERS: + case CURLOPT_DOH_URL: case CURLOPT_EGDSOCKET: case CURLOPT_ENCODING: case CURLOPT_FTPPORT: @@ -1424,3 +1425,46 @@ curl_mime_data_ccsid(curl_mimepart *part, free(s); return result; } + +CURLUcode +curl_url_get_ccsid(CURLU *handle, CURLUPart what, char **part, + unsigned int flags, unsigned int ccsid) + +{ + char *s = (char *)NULL; + CURLUcode result; + + if(!part) + return CURLUE_BAD_PARTPOINTER; + + *part = (char *)NULL; + result = curl_url_get(handle, what, &s, flags); + if(result == CURLUE_OK) { + if(s) { + *part = dynconvert(ccsid, s, -1, ccsid, ASCII_CCSID); + if(!*part) + result = CURLUE_OUT_OF_MEMORY; + } + if(s) + free(s); + return result; +} + +CURLUcode +curl_url_set_ccsid(CURLU *handle, CURLUPart what, const char *part, + unsigned int flags, unsigned int ccsid) + +{ + char *s = (char *)NULL; + CURLUcode result; + + if(part) { + s = dynconvert(ASCII_CCSID, part, -1, ccsid); + if(!s) + return CURLUE_OUT_OF_MEMORY; + } + result = curl_url_set(handle, what, s, flags); + if(s) + free(s); + return result; +} diff --git a/packages/OS400/ccsidcurl.h b/packages/OS400/ccsidcurl.h index a65dfbc2a..895db7002 100644 --- a/packages/OS400/ccsidcurl.h +++ b/packages/OS400/ccsidcurl.h @@ -85,5 +85,11 @@ CURL_EXTERN CURLcode curl_mime_filedata_ccsid(curl_mimepart *part, CURL_EXTERN CURLcode curl_mime_data_ccsid(curl_mimepart *part, const char *data, size_t datasize, unsigned int ccsid); +CURL_EXTERN CURLUcode curl_url_get_ccsid(CURLU *handle, CURLUPart what, + char **part, unsigned int flags, + unsigned int ccsid); +CURL_EXTERN CURLUcode curl_url_set_ccsid(CURLU *handle, CURLUPart what, + const char *part, unsigned int flags, + unsigned int ccsid); #endif diff --git a/packages/OS400/curl.inc.in b/packages/OS400/curl.inc.in index 2cf7899bd..5dd052848 100644 --- a/packages/OS400/curl.inc.in +++ b/packages/OS400/curl.inc.in @@ -369,6 +369,27 @@ d CURL_WAIT_POLLOUT... d c X'0004' * + d CURLU_DEFAULT_PORT... + d c X'00000001' + d CURLU_NO_DEFAULT_PORT... + d c X'00000002' + d CURLU_DEFAULT_SCHEME... + d c X'00000004' + d CURLU_NON_SUPPORT_SCHEME... + d c X'00000008' + d CURLU_PATH_AS_IS... + d c X'00000010' + d CURLU_DISALLOW_USER... + d c X'00000020' + d CURLU_URLDECODE... + d c X'00000040' + d CURLU_URLENCODE... + d c X'00000080' + d CURLU_APPENDQUERY... + d c X'00000100' + d CURLU_GUESS_SCHEME... + d c X'00000200' + * ************************************************************************** * Types ************************************************************************** @@ -480,7 +501,7 @@ d c 49 d CURLE_OBSOLETE50... d c 50 - d CURLE_PEER_FAILED_VERIFICATION... + d CURLE_OBSOLETE51... d c 51 d CURLE_GOT_NOTHING... d c 52 @@ -498,7 +519,7 @@ d c 58 d CURLE_SSL_CIPHER... d c 59 - d CURLE_SSL_CACERT... + d CURLE_PEER_FAILED_VERIFICATION... d c 60 d CURLE_BAD_CONTENT_ENCODING... d c 61 @@ -565,6 +586,9 @@ d CURLE_HTTP2_STREAM... d c 92 * + d CURLE_SSL_CACERT... + d c 60 + * /if not defined(CURL_NO_OLDIES) d CURLE_URL_MALFORMAT_USER... d c 4 @@ -727,6 +751,12 @@ d CURLSSLOPT_NO_REVOKE... d c X'0002' * + d CURL_HET_DEFAULT... + d c 200 + * + d CURL_UPKEEP_INTERVAL_DEFAULT... + d c 60000 + * /if not defined(CURL_NO_OLDIES) d curl_ftpssl s like(curl_usessl) d based(######ptr######) @@ -1348,6 +1378,12 @@ d c 10277 d CURLOPT_DISALLOW_USERNAME_IN_URL... d c 00278 + d CURLOPT_DOH_URL... + d c 10279 + d CURLOPT_UPLOAD_BUFFERSIZE... + d c 00280 + d CURLOPT_UPKEEP_INTERVAL_MS... + d c 00281 * /if not defined(CURL_NO_OLDIES) d CURLOPT_FILE c 10001 @@ -1804,7 +1840,64 @@ d c 12 d CURL_RTSPREQ_LAST... d c 13 - + * + d CURLUcode s 10i 0 based(######ptr######) Enum + d CURLUE_OK c 0 + d CURLUE_BAD_HANDLE... + d c 1 + d CURLUE_BAD_PARTPOINTER... + d c 2 + d CURLUE_MALFORMED_INPUT... + d c 3 + d CURLUE_BAD_PORT_NUMBER... + d c 4 + d CURLUE_UNSUPPORTED_SCHEME... + d c 5 + d CURLUE_URLDECODE... + d c 6 + d CURLUE_OUT_OF_MEMORY... + d c 7 + d CURLUE_USER_NOT_ALLOWED... + d c 8 + d CURLUE_UNKNOWN_PART... + d c 9 + d CURLUE_NO_SCHEME... + d c 10 + d CURLUE_NO_USER... + d c 11 + d CURLUE_NO_PASSWORD... + d c 12 + d CURLUE_NO_OPTIONS... + d c 13 + d CURLUE_NO_HOST... + d c 14 + d CURLUE_NO_PORT... + d c 15 + d CURLUE_NO_QUERY... + d c 16 + d CURLUE_NO_FRAGMENT... + d c 17 + * + d CURLUPart s 10i 0 based(######ptr######) Enum + d CURLUPART_URL c 0 + d CURLUPART_SCHEME... + d c 1 + d CURLUPART_USER... + d c 2 + d CURLUPART_PASSWORD... + d c 3 + d CURLUPART_OPTIONS... + d c 4 + d CURLUPART_HOST... + d c 5 + d CURLUPART_PORT... + d c 6 + d CURLUPART_PATH... + d c 7 + d CURLUPART_QUERY... + d c 8 + d CURLUPART_FRAGMENT... + d c 9 * * Renaming CURLMsg to CURL_Msg to avoid case-insensivity name clash. * @@ -2486,6 +2579,29 @@ d sockfd value like(curl_socket_t) d sockp * value void * * + d curl_url pr * extproc('curl_url') CURLU * + * + d curl_url_cleanup... + d pr extproc('curl_url_cleanup') + d handle * value CURLU * + * + d curl_url_dup pr * extproc('curl_url_dup') CURLU * + d in * value CURLU * + * + d curl_url_get pr extproc('curl_url_get') + d like(CURLUcode) + d handle * value CURLU * + d what value like(CURLUPart) + d part * char ** + d flags 10u 0 value + * + d curl_url_set pr extproc('curl_url_set') + d like(CURLUcode) + d handle * value CURLU * + d what value like(CURLUPart) + d part * value options(*string) + d flags 10u 0 value + * ************************************************************************** * CCSID wrapper procedure prototypes ************************************************************************** @@ -2640,6 +2756,24 @@ d like(CURLcode) d part * value curl_mimepart * d filename * value options(*string) + d ccsid 10u 0 value + * + d curl_url_get_ccsid... + d pr extproc('curl_url_get_ccsid') + d like(CURLUcode) + d handle * value CURLU * + d what value like(CURLUPart) + d part * char ** + d flags 10u 0 value + d ccsid 10u 0 value + * + d curl_url_set_ccsid... + d pr extproc('curl_url_set_ccsid') + d like(CURLUcode) + d handle * value CURLU * + d what value like(CURLUPart) + d part * value options(*string) + d flags 10u 0 value d ccsid 10u 0 value * /endif -- cgit v1.2.3