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

AW: Perform a "HEAD" operation



   I have made the suggested changes and added a "SaveProc" to the
   http_persist_call.

   But the result is the same, I will get a "rc= -1" from the
   http_persist_req() call and not the expected "200".


   Hannes



   =============== Debug file ==================

   ***************Datenanfang*****************

   HTTPAPI Ver 1.24 released 2012-01-23

   OS/400 Ver V5R4M0


   New iconv() objects set, PostRem=819. PostLoc=0. ProtRem=819. ProtLoc=0

   http_persist_open(): entered

   http_long_ParseURL(): entered

   DNS resolver retrans: 2

   DNS resolver retry  : 2

   DNS resolver options: x'00000136'

   DNS default domain: X****X.AT

   DNS server found: 10.1.2.11

   DNS server found: 10.1.2.196

   http_persist_req(HEAD) entered.

   http_long_ParseURL(): entered

   do_oper(HEAD): entered

   There are 0 cookies in the cache

   HEAD /img/logo.png HTTP/1.1

   Host: www.wikipedia.de

   Host: www.wikipedia.de

   User-Agent: http-api/1.24



   recvresp(): entered

   HTTP/1.1 200 OK

   Server: nginx/0.7.67

   Date: Tue, 01 Jul 2014 14:49:48 GMT

   Content-Type: image/png

   Content-Length: 11518

   Last-Modified: Fri, 27 Jul 2012 10:31:32 GMT

   Connection: keep-alive

   Accept-Ranges: bytes



   SetError() #13: HTTP/1.1 200 OK

   recvresp(): end with 200

   recvdoc parms: identity 11518

   header_load_cookies() entered

   header_load_cookies() entered

   recvdoc(): entered

   SetError() #0:

   http_close(): entered

    ***************Datenende*******************



   ==================== Program =======================

   h DftActGrp( *NO )
   ActGrp('TEST')

   h
   BndDir('LIBHTTP/HTTPAPI')

   h Option( *NoDebugIO           :*SrcStmt :*SecLvl
   )



   d Main            pr
   ExtPgm('TEST17R')



   d Main
   pi



    /Copy LIBHTTP/QRPGLESRC,HttpApi_h          Routines for working with
   Headers & Cookies

    /Copy LIBHTTP/QRPGLESRC,IFSio_h            Integrated File System API
   Header File



   d RcvData         pr            10i
   0

   d  peFD                         10i 0
   Value

   d  peData                         *
   Value

   d  peLength                     10i 0
   Value



   d PsDs           sds                  Qualified
   NoOpt

   d  ProcName
   *PROC



   d  msg            s             52a   Inz

   d  URL            s            300a   Inz
   Varying

   d  IFS            s            256a   Inz
   Varying

   d  wwComm         s
   *

   d  fd             s             10i 0
   Inz

   d  rc             s             10i 0
   Inz

   d  ErrNo          s             10i 0
   Inz

   d  header         s          32500a   Inz
   Varying



    /Free



        *INLR =
   *ON;

        http_debug(*ON :'/tmp/httpapi_debug.' +%Trim(psds.ProcName) +
   '.txt');



     // IFS      =
   http_tempfile();

     // fd  = open(IFS: O_WRONLY + O_TRUNC + O_CREAT + O_CCSID:
   511:1208);

        URL =
   'http://www.wikipedia.de/img/logo.png';



        wwComm = http_persist_open( URL
   );



       If  ( wwComm = *NULL );

           http_crash();

       EndIF;



       rc = http_persist_req('HEAD'          // Method Type: 10a

                            : wwComm         // HTTP Comm Session
   Type:*

                            : URL            // URL    Type:
   a

                            : 0              // Upload fd    Type: 10i
   0

                            : *NULL          // Upload Proc  Type: *

                            : *NULL          // Upload Data  Type:
   *

                            : 0              // Upload Data length Type:
   10i 0

                            : 0              // Save fd          Type: 10i
   0

                            : %Paddr( RcvData ) // Save Proc Type: *

                            );



       If  ( rc <> 0 );

           Dsply ( 'rc= ' + %Char( rc ));

           msg = http_error( ErrNo );

           Dsply ( 'ErrNo= ' + %Char( ErrNo ));

           Dsply ( msg );

        EndIF;



        http_persist_close( wwComm );



        Return;



    /End-Free



   p RcvData         b

   d RcvData         pi            10i 0

   d  peFD                         10i 0 Value

   d  peData                         *   Value

   d  peLength                     10i 0 Value

    /Free



        Return peLength;



   /End-Free

   p RcvData         e

   ******************Datenende
   ***********************************************

   ===========================================
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------