[
https://issues.apache.org/jira/browse/ASYNCWEB-11?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12593563#action_12593563
]
Daniel Wirtz commented on ASYNCWEB-11:
--------------------------------------
It works by calling finishDecode() when at least one byte of data is available,
but it does not work the same way, when no content (only the header) is
available. Instead of returning nothing, the decoder should return an empty
http response with the appropriate headers set.
> HttpResponseDecoder not finishing decode process before some content is
> received
> --------------------------------------------------------------------------------
>
> Key: ASYNCWEB-11
> URL: https://issues.apache.org/jira/browse/ASYNCWEB-11
> Project: Asyncweb
> Issue Type: Bug
> Components: Common
> Environment: FCGIHttpService
> Reporter: Daniel Wirtz
> Priority: Trivial
>
> Basically I transform FastCGI responses into HTTP responses using the
> HttpResponseDecoder in conjunction with AsyncFCGI (0.9.0 CVS):
> public void onReceive(FCGIRequest request, FCGIResponse response) {
> HttpServiceContext context = (HttpServiceContext) request.getAttachment();
> HttpResponseDecoder decoder = new HttpResponseDecoder();
> DecoderOutput output = new DecoderOutput(context); // Custom output
> implementing a write() method
> decoder.decode(null, IoBuffer.wrap("HTTP/1.1 200 OK\r\n".getBytes()),
> output);
> decoder.decode(null, response.getStdout(), output);
> decoder.finishDecode(null, output); // HttpResonse is produced and sent to
> DecoderOutput
> decoder.dispose(null);
> }
> This works fine so far, but when an empty response (in this case produced by
> PHP is received), no write() to DecoderOutput occurs even though the
> finishDecode() method was called. The response looks like this:
> Content-Type: text/html\r\n
> \r\n
> As a result of this, I'm not able to use the decoder in this particular case
> to produce HttpResponse objects for further asyncweb processing originating
> from a FastCGI backend. The connection just times out because no response is
> produced. However, if Content-Length: 0 is provided, it works fine (but PHP
> does not produce this header by default, it is added by the webserver, in
> this case this would be asyncweb).
> The reason that I don't want to preparse the output by myself is that this
> results in unneccessary double checking (converting the IoBuffer to something
> parseable and checking headers twice).
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.