Skip to content
This repository was archived by the owner on Nov 20, 2018. It is now read-only.

Add RawTarget property to IHttpRequestFeature (#596) #639

Merged
merged 1 commit into from
May 31, 2016

Conversation

cesarblum
Copy link
Contributor

#596

Let me know if I'm missing anything on this repo.

Once this is merged I need to change:

  • Kestrel
  • WebListener
  • What else? 😁

Do you think RawTarget is a good name for the property? I didn't want to use Uri, Url, or anything like that since this is called "target" in the RFCs.

cc @Tratcher @halter73 @JunTaoLuo @blowdart @davidfowl

@cesarblum cesarblum force-pushed the cesarbs/raw-target-request-feature branch from a585486 to be421c9 Compare May 25, 2016 04:12
@cesarblum cesarblum changed the title Add RawTarget property to IHttpRequestFeature. Add RawTarget property to IHttpRequestFeature (#596) May 25, 2016
@@ -49,6 +49,11 @@ public interface IHttpRequestFeature
string QueryString { get; set; }

/// <summary>
/// The request target as it was sent in the HTTP request.
/// </summary>
string RawTarget { get; set; }
Copy link
Member

Choose a reason for hiding this comment

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

RawTarget? Thats super cryptic

Copy link
Member

Choose a reason for hiding this comment

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

That's ok in this case, it's not like we want people to use it. It's only the emergency backup.

That said, I'm sure @blowdart has some very strong language to put in the comments to the effect of Don't even think about using this, you won't do it right and then you'll get hacked.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's the technically correct term 😛

What about RawRequest? Or RawPath?

Copy link
Member

Choose a reason for hiding this comment

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

Inaccurate.

Copy link
Member

@davidfowl davidfowl May 25, 2016

Choose a reason for hiding this comment

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

I like RawPath, it's "hidden" already on the feature and people aren't stupid, let's not try to protect them.

Copy link
Contributor Author

@cesarblum cesarblum May 25, 2016

Choose a reason for hiding this comment

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

The problem with RawPath is that it's incorrect. We'll include the query with it, not just the path. Plus the feature distinguishes between Path and PathBase, which makes it even more confusing.

Copy link
Member

Choose a reason for hiding this comment

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

Path is wrong, it's Path and Query at a minimum. And for things like Options * it's not Path or Query, it's just *. Target is the right term.

Copy link
Member

@davidfowl davidfowl May 25, 2016

Choose a reason for hiding this comment

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

Call it RawTarget then, we'll be forever explaining this to people 😄 because the spec says so!

Copy link
Member

@Tratcher Tratcher May 25, 2016

Choose a reason for hiding this comment

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

That's what doc comments are for :-). Link to the RFC section.

Besides, most people don't even know what feature interfaces are.

Copy link
Member

Choose a reason for hiding this comment

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

Uh huh 😁

@Tratcher
Copy link
Member

Check Hosting's TestHost.

@cesarblum
Copy link
Contributor Author

So do I get a squirrel?

@cesarblum
Copy link
Contributor Author

I mean, I guess we have to wait for @blowdart's feedback on stating the new property should not be used unless someone really really really knows what they're doing.

@davidfowl
Copy link
Member

:shipit:

@Tratcher
Copy link
Member

You still need more doc comments. An RFC section link and that the filed contains the escaped full path and/or query, or * for Options *.

@@ -102,6 +102,12 @@ string IHttpRequestFeature.QueryString
set { Prop(OwinConstants.RequestQueryString, Utilities.RemoveQuestionMark(value)); }
}

string IHttpRequestFeature.RawTarget
{
get { throw new NotSupportedException(); }
Copy link
Member

Choose a reason for hiding this comment

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

Property Getters shouldn't throw, return string.Empty. Setters can throw.

@davidfowl
Copy link
Member

I mean, I guess we have to wait for @blowdart's feedback on stating the new property should not be used unless someone really really really knows what they're doing.

Leave that for the docs. Let's get the feature in after the changes @Tratcher suggests and worry about that later 😄

@blowdart
Copy link
Member

Let's worry about it now. It's not just a docs issue, it's an xmldocs issue too.

So how about

/// This property is not used internally for routing or authorization decisions. It has not been UrlDecoded and care should be taken in its use.

@cesarblum
Copy link
Contributor Author

Updated.

@blowdart
Copy link
Member

🚢 (I hate that squirrel)

@@ -49,6 +49,15 @@ public interface IHttpRequestFeature
string QueryString { get; set; }

/// <summary>
/// The request target as it was sent in the HTTP request. This property contains the
/// escaped path and full query, as well as other request targets such as * for OPTIONS
Copy link
Member

Choose a reason for hiding this comment

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

"escaped path"

Does this mean that the precent encoded characters in path are unescaped or raw? I think the word escaped implies that the server did some sort of escaping.

Copy link
Contributor Author

@cesarblum cesarblum May 25, 2016

Choose a reason for hiding this comment

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

I was equally confused 😄 But "escaped" here means they are URL-encoded i.e. the %s will be there.

Copy link
Member

Choose a reason for hiding this comment

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

Just use "raw" then

@cesarblum
Copy link
Contributor Author

Turns out there was a bit more that I needed to change.

@blowdart I've moved your warning on the property's usage to <remarks>. Is that alright?

@blowdart
Copy link
Member

Yup :)

@Tratcher
Copy link
Member

:shipit:

@cesarblum cesarblum force-pushed the cesarbs/raw-target-request-feature branch from a91444e to d778521 Compare May 26, 2016 22:20
@halter73
Copy link
Member

:shipit:

@cesarblum cesarblum force-pushed the cesarbs/raw-target-request-feature branch from d778521 to 8a804a9 Compare May 27, 2016 21:07
@cesarblum cesarblum force-pushed the cesarbs/raw-target-request-feature branch from 8a804a9 to 8212694 Compare May 27, 2016 23:54
@cesarblum cesarblum merged commit 8212694 into dev May 31, 2016
@cesarblum cesarblum deleted the cesarbs/raw-target-request-feature branch May 31, 2016 23:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants