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

Respond to bad requests with a 400 status code #2671

Merged
merged 2 commits into from
Nov 8, 2013
Merged

Respond to bad requests with a 400 status code #2671

merged 2 commits into from
Nov 8, 2013

Conversation

halter73
Copy link
Member

  • Previously bad requests caused PersistentConnection.ProcessRequest to throw
    resulting in a 500
  • Respond with a 403 status code when the client changes identity
  • No longer throwing on bad requests reduces extraneous error logging
  • Traces logged by TaskAsynceHelper.Catch are now warnings making it easier to filter out those traces
    Swallow some exceptions on the server so they don't get logged #2450

@davidfowl
Copy link
Member

Looks good. :shipit: . We just need to verify that all of the fallback works as it should (and it should).

string tokenUserName = tokens.Length > 1 ? tokens[1] : String.Empty;
string userName = GetUserIdentity(context);

if (!String.Equals(tokenUserName, userName, StringComparison.OrdinalIgnoreCase))
{
throw new InvalidOperationException(String.Format(CultureInfo.CurrentCulture, Resources.Error_UnrecognizedUserIdentity));
message = String.Format(CultureInfo.CurrentCulture, Resources.Error_UnrecognizedUserIdentity);
Copy link
Contributor

Choose a reason for hiding this comment

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

Hitting this code path will now cause the client to stop due to the 403. I'm ok with this behavior but it is a behavior change nonetheless. This ok? @davidfowl @DamianEdwards

Copy link
Member

Choose a reason for hiding this comment

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

Yeah that's perfectly fine. There's no recovering from this error anyway so stopping is the right thing.

@DamianEdwards
Copy link
Member

:shipit:

- Previously bad requests caused PersistentConnection.ProcessRequest to throw
  resulting in a 500
- Respond with a 403 status code when the client changes identity
- No longer throwing on bad requests reduces extraneous error logging

#2450
- This should make it easier to filter out those traces

#2450
@halter73 halter73 merged commit e7ad906 into release Nov 8, 2013
@halter73 halter73 deleted the bug-2450 branch December 13, 2013 20:41
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.

4 participants