Improved handling of BEGIN_REQUEST flags.

This commit is contained in:
Simone Bordet 2014-01-14 10:36:11 +01:00
parent 63e8a462d4
commit 05f4367790
4 changed files with 9 additions and 7 deletions

View File

@ -86,6 +86,7 @@ public class ClientGenerator extends Generator
// Generate the FCGI_BEGIN_REQUEST frame
beginRequestBuffer.putInt(0x01_01_00_00 + request);
beginRequestBuffer.putInt(0x00_08_00_00);
// Hardcode RESPONDER role and KEEP_ALIVE flag
beginRequestBuffer.putLong(0x00_01_01_00_00_00_00_00L);
beginRequestBuffer.flip();

View File

@ -76,7 +76,7 @@ public class BeginRequestContentParser extends ContentParser
if (buffer.remaining() >= 5)
{
buffer.position(buffer.position() + 5);
onStart(getRequest(), role);
onStart();
reset();
return true;
}
@ -92,7 +92,7 @@ public class BeginRequestContentParser extends ContentParser
buffer.get();
if (++cursor == 5)
{
onStart(getRequest(), role);
onStart();
reset();
return true;
}
@ -107,9 +107,9 @@ public class BeginRequestContentParser extends ContentParser
return false;
}
private void onStart(int request, int role)
private void onStart()
{
listener.onStart(request, FCGI.Role.from(role));
listener.onStart(getRequest(), FCGI.Role.from(role), flags);
}
private void reset()

View File

@ -41,12 +41,12 @@ public class ServerParser extends Parser
public interface Listener extends Parser.Listener
{
public void onStart(int request, FCGI.Role role);
public void onStart(int request, FCGI.Role role, int flags);
public static class Adapter extends Parser.Listener.Adapter implements Listener
{
@Override
public void onStart(int request, FCGI.Role role)
public void onStart(int request, FCGI.Role role, int flags)
{
}
}

View File

@ -115,8 +115,9 @@ public class ServerFCGIConnection extends AbstractConnection
private class ServerListener implements ServerParser.Listener
{
@Override
public void onStart(int request, FCGI.Role role)
public void onStart(int request, FCGI.Role role, int flags)
{
// TODO: handle flags
HttpChannelOverFCGI channel = new HttpChannelOverFCGI(connector, configuration, getEndPoint(),
new HttpTransportOverFCGI(connector.getByteBufferPool(), flusher, request), new ByteBufferQueuedHttpInput());
HttpChannelOverFCGI existing = channels.putIfAbsent(request, channel);