[fpc-pascal] How to get the "Authorization" header in CGI/FastCGI?

silvioprog silvioprog at gmail.com
Sat Apr 19 00:11:07 CEST 2014


2014-04-18 17:44 GMT-03:00 silvioprog <silvioprog at gmail.com>:

> Hello,
>
> In PHP it is very easy:
>
> <?php
> $headers = apache_request_headers();
> echo $headers['Authorization'];
> ?>
>
> But I tried in CGI, and the "Authorization" header isn't returned in any
> property, even in environment variables.
>
> Can I get this header using CGI and/or FastCGI?
>
> Thank you!
>

Following this steps:

http://stackoverflow.com/questions/17488656/zend-server-windows-authorization-header-is-not-passed-to-php-script

SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1


With:

procedure TReqTokenAction.Post;
begin
  Write(TheRequest.Authorization);
end;

And it worked fine! :)

-- 
Silvio Clécio
My public projects - github.com/silvioprog
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20140418/b0ea5ee8/attachment.html>


More information about the fpc-pascal mailing list