Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removed argument requestId from loopbackserver.cs #58678

Merged
merged 21 commits into from
Nov 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
824b4d3
removed argument requestId
AnudeepGunukula Sep 4, 2021
05afbeb
Merge branch 'dotnet:main' into main
AnudeepGunukula Sep 6, 2021
2b435f3
removed requestId in LoopbackServer.cs
AnudeepGunukula Sep 7, 2021
a714e82
Merge branch 'dotnet:main' into main
AnudeepGunukula Sep 7, 2021
ff6c249
Update src/libraries/Common/tests/System/Net/Http/GenericLoopbackServ…
AnudeepGunukula Sep 7, 2021
dd33a08
Merge branch 'dotnet:main' into main
AnudeepGunukula Sep 8, 2021
c75dfdb
commit after changes
AnudeepGunukula Sep 15, 2021
8575dee
Merge branch 'dotnet:main' into main
AnudeepGunukula Sep 15, 2021
05173b9
Merge branch 'dotnet:main' into main
AnudeepGunukula Sep 18, 2021
8093748
removed requestId from LoopbackServer
AnudeepGunukula Sep 18, 2021
92fd0fd
removed requestId from Http2 and Http3 LoopbackConnection
AnudeepGunukula Sep 18, 2021
690fb0f
Merge branch 'dotnet:main' into main
AnudeepGunukula Sep 19, 2021
5d3b57d
removed requestId from HttpClientHandlerTest.Http2.cs
AnudeepGunukula Sep 19, 2021
8d3a472
Merge branch 'dotnet:main' into main
AnudeepGunukula Oct 27, 2021
636d0c8
commit after modifying http2 test
AnudeepGunukula Oct 30, 2021
9e1f7cb
created new function in http2
AnudeepGunukula Nov 3, 2021
6a82b71
Update src/libraries/Common/tests/System/Net/Http/Http2LoopbackConnec…
AnudeepGunukula Nov 23, 2021
fd2c887
Update src/libraries/Common/tests/System/Net/Http/Http2LoopbackConnec…
AnudeepGunukula Nov 23, 2021
fefa416
Update src/libraries/Common/tests/System/Net/Http/Http2LoopbackConnec…
AnudeepGunukula Nov 23, 2021
d06ddf0
Update src/libraries/Common/tests/System/Net/Http/Http2LoopbackConnec…
AnudeepGunukula Nov 23, 2021
62bc2bb
removed async keyword
AnudeepGunukula Nov 23, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -124,24 +124,24 @@ public abstract class GenericLoopbackConnection : IDisposable

/// <summary>Sends Response back with provided statusCode, headers and content.
/// If isFinal is false, the body is not completed and you can call SendResponseBodyAsync to send more.</summary>
public abstract Task SendResponseAsync(HttpStatusCode statusCode = HttpStatusCode.OK, IList<HttpHeaderData> headers = null, string content = "", bool isFinal = true, int requestId = 0);
public abstract Task SendResponseAsync(HttpStatusCode statusCode = HttpStatusCode.OK, IList<HttpHeaderData> headers = null, string content = "", bool isFinal = true);
/// <summary>Sends response headers.</summary>
public abstract Task SendResponseHeadersAsync(HttpStatusCode statusCode = HttpStatusCode.OK, IList<HttpHeaderData> headers = null, int requestId = 0);
public abstract Task SendResponseHeadersAsync(HttpStatusCode statusCode = HttpStatusCode.OK, IList<HttpHeaderData> headers = null);
/// <summary>Sends valid but incomplete headers. Once called, there is no way to continue the response past this point.</summary>
public abstract Task SendPartialResponseHeadersAsync(HttpStatusCode statusCode = HttpStatusCode.OK, IList<HttpHeaderData> headers = null, int requestId = 0);
public abstract Task SendPartialResponseHeadersAsync(HttpStatusCode statusCode = HttpStatusCode.OK, IList<HttpHeaderData> headers = null);
/// <summary>Sends Response body after SendResponse was called with isFinal: false.</summary>
public abstract Task SendResponseBodyAsync(byte[] content, bool isFinal = true, int requestId = 0);
public abstract Task SendResponseBodyAsync(byte[] content, bool isFinal = true);

/// <summary>Reads Request, sends Response and closes connection.</summary>
public abstract Task<HttpRequestData> HandleRequestAsync(HttpStatusCode statusCode = HttpStatusCode.OK, IList<HttpHeaderData> headers = null, string content = "");

/// <summary>Waits for the client to signal cancellation.</summary>
public abstract Task WaitForCancellationAsync(bool ignoreIncomingData = true, int requestId = 0);
public abstract Task WaitForCancellationAsync(bool ignoreIncomingData = true);

/// <summary>Helper function to make it easier to convert old test with strings.</summary>
public async Task SendResponseBodyAsync(string content, bool isFinal = true, int requestId = 0)
public async Task SendResponseBodyAsync(string content, bool isFinal = true)
{
await SendResponseBodyAsync(String.IsNullOrEmpty(content) ? new byte[0] : Encoding.ASCII.GetBytes(content), isFinal, requestId);
await SendResponseBodyAsync(String.IsNullOrEmpty(content) ? new byte[0] : Encoding.ASCII.GetBytes(content), isFinal);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -864,7 +864,7 @@ public override Task<Byte[]> ReadRequestBodyAsync()
return ReadBodyAsync();
}

public override async Task SendResponseAsync(HttpStatusCode statusCode = HttpStatusCode.OK, IList<HttpHeaderData> headers = null, string content = "", bool isFinal = true, int requestId = 0)
public async Task SendResponseAsync(HttpStatusCode statusCode = HttpStatusCode.OK, IList<HttpHeaderData> headers = null, string content = "", bool isFinal = true, int requestId = 0)
{
if (headers != null)
{
Expand Down Expand Up @@ -910,25 +910,30 @@ public override async Task SendResponseAsync(HttpStatusCode statusCode = HttpSta
else
{
await SendResponseHeadersAsync(streamId, endStream: false, (HttpStatusCode)statusCode, endHeaders: true, headers: headers);
await SendResponseBodyAsync(content, isFinal: isFinal, requestId: streamId);
await SendResponseBodyAsync(content, isFinal: isFinal);
}
}

public override Task SendResponseHeadersAsync(HttpStatusCode statusCode = HttpStatusCode.OK, IList<HttpHeaderData> headers = null, int requestId = 0)
public override Task SendResponseAsync(HttpStatusCode statusCode = HttpStatusCode.OK, IList<HttpHeaderData> headers = null, string content = "", bool isFinal = true)
{
int streamId = requestId == 0 ? _lastStreamId : requestId;
return SendResponseAsync(statusCode, headers, content, isFinal, requestId: 0);
}

public override Task SendResponseHeadersAsync(HttpStatusCode statusCode = HttpStatusCode.OK, IList<HttpHeaderData> headers = null)
{
int streamId = _lastStreamId;
return SendResponseHeadersAsync(streamId, endStream: false, statusCode, isTrailingHeader: false, endHeaders: true, headers);
}

public override Task SendPartialResponseHeadersAsync(HttpStatusCode statusCode = HttpStatusCode.OK, IList<HttpHeaderData> headers = null, int requestId = 0)
public override Task SendPartialResponseHeadersAsync(HttpStatusCode statusCode = HttpStatusCode.OK, IList<HttpHeaderData> headers = null)
{
int streamId = requestId == 0 ? _lastStreamId : requestId;
int streamId = _lastStreamId;
return SendResponseHeadersAsync(streamId, endStream: false, statusCode, isTrailingHeader: false, endHeaders: false, headers);
}

public override Task SendResponseBodyAsync(byte[] content, bool isFinal = true, int requestId = 0)
public override Task SendResponseBodyAsync(byte[] content, bool isFinal = true)
{
int streamId = requestId == 0 ? _lastStreamId : requestId;
int streamId = _lastStreamId;
return SendResponseBodyAsync(streamId, content, isFinal);
}

Expand All @@ -955,9 +960,9 @@ public override async Task<HttpRequestData> HandleRequestAsync(HttpStatusCode st
return requestData;
}

public override async Task WaitForCancellationAsync(bool ignoreIncomingData = true, int requestId = 0)
public override async Task WaitForCancellationAsync(bool ignoreIncomingData = true)
{
int streamId = requestId == 0 ? _lastStreamId : requestId;
int streamId = _lastStreamId;

Frame frame;
do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,24 +200,24 @@ public override async Task<HttpRequestData> ReadRequestDataAsync(bool readBody =
return await stream.ReadRequestDataAsync(readBody).ConfigureAwait(false);
}

public override Task SendResponseAsync(HttpStatusCode statusCode = HttpStatusCode.OK, IList<HttpHeaderData> headers = null, string content = "", bool isFinal = true, int requestId = 0)
public override Task SendResponseAsync(HttpStatusCode statusCode = HttpStatusCode.OK, IList<HttpHeaderData> headers = null, string content = "", bool isFinal = true)
{
return GetOpenRequest(requestId).SendResponseAsync(statusCode, headers, content, isFinal);
return GetOpenRequest().SendResponseAsync(statusCode, headers, content, isFinal);
}

public override Task SendResponseBodyAsync(byte[] content, bool isFinal = true, int requestId = 0)
public override Task SendResponseBodyAsync(byte[] content, bool isFinal = true)
{
return GetOpenRequest(requestId).SendResponseBodyAsync(content, isFinal);
return GetOpenRequest().SendResponseBodyAsync(content, isFinal);
}

public override Task SendResponseHeadersAsync(HttpStatusCode statusCode = HttpStatusCode.OK, IList<HttpHeaderData> headers = null, int requestId = 0)
public override Task SendResponseHeadersAsync(HttpStatusCode statusCode = HttpStatusCode.OK, IList<HttpHeaderData> headers = null)
{
return GetOpenRequest(requestId).SendResponseHeadersAsync(statusCode, headers);
return GetOpenRequest().SendResponseHeadersAsync(statusCode, headers);
}

public override Task SendPartialResponseHeadersAsync(HttpStatusCode statusCode = HttpStatusCode.OK, IList<HttpHeaderData> headers = null, int requestId = 0)
public override Task SendPartialResponseHeadersAsync(HttpStatusCode statusCode = HttpStatusCode.OK, IList<HttpHeaderData> headers = null)
{
return GetOpenRequest(requestId).SendPartialResponseHeadersAsync(statusCode, headers);
return GetOpenRequest().SendPartialResponseHeadersAsync(statusCode, headers);
}

public override async Task<HttpRequestData> HandleRequestAsync(HttpStatusCode statusCode = HttpStatusCode.OK, IList<HttpHeaderData> headers = null, string content = "")
Expand Down Expand Up @@ -301,9 +301,9 @@ public async Task WaitForClientDisconnectAsync(bool refuseNewRequests = true)
await CloseAsync(H3_NO_ERROR);
}

public override async Task WaitForCancellationAsync(bool ignoreIncomingData = true, int requestId = 0)
public override async Task WaitForCancellationAsync(bool ignoreIncomingData = true)
{
await GetOpenRequest(requestId).WaitForCancellationAsync(ignoreIncomingData).ConfigureAwait(false);
await GetOpenRequest().WaitForCancellationAsync(ignoreIncomingData).ConfigureAwait(false);
}
}

Expand Down
12 changes: 6 additions & 6 deletions src/libraries/Common/tests/System/Net/Http/LoopbackServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,7 @@ public void CompleteRequestProcessing()
_bodyRead = false;
}

public override async Task SendResponseAsync(HttpStatusCode statusCode = HttpStatusCode.OK, IList<HttpHeaderData> headers = null, string content = "", bool isFinal = true, int requestId = 0)
public override async Task SendResponseAsync(HttpStatusCode statusCode = HttpStatusCode.OK, IList<HttpHeaderData> headers = null, string content = "", bool isFinal = true)
{
MemoryStream headerBytes = new MemoryStream();
int contentLength = -1;
Expand Down Expand Up @@ -933,7 +933,7 @@ public override async Task SendResponseAsync(HttpStatusCode statusCode = HttpSta

if (content != null)
{
await SendResponseBodyAsync(content, isFinal: isFinal, requestId: requestId).ConfigureAwait(false);
await SendResponseBodyAsync(content, isFinal: isFinal).ConfigureAwait(false);
}
}

Expand All @@ -955,13 +955,13 @@ private string GetResponseHeaderString(HttpStatusCode statusCode, IList<HttpHead
return headerString;
}

public override async Task SendResponseHeadersAsync(HttpStatusCode statusCode = HttpStatusCode.OK, IList<HttpHeaderData> headers = null, int requestId = 0)
public override async Task SendResponseHeadersAsync(HttpStatusCode statusCode = HttpStatusCode.OK, IList<HttpHeaderData> headers = null)
{
string headerString = GetResponseHeaderString(statusCode, headers);
await SendResponseAsync(headerString).ConfigureAwait(false);
}

public override async Task SendPartialResponseHeadersAsync(HttpStatusCode statusCode = HttpStatusCode.OK, IList<HttpHeaderData> headers = null, int requestId = 0)
public override async Task SendPartialResponseHeadersAsync(HttpStatusCode statusCode = HttpStatusCode.OK, IList<HttpHeaderData> headers = null)
{
string headerString = GetResponseHeaderString(statusCode, headers);

Expand All @@ -971,7 +971,7 @@ public override async Task SendPartialResponseHeadersAsync(HttpStatusCode status
await SendResponseAsync(headerString).ConfigureAwait(false);
}

public override async Task SendResponseBodyAsync(byte[] content, bool isFinal = true, int requestId = 0)
public override async Task SendResponseBodyAsync(byte[] content, bool isFinal = true)
{
await SendResponseAsync(content).ConfigureAwait(false);
}
Expand Down Expand Up @@ -1047,7 +1047,7 @@ public override async Task<HttpRequestData> HandleRequestAsync(HttpStatusCode st
return requestData;
}

public override async Task WaitForCancellationAsync(bool ignoreIncomingData = true, int requestId = 0)
public override async Task WaitForCancellationAsync(bool ignoreIncomingData = true)
{
var buffer = new byte[1024];
while (true)
Expand Down