ws.write(0);
setEnvironment(stream, ws, req);
InputStream in = req.getInputStream();
TempBuffer tempBuf = TempBuffer.allocate();
byte []buf = tempBuf.getBuffer();
int len = buf.length;
int sublen;
writeHeader(ws, FCGI_PARAMS, 0);
boolean hasStdin = false;
while ((sublen = in.read(buf, 0, len)) > 0) {
hasStdin = true;
writeHeader(ws, FCGI_STDIN, sublen);
ws.write(buf, 0, sublen);
}
TempBuffer.free(tempBuf);
tempBuf = null;
/*
if (hasStdin)
writeHeader(fcgiSocket, ws, FCGI_STDIN, 0);
*/
writeHeader(ws, FCGI_STDIN, 0);
ws.flush();
FastCGIInputStream is = new FastCGIInputStream(stream);
int ch = parseHeaders(res, is);
if (ch >= 0)
out.write(ch);
TempBuffer tb = TempBuffer.allocate();
byte []buffer = tb.getBuffer();
while ((sublen = is.read(buffer, 0, buffer.length)) > 0) {
out.write(buffer, 0, sublen);
}