public void ExtractMainParams() { RequestMethod = Params [FastCGIParam.REQUEST_METHOD].Value; ResourceUri = Params [FastCGIParam.REQUEST_URI].Value; ServerProtocol = Params [FastCGIParam.SERVER_PROTOCOL].Value; // check https string httpsParamName = "HTTP_X_IS_HTTPS"; // first, if HTTP_X_IS_HTTPS is present this means that `X-Is-Https` header was set by the client and this is not good. // remove it if(Params.Contains(httpsParamName)) Params.Remove(httpsParamName); // If HTTPS was set by the reverse proxy then copy it into HTTP_X_IS_HTTPS (prefixed by HTTP_ to be recognized as header by Badr.Net.Http.HttpRequest) string https = Params [FastCGIParam.HTTPS].Value; if (https != null && https.ToLower () == "on") { Params [httpsParamName] = new FastCGIParam (httpsParamName, "on"); } }
public int ParseParams(FastCGIHeader paramsHeader, byte[] buffer, int offset, int endOffset) { if (paramsHeader.ContentLength > 0) { int paramsEndOffset = Math.Min(offset + paramsHeader.ContentLength, endOffset); while (offset < paramsEndOffset) { FastCGIParam param = new FastCGIParam(buffer, offset); Params.Add(param.Name, param); offset = param.ParamEndOffset; } } return offset; }