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

Clarification regarding host behaviour with Content-Length header #105

Open
karthik2804 opened this issue Mar 1, 2024 · 1 comment
Open

Comments

@karthik2804
Copy link

What is the expected/acceptable behavior in the host in terms of automatically setting the Content-Length header on behalf of the guest when the size of the body is known?

@lukewagner
Copy link
Member

Good question, b/c I know this varies widely. The expectation, iiuc, is that the host never sets Content-Length automatically, and thus it's up to the guest (or more likely: the guest's HTTP standard library) to set Content-Length appropriately (e.g., the JS Request constructor would set Content-Length when given a Blob, but not when given a ReadableStream). Supporting this: there's not even really a general way for a WASI host to know the body length up front (given the design of streams and the lack of any sort of length-specified-up-front-stream.

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

No branches or pull requests

2 participants