public void ForwardedForHeader_SetsRemoteAddr([Values("192.168.0.1", "10.70.30.54,192.168.0.1")] string value) { var module = new NlbCompatModule(); var httpContext = this.CreateHttpContextBase(); httpContext.Request.ServerVariables.Add("HTTP_X_FORWARDED_FOR", value); module.ProcessBeginRequest(httpContext); Assert.That(httpContext.Request.ServerVariables["REMOTE_ADDR"], Is.EqualTo("192.168.0.1")); }
public void ForwardedProtoHeaderDefineHttps_RequestIsHttps() { var module = new NlbCompatModule(); var httpContext = this.CreateHttpContextBase(); httpContext.Request.ServerVariables.Add("HTTP_X_FORWARDED_PROTO", "https"); module.ProcessBeginRequest(httpContext); Assert.That(httpContext.Request.ServerVariables["SERVER_PORT"], Is.EqualTo("443")); Assert.That(httpContext.Request.ServerVariables["SERVER_PORT_SECURE"], Is.EqualTo("1")); Assert.That(httpContext.Request.ServerVariables["HTTPS"], Is.EqualTo("on")); }
public void module_OnBeginRequest_NullContext_ThrowArgumentNullException() { var module = new NlbCompatModule(); Assert.That(() => module.ProcessBeginRequest(null), Throws.TypeOf <ArgumentNullException>()); }