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

Re: [Ftpapi] Question regarding adding addtional headers with html_xproc



It wasn't my original question - but as it happens I may have a use for this.  Hadn't thought about using it that way.

Thanks Scott.



> On Jul 20, 2020, at 4:59 PM, Scott Klement <sk@xxxxxxxxxxxxxxxx> wrote:
> 
> On 7/20/2020 3:14 PM, Jon Paris wrote:
>> Perhaps he is looking for something similar to the XML-INTO %Handler comms area Scott?
> 
> Hi Jon,
> 
> If you're looking for something like the 'comm area' of the XML-INTO handler, you can use the userData option on http_xproc. The example that follows is with 32-byte bearer token, hopefully it can be adapted to different types of tokens as needed.
> 
> 
> **free
> 
> ctl-opt dftactgrp(*no) bnddir('HTTPAPI');
> 
> /copy httpapi_h
> 
> dcl-ds TokenData qualified;
>   Type  varchar(20);
>   Value varchar(256);
> end-ds;
> 
> dcl-s result varchar(10000);
> 
> 
> http_xproc( HTTP_POINT_ADDL_HEADER
>           : %paddr(Add_Token_Routine)
>           : %addr(TokenData) );
> 
> TokenData.Type  = 'Bearer';
> TokenData.Value = '6996708b55829823c069b9ea2d708bf7';
> 
> http_debug(*on: '/tmp/token_debug_log.txt');
> 
> result = http_string( 'GET': 'http://www.scottklement.com' );
> 
> *inlr = *on;
> 
> dcl-proc Add_Token_Routine;
> 
>   dcl-pi *n;
>      NewHeaders varchar(32767);
>      Token      likeds(TokenData);
>   end-pi;
> 
>   dcl-c CRLF const(x'0d25');
> 
>   NewHeaders = 'Authorization: '
>              + Token.type + ' ' + Token.value + CRLF;
> 
> end-proc;
> 
> -- 
> _______________________________________________
> Ftpapi mailing list
> Ftpapi@xxxxxxxxxxxxxxxxxxxxxx
> http://scottklement.com/mailman/listinfo/ftpapi

-- 
_______________________________________________
Ftpapi mailing list
Ftpapi@xxxxxxxxxxxxxxxxxxxxxx
http://scottklement.com/mailman/listinfo/ftpapi