Skip to content

Commit 4623499

Browse files
committed
Fix triple dots for <pre> in Web/HTTP
1 parent c84293e commit 4623499

File tree

268 files changed

+2207
-1505
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

268 files changed

+2207
-1505
lines changed

files/en-us/web/http/authentication/index.md

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ The {{HTTPHeader("WWW-Authenticate")}} and {{HTTPHeader("Proxy-Authenticate")}}
5454

5555
The syntax for these headers is the following:
5656

57-
```html
57+
```
5858
WWW-Authenticate: <type> realm=<realm>
5959
Proxy-Authenticate: <type> realm=<realm>
6060
```
@@ -65,7 +65,7 @@ Here, `<type>` is the authentication scheme ("Basic" is the most common scheme a
6565

6666
The {{HTTPHeader("Authorization")}} and {{HTTPHeader("Proxy-Authorization")}} request headers contain the credentials to authenticate a user agent with a (proxy) server. Here, the `<type>` is needed again followed by the credentials, which can be encoded or encrypted depending on which authentication scheme is used.
6767

68-
```html
68+
```
6969
Authorization: <type> <credentials>
7070
Proxy-Authorization: <type> <credentials>
7171
```
@@ -103,30 +103,36 @@ To password-protect a directory on an Apache server, you will need a `.htaccess`
103103

104104
The `.htaccess` file typically looks like this:
105105

106-
AuthType Basic
107-
AuthName "Access to the staging site"
108-
AuthUserFile /path/to/.htpasswd
109-
Require valid-user
106+
```
107+
AuthType Basic
108+
AuthName "Access to the staging site"
109+
AuthUserFile /path/to/.htpasswd
110+
Require valid-user
111+
```
110112

111113
The `.htaccess` file references a `.htpasswd` file in which each line consists of a username and a password separated by a colon (`:`). You cannot see the actual passwords as they are [hashed](https://httpd.apache.org/docs/2.4/misc/password_encryptions.html) (using MD5-based hashing, in this case). Note that you can name your `.htpasswd` file differently if you like, but keep in mind this file shouldn't be accessible to anyone. (Apache is usually configured to prevent access to `.ht*` files).
112114

113-
aladdin:$apr1$ZjTqBB3f$IF9gdYAGlMrs2fuINjHsz.
114-
user2:$apr1$O04r.y2H$/vEkesPhVInBByJUkXitA/
115+
```
116+
aladdin:$apr1$ZjTqBB3f$IF9gdYAGlMrs2fuINjHsz.
117+
user2:$apr1$O04r.y2H$/vEkesPhVInBByJUkXitA/
118+
```
115119

116120
### Restricting access with nginx and basic authentication
117121

118122
For nginx, you will need to specify a location that you are going to protect and the `auth_basic` directive that provides the name to the password-protected area. The `auth_basic_user_file` directive then points to a `.htpasswd` file containing the encrypted user credentials, just like in the Apache example above.
119123

120-
location /status {
121-
auth_basic "Access to the staging site";
122-
auth_basic_user_file /etc/apache2/.htpasswd;
123-
}
124+
```
125+
location /status {
126+
auth_basic "Access to the staging site";
127+
auth_basic_user_file /etc/apache2/.htpasswd;
128+
}
129+
```
124130

125131
### Access using credentials in the URL
126132

127133
Many clients also let you avoid the login prompt by using an encoded URL containing the username and the password like this:
128134

129-
```plain example-bad
135+
```example-bad
130136
https://username:[email protected]/
131137
```
132138

files/en-us/web/http/basics_of_http/choosing_between_www_and_non-www_urls/index.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ It is possible to add a special HTML {{HTMLElement("link")}} element to a page t
4545

4646
When adding such a tag, you serve the same content for both domains, telling search engines which URL is canonical. In the previous example, `http://www.example.org/whaddup` would serve the same content as `http://example.org/whaddup`, but with an additional {{htmlelement("link")}} element in the head:
4747

48-
`<link href="http://example.org/whaddup" rel="canonical">`
48+
```html
49+
<link href="http://example.org/whaddup" rel="canonical">
50+
``
4951

5052
Unlike the previous case, browser history will consider non-www and www URLs as independent entries.
5153

files/en-us/web/http/basics_of_http/data_uris/index.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,14 @@ base64 a.txt>b.txt
6868

6969
On Windows, [Convert.ToBase64String](https://docs.microsoft.com/en-us/dotnet/api/system.convert.tobase64string?view=net-5.0) from PowerShell can be used to perform the Base64 encoding:
7070

71-
```html
71+
```bash
7272
[convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes("hello"))
7373
# outputs to console: aGVsbG8=
7474
```
7575

7676
Alternatively, a GNU/Linux shell (such as [WSL](https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux)) provides the utility `base64`:
7777

78-
```html
78+
```bash
7979
bash$ echo -n hello | base64
8080
# outputs to console: aGVsbG8=
8181
```
@@ -84,11 +84,15 @@ bash$ echo -n hello | base64
8484

8585
This section describes problems that commonly occur when creating and using `data` URLs.
8686

87-
data:text/html,lots of text...<p><a name%3D"bottom">bottom</a>?arg=val
87+
```
88+
data:text/html,lots of text...<p><a name%3D"bottom">bottom</a>?arg=val
89+
```
8890

8991
This represents an HTML resource whose contents are:
9092

91-
lots of text...<p><a name="bottom">bottom</a>?arg=val
93+
```html
94+
lots of text...<p><a name="bottom">bottom</a>?arg=val
95+
```
9296

9397
- Syntax
9498
- : The format for `data` URLs is very simple, but it's easy to forget to put a comma before the "data" segment, or to incorrectly encode the data into base64 format.
@@ -119,5 +123,5 @@ This represents an HTML resource whose contents are:
119123
- [Percent encoding](/en-US/docs/Glossary/percent-encoding)
120124
- {{domxref("WindowOrWorkerGlobalScope/atob","atob()")}}
121125
- {{domxref("WindowOrWorkerGlobalScope/btoa","btoa()")}}
122-
- [CSS `url()`](</en-US/docs/Web/CSS/url()>)
126+
- [CSS `url()`](/en-US/docs/Web/CSS/url())
123127
- [URI](/en-US/docs/Glossary/URI)

files/en-us/web/http/basics_of_http/evolution_of_http/index.md

Lines changed: 72 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,17 @@ The HTTP protocol used in those early phases was very simple, later dubbed HTTP/
2828

2929
The initial version of HTTP had no version number; it has been later called 0.9 to differentiate it from the later versions. HTTP/0.9 is extremely simple: requests consist of a single line and start with the only possible method {{HTTPMethod("GET")}} followed by the path to the resource (not the URL as both the protocol, server, and port are unnecessary once connected to the server).
3030

31-
GET /mypage.html
31+
```
32+
GET /mypage.html
33+
```
3234

3335
The response is extremely simple too: it only consisted of the file itself.
3436

35-
<HTML>
36-
A very simple HTML page
37-
</HTML>
37+
```html
38+
<html>
39+
A very simple HTML page
40+
</html>
41+
```
3842

3943
Unlike subsequent evolutions, there were no HTTP headers, meaning that only HTML files could be transmitted, but no other type of documents. There were no status or error codes: in case of a problem, a specific HTML file was sent back with the description of the problem contained in it, for human consumption.
4044

@@ -49,28 +53,32 @@ HTTP/0.9 was very limited and both browsers and servers quickly extended it to b
4953

5054
At this point, a typical request and response looked like this:
5155

52-
GET /mypage.html HTTP/1.0
53-
User-Agent: NCSA_Mosaic/2.0 (Windows 3.1)
56+
```
57+
GET /mypage.html HTTP/1.0
58+
User-Agent: NCSA_Mosaic/2.0 (Windows 3.1)
5459
55-
200 OK
56-
Date: Tue, 15 Nov 1994 08:12:31 GMT
57-
Server: CERN/3.0 libwww/2.17
58-
Content-Type: text/html
59-
<HTML>
60-
A page with an image
61-
<IMG SRC="/myimage.gif">
62-
</HTML>
60+
200 OK
61+
Date: Tue, 15 Nov 1994 08:12:31 GMT
62+
Server: CERN/3.0 libwww/2.17
63+
Content-Type: text/html
64+
<HTML>
65+
A page with an image
66+
<IMG SRC="/myimage.gif">
67+
</HTML>
68+
```
6369

6470
Followed by a second connection and request to fetch the image (followed by a response to that request):
6571

66-
GET /myimage.gif HTTP/1.0
67-
User-Agent: NCSA_Mosaic/2.0 (Windows 3.1)
72+
```
73+
GET /myimage.gif HTTP/1.0
74+
User-Agent: NCSA_Mosaic/2.0 (Windows 3.1)
6875
69-
200 OK
70-
Date: Tue, 15 Nov 1994 08:12:32 GMT
71-
Server: CERN/3.0 libwww/2.17
72-
Content-Type: text/gif
73-
(image content)
76+
200 OK
77+
Date: Tue, 15 Nov 1994 08:12:32 GMT
78+
Server: CERN/3.0 libwww/2.17
79+
Content-Type: text/gif
80+
(image content)
81+
```
7482

7583
These novelties have not been introduced as concerted effort, but as a try-and-see approach over the 1991-1995 period: a server and a browser added one feature and it saw if it got traction. A lot of interoperability problems were common. In November 1996, in order to solve these annoyances, an informational document describing the common practices has been published, {{RFC(1945)}}. This is the definition of HTTP/1.0 and it is notable that, in the narrow sense of the term, it isn't an official standard.
7684

@@ -89,47 +97,49 @@ HTTP/1.1 clarified ambiguities and introduced numerous improvements:
8997

9098
A typical flow of requests, all through one single connection is now looking like this:
9199

92-
GET /en-US/docs/Glossary/Simple_header HTTP/1.1
93-
Host: developer.mozilla.org
94-
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:50.0) Gecko/20100101 Firefox/50.0
95-
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
96-
Accept-Language: en-US,en;q=0.5
97-
Accept-Encoding: gzip, deflate, br
98-
Referer: https://developer.mozilla.org/en-US/docs/Glossary/Simple_header
99-
100-
200 OK
101-
Connection: Keep-Alive
102-
Content-Encoding: gzip
103-
Content-Type: text/html; charset=utf-8
104-
Date: Wed, 20 Jul 2016 10:55:30 GMT
105-
Etag: "547fa7e369ef56031dd3bff2ace9fc0832eb251a"
106-
Keep-Alive: timeout=5, max=1000
107-
Last-Modified: Tue, 19 Jul 2016 00:59:33 GMT
108-
Server: Apache
109-
Transfer-Encoding: chunked
110-
Vary: Cookie, Accept-Encoding
111-
112-
(content)
113-
114-
GET /static/img/header-background.png HTTP/1.1
115-
Host: developer.mozilla.org
116-
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:50.0) Gecko/20100101 Firefox/50.0
117-
Accept: */*
118-
Accept-Language: en-US,en;q=0.5
119-
Accept-Encoding: gzip, deflate, br
120-
Referer: https://developer.mozilla.org/en-US/docs/Glossary/Simple_header
121-
122-
200 OK
123-
Age: 9578461
124-
Cache-Control: public, max-age=315360000
125-
Connection: keep-alive
126-
Content-Length: 3077
127-
Content-Type: image/png
128-
Date: Thu, 31 Mar 2016 13:34:46 GMT
129-
Last-Modified: Wed, 21 Oct 2015 18:27:50 GMT
130-
Server: Apache
131-
132-
(image content of 3077 bytes)
100+
```
101+
GET /en-US/docs/Glossary/Simple_header HTTP/1.1
102+
Host: developer.mozilla.org
103+
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:50.0) Gecko/20100101 Firefox/50.0
104+
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
105+
Accept-Language: en-US,en;q=0.5
106+
Accept-Encoding: gzip, deflate, br
107+
Referer: https://developer.mozilla.org/en-US/docs/Glossary/Simple_header
108+
109+
200 OK
110+
Connection: Keep-Alive
111+
Content-Encoding: gzip
112+
Content-Type: text/html; charset=utf-8
113+
Date: Wed, 20 Jul 2016 10:55:30 GMT
114+
Etag: "547fa7e369ef56031dd3bff2ace9fc0832eb251a"
115+
Keep-Alive: timeout=5, max=1000
116+
Last-Modified: Tue, 19 Jul 2016 00:59:33 GMT
117+
Server: Apache
118+
Transfer-Encoding: chunked
119+
Vary: Cookie, Accept-Encoding
120+
121+
(content)
122+
123+
GET /static/img/header-background.png HTTP/1.1
124+
Host: developer.mozilla.org
125+
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:50.0) Gecko/20100101 Firefox/50.0
126+
Accept: */*
127+
Accept-Language: en-US,en;q=0.5
128+
Accept-Encoding: gzip, deflate, br
129+
Referer: https://developer.mozilla.org/en-US/docs/Glossary/Simple_header
130+
131+
200 OK
132+
Age: 9578461
133+
Cache-Control: public, max-age=315360000
134+
Connection: keep-alive
135+
Content-Length: 3077
136+
Content-Type: image/png
137+
Date: Thu, 31 Mar 2016 13:34:46 GMT
138+
Last-Modified: Wed, 21 Oct 2015 18:27:50 GMT
139+
Server: Apache
140+
141+
(image content of 3077 bytes)
142+
```
133143

134144
HTTP/1.1 was first published as {{rfc(2068)}} in January 1997.
135145

files/en-us/web/http/basics_of_http/identifying_resources_on_the_web/index.md

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,28 @@ The target of an HTTP request is called a "resource", whose nature isn't defined
2626

2727
The most common form of URI is the Uniform Resource Locator ({{Glossary("URL")}}), which is known as the _web address_.
2828

29-
https://developer.mozilla.org
30-
https://developer.mozilla.org/en-US/docs/Learn/
31-
https://developer.mozilla.org/en-US/search?q=URL
29+
```
30+
https://developer.mozilla.org
31+
https://developer.mozilla.org/en-US/docs/Learn/
32+
https://developer.mozilla.org/en-US/search?q=URL
33+
```
3234

3335
Any of those URLs can be typed into your browser's address bar to tell it to load the associated page (resource).
3436

3537
A URL is composed of different parts, some mandatory and others are optional. A more complex example might look like this:
3638

37-
http://www.example.com:80/path/to/myfile.html?key1=value1&key2=value2#SomewhereInTheDocument
39+
```
40+
http://www.example.com:80/path/to/myfile.html?key1=value1&key2=value2#SomewhereInTheDocument
41+
```
3842

3943
### URNs
4044

41-
A Uniform Resource Name (URN) is a URI that identifies a resource by name in a particular namespace.
45+
A Uniform Resource Name (URN) is a URI that identifies a resource by name in a particular namespace.
4246

43-
urn:isbn:9780141036144
44-
urn:ietf:rfc:7230
47+
```
48+
urn:isbn:9780141036144
49+
urn:ietf:rfc:7230
50+
```
4551

4652
The two URNs correspond to
4753

@@ -102,12 +108,14 @@ FTP is still acceptable at the top level (such as typed directly into the browse
102108

103109
## Examples
104110

105-
https://developer.mozilla.org/en-US/docs/Learn
106-
tel:+1-816-555-1212
107-
[email protected]:mdn/browser-compat-data.git
108-
ftp://example.org/resource.txt
109-
urn:isbn:9780141036144
110-
111+
```
112+
https://developer.mozilla.org/en-US/docs/Learn
113+
tel:+1-816-555-1212
114+
[email protected]:mdn/browser-compat-data.git
115+
ftp://example.org/resource.txt
116+
urn:isbn:9780141036144
117+
118+
```
111119

112120
## Specifications
113121

0 commit comments

Comments
 (0)