[ 
https://issues.apache.org/jira/browse/ASYNCWEB-12?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12592394#action_12592394
 ] 

Daniel Wirtz commented on ASYNCWEB-12:
--------------------------------------

No, I parse only the relevant part of the FastCGI message with the 
HttpResponseDecoder. FastCGI (like CGI or mod_xyz) responds besides other 
protocol specific stuff with a set of HTTP headers followed by the body in its 
"stdout"-part:

[cryptic fastcgi heading]
[stdout]
  Content-Type: text/html\r\n
  \r\n
  Hello World!
[/stdout]
[cryptic fastcgi padding]

Except that there is no "HTTP/1.1 200 OK" or similar at the beginning it is a 
complete HTTP response that can be parsed by AsyncWeb - but it will contain the 
Status-Header if the response status has been set by the script (e.g. for 
redirection to a "success" uri or similar).

I also found out that it can be easily fixed from outside AsyncWeb. Cast to 
MutableHttpResponse, check the status header, set the http status, maybe cast 
back, done. However, I still think AsyncWeb should understand the status header.

> AsyncWeb does not understand the Status-Header e.g. sent by FastCGI backends.
> -----------------------------------------------------------------------------
>
>                 Key: ASYNCWEB-12
>                 URL: https://issues.apache.org/jira/browse/ASYNCWEB-12
>             Project: Asyncweb
>          Issue Type: Bug
>          Components: Common
>         Environment: AsyncWeb 0.9.0 CVS used in AsyncFCGI
>            Reporter: Daniel Wirtz
>            Priority: Trivial
>
> When a Status header is provided, AsyncWeb does not transform it into the 
> equivalent HTTPStatus in a HttpResponse.
> A response from a FastCGI backend could look like this:
> Content-Type: text/html\r\n
> Status: 404\r\n
> \r\n
> File not found!
> or
> Content-Type: text/html\r\n
> Status: 404 Some Custom Message\r\n
> \r\n
> File not found!
> in PHP this looks like:
> header("404: Some Custom Message"); or
> header("HTTP/1.1 404 Not Found"); etc.
> -> both produce the Status-Header.
> As far as I know the webserver (this would be asyncweb in this case) converts 
> the status header into the correct http status (e.g. "HTTP/1.1 404 Not 
> Found"). I'm using PHP a lot, the status header is the default behaviour and 
> Apache / Lighttpd handle it this way (even with mod_php instead of FastCGI). 
> I don't want to preparse the response because of unneccessary double checking 
> instead of simply feeding it into a HttpResponseDecoder. However, I think the 
> status header is not part of the http specification but since it's used a 
> lot, it would make sence.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to