Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2014-04

How to get the "Authorization" header in CGI/FastCGI?

2 messages · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

silvioprog

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!

Silvio Clécio My public projects - github.com/silvioprog
silvioprog
to silvioprog

2014-04-18 17:44 GMT-03:00 silvioprog :

Show quoted text 16 lines
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