fcgiHeaders.put(FCGI.Headers.DOCUMENT_URI, path);
String query = uri.getRawQuery();
fcgiHeaders.put(FCGI.Headers.QUERY_STRING, query == null ? "" : query);
// FastCGI headers based on HTTP headers
HttpField httpField = headers.remove(HttpHeader.AUTHORIZATION);
if (httpField != null)
fcgiHeaders.put(FCGI.Headers.AUTH_TYPE, httpField.getValue());
httpField = headers.remove(HttpHeader.CONTENT_LENGTH);
fcgiHeaders.put(FCGI.Headers.CONTENT_LENGTH, httpField == null ? "" : httpField.getValue());
httpField = headers.remove(HttpHeader.CONTENT_TYPE);
fcgiHeaders.put(FCGI.Headers.CONTENT_TYPE, httpField == null ? "" : httpField.getValue());
// FastCGI headers that are not based on HTTP headers nor URI
fcgiHeaders.put(FCGI.Headers.REQUEST_METHOD, request.getMethod());
fcgiHeaders.put(FCGI.Headers.SERVER_PROTOCOL, request.getVersion().asString());
fcgiHeaders.put(FCGI.Headers.GATEWAY_INTERFACE, "CGI/1.1");