Skip to content

Commit

Permalink
feat(http): Add SVG diagrams for HTTP pages
Browse files Browse the repository at this point in the history
  • Loading branch information
bsmth committed Jun 21, 2024
1 parent d376326 commit a548026
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 4 deletions.
Binary file not shown.
2 changes: 1 addition & 1 deletion files/en-us/web/http/authentication/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ The challenge and response flow works like this:
2. A client that wants to authenticate itself with the server can then do so by including an {{HTTPHeader("Authorization")}} request header with the credentials.
3. Usually a client will present a password prompt to the user and will then issue the request including the correct `Authorization` header.

![A sequence diagram illustrating HTTP messages between a client and a server lifeline.](http-auth-sequence-diagram.png)
![A sequence diagram illustrating HTTP messages between a client and a server lifeline.](https://mdn.github.io/shared-assets/images/diagrams/http/authentication/basic-auth.svg)

The general message flow above is the same for most (if not all) [authentication schemes](#authentication_schemes).
The actual information in the headers and the way it is encoded does change!
Expand Down
Binary file removed files/en-us/web/http/cors/cred-req-updated.png
Binary file not shown.
6 changes: 3 additions & 3 deletions files/en-us/web/http/cors/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ fetchPromise

This operation performs a simple exchange between the client and the server, using CORS headers to handle the privileges:

![Diagram of simple CORS GET request](simple-req.png)
![Diagram of simple CORS GET request](https://mdn.github.io/shared-assets/images/diagrams/http/cors/simple-request.svg)

Let's look at what the browser will send to the server in this case:

Expand Down Expand Up @@ -164,7 +164,7 @@ fetchPromise.then((response) => {

The example above creates an XML body to send with the `POST` request. Also, a non-standard HTTP `X-PINGOTHER` request header is set. Such headers are not part of HTTP/1.1, but are generally useful to web applications. Since the request uses a `Content-Type` of `text/xml`, and since a custom header is set, this request is preflighted.

![Diagram of a request that is preflighted](preflight_correct.png)
![Diagram of a request that is preflighted](https://mdn.github.io/shared-assets/images/diagrams/http/cors/preflight-correct.svg)

> **Note:** As described below, the actual `POST` request does not include the `Access-Control-Request-*` headers; they are needed only for the `OPTIONS` request.
Expand Down Expand Up @@ -296,7 +296,7 @@ fetchPromise.then((response) => console.log(response));

This code creates a {{domxref("Request")}} object, setting the `credentials` option to `"include"` in the constructor, then passes this request into `fetch()`. Since this is a simple `GET` request, it is not preflighted but the browser will **reject** any response that does not have the {{HTTPHeader("Access-Control-Allow-Credentials")}}`: true` header, and **not** make the response available to the invoking web content.

![Diagram of a simple GET request with Access-Control-Allow-Credentials](cred-req-updated.png)
![Diagram of a simple GET request with Access-Control-Allow-Credentials](https://mdn.github.io/shared-assets/images/diagrams/http/cors/include-credentials.svg)

Here is a sample exchange between client and server:

Expand Down
Binary file removed files/en-us/web/http/cors/preflight_correct.png
Binary file not shown.
Binary file removed files/en-us/web/http/cors/simple-req.png
Binary file not shown.

0 comments on commit a548026

Please sign in to comment.