public Task TestWebServer(TestContext ctx, CancellationToken cancellationToken, [HttpServer(ListenerFlags.SSL)] HttpServer server) { var handler = new HelloWorldHandler("Hello World"); return(TestRunner.RunTraditional(ctx, server, handler, cancellationToken)); }
public static bool CheckInputs(KeyCode kc, char ch) { if (keyCodes.Contains(kc)) { Debug.Log("Press => " + kc); keyCodes.Remove(kc); int index = availableChars.IndexOf(ch); Debug.Log("Index " + index); availableChars.Insert(index, '*'); availableChars.Remove(ch); char temp = offset.ElementAt(index); HelloWorldHandler.GetDeletedOffset(temp); //offset.RemoveAt(index); unavailableChars.Add(ch); return(true); } else { Debug.Log("ERROR -> " + kc); return(false); } }
public async Task Run(TestContext ctx, HttpServer server, CancellationToken cancellationToken) { var handler = HelloWorldHandler.GetSimple(); using (var operation = new TraditionalOperation(server, handler, true)) await operation.Run(ctx, cancellationToken).ConfigureAwait(false); }
public async Task MartinTest2(TestContext ctx, HttpServer server, CancellationToken cancellationToken) { var handler = HelloWorldHandler.GetSimple(); var authHandler = new AuthenticationHandler(AuthenticationType.NTLM, handler); using (var operation = new TraditionalOperation(server, authHandler, true)) await operation.Run(ctx, cancellationToken).ConfigureAwait(false); }
public void TestUnauthenticated() { if (noNetwork) { return; } var handler = new HelloWorldHandler(); unauthRunner.Run(handler, HttpStatusCode.ProxyAuthenticationRequired); }
public void MustClearAuthOnRedirect() { var target = new HelloWorldHandler(); var targetAuth = new AuthenticationHandler(AuthenticationType.ForceNone, target); var redirect = new RedirectHandler(targetAuth, HttpStatusCode.Redirect); var authHandler = new AuthenticationHandler(AuthenticationType.Basic, redirect); Run(authHandler); }
public Task MustClearAuthOnRedirect( TestContext ctx, HttpServer server, CancellationToken cancellationToken) { var target = new HelloWorldHandler("Hello World"); var targetAuth = new AuthenticationHandler(AuthenticationType.ForceNone, target); var redirect = new RedirectHandler(targetAuth, HttpStatusCode.Redirect); var authHandler = new AuthenticationHandler(AuthenticationType.Basic, redirect); return(TestRunner.RunTraditional(ctx, server, authHandler, cancellationToken, SendAsync)); }
public async Task MustClearAuthOnRedirect( TestContext ctx, HttpServer server, CancellationToken cancellationToken) { var target = new HelloWorldHandler("Hello World"); var targetAuth = new AuthenticationHandler(AuthenticationType.ForceNone, target); var redirect = new RedirectHandler(targetAuth, HttpStatusCode.Redirect); var authHandler = new AuthenticationHandler(AuthenticationType.Basic, redirect); using (var operation = new TraditionalOperation(server, authHandler, true)) await operation.Run(ctx, cancellationToken).ConfigureAwait(false); }
public IEnumerable <Handler> GetParameters(TestContext ctx, string filter) { var list = new List <Handler> (); switch (filter) { case "martin": // list.Add (HelloWorldHandler.GetSimple ()); list.Add(new PostHandler("Normal post", HttpContent.HelloWorld)); break; default: list.Add(HelloWorldHandler.GetSimple()); list.AddRange(TestPost.GetParameters(ctx, filter, HttpServerFlags.Proxy)); break; } return(list); }
public HttpInstrumentationHandler(HttpInstrumentationTestRunner parent, bool primary) : base(parent, parent.EffectiveType.ToString()) { readyTcs = new TaskCompletionSource <bool> (); Flags = RequestFlags.KeepAlive; switch (parent.EffectiveType) { case HttpInstrumentationTestType.ReuseConnection: CloseConnection = !primary; break; case HttpInstrumentationTestType.ReuseAfterPartialRead: Content = ConnectionHandler.GetLargeStringContent(2500); OperationFlags = HttpOperationFlags.ClientUsesNewConnection; CloseConnection = !primary; break; case HttpInstrumentationTestType.ReuseConnection2: Content = HttpContent.HelloWorld; CloseConnection = !primary; break; case HttpInstrumentationTestType.CloseIdleConnection: case HttpInstrumentationTestType.CloseCustomConnectionGroup: CloseConnection = false; break; case HttpInstrumentationTestType.NtlmClosesConnection: AuthManager = parent.GetAuthenticationManager(); CloseConnection = true; break; case HttpInstrumentationTestType.NtlmReusesConnection: AuthManager = parent.GetAuthenticationManager(); CloseConnection = false; break; case HttpInstrumentationTestType.ParallelNtlm: case HttpInstrumentationTestType.NtlmInstrumentation: case HttpInstrumentationTestType.NtlmWhileQueued: case HttpInstrumentationTestType.NtlmWhileQueued2: AuthManager = parent.GetAuthenticationManager(); CloseConnection = false; break; case HttpInstrumentationTestType.CustomConnectionGroup: OperationFlags = HttpOperationFlags.DontReuseConnection | HttpOperationFlags.ForceNewConnection; CloseConnection = !primary; break; case HttpInstrumentationTestType.ReuseCustomConnectionGroup: case HttpInstrumentationTestType.AbortResponse: CloseConnection = !primary; break; case HttpInstrumentationTestType.RedirectOnSameConnection: Target = new HelloWorldHandler(ME); CloseConnection = false; break; default: throw new NotSupportedException(parent.EffectiveType.ToString()); } if (CloseConnection) { Flags |= RequestFlags.CloseConnection; } if (AuthManager != null) { Target = new HelloWorldHandler(ME); } if (ExpectedContent == null) { ExpectedContent = Content ?? new StringContent(ME); } }
public HttpRequestHandler (HttpRequestTestRunner parent) : base (parent.EffectiveType.ToString ()) { TestRunner = parent; ME = $"{GetType ().Name}({parent.EffectiveType})"; readyTcs = new TaskCompletionSource<bool> (); Flags = RequestFlags.KeepAlive; switch (parent.EffectiveType) { case HttpRequestTestType.LargeHeader: case HttpRequestTestType.LargeHeader2: case HttpRequestTestType.SendResponseAsBlob: Content = ConnectionHandler.TheQuickBrownFoxContent; CloseConnection = true; break; case HttpRequestTestType.CloseRequestStream: OperationFlags = HttpOperationFlags.AbortAfterClientExits; CloseConnection = false; break; case HttpRequestTestType.ReadTimeout: CloseConnection = false; break; case HttpRequestTestType.RedirectNoLength: Target = new HelloWorldHandler (ME); OperationFlags |= HttpOperationFlags.RedirectOnNewConnection; CloseConnection = false; break; case HttpRequestTestType.PutChunked: case HttpRequestTestType.PutChunkDontCloseRequest: CloseConnection = true; break; case HttpRequestTestType.ServerAbortsRedirect: OperationFlags = HttpOperationFlags.ServerAbortsRedirection; CloseConnection = false; break; case HttpRequestTestType.ServerAbortsPost: OperationFlags = HttpOperationFlags.ServerAbortsRedirection; CloseConnection = true; break; case HttpRequestTestType.PostChunked: OperationFlags = HttpOperationFlags.DontReadRequestBody; CloseConnection = false; break; case HttpRequestTestType.EntityTooBig: case HttpRequestTestType.ClientAbortsPost: OperationFlags = HttpOperationFlags.AbortAfterClientExits | HttpOperationFlags.DontReadRequestBody; CloseConnection = false; break; case HttpRequestTestType.PostContentLength: OperationFlags = HttpOperationFlags.DontReadRequestBody; break; case HttpRequestTestType.SimpleGZip: Content = HttpContent.TheQuickBrownFox; CloseConnection = true; break; case HttpRequestTestType.TestResponseStream: Content = new StringContent ("AAAA"); CloseConnection = true; break; case HttpRequestTestType.LargeChunkRead: Content = HttpContent.TheQuickBrownFoxChunked; ExpectedContent = Content.RemoveTransferEncoding (); CloseConnection = false; break; case HttpRequestTestType.LargeGZipRead: Content = ConnectionHandler.GetLargeChunkedContent (16384); ExpectedContent = Content.RemoveTransferEncoding (); CloseConnection = false; break; case HttpRequestTestType.GZipWithLength: Content = ConnectionHandler.GetLargeStringContent (16384); ExpectedContent = Content; CloseConnection = false; break; case HttpRequestTestType.ResponseStreamCheckLength2: Content = HttpContent.HelloChunked; ExpectedContent = Content.RemoveTransferEncoding (); CloseConnection = false; break; case HttpRequestTestType.ResponseStreamCheckLength: Content = HttpContent.HelloWorld; ExpectedContent = Content; CloseConnection = false; break; case HttpRequestTestType.GetNoLength: ExpectedContent = ConnectionHandler.TheQuickBrownFoxContent; CloseConnection = false; break; case HttpRequestTestType.ImplicitHost: case HttpRequestTestType.CustomHost: case HttpRequestTestType.CustomHostWithPort: case HttpRequestTestType.CustomHostDefaultPort: CloseConnection = false; break; default: throw new NotSupportedException (parent.EffectiveType.ToString ()); } if (CloseConnection) Flags |= RequestFlags.CloseConnection; if (ExpectedContent == null) ExpectedContent = Content ?? new StringContent (ME); }
internal RustlambStack(Construct scope, string id, RustlambProps props) : base(scope, id, props) { var rustlambVpc = new RustlambVpc(this, "RustlambVpc", props); var helloWorld = new HelloWorldHandler(this, "HelloWorld", rustlambVpc, props); }