Closed Bug 1122194 Opened 10 years ago Closed 10 years ago

Follow method validation rules in Request constructor

Categories

(Core :: DOM: Core & HTML, defect)

33 Branch
x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla38

People

(Reporter: nsm, Assigned: nsm)

References

Details

Attachments

(1 file)

Step 14 of the request constructor is not implemented properly currently.
Assignee: nobody → nsm.nikhil
Status: NEW → ASSIGNED
Comment on attachment 8549831 [details] [diff] [review]
Follow method validation rules when constructing Request

Review of attachment 8549831 [details] [diff] [review]:
-----------------------------------------------------------------

The normalization of just some headers confused me, but that is indeed what the spec says.  LGTM.  Thanks!

Over to Andrea as DOM peer.
Attachment #8549831 - Flags: review?(bkelly)
Attachment #8549831 - Flags: review?(amarchesini)
Attachment #8549831 - Flags: review+
Comment on attachment 8549831 [details] [diff] [review]
Follow method validation rules when constructing Request

Review of attachment 8549831 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/fetch/Request.cpp
@@ +155,2 @@
>    if (aInit.mMethod.WasPassed()) {
>      nsCString method = aInit.mMethod.Value();

nsAutoCString

@@ +157,4 @@
>  
> +    // Step 14.1. Disallow forbidden methods, and anything that is not a HTTP
> +    // token, since HTTP states that Method may be any of the defined values or
> +    // a token (extension method).

I still prefer the lowerCase approach. These are several string operations and for each one you ask to convert the method to lower case.
Can you do something similar to:

nsAutoString lowerCaseMethod;
nsContentUtils::ASCIIToLower(aInit.mMethod.Value(), lowerCaseMethod);
Attachment #8549831 - Flags: review?(amarchesini) → review+
I Used an uppercase approach instead since normalization is uppercasing.
https://hg.mozilla.org/mozilla-central/rev/c2c0d8f26b97
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla38
Comment on attachment 8549831 [details] [diff] [review]
Follow method validation rules when constructing Request

Review of attachment 8549831 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/fetch/Request.cpp
@@ +160,5 @@
> +    // a token (extension method).
> +    if (method.LowerCaseEqualsLiteral("connect") ||
> +        method.LowerCaseEqualsLiteral("trace") ||
> +        method.LowerCaseEqualsLiteral("track") ||
> +        !NS_IsValidHTTPToken(method)) {

Missing #include "nsNetUtil.h"
Depends on: 1125588
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: