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

Specify "upload body of a request" #449

Merged
merged 5 commits into from
Jan 6, 2017
Merged

Specify "upload body of a request" #449

merged 5 commits into from
Jan 6, 2017

Conversation

yutakahirano
Copy link
Member

...and replace "read a request" with it.

Fixing #441.

Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

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

What is the plan for response bodies?


<li><p>When <var>read</var> is fulfilled with a value that matches with neither of the
above patterns, or <var>read</var> is rejected, <a lt=terminated for=fetch>terminate</a> the
ongoing fetch with reason <i>fatal</i>.
Copy link
Member

Choose a reason for hiding this comment

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

This seems a little weird since we don't have a handle on the ongoing fetch and it's not passed to this algorithm. Perhaps it's okay for now though, but we should maybe file a follow up issue to see if we can fix that somehow.

<li>
<p>When <var>read</var> is fulfilled with an object whose <code>done</code>
property is false and whose <code>value</code> property is a
<code>Uint8Array</code> object, run these substeps:
Copy link
Member

Choose a reason for hiding this comment

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

Is this the right way of phrasing this, @domenic?

Copy link
Member

Choose a reason for hiding this comment

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

It seems solid for a web spec. ES-style specs could use more formal internal slot inspection but that doesn't seem necessary here.

Copy link
Member

Choose a reason for hiding this comment

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

I guess we can make it formal once IDL formalizes promises.

Copy link
Member

Choose a reason for hiding this comment

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

Oh, I see, I was focusing on the Uint8Array issue, but the "object whose done property is false" part is the imprecise part. In particular, what if obj.done or obj.value is a throwing getter? Let me push a commit to fix.

Copy link
Member

Choose a reason for hiding this comment

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

Nevermind, these objects are created by the streams, and can never have getters or non-booleans or similar. The only "bad" thing that can happen is value not being a Uint8Array, and we have that covered.

@@ -215,16 +215,6 @@ for <var>request</var>.

<hr>
Copy link
Member

Choose a reason for hiding this comment

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

This can also be removed it seems if we move this algorithm.

Copy link
Member Author

Choose a reason for hiding this comment

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

And can we remove two references to this item in Main Fetch section?

Copy link
Member

Choose a reason for hiding this comment

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

References to this <hr>? I'm not sure I understand.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, sorry, I misunderstood.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

@@ -1121,6 +1109,46 @@ or "<code>worker</code>".
<li><p>Return <var>newRequest</var>.
</ol>

<p>To <dfn export for=request id=concept-request-upload-body>upload body</dfn> of a
Copy link
Member

Choose a reason for hiding this comment

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

Nit: I would phrase this as "upload a body for a request".

Copy link
Member

Choose a reason for hiding this comment

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

I think we should avoid "upload" entirely. The protocol specification doesn't use it either and it doesn't make much sense for non-HTTP URLs (although I guess those will fail to function anyway).

Copy link
Member Author

@yutakahirano yutakahirano Jan 6, 2017

Choose a reason for hiding this comment

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

Then which term should we use? In other words, what are the "primitive" operations on the network layer which I can use?

Copy link
Member

Choose a reason for hiding this comment

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

What was wrong with read?

Copy link
Member

Choose a reason for hiding this comment

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

If read cannot be used, "transmit" would be okay.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

@annevk
Copy link
Member

annevk commented Jan 6, 2017

@yutakahirano I'd appreciate if you could mention what was wrong with "read". And also what the plan is for responses.

@yutakahirano
Copy link
Member Author

@yutakahirano I'd appreciate if you could mention what was wrong with "read". And also what the plan is for responses.

For me, send / upload / transmit are easier to understand the intention. When you read something, you can do anything (including nothing) to it and so I feel it vague.

For responses, isn't the 15th step of HTTP-network fetch enough?

@annevk
Copy link
Member

annevk commented Jan 6, 2017

@yutakahirano that only covers a response coming from the network. What about a response coming from a service worker?

@yutakahirano
Copy link
Member Author

@yutakahirano that only covers a response coming from the network. What about a response coming from a service worker?

It's written in https://w3c.github.io/ServiceWorker/#dom-fetchevent-respondwith.

@annevk
Copy link
Member

annevk commented Jan 6, 2017

Interesting. I think a lot of that would be more logically placed in Fetch. Otherwise we have to repeat all that text for foreign fetch service workers. Would you agree with that?

@yutakahirano
Copy link
Member Author

Interesting. I think a lot of that would be more logically placed in Fetch. Otherwise we have to repeat all that text for foreign fetch service workers. Would you agree with that?

Yes, but as in a comment, I hope we can simplify the description with pipeTo and transform streams someday (IIUC transform stream is not ready). Is it OK to move the algorithm at that time?

@annevk
Copy link
Member

annevk commented Jan 6, 2017

Maybe, it depends on whether that or foreign fetch happens earlier. Can you open a new tracking issue against Fetch for it? (I'm fine not doing it right away.)

@annevk
Copy link
Member

annevk commented Jan 6, 2017

I'll also let @domenic have another look before landing this.

@yutakahirano
Copy link
Member Author

Can you open a new tracking issue against Fetch for it? (I'm fine not doing it right away.

Done: #450

@annevk annevk merged commit 6beb38d into master Jan 6, 2017
@annevk annevk deleted the read-request branch January 6, 2017 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants