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

chore(http): Improvements to HTTP messages page #36029

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

bsmth
Copy link
Member

@bsmth bsmth commented Sep 24, 2024

Description

Rewriting some of the content, adding some details about working with HTTP/2 messages, some diagrams.

Motivation

Keeping the content up-to-date

Drafting for now, more details to follow.

@github-actions github-actions bot added Content:WebAPI Web API docs Content:HTTP HTTP docs size/m [PR only] 51-500 LoC changed labels Sep 24, 2024
Copy link
Contributor

github-actions bot commented Sep 24, 2024

Preview URLs

Flaws (6)

Note! 1 document with no flaws that don't need to be listed. 🎉

URL: /en-US/docs/Web/HTTP/Messages
Title: HTTP messages
Flaw count: 6

  • images:
    • External image URL
    • External image URL
    • External image URL
    • External image URL
    • External image URL
  • broken_links:
    • Can't resolve /en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types#multipartform-data
External URLs (2)

URL: /en-US/docs/Web/HTTP/Messages
Title: HTTP messages

(comment last updated: 2024-10-22 15:37:52)

@bsmth bsmth changed the title chore(http) Improvements to HTTP messages page chore(http): Improvements to HTTP messages page Sep 24, 2024
Copy link
Contributor

github-actions bot commented Oct 1, 2024

This pull request has merge conflicts that must be resolved before it can be merged.

@github-actions github-actions bot removed the merge conflicts 🚧 [PR only] label Oct 2, 2024
@bsmth bsmth marked this pull request as ready for review October 2, 2024 08:30
@bsmth bsmth requested review from a team as code owners October 2, 2024 08:30
@bsmth bsmth requested review from sideshowbarker and hamishwillee and removed request for a team October 2, 2024 08:30
@github-actions github-actions bot added the merge conflicts 🚧 [PR only] label Oct 8, 2024
Copy link
Contributor

github-actions bot commented Oct 8, 2024

This pull request has merge conflicts that must be resolved before it can be merged.


## HTTP Requests
![Requests and responses share a common structure in HTTP](https://mdn.github.io/shared-assets/images/diagrams/http/messages/http-message-anatomy.svg)
Copy link
Collaborator

@hamishwillee hamishwillee Oct 11, 2024

Choose a reason for hiding this comment

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

Accept shown in response in image is a request header only.

- : The request target is usually a {{glossary("URL")}} or a path and is characterized by the context of the request.
The format of the request target depends on the HTTP method used and the request context, but is described in more detail in the [Request targets](#request-targets) section below
- `<protocol>`
- : The _HTTP version_, which defines the structure of the remaining message, acting as an indicator of the expected version to use for the response.
Copy link
Collaborator

Choose a reason for hiding this comment

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

List the main options?

The last part of a request is the body.
Not all requests have one: requests with a {{HTTPMethod("GET")}} _[HTTP method](/en-US/docs/Web/HTTP/Methods)_ should only be used to request data and shouldn't contain a body.
1. In _origin form_, the recipient combines an absolute path with the information in the {{HTTPHeader("Host")}} header.
A query string can be appended to the path for additional information (usually in `key=value` format).
Copy link
Collaborator

Choose a reason for hiding this comment

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

Usually or always?

OPTIONS * HTTP/1.1
```

### Request headers
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe, because not all of the headers in requests are usually referred to as request headers .. or are they ...

Suggested change
### Request headers
### Headers in requests


![Example of headers in an HTTP request](https://mdn.github.io/shared-assets/images/diagrams/http/messages/request-headers.svg)

There are many different headers that can appear in requests, but they are categorized as follows:
Copy link
Collaborator

Choose a reason for hiding this comment

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

As per comment above, https://github.com/mdn/content/pull/36029/files#r1796474253 it might be best to be clear about our headers in the request

Suggested change
There are many different headers that can appear in requests, but they are categorized as follows:
Some headers in a request message are explicitly referred to as request headers. Others can be sent in both requests and responses, or might have a more fine-grained categorization:

Copy link
Collaborator

Choose a reason for hiding this comment

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

I only got this far in review @bsmth . Will try again Monday.

@sideshowbarker sideshowbarker removed their request for review October 16, 2024 04:57

Like request headers, there are many different headers that can appear in responses, and they are categorized as:

- {{glossary("Response header", "Response headers")}} give additional information about the server which doesn't fit in the status line.
Copy link
Collaborator

Choose a reason for hiding this comment

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

True, but perhaps you might say a little more - i.e. it is also about the message - such as how the message should be cached.

Response headers are the metadata sent with a response.
In HTTP/1.x, they are a **case-insensitive** string followed by a colon (`:`) and a value whose format depends upon which header is used.

![Example of headers in an HTTP response](https://mdn.github.io/shared-assets/images/diagrams/http/messages/response-headers.svg)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh, didn't know ETag was a representation header - It isn't marked as such in https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag

I guess it should be if it describes the state of the data at a particular time.

HTTP messages are the key in using HTTP; their structure is simple, and they are highly extensible. The HTTP/2 framing mechanism adds a new intermediate layer between the HTTP/1.x syntax and the underlying transport protocol, without fundamentally modifying it: building upon proven mechanisms.
This guide gives a general overview of the anatomy of HTTP messages from HTTP/1.X to HTTP/2.
If you've followed the examples and understood the concepts described, you should be able to work with HTTP and understand how applications can use the protocol to send and receive data.
The HTTP/2 framing mechanism adds a new intermediate layer between the HTTP/1.x syntax and the underlying transport protocol, without fundamentally modifying it, which builds upon proven mechanisms.
Copy link
Collaborator

Choose a reason for hiding this comment

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

This line is dangling. If you want to keep it, swap the last two lines in the paragraph.

Are we going to talk about HTTP/3 ?

@github-actions github-actions bot removed the merge conflicts 🚧 [PR only] label Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:HTTP HTTP docs Content:WebAPI Web API docs size/m [PR only] 51-500 LoC changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants