Closed Bug 1346313 Opened 7 years ago Closed 7 years ago

Fetch: use ", " as value separator rather than ","

Categories

(Core :: DOM: Core & HTML, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: annevk, Assigned: tt)

Details

Attachments

(3 files, 6 obsolete files)

(deleted), patch
Details | Diff | Splinter Review
(deleted), patch
Details | Diff | Splinter Review
(deleted), patch
Details | Diff | Splinter Review
Somewhat related to bug 1330297. The plan is to make Fetch and XMLHttpRequest as close as possible as they can be and not to have weird small divergences.

Standard change: https://github.com/whatwg/fetch/pull/504.

Tests: https://github.com/w3c/web-platform-tests/pull/5115. (There's many other tests around this too that have already landed. I suspect that any code changes would end up affecting more results than just these.)
Priority: -- → P3
I would like to take this bug.
Assignee: nobody → ttung
Simple fix for using ", " rather than just "," to separate combined value. 

I will check the patch again to ensure I don't misunderstand anything.
Update the WPT test to verify behavior.
Attached patch P3: Patch for ensuring reasonalbe HTTP value. (obsolete) (deleted) — Splinter Review
While implementing, I found that we don't ensure there are no any leading or trailing HTTP whitespace for Header's value [1]. 

To achieve this, I check HTTP whitespace on IsReasonableHeaderValue()[2]. But, it is called from lots of places, so I'm not sure whether should we apply this check to those places.

Moreover, I also not sure about whether this patch belongs to this bug.

I'll check above questions next week.

[1] https://fetch.spec.whatwg.org/#dfnReturnLink-0
[2] http://searchfox.org/mozilla-central/source/netwerk/protocol/http/nsHttp.cpp#250-264
Comment on attachment 8855745 [details] [diff] [review]
P3: Patch for ensuring reasonalbe HTTP value.

I found that I should just strip the HTTP whitespace rather than forbid the HTTP whitespace appears. Moreover, I found there is a bug for stripping HTTP whitespace, which is bug 1330297.
Attachment #8855745 - Attachment is obsolete: true
Add a patch to modify mochitest which is affected by the change of combined value.
(In reply to Tom Tung [:tt] from comment #6)
rerun try after applying P3.
try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=351ad60bd64436d1cc4921f47ade07757a13569d
Update for the typo of bug commit message.
Attachment #8856406 - Attachment is obsolete: true
Attachment #8856858 - Attachment description: P3: Update mochitests since we change the format for combined value. 22 hours ago Tom Tung [:tt] 2.55 KB, patch → P3: Update mochitests since we change the format for combined value.
Comment on attachment 8855741 [details] [diff] [review]
P1: Modify Fetch's header handler delimiter to 0x2C 0x20 to align with spec.

Hi Andrea,

This bug is to align the behavior for getting header's combined value. We used to used ',' to separate multiple values, and now we want to use ', ' to separate them. 

github issue: https://github.com/whatwg/fetch/pull/504

This patch is the main change for it. Could you help me to review it? Thanks!
Attachment #8855741 - Flags: review?(amarchesini)
Comment on attachment 8855742 [details] [diff] [review]
P2: Update wpt test to verify our implementation algin with spec.

Patch for updating WPT in github issue to verify the behavior is correct.
Attachment #8855742 - Flags: review?(amarchesini)
Comment on attachment 8856858 [details] [diff] [review]
P3: Update mochitests since we change the format for combined value.

Patch for fixing mochitest since we change the behavior of Header.
Attachment #8856858 - Flags: review?(amarchesini)
Sorry for change patch, I just found there is a useless modification. Update the patch and send review request again... :(
Attachment #8856858 - Attachment is obsolete: true
Attachment #8856858 - Flags: review?(amarchesini)
Attachment #8856922 - Flags: review?(amarchesini)
Attachment #8855741 - Flags: review?(amarchesini) → review+
Comment on attachment 8855742 [details] [diff] [review]
P2: Update wpt test to verify our implementation algin with spec.

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

::: testing/web-platform/tests/fetch/api/headers/headers-combine.html
@@ -25,5 @@
>        test(function() {
>          var headers = new Headers(headerSeqCombine);
>          for (name in expectedDict)
> -          assert_equals(headers.get(name), expectedDict[name],
> -              "name: " + name + " has value: " + expectedDict[name]);

why have you removed the message here?

@@ -51,5 @@
>          for (name in expectedDict) {
>            var value = headers.get(name);
>            headers.append(name,"newSingleValue");
> -          assert_equals(headers.get(name), (value + "," + "newSingleValue"),
> -            "name: " + name + " has value: " + headers.get(name));

and here?
Attachment #8855742 - Flags: review?(amarchesini) → review+
Attachment #8856922 - Flags: review?(amarchesini) → review+
(In reply to Andrea Marchesini [:baku] from comment #14)
Thanks for the reviews!

> ::: testing/web-platform/tests/fetch/api/headers/headers-combine.html
> @@ -25,5 @@
> >        test(function() {
> >          var headers = new Headers(headerSeqCombine);
> >          for (name in expectedDict)
> > -          assert_equals(headers.get(name), expectedDict[name],
> > -              "name: " + name + " has value: " + expectedDict[name]);
> 
> why have you removed the message here?
> 
> @@ -51,5 @@
> >          for (name in expectedDict) {
> >            var value = headers.get(name);
> >            headers.append(name,"newSingleValue");
> > -          assert_equals(headers.get(name), (value + "," + "newSingleValue"),
> > -            "name: " + name + " has value: " + headers.get(name));
> 
> and here?

I didn't have any strong reason for it. I thought it's better to have less differentiate between github and ours, so I applied the commit[2]. I wanted to align it with web-platform-tests in githud[1]. 

I have no much experience about this. Is there any reason that we want to keep it? If so, I will add them back. :)

[1] https://github.com/w3c/web-platform-tests/blob/master/fetch/api/headers/headers-combine.html
[2] https://github.com/w3c/web-platform-tests/commit/c7b0af2363886e40e48b024ccd03eb2b252785c2
Flags: needinfo?(amarchesini)
Update commit message since it got r+
Attachment #8855741 - Attachment is obsolete: true
Attachment #8857299 - Flags: review+
Attachment #8857299 - Attachment description: Bug 1346313 - Part 1: Modify Fetch's header handler delimiter to 0x2C 0x20 to align with spec. r=baku → [Final] Bug 1346313 - Part 1: Modify Fetch's header handler delimiter to 0x2C 0x20 to align with spec. r=baku
Attachment #8857302 - Attachment description: Bug 1346313 - Part 3: Update mochitests since we change the format for combined value. r=baku → [Final] Bug 1346313 - Part 3: Update mochitests since we change the format for combined value. r=baku
> I have no much experience about this. Is there any reason that we want to
> keep it? If so, I will add them back. :)

I was asking because those changes were unrelated with the rest of the patch. Good to me.
Flags: needinfo?(amarchesini)
(In reply to Andrea Marchesini [:baku] from comment #20)
> > I have no much experience about this. Is there any reason that we want to
> > keep it? If so, I will add them back. :)
> 
> I was asking because those changes were unrelated with the rest of the
> patch. Good to me.

Thanks! I see.
Attachment #8857301 - Attachment description: Bug 1346313 - Part 2: Update wpt test to verify our implementation algin with spec. r=baku → [Final] Bug 1346313 - Part 2: Update wpt test to verify our implementation algin with spec. r=baku
Keywords: checkin-needed
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/68fda8a87a98
Part 1: Modify Fetch's header handler delimiter to 0x2C 0x20 to align with spec. r=baku
https://hg.mozilla.org/integration/mozilla-inbound/rev/825e868da1de
Part 2: Update wpt test to verify our implementation align with spec. r=baku
https://hg.mozilla.org/integration/mozilla-inbound/rev/3217a1c33b4c
Part 3: Update mochitests since we change the format for combined value. r=baku
Keywords: checkin-needed
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: