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

KeepAliveEnabled property implementation for HttpTransportBindingElement #2370

Merged
merged 1 commit into from
Jan 19, 2018
Merged

KeepAliveEnabled property implementation for HttpTransportBindingElement #2370

merged 1 commit into from
Jan 19, 2018

Conversation

BogdanovKirill
Copy link

This property could be used to disable for each HTTP query keep-alive header.

@cloudmustafa
Copy link

👍 LGTM

@zhenlan
Copy link
Member

zhenlan commented Nov 15, 2017

@BogdanovKirill Thanks for your interest in contributing to the project.

As noted in our contributing doc, WCF repo follows the .NET Core Contribution guidelines. For API additions, we would recommend not to submit PRs until the APs have been approved via the API Review Process. Can you please open an issue and follow the said process?

@BogdanovKirill
Copy link
Author

@zhenlan

Ok, thank you for your feedback. #2389

@mconnew
Copy link
Member

mconnew commented Nov 21, 2017

Your implementation looks correct. Would you be able to add a test? You can add a variation to this source file. Add a new method to this interface and this class. In the implementation, get the request headers using the same mechanism as used here and check the Connection header is present with the value "close".

Copy link
Member

@mconnew mconnew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a scenario test as outlined in comment.

property = obj as HttpRequestMessageProperty;
WebHeaderCollection collection = property.Headers;
string connectionValue = collection.Get(Enum.GetName(typeof(HttpRequestHeader), HttpRequestHeader.Connection));
return connectionValue.Equals("Close", StringComparison.OrdinalIgnoreCase);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would nameof(HttpRequestHeader.Connection) work here?

WebHeaderCollection collection = property.Headers;
string connectionValue = collection.Get(Enum.GetName(typeof(HttpRequestHeader), HttpRequestHeader.Connection));
return connectionValue.Equals("Close", StringComparison.OrdinalIgnoreCase);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this return true if the Connection header has the value Close meaning KeepAlive is disabled? Also this method doesn't echo anything back so having Echo in the name doesn't make sense. Can you either rename to IsKeepAliveEnabled and flip the logic or rename to IsKeepAliveDisabled. You are also returning true if there is a missing message property. Instead throw an exception as in this case we can't tell. This will be converted to a FaultException on the client so will signal something has gone wrong with the test scenario.

@BogdanovKirill
Copy link
Author

@mconnew

Thank you very much for help. Need some time, I will fix my mistakes

@BogdanovKirill
Copy link
Author

@mconnew

Could you check new iteration please ?

This property could be used to disable for each HTTP query keep-alive header.
@mconnew
Copy link
Member

mconnew commented Jan 19, 2018

Sorry, Christmas got away from me. The code looks good, I'm going to manually verify this locally rebased against master and if everything looks good, then I'll merge it.

@mconnew
Copy link
Member

mconnew commented Jan 19, 2018

Fixes #2389

@mconnew mconnew merged commit c931e26 into dotnet:master Jan 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants