Http: Difference between revisions
From wikinotes
Line 66: | Line 66: | ||
∨ Hypertext Transfer Protocol | ∨ Hypertext Transfer Protocol | ||
HTTP/1.1 200 OK | |||
Server: nginx/1.20.1 | |||
Date: Sat, 18 Sep 2021 13:51:13 GMT | |||
Content-Type: text/html | |||
Content-Length: 340 | |||
Last-Modified: Mon, 05 Apr 2021 14:47:38 GMT | |||
Connection: close | |||
ETag: "606b230a-154" | |||
Accept-Ranges: bytes | |||
<html> | |||
<header> | |||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/kognise/water.css@latest/dist/light.min.css"> | |||
</header> | |||
<body> | |||
<h1>Welcome</h1> | |||
<ul> | |||
<li><a href="https://willpittman.net:8080/index.php?title=Main_Page">Wiki</a></li> | |||
<li><a href="https://willpittman.net:9090/">Blog</a></li> | |||
</ul> | |||
</body> | |||
</html> | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Revision as of 13:52, 18 September 2021
TODO:
clean this up
TODO:
add section for headers, CORS, Content Security Policy, etc
Documentation
MDN HTTP overview https://developer.mozilla.org/en-US/docs/Web/HTTP/Overview http headers https://en.wikipedia.org/wiki/List_of_HTTP_header_fields
Example
Perform a raw HTTP request using netcat.
cat << EOF | nc willpittman.net 80 GET / HTTP/1.1 Host: willpittman.net Connection: close EOF # blank line intentionalYou can also inspect an HTTP request from any source using wireshark.
HTTP request
> Frame 18: 596 bytes on wire (4786 bits), 596 bytes captured (5786 bits) on interface eno1, id 0 > Ethernet II, Src: ..., Dst: ... > Internet Protocol Version 4, Src: 100.100.100.100, Dst: 200.200.200.200 > Transmission Control Protocol, Src Port: 47708, Dst Port: 80, Seq: 1, Ack: 1, Len: 530 ∨ Hypertext Transfer Protocol GET / HTTP/1.1 Host: willpittman.net Connection: keep-alive Cache-Control: max-age=0 Upgrade-Insecure-Requests: 1 User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9 Accept-Encoding: gzip, deflate Accept-Language: en-US,en;q=0.9 If-None-Match: "606b230a-154" If-Modified-Since: Mon, 05 Apr 2021 14:47:38 GMT
HTTP response
> Frame 19: 246 bytes on wire (1968 bits), 246 bytes captured (1968 bits) on interface eno1, id 0 > Ethernet II, Src: ..., Dst: ... > Internet Protocol Version 4, Src: 200.200.200.200, Dst: 100.100.100.100 > Transmission Control Protocol, Src Port: 80, Dst Port: 47708, Seq: 1, Ack: 531, Len: 180 ∨ Hypertext Transfer Protocol HTTP/1.1 200 OK Server: nginx/1.20.1 Date: Sat, 18 Sep 2021 13:51:13 GMT Content-Type: text/html Content-Length: 340 Last-Modified: Mon, 05 Apr 2021 14:47:38 GMT Connection: close ETag: "606b230a-154" Accept-Ranges: bytes <html> <header> <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/kognise/water.css@latest/dist/light.min.css"> </header> <body> <h1>Welcome</h1> <ul> <li><a href="https://willpittman.net:8080/index.php?title=Main_Page">Wiki</a></li> <li><a href="https://willpittman.net:9090/">Blog</a></li> </ul> </body> </html>
Notes
http protocol http headers http statuses http cookies