[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Post operation with Stream File



   I've got the following RPG program trying to post a stream file to a
   URL on a SSL enabled web site:



   H DFTACTGRP(*NO) ACTGRP(*NEW) BNDDIR('HTTPAPI') BNDDIR('QC2LE')

   D/copy qrpglesrc,httpapi_h
   D/copy qrpglesrc,ifsio_h
   D/copy qrpglesrc,errno_h

   D cmd             pr                  extpgm('QCMDEXC')
   D  command                     200A   const
   D  length                       15P 5 const

   D rc              s             10I 0
   D msg             s             52A
   D stmf            S            256A
   D err             S             10I 0
   D basic           S              1N
   D digest          S              1N
   D realm           S            124A
   D userid          S             50A
   D pass            S             50A

   D URL             s
   256A


   c                   eval      *inlr =
   *on
   c                   callp
   http_debug(*on)


   c                   eval      stmf =
   '/Nordyne/Out/keith_test.txt'
   c                   eval      URL = 'https://norftp.nordyne.com/users'
   +
   c
   '/Kenco/In/keith_test.txt'


   c                   eval
   rc=http_url_post_stmf(%trim(URL):%trim(stmf):
   c
   '/tmp/httptest.html')


   c                   if        rc <>
   1
   c                   callp
   http_error(err)
   c                   if        err <>
   HTTP_NDAUTH
   c                   eval      msg =
   http_error
   c                   dsply
   msg
   c
   return
   c
   endif

    ** This should be the data that Nordyne returns to us:
   c                   callp     cmd('DSPF ''/tmp/httptest.html''': 200)
   c                   return

   C* ------------------------------------------------------------
   C* this is called when the web server requests a userid/passwd
   C* ------------------------------------------------------------
   csr   getpasswd     begsr

   c                   eval      rc = http_getauth(basic: digest: realm)
   c                   if        rc < 0
   c                   eval      msg = HTTP_ERROR
   c                   dsply                   msg
   c                   return
   c                   endif

   c                   eval      userid =
   'Kenco'
   c                   eval      pass =
   'XXYYYZZZ1234'


   c                   if
   Digest
   c                   callp
   http_setauth(HTTP_AUTH_MD5_DIGEST:
   c                                          userid:
   pass)
   c
   else
   c                   callp
   http_setauth(HTTP_AUTH_BASIC:
   c                                          userid:
   pass)
   c
   endif


   c                   eval
   rc=http_url_post_stmf(%trim(URL):%trim(stmf):
   c
   '/tmp/httptest.html')


   c                   if        rc <>
   1
   c                   eval      msg =
   HTTP_ERROR
   c                   dsply
   msg
   c
   return
   c
   endif

   csr                 endsr

    /define ERRNO_LOAD_PROCEDURE
    /copy qrpglesrc,errno_h



   The process runs to a point and stops with a HTTP/1.1 100 Continue
   message and no data is posted to the site. The Debug File is listed
   below:



    ************Beginning of
   data**************
   HTTPAPI Ver 1.18 released
   2007-04-26


   http_getauth():
   entered
   http_setauth():
   entered
   http_url_post_stmf():
   entered
   getting post file
   size...
   opening file to be
   sent...
   opening file to be
   received
   http_persist_open():
   entered
   http_long_ParseURL():
   entered
   ----------------------------------------------------------------------
   ---------------
   Dump of server-side certificate
   information:
   ----------------------------------------------------------------------
   ---------------
   Cert Validation Code =
   0
   -----BEGIN
   CERTIFICATE-----

   MIIEpTCCBA6gAwIBAgIQHSS2fgpkGnrDnQj9M7JjZTANBgkqhkiG9w0BAQUFADCB

   ujEfMB0GA1UEChMWVmVyaVNpZ24gVHJ1c3QgTmV0d29yazEXMBUGA1UECxMOVmVy

   aVNpZ24sIEluYy4xMzAxBgNVBAsTKlZlcmlTaWduIEludGVybmF0aW9uYWwgU2Vy


   aVNpZ24sIEluYy4xMzAxBgNVBAsTKlZlcmlTaWduIEludGVybmF0aW9uYWwgU2Vy
   dmVyIENBIC0gQ2xhc3MgMzFJMEcGA1UECxNAd3d3LnZlcmlzaWduLmNvbS9DUFMg
   SW5jb3JwLmJ5IFJlZi4gTElBQklMSVRZIExURC4oYyk5NyBWZXJpU2lnbjAeFw0w
   NzA0MTkwMDAwMDBaFw0xMDA1MDMyMzU5NTlaMIGpMQswCQYDVQQGEwJVUzERMA8G
   A1UECBMITWlzc291cmkxETAPBgNVBAcUCE8nRmFsbG9uMRAwDgYDVQQKFAdOb3Jk
   eW5lMRAwDgYDVQQLFAdOb3JkeW5lMTMwMQYDVQQLFCpUZXJtcyBvZiB1c2UgYXQg
   d3d3LnZlcmlzaWduLmNvbS9ycGEgKGMpMDUxGzAZBgN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ujkusRyagUaLs9WuPSnfa0Hz1FXSECJYUAHYViVJH/iMKofI3gfJdM=

   -----END
   CERTIFICATE-----

   Serial Number:
   1D:24:B6:7E:0A:64:1A:7A:C3:9D:08:FD:33:B2:63:65

   Common Name:
   norftp.nordyne.com

   Country:
   US

   State/Province:
   Missouri

   Locality:
   O'Fallon

   Org Unit:
   Nordyne

   Org: Terms of use at [1]www.verisign.com/rpa (c)05,
   OU=Nordyne

   Issuer Org: VeriSign Trust
   Network

   Issuer Org Unit: [2]www.verisign.com/CPS Incorp.by Ref. LIABILITY
   LTD.(c)97 VeriSign, OU=VeriSign International Server CA - Class 3,
   OU=VeriSign, Inc.
   Unknown Field:
   03

   Unknown Field:
   20070418190000

   Unknown Field:
   20100503185959

   Unknown Field:
   1.2.840.113549.1.1.5


   Unknown Field: 1.2.840.113549.1.1.5

   Protocol Used: TLS Version 1
   http_persist_post(): entered
   http_long_ParseURL(): entered
   do_post(): entered
   POST /users/Kenco/In/keith_test.txt HTTP/1.1
   Host: norftp.nordyne.com
   User-Agent: http-api/1.18
   Content-Type: text/xml
   Expect: 100-continue
   Content-Length: 0
   Authorization: Basic S2VuY286Tm9EYXlidXQyRGF5


   recvresp(): entered
   HTTP/1.1 100 Continue
   Date: Mon, 07 May 2007 18:24:24 GMT
   Server: Apache/1.3.19 (Unix) PHP/4.0.4pl1



   SetError() #13: HTTP/1.1 100 Continue
   sendraw(): entered
   http_close(): entered
    ************End of Data********************



   Any direction on how to proceed with getting the stream file posted
   would be appreciated.



   Thanks,

   Michael Fulmer
     _________________________________________________________________

   Ahhh...imagining that irresistible "new car" smell?
   Check out [3]new cars at Yahoo! Autos.

References

   1. http://www.verisign.com/rpa
   2. http://www.verisign.com/CPS
   3. http://us.rd.yahoo.com/evt=48245/*http://autos.yahoo.com/new_cars.html;_ylc=X3oDMTE1YW1jcXJ2BF9TAzk3MTA3MDc2BHNlYwNtYWlsdGFncwRzbGsDbmV3LWNhcnM-
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------