You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Terence Burnard <te...@knet.ca> on 2005/09/28 01:32:56 UTC

[users@httpd] CGI wont read STDIN/POST

Hello,

I have been working for a while trying to get Nagios working with
apache.  This is the .htaccess configuration for the directory that the
cgis are in:

AuthName "Nagios Access"
AuthType Basic
#AuthScriptURI "/htlogin/ldap.php?filter=nagios"
require valid-user
AuthUserFile /home/nagios/nagios.users

Now if you notice, the AuthScriptURI is commented out. This is the the
configuration that works.

If I uncomment AuthScriptURI and comment out AuthUserFile, my browser
locks up on this line in the cgi:
      if(!fread(cgiinput,content_length,1,stdin)){
The cgi can retrieve CONTENT_LENGTH and CONTENT_TYPE from the environment.


Now the question I have is:

What configuration would prevent the cgi script from reading the POST
variables on STDIN when the script works fine with AuthUserFile but
hangs on a 'fread' with AuthScriptURI?

The ldap.php script works properly on GET requests, but as mentioned
hangs on POST.


Thanks,


Terence

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] CGI wont read STDIN/POST

Posted by Terence Burnard <te...@knet.ca>.
> On 9/27/05, Terence Burnard <te...@knet.ca> wrote:
> 
>>Hello,
>>
>>I have been working for a while trying to get Nagios working with
>>apache.  This is the .htaccess configuration for the directory that the
>>cgis are in:
>>
>>AuthName "Nagios Access"
>>AuthType Basic
>>#AuthScriptURI "/htlogin/ldap.php?filter=nagios"
>>require valid-user
>>AuthUserFile /home/nagios/nagios.users
>>
>>Now if you notice, the AuthScriptURI is commented out. This is the the
>>configuration that works.
>>
>>If I uncomment AuthScriptURI and comment out AuthUserFile, my browser
>>locks up on this line in the cgi:
>>      if(!fread(cgiinput,content_length,1,stdin)){
>>The cgi can retrieve CONTENT_LENGTH and CONTENT_TYPE from the environment.
>>
>>
>>Now the question I have is:
>>
>>What configuration would prevent the cgi script from reading the POST
>>variables on STDIN when the script works fine with AuthUserFile but
>>hangs on a 'fread' with AuthScriptURI?
>>
>>The ldap.php script works properly on GET requests, but as mentioned
>>hangs on POST.
> 
> 
> I had to google to figure out what the heck AuthScriptURI is.  It
> belongs to mod_auth_script, which I have never seen before.
> 
> I think your solution is going to be to use a different auth module. 
> There are apache modules that allow you to auth directly against ldap
> rather than going through a php script.
> 
> If I had to guess what was happening, I would say that php is sucking
> up the post contents, because it does not know that it is being called
> as an auth handler and not as a content handler.  I doubt that is
> fixable.
> 
> Joshua.
> 


Thanks for the lead, it helped me fix the problem.  It turned out to be 
mod_auth_script(1.03), all I did was upgrade it to 1.10 and everything 
is working great.

Terence

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] CGI wont read STDIN/POST

Posted by Joshua Slive <js...@gmail.com>.
On 9/27/05, Terence Burnard <te...@knet.ca> wrote:
> Hello,
>
> I have been working for a while trying to get Nagios working with
> apache.  This is the .htaccess configuration for the directory that the
> cgis are in:
>
> AuthName "Nagios Access"
> AuthType Basic
> #AuthScriptURI "/htlogin/ldap.php?filter=nagios"
> require valid-user
> AuthUserFile /home/nagios/nagios.users
>
> Now if you notice, the AuthScriptURI is commented out. This is the the
> configuration that works.
>
> If I uncomment AuthScriptURI and comment out AuthUserFile, my browser
> locks up on this line in the cgi:
>       if(!fread(cgiinput,content_length,1,stdin)){
> The cgi can retrieve CONTENT_LENGTH and CONTENT_TYPE from the environment.
>
>
> Now the question I have is:
>
> What configuration would prevent the cgi script from reading the POST
> variables on STDIN when the script works fine with AuthUserFile but
> hangs on a 'fread' with AuthScriptURI?
>
> The ldap.php script works properly on GET requests, but as mentioned
> hangs on POST.

I had to google to figure out what the heck AuthScriptURI is.  It
belongs to mod_auth_script, which I have never seen before.

I think your solution is going to be to use a different auth module. 
There are apache modules that allow you to auth directly against ldap
rather than going through a php script.

If I had to guess what was happening, I would say that php is sucking
up the post contents, because it does not know that it is being called
as an auth handler and not as a content handler.  I doubt that is
fixable.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org