]> granicus.if.org Git - curl/commitdiff
OS400: add URL API ccsid wrappers and sync ILE/RPG bindings
authorPatrick Monnerat <patrick@monnerat.net>
Mon, 5 Nov 2018 14:37:23 +0000 (15:37 +0100)
committerPatrick Monnerat <patrick@monnerat.net>
Mon, 5 Nov 2018 14:37:23 +0000 (15:37 +0100)
packages/OS400/README.OS400
packages/OS400/ccsidcurl.c
packages/OS400/ccsidcurl.h
packages/OS400/curl.inc.in

index 2f99103772a128e0f60042d877786798ceea6f39..967c26f687c17a9ec6985165a85dfffafc13526f 100644 (file)
@@ -75,6 +75,7 @@ options:
         CURLOPT_CUSTOMREQUEST
         CURLOPT_DEFAULT_PROTOCOL
         CURLOPT_DNS_SERVERS
+        CURLOPT_DOH_URL
         CURLOPT_EGDSOCKET
         CURLOPT_ENCODING
         CURLOPT_FTPPORT
index af53f67619b10ee5de5eb81a982b52388167425d..b1d3ba845d8956fa731c92a24eedbf83016f4078 100644 (file)
@@ -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;
+}
index a65dfbc2a73c5f87710b498559e7fc1d9c0a67d0..895db7002bb0ba40a235f3dbfc9c145e104cce10 100644 (file)
@@ -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
index 2cf7899bd4ceb6d1631b2594465d28211dd07c05..5dd052848b3db5c48368f001927b96071b5cc3db 100644 (file)
      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
       **************************************************************************
      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
      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
      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
      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######)
      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
      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.
       *
      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
       **************************************************************************
      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