{"id":210,"date":"2017-12-04T20:46:02","date_gmt":"2017-12-05T01:46:02","guid":{"rendered":"https:\/\/itp.nyu.edu\/networks\/?page_id=210"},"modified":"2019-04-04T12:36:35","modified_gmt":"2019-04-04T16:36:35","slug":"a-gentle-introduction-to-http","status":"publish","type":"page","link":"https:\/\/itp.nyu.edu\/networks\/explanations\/a-gentle-introduction-to-http\/","title":{"rendered":"A gentle introduction to HTTP"},"content":{"rendered":"<p class=\"c2 c32\"><span class=\"c23 c7\"><a class=\"c6\" href=\"#h.p6x2zfqyp6fw\">1. HT\u2026 something: HTML and HTTP<\/a><\/span><\/p>\n<p class=\"c2 c32\"><span class=\"c23 c7\"><a class=\"c6\" href=\"#h.dgr99lk5gdr8\">2. That which we call a rose is a web resource: URIS, URLs and URNs<\/a><\/span><\/p>\n<p class=\"c2 c32\"><span class=\"c23 c7\"><a class=\"c6\" href=\"#h.8ygp1paupgyt\">3. Overview of the protocol: connection, request and response<\/a><\/span><\/p>\n<p class=\"c2 c32\"><span class=\"c23 c7\"><a class=\"c6\" href=\"#h.k0wjg4v1ker1\">4. Asking nicely for content: what client requests look like<\/a><\/span><\/p>\n<p class=\"c2 c32\"><span class=\"c23 c7\"><a class=\"c6\" href=\"#h.1fteiab9iz4a\">5. How the server responds<\/a><\/span><\/p>\n<p class=\"c2 c3\"><span class=\"c19 c7\"><a class=\"c6\" href=\"#common_response_status_codes\">5.1 Common response status codes<\/a><\/span><\/p>\n<p class=\"c2 c32\"><span class=\"c23 c7\"><a class=\"c6\" href=\"#h.b22x0oujcej3\">6. Further reading and resources<\/a><\/span><\/p>\n<p class=\"c2 c3\"><span class=\"c19 c7\"><a class=\"c6\" href=\"#h.ldnjci9iqhov\">Deeper into the \u00a0HTTP rabbithole<\/a><\/span><\/p>\n<p class=\"c2 c3\"><span class=\"c19 c7\"><a class=\"c6\" href=\"#h.8jhfhk5q1180\">6.2 HTTP vs. HTTPs<\/a><\/span><\/p>\n<p class=\"c2 c32\"><span class=\"c7 c23\"><a class=\"c6\" href=\"#h.nzyc82g92rc6\">7. Term Index<\/a><\/span><\/p>\n<p class=\"c2\"><span class=\"c5 c8 c34\">Note: if you just want a quick overview of how HTTP works, head to <\/span><span class=\"c5 c7 c8\"><a class=\"c6\" href=\"#h.8ygp1paupgyt\">Section 3.<\/a><\/span><span class=\"c5 c34 c8 c41\">\u00a0<\/span><\/p>\n<p class=\"c2\"><span class=\"c5\">When <\/span><span class=\"c5 c14\">Tim Berners-Lee invented the World Wide Web in 1989, \u00a0he had more in mind than just the free exchange of files around a network of computers: his design conveyed the idea of <\/span><strong><a id=\"id.zbza9gudwz3n\"><\/a><span class=\"c9 c14\">hypertext<\/span><\/strong><span class=\"c5 c14 c8\">\u00a0<\/span><span class=\"c5 c14\">or<\/span><span class=\"c5 c14 c8\">\u00a0<\/span><span class=\"c5 c14\">linked documents: structured resources connected to each other through cross references that could be not only explored and retrieved in real time, but also searched, updated and even annotated on <\/span><span class=\"c5 c14 c33\"><a class=\"c6\" href=\"https:\/\/www.google.com\/url?q=https:\/\/tools.ietf.org\/html\/rfc2616%23section-1.1&amp;sa=D&amp;ust=1513305734098000&amp;usg=AFQjCNHRQhQ0cg9algUywLEm_HPM5B-6ZQ\">(HTTP RFC, Section 1.1)<\/a><\/span><span class=\"c1 c14\">\u00a0through an interface. This article being delivered to you on a website through a browser is an example of such a document. It has links to related terms that you can click on and navigate to. How does this happen? <\/span><\/p>\n<h2 id=\"h.p6x2zfqyp6fw\" class=\"c11\"><span class=\"ez-toc-section\" id=\"1_HT%E2%80%A6_something_HTML_and_HTTP\"><\/span><span class=\"c22 c31\">1. HT\u2026 something: HTML and HTTP<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p class=\"c2\"><span class=\"c1 c14\">The two sister technologies that make exchanges on the Web possible are <\/span><span class=\"c5 c14\">the <\/span><span class=\"c5 c14 c8\">Hypertext <\/span><span class=\"c9 c14 c8\">Markup Language<\/span><span class=\"c5 c14\">\u00a0<\/span><a id=\"id.vz2ldqcabl91\"><\/a><span class=\"c5 c14\"><strong>(HTML)<\/strong> and the <\/span><span class=\"c5 c14 c8\">Hypertext<\/span><span class=\"c9 c14 c8\">\u00a0Transfer<\/span><span class=\"c5 c14 c8\">\u00a0<\/span><span class=\"c9 c14 c8\">Protocol<\/span><span class=\"c9 c14\">\u00a0<\/span><a id=\"id.rk8p9pk77bu6\"><\/a><span class=\"c1 c14\"><strong>(HTTP).<\/strong> Both start with HT because they are dealing with the same stuff, hypertext, that is. <\/span><\/p>\n<p class=\"c2\"><span class=\"c5 c14\">HTML defines how a document should be formatted in order to play in this sharing environment we call the Web and HTTP defines<\/span><span class=\"c5\">\u00a0how this document and its <\/span><span class=\"c9\">resources <\/span><span class=\"c5 c7\"><a class=\"c6\" href=\"#h.dgr99lk5gdr8\">(see Section 2)<\/a><\/span><span class=\"c5\">\u00a0get from one computer to another. Both are sets of instructions, or<\/span><span class=\"c9\">\u00a0<\/span><a id=\"id.6rsjgm9zadph\"><\/a><strong><span class=\"c9\">protocols.<\/span><\/strong><span class=\"c1\">\u00a0HTML defines structure, HTTP transport. <\/span><\/p>\n<p class=\"c2\"><span class=\"c5 c14\">Although this article does not attempt to go into too much detail into how HTML works, it is worth talking a bit about <\/span><a id=\"id.wh7h6p2rf3g\"><\/a><span class=\"c9 c14\">markup<\/span><span class=\"c1 c14\">\u00a0before we delve into HTTP.<\/span><\/p>\n<p class=\"c2\"><span class=\"c5 c7 c14\"><a class=\"c6\" href=\"https:\/\/www.google.com\/url?q=https:\/\/books.google.com\/books?id%3D4XycAQAAQBAJ%26pg%3DPA876%26lpg%3DPA876%26dq%3DA%2Bset%2Bof%2Btags%2Bassigned%2Bto%2Belements%2Bof%2Ba%2Btext%2Bto%2Bindicate%2Btheir%2Brelation%2Bto%2Bthe%2Brest%2Bof%2Bthe%2Btext%2Bor%2Bdictate%2Bhow%2Bthey%2Bshould%2Bbe%2Bdisplayed%26source%3Dbl%26ots%3DS41M0G3dnS%26sig%3D2gbJojCE5g28T5x2eY5gtc5Llvg%26hl%3Den%26sa%3DX%26ved%3D0ahUKEwivxc6m5enXAhUlSN8KHe60Ci8Q6AEIJzAA%23v%3Donepage%26q%3DA%2520set%2520of%2520tags%2520assigned%2520to%2520elements%2520of%2520a%2520text%2520to%2520indicate%2520their%2520relation%2520to%2520the%2520rest%2520of%2520the%2520text%2520or%2520dictate%2520how%2520they%2520should%2520be%2520displayed%26f%3Dfalse&amp;sa=D&amp;ust=1513305734101000&amp;usg=AFQjCNFKfpbr9jWDXjJknFAOcftyEplkxg\">The Concise Oxford English Dictionary<\/a><\/span><span class=\"c5 c14\">\u00a0defines markup, in the computational arena, as \u201ca set of tags assigned to elements of a text to indicate their relation to the rest of the text or dictate how they should be displayed\u201d. The key term to keep in mind here is <\/span><strong><a id=\"id.4vlderxz0flv\"><\/a><span class=\"c9 c14\">tags<\/span><span class=\"c1 c14\">. <\/span><\/strong><\/p>\n<p class=\"c2\"><span class=\"c1 c14\">When your human eyes rest on a document that has a certain constant visual hierarchy, you can infer which parts of it are titles, subtitles, paragraphs, lists and so on. Computers and the browsers that operate in them are not as smart. You need to tell them which parts are which with tags (Fig. 1). \u00a0<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-214\" src=\"https:\/\/itp.nyu.edu\/networks\/wp-content\/uploads\/2017\/12\/Figure-1.png\" alt=\"Web page illustration with title and paragraph labeled, showing how your browser needs title and paragraph tags to make sense of the document.\" width=\"500\" height=\"672\" srcset=\"https:\/\/itp.nyu.edu\/networks\/wp-content\/uploads\/2017\/12\/Figure-1.png 548w, https:\/\/itp.nyu.edu\/networks\/wp-content\/uploads\/2017\/12\/Figure-1-223x300.png 223w, https:\/\/itp.nyu.edu\/networks\/wp-content\/uploads\/2017\/12\/Figure-1-260x350.png 260w\" sizes=\"(max-width: 500px) 85vw, 500px\" \/><\/p>\n<p class=\"c2\"><span class=\"c1 c14\">A HTML tag looks like \u00a0this: <\/span><\/p>\n<blockquote>\n<p class=\"c2 c32\"><span class=\"c9 c14 c28\">&lt;title&gt;<\/span><span class=\"c5 c14 c28\">\u00a0A gentle introduction to HTTP <\/span><span class=\"c9 c14 c28 c29\">&lt;\/title&gt;<\/span><\/p>\n<\/blockquote>\n<p class=\"c0\"><span class=\"c5 c14\">The actual tag is defined inside the characters <\/span><span class=\"c5 c14 c28\">&lt; &gt; &lt;\/&gt;.<\/span><span class=\"c1 c14\">\u00a0The text in between is the actual content in the case of text, and other multimedia items have other rules (but don\u2019t worry about this for now). <\/span><\/p>\n<p class=\"c0\"><span class=\"c5 c14\">Modern HTML\u2019s standards are to a great extent designed so that tags are semantic, namely, that they accurately describe the element contained within them. \u00a0This sounds obvious, but a tag &lt;cat&gt; &lt;\/cat&gt; might not be ideal to contain information about, say, pugs. Jeffrey Zeldman and Ethan Marcotte make a strong argument on the importance of semantic structuring of documents in their <\/span><span class=\"c5 c7 c14\"><a class=\"c6\" href=\"https:\/\/www.google.com\/url?q=https:\/\/www.amazon.com\/Designing-Web-Standards-Jeffrey-Zeldman\/dp\/0321616952&amp;sa=D&amp;ust=1513305734102000&amp;usg=AFQjCNG5Ln8fUm2waUl28ecip6e3qB4MGw\">Designing with Web Standards<\/a><\/span><span class=\"c5 c14\">\u00a0 book<\/span><span class=\"c1 c14\">, which is a fantastic primer in HTML and other web technologies well worth looking into if you want to dig deeper into these subjects (you\u2019ll want to look at the 3rd edition, the most current version of this text, from 2010). <\/span><\/p>\n<p class=\"c0\"><span class=\"c5 c14\">So, with the idea of tagged resources in mind, let\u2019s move on to HTTP. <\/span><span class=\"c5\">Why would you want to learn about it, anyway? If you are at ITP, you might want at some point create things and connect them to the Internet. If you are ready to move from your Github page or your <\/span><span class=\"c5 c8\">just another WordPress site,<\/span><span class=\"c5\">\u00a0you will find useful to learn about <\/span><span class=\"c1\">HTTP to get \u00a0your hyperlinked creations get out there. <\/span><\/p>\n<p class=\"c0\"><span class=\"c1\">This document aims to be a friendly overview of how the HTTP protocol works and point to some further readings in case you want to dig deeper into the subject. <\/span><\/p>\n<h2 id=\"h.dgr99lk5gdr8\" class=\"c11\"><span class=\"ez-toc-section\" id=\"2_That_which_we_call_a_rose_is_a_web_resource_URIS_URLs_and_URNs\"><\/span><span class=\"c22 c31\">2. That which we call a rose is a web resource: URIS, URLs and URNs<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p class=\"c0\"><span class=\"c5\">Web <\/span><strong><a id=\"id.i7iqrjteko78\"><\/a><span class=\"c9\">resources<\/span><\/strong><span class=\"c1\">\u00a0take many forms. They might be text or data, images, video or other multimedia as well as information that specifies aspects of presentation and behavior\u2013like CSS and Javascript files\u2013 of \u00a0a web document. <\/span><\/p>\n<p class=\"c0\"><span class=\"c5\">A resource is a workable\/shareable item on the internet when it has a <\/span><span class=\"c5 c8\">Unified Resource Identifier<\/span><span class=\"c5\">, or <\/span><strong><a id=\"id.vansdfy9817f\"><\/a><span class=\"c9\">URI.<\/span><\/strong><span class=\"c1\">\u00a0The URI could indicate a name of a resource, where it\u2019s located, or both. \u00a0Here\u2019s an example of a URI: <\/span><\/p>\n<blockquote>\n<p class=\"c0 c24\"><span class=\"c5 c29 c28\">www.pbs.org\/video\/nova-first-man-moon\/<\/span><\/p>\n<\/blockquote>\n<p class=\"c0\"><span class=\"c5\">You might be more familiar with the term <\/span><span class=\"c5 c8\">Unified Resource Locator,<\/span><span class=\"c5\">\u00a0or <\/span><a id=\"id.q9zs3hqdm5q4\"><\/a><span class=\"c9\"><strong>URL<\/strong>.<\/span><span class=\"c1\">\u00a0URLs are URIs that in addition of pointing to the resource, they also indicate the mechanism to access it (like HTTP, HTTPs or FTP). This is what you see on your address\/search bar. Following with our previous example, a URL will look like this: <\/span><\/p>\n<blockquote><p><span class=\"c9 c28\">http:\/\/<\/span><span class=\"c5 c28\">www.pbs.org\/video\/nova-first-man-moon\/<\/span><\/p><\/blockquote>\n<p class=\"c2\"><span class=\"c5\">Another term that you might run into is <\/span><span class=\"c5 c8\">Unified Resource Name <\/span><span class=\"c5\">or <\/span><a id=\"id.clim547fkrji\"><\/a><strong><span class=\"c9\">URN,<\/span><\/strong><span class=\"c1\">\u00a0which would look like the first example: \u00a0<\/span><\/p>\n<blockquote>\n<p class=\"c0 c24\"><span class=\"c5 c29 c28\">www.pbs.org\/video\/nova-first-man-moon\/<\/span><\/p>\n<\/blockquote>\n<p class=\"c0\"><span class=\"c5\">This can be a very confusing rabbit hole to dive into, the important thing to remember is that all three terms refer roughly to the same thing, but when you have an address to a resource that indicates the method to get it (eg.: HTTP:\/\/), you are looking at a URL. All URLs are URIs, but not all URIs are URLs (they can just be URNs). The bigger group is URIs (Figure 2). \u00a0If you want to keep ruminating on this <\/span><span class=\"c5 c8\">all roses are red (supposing they were), but not all red things are roses<\/span><span class=\"c5\">\u00a0thread check out <\/span><span class=\"c5 c7\"><a class=\"c6\" href=\"https:\/\/www.google.com\/url?q=https:\/\/danielmiessler.com\/study\/url-uri\/&amp;sa=D&amp;ust=1513305734104000&amp;usg=AFQjCNHtjRSQdVxchy7IMBuTzv4be8j4zg\">Daniel Miessler\u2019s<\/a><\/span><span class=\"c5\">\u00a0article<\/span><span class=\"c5\">\u00a0on the subject.<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-215\" src=\"https:\/\/itp.nyu.edu\/networks\/wp-content\/uploads\/2017\/12\/figure2.png\" alt=\"Illustration depicting how a URN is a subset of a URL and a URL is a subset of a URI.\" width=\"500\" height=\"185\" srcset=\"https:\/\/itp.nyu.edu\/networks\/wp-content\/uploads\/2017\/12\/figure2.png 758w, https:\/\/itp.nyu.edu\/networks\/wp-content\/uploads\/2017\/12\/figure2-300x111.png 300w\" sizes=\"(max-width: 500px) 85vw, 500px\" \/><\/p>\n<h2 id=\"h.8ygp1paupgyt\" class=\"c11\"><span class=\"ez-toc-section\" id=\"3_Overview_of_the_protocol_connection_request_and_response\"><\/span><span class=\"c22 c31\">3. Overview of the protocol: connection, request and response<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p class=\"c2\"><span class=\"c5\">The two main players that make use of the HTTP protocol are <\/span><strong><a id=\"id.5dmqaqdg9iic\"><\/a><span class=\"c9\">clients <\/span><\/strong><span class=\"c5\">and <\/span><strong><a id=\"id.cawiu339co1i\"><\/a><span class=\"c9\">servers.<\/span><\/strong><span class=\"c5\">\u00a0This is how they tango: clients <\/span><span class=\"c5\">request to be <\/span><span class=\"c9\">connected <\/span><span class=\"c5\">to a certain server from where they want to pull up resources and the server accepts the connection. If this goes well then the client will <\/span><span class=\"c9\">request<\/span><span class=\"c5\">\u00a0content and the server with <\/span><span class=\"c9\">respond <\/span><span class=\"c5\">with the requested resource. Both clients and servers are<\/span><span class=\"c9\">\u00a0<\/span><span class=\"c5\">software programs. In<\/span><span class=\"c9\">\u00a0<\/span><span class=\"c5\">between these two there may be additional middlemen often referred to as <\/span><span class=\"c5 c8\">proxies<\/span><span class=\"c5\">\u00a0that do a number of additional things (like logging in, filtering, caching, etc.), but they are beyond the scope of this article, but a good resource to look at if you want to learn more is the <\/span><span class=\"c5 c7\"><a class=\"c6\" href=\"https:\/\/www.google.com\/url?q=https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTTP\/Overview&amp;sa=D&amp;ust=1513305734106000&amp;usg=AFQjCNE06lP-lkJTIyDHGMt4tusYYZkSZQ\">Mozilla Developer Network documentation on HTTP).<\/a><\/span><span class=\"c5\">\u00a0<\/span><\/p>\n<p class=\"c2\"><span class=\"c5\">For this overview we are assuming that all sides are completely functional and playing by the rules (we will briefly mention how the server responds in case something goes wrong in <\/span><span class=\"c5 c7\"><a class=\"c6\" href=\"#h.1fteiab9iz4a\">Section 5).<\/a><\/span><span class=\"c1\">\u00a0 So the mechanics of the HTTP protocol can be divided into three main chunks: connection, request and response (Figure 3). <\/span><\/p>\n<p class=\"c2\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-216\" src=\"https:\/\/itp.nyu.edu\/networks\/wp-content\/uploads\/2017\/12\/figure3.png\" alt=\"A client-server interaction has three steps. The client opens a connection with the server, then with the open connection it sends a request and receives a response\" width=\"500\" height=\"386\" srcset=\"https:\/\/itp.nyu.edu\/networks\/wp-content\/uploads\/2017\/12\/figure3.png 792w, https:\/\/itp.nyu.edu\/networks\/wp-content\/uploads\/2017\/12\/figure3-300x232.png 300w, https:\/\/itp.nyu.edu\/networks\/wp-content\/uploads\/2017\/12\/figure3-768x593.png 768w\" sizes=\"(max-width: 500px) 85vw, 500px\" \/><\/p>\n<p class=\"c2\"><span class=\"c5\">The <\/span><span class=\"c5 c7\"><a class=\"c6\" href=\"https:\/\/www.google.com\/url?q=https:\/\/www.w3.org\/Protocols\/HTTP\/AsImplemented.html&amp;sa=D&amp;ust=1513305734107000&amp;usg=AFQjCNFAnPayQ1W3c462PkBLyoj86YS0PQ\">World Wide Web Consortium,<\/a><\/span><span class=\"c5\">\u00a0<\/span><span class=\"c1\">or W3C, provided a very \u00a0straightforward description of how this breaks down (note, this is from the 1991 specification, but the mechanics remain roughly the same): <\/span><\/p>\n<ol class=\"c16 lst-kix_rljm9q4wywwe-0 start\" start=\"1\">\n<li class=\"c2 c13\"><span class=\"c5\">The client and server establish a <\/span><strong><a id=\"id.br0rmegu337t\"><\/a><span class=\"c9\">connection,<\/span><\/strong><span class=\"c5\">\u00a0technically called a <\/span><strong><a id=\"id.ixjid6pjyb77\"><\/a><span class=\"c9\">session.<\/span><\/strong><\/li>\n<\/ol>\n<ol class=\"c16 lst-kix_rljm9q4wywwe-1 start\" start=\"1\">\n<li class=\"c2 c36 c3\"><span class=\"c5\">The client starts off by asking to make a <\/span><span class=\"c5 c8\">TCP\/IP<\/span><span class=\"c5\">\u00a0connection to the server using the <\/span><span class=\"c5 c8\">domain name<\/span><span class=\"c5\">\u00a0(eg. http:\/\/<\/span><span class=\"c5\">bobcat.library.nyu.edu<\/span><span class=\"c5\">\/) or its <\/span><span class=\"c5 c8\">IP number<\/span><span class=\"c5\">\u00a0equivalent (128.122.149.83, in the case of our example site) and the specific <\/span><span class=\"c5 c8\">port<\/span><span class=\"c9\">\u00a0<\/span><span class=\"c5\">number<\/span><span class=\"c5\">\u00a0given in the address (Borrowing a metaphor from Charles Severance\u2019s <\/span><span class=\"c5 c7\"><a class=\"c6\" href=\"https:\/\/www.google.com\/url?q=https:\/\/www.coursera.org\/learn\/internet-history&amp;sa=D&amp;ust=1513305734108000&amp;usg=AFQjCNGr9MUtXNvIZkPzkFXQa5o-8IJMDw\">introductory course to Internet technologies<\/a><\/span><span class=\"c5\">, if a domain name or IP were to be taken as a phone number for an organization, a port would be the <\/span><span class=\"c5 c8\">extension<\/span><span class=\"c5\">\u00a0to locate a specific person inside this organization, here are some <\/span><span class=\"c5 c7\"><a class=\"c6\" href=\"https:\/\/www.google.com\/url?q=http:\/\/www.meridianoutpost.com\/resources\/articles\/well-known-tcpip-ports.php&amp;sa=D&amp;ust=1513305734109000&amp;usg=AFQjCNEUi5DBFb6bObIMOcwFS8b1uZAx2A\">common port numbers).<\/a><\/span><span class=\"c1\">\u00a0<\/span><\/li>\n<li class=\"c2 c36 c3\"><span class=\"c1\">The server accepts the connection.<\/span><\/li>\n<\/ol>\n<ol class=\"c16 lst-kix_rljm9q4wywwe-0\" start=\"2\">\n<li class=\"c2 c13\"><span class=\"c5\">The client sends a request to the server. A request is a document, or a set of <\/span><span class=\"c5 c7\"><a class=\"c6\" href=\"https:\/\/www.google.com\/url?q=https:\/\/ascii.cl\/&amp;sa=D&amp;ust=1513305734109000&amp;usg=AFQjCNHK-6t2MRdTcQbQ1PaZLJ2Jv_PPPg\">ASCII characters<\/a><\/span><span class=\"c5\">\u00a0where it defines what it wants to do with the server (it might want to get a specific resource, post information to the server, or even delete stuff from it. More on this on <\/span><span class=\"c5 c7\"><a class=\"c6\" href=\"#h.k0wjg4v1ker1\">Section 4).<\/a><\/span><span class=\"c1\">\u00a0<\/span><\/li>\n<li class=\"c2 c13\"><span class=\"c5\">The server answers to the client\u2019s request with a document in HTML format (this is the actual resource a browser requests) and a message to notify the client if it has been successful or not in attending its demands (see <\/span><span class=\"c5 c7\"><a class=\"c6\" href=\"#h.1fteiab9iz4a\">Section 5<\/a><\/span><span class=\"c1\">\u00a0for some examples of these responses). <\/span><\/li>\n<\/ol>\n<ol class=\"c16 lst-kix_rljm9q4wywwe-1 start\" start=\"1\">\n<li class=\"c2 c36 c3\"><span class=\"c1\">The server ends the connection, or the session, when the full resource has been transferred. <\/span><\/li>\n<\/ol>\n<p class=\"c2\"><span class=\"c1\">This article will not cover TCP\/IP connection and will take it as a given, this is, we will assume this part is running smoothly and the parts don\u2019t close the connection until the whole transaction has been made and we will proceed to an overview of requests and responses.<\/span><\/p>\n<h2 id=\"h.k0wjg4v1ker1\" class=\"c11\"><span class=\"ez-toc-section\" id=\"4_Asking_nicely_for_content_what_client_requests_look_like\"><\/span><span class=\"c22 c31\">4. Asking nicely for content: what client requests look like<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p class=\"c2\"><span class=\"c1\">When you request through your browser to access a certain website, you don&#8217;t receive all the content at once (although it sure feels like it!) Rather, all the components that make up that site are sent by the server as a series of requests for different resources that, like puzzle pieces, the browser then interprets, assembles and displays on your screen. <\/span><\/p>\n<p class=\"c2\"><span class=\"c5\">Clients manifest in the form of <\/span><a id=\"id.nt78p6da1r8l\"><\/a><strong><span class=\"c9\">user agents <\/span><\/strong><span class=\"c5\">(this is probably the name you\u2019ll run into when looking at other HTTP documentation)<\/span><span class=\"c5\">\u00a0and the most common one is the <\/span><strong><a id=\"id.lay4rbjpva8z\"><\/a><span class=\"c9\">web browser<\/span><span class=\"c1\">. <\/span><\/strong><\/p>\n<p class=\"c2\"><span class=\"c5\">Other user agents that you might have heard of are spiders (or website bots, the ones that Google uses to link pages to its search engine) phone apps, programs working on your computer that are connected to the Internet without the aid of a browser, \u00a0Internet of Things (IoT) devices (like Amazon\u2019s Echo or Google Home), amongst other tools that may or may not have a human user behind them. <\/span><\/p>\n<p class=\"c2\"><span class=\"c1\">Different user agents will have different content needs and HTTP is flexible enough to cater to many client needs. When the Echo speaker connects to the Internet, for example, it has no use for images, so the server could potentially send to it a different document than the one that would be delivered to your browser. Let\u2019s stick with the browser case, as we have throughout this article, as this is probably the client you are most familiar with. <\/span><\/p>\n<p class=\"c2\"><span class=\"c5\">It is also important to remember from <\/span><span class=\"c5 c7\"><a class=\"c6\" href=\"#h.8ygp1paupgyt\">Section 3,<\/a><\/span><span class=\"c5\">\u00a0that you, as the user utilizing a client\/user agent (your browser), are always the one that starts the conversation, that is, you request information, and you do so using the rules set by HTTP.<\/span><span class=\"c1\">\u00a0<\/span><\/p>\n<p class=\"c2\"><span class=\"c1\">So, you might be wondering, how does your browser asks for information in a polite, protocol-complying manner? <\/span><\/p>\n<p class=\"c2\"><span class=\"c5\">Well, it makes a specific <\/span><a id=\"id.os5yqw888vts\"><\/a><strong><span class=\"c9\">request<\/span><\/strong><span class=\"c1\">\u00a0defining what it wants to do with the server. Requests have the following elements: <\/span><\/p>\n<ul class=\"c16 lst-kix_opbriu4cnulf-0 start\">\n<li class=\"c2 c13\"><strong><span class=\"c9\">Method:<\/span><\/strong><span class=\"c5\">\u00a0we specify what we are asking for with it.<\/span><span class=\"c5\">\u00a0<\/span><span class=\"c5\">The most common ones are <\/span><span class=\"c5\">GET<\/span><span class=\"c5\">\u00a0and <\/span><span class=\"c5\">POST.<\/span><span class=\"c5\">\u00a0When you want to simply browse through a web page, for example, you are using a GET method, when you fill out a form and send it to a browser you send information to a server, which then stores it somewhere. <\/span><span class=\"c5 c7\"><a class=\"c6\" href=\"https:\/\/www.google.com\/url?q=https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTTP\/Methods&amp;sa=D&amp;ust=1513305734112000&amp;usg=AFQjCNGdGKnpj61gCNDpkdu8KkfFt0yrig\">Here\u2019s the MDN reference <\/a><\/span><span class=\"c5\">if you want to look at<\/span><span class=\"c1\">\u00a0other methods. <\/span><\/li>\n<\/ul>\n<ul class=\"c16 lst-kix_opbriu4cnulf-0\">\n<li class=\"c2 c13\"><strong><span class=\"c9\">Version:<\/span><\/strong><span class=\"c5\">\u00a0our request must specify the <\/span><span class=\"c9\">version of HTTP<\/span><span class=\"c5\">\u00a0we are using (probably 1.1, which is the one we\u2019ve been discussing throughout this article, although be aware that there is a <\/span><span class=\"c5 c7\"><a class=\"c6\" href=\"https:\/\/www.google.com\/url?q=https:\/\/en.wikipedia.org\/wiki\/HTTP\/2&amp;sa=D&amp;ust=1513305734112000&amp;usg=AFQjCNHxTc-8XRHinWilAG0zTjoUD_R3Yg\">HTTP2<\/a><\/span><span class=\"c1\">\u00a0version out there as well). <\/span><\/li>\n<li class=\"c2 c13\"><span class=\"c5\"><strong>URI:<\/strong> we also include the <\/span><span class=\"c9\">resource identifier <\/span><span class=\"c5\">(s<\/span><span class=\"c5\">ee <\/span><span class=\"c5 c7\"><a class=\"c6\" href=\"#h.dgr99lk5gdr8\">Section 2).<\/a><\/span><span class=\"c1\">\u00a0<\/span><\/li>\n<\/ul>\n<ul class=\"c16 lst-kix_oq4rj9tez02y-0 start\">\n<li class=\"c2 c13\"><strong><span class=\"c9\">Header: <\/span><\/strong><span class=\"c1\">these are fields that contain information like details about the client (that\u2019s our browser!) and other metadata, like the type of content being sent. <\/span><\/li>\n<\/ul>\n<ul class=\"c16 lst-kix_oq4rj9tez02y-0\">\n<li class=\"c2 c13\"><strong><span class=\"c9\">Body:<\/span><\/strong><span class=\"c1\">\u00a0the actual resource, if we are sending something (eg. when using the POST method). <\/span><\/li>\n<\/ul>\n<p class=\"c2\"><span class=\"c5\">As mentioned in <\/span><span class=\"c5 c7\"><a class=\"c6\" href=\"#h.8ygp1paupgyt\">Section 3,<\/a><\/span><span class=\"c1\">\u00a0what follows is that your browser will wait for a response and then either keep the connection alive for further requests or close the connection. If you want to see how HTTP headers look like on a page you are browsing you can install and use tools like the <a href=\"https:\/\/chrome.google.com\/webstore\/detail\/http-headers\/nioieekamcpjfleokdcdifpmclkohddp?hl=en\">HTTP Headers<\/a> Chrome extension.\u00a0<\/span><\/p>\n<h2 id=\"h.1fteiab9iz4a\" class=\"c11\"><span class=\"ez-toc-section\" id=\"5_How_the_server_responds\"><\/span><span class=\"c22 c31\">5. How the server responds<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p class=\"c2\"><span class=\"c5\">The server\u2019s <\/span><a id=\"id.s6giribeq4pe\"><\/a><span class=\"c9\">response<\/span><span class=\"c5\">\u00a0is very similarly to our request, that is, it will also indicate the <\/span><span class=\"c9\">version<\/span><span class=\"c5\">\u00a0of HTTP it is using and will also include <\/span><span class=\"c9\">headers <\/span><span class=\"c5\">with information about the request. In addition to this, it will also attach a response number indicating the status of the request (if it is successful in fetching the resource, it will return a <\/span><span class=\"c9\">200). <\/span><span class=\"c5\">You are probably most familiar with the response you get when it can\u2019t find the resource: the infamous 404: not found, which will be displayed on your screen. On a successful normal browser scenario you, the end user, will not see the 200. Your browser does, however, and that is all that matters. Successful requests will also include the actual <\/span><span class=\"c9\">resource<\/span><span class=\"c5\">\u00a0you were requesting (if you were using a GET method). <\/span><\/p>\n<h3 id=\"common_response_status_codes\"><span class=\"ez-toc-section\" id=\"51_Common_response_status_codes\"><\/span><span class=\"c18 c5 c8\">5.1 Common response status codes<\/span><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p class=\"c2\"><span class=\"c9\">Response status codes<\/span><span class=\"c5\">\u00a0are good to know about specially when your request is not successful and you want to find about what went wrong. The following list is by no means exhaustive <\/span><span class=\"c5 c7\"><a class=\"c6\" href=\"https:\/\/www.google.com\/url?q=https:\/\/www.w3.org\/Protocols\/rfc2616\/rfc2616-sec10.html&amp;sa=D&amp;ust=1513305734114000&amp;usg=AFQjCNEbEbBFaXSOrbqKYorBVBh9xbzW-Q\">(but here\u2019s a link to an exhaustive list<\/a><\/span><span class=\"c1\">), but it gives you an idea of where common responses are in the overall scheme: <\/span><\/p>\n<p class=\"c2\"><span class=\"c9 c25\"><strong>100s:<\/strong> <\/span><span class=\"c5 c29 c25\">informational<\/span><\/p>\n<p class=\"c2\"><strong><span class=\"c9\">200s:<\/span><\/strong><span class=\"c1\"><strong>\u00a0<\/strong>all is well, your request has been received, understood, accepted.<\/span><\/p>\n<ul class=\"c16 lst-kix_t7jck1yer0yc-0 start\">\n<li class=\"c2 c36 c3\"><span class=\"c5\">Example: the good old <\/span><strong><span class=\"c9\">200<\/span><\/strong><span class=\"c1\"><strong>,<\/strong> which indicates that the content you requested has been delivered<\/span><\/li>\n<\/ul>\n<p class=\"c2\"><strong><span class=\"c9 c28\">300: <\/span><\/strong><span class=\"c5 c29 c28\">redirection<\/span><\/p>\n<p class=\"c2\"><strong><span class=\"c9\">400s: <\/span><\/strong><span class=\"c1\">uh-oh! there is something wrong with the request (it could be your fault, but not necessarily)<\/span><\/p>\n<ul class=\"c16 lst-kix_t7jck1yer0yc-0\">\n<li class=\"c2 c36 c3\"><span class=\"c5\">Example: <\/span><strong><span class=\"c9\">404,<\/span><\/strong><span class=\"c1\">\u00a0the resource you are looking for can\u2019t be found. \u00a0This is the classic thing that happens when you type a URL wrong, but this also appears when people on the other side changed the name of the resource and didn\u2019t update their links or refer to the change like considerate people do. <\/span><\/li>\n<\/ul>\n<p class=\"c2\"><strong><span class=\"c9\">500s:<\/span><\/strong><span class=\"c1\"><strong>\u00a0<\/strong>uh-oh! there is something wrong on the server side<\/span><\/p>\n<ul class=\"c16 lst-kix_t7jck1yer0yc-0\">\n<li class=\"c2 c3 c36\"><span class=\"c5\">Example: <\/span><strong><span class=\"c9\">503,<\/span><\/strong><span class=\"c5\">\u00a0service unavailable: might appear when the server is too busy handling requests or is under maintenance, therefore it can\u2019t take requests. <\/span><\/li>\n<\/ul>\n<h2 id=\"h.b22x0oujcej3\" class=\"c11\"><span class=\"ez-toc-section\" id=\"6_Further_readings_and_resources\"><\/span><span class=\"c42\">6. Further readings and resources<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p class=\"c2\"><span class=\"c5\">I hope you have found this guide useful. I just want to end by saying that as a resource exchange protocol, HTTP defines how things<\/span><span class=\"c5 c8\">\u00a0should be,<\/span><span class=\"c1\">\u00a0but in real life developers might not adhere to it and make arbitrary decisions when building their systems. That can be frustrating. If you are planning to work on server side stuff, please try be a nice standards complying fellow and try to play by the rules. The Internet will thank you. <\/span><\/p>\n<p class=\"c2\"><span class=\"c5\">This guide is by no means exhaustive. Below are some sites that I delved into to write this article that you might want to explore on your own: <\/span><\/p>\n<h3 id=\"h.ldnjci9iqhov\" class=\"c17\"><span class=\"ez-toc-section\" id=\"61_Deeper_into_the_HTTP_rabbit_hole\"><\/span><span class=\"c23 c8\">6.1 Deeper into the \u00a0HTTP rabbit hole<\/span><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<ul class=\"c16 lst-kix_yc94q8rs214s-0 start\">\n<li class=\"c2 c13\"><span class=\"c5\">The <\/span><span class=\"c5 c7\"><a class=\"c6\" href=\"https:\/\/www.google.com\/url?q=https:\/\/tools.ietf.org\/html\/rfc2616&amp;sa=D&amp;ust=1513305734117000&amp;usg=AFQjCNHOYIbofjMV2XO1qR3iMnjJ6dCznQ\">HTTP 1.1 Request For Comment (RFC) Document<\/a><\/span><span class=\"c1\">\u00a0is the most comprehensive documentation on this protocol. <\/span><\/li>\n<li class=\"c2 c13\"><span class=\"c5\">All the<\/span><span class=\"c5 c7\"><a class=\"c6\" href=\"https:\/\/www.google.com\/url?q=https:\/\/mdn.mozilla.org\/en-US\/docs\/Web\/HTTP&amp;sa=D&amp;ust=1513305734117000&amp;usg=AFQjCNGJJ3k1bRmuGY0a57Kivq25gA0Dzg\">\u00a0Mozilla Development Network Documentation<\/a><\/span><span class=\"c5\">\u00a0<\/span><span class=\"c5\">has great guides<\/span><span class=\"c1\">\u00a0and is an excellent reference. <\/span><\/li>\n<\/ul>\n<h3 id=\"h.8jhfhk5q1180\" class=\"c17\"><span class=\"ez-toc-section\" id=\"62_HTTP_vs_HTTPS\"><\/span><span class=\"c18 c5 c8\">6.2 HTTP vs HTTPS<\/span><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p class=\"c2\"><span class=\"c5\">When using the HTTP protocol to transfer resources the data going through the cables of the Internet is not secure. The information your browser and a server are exchanging is an open book and a person that has the tools and knowledge to intercept <\/span><span class=\"c5 c7\"><a class=\"c6\" href=\"https:\/\/www.google.com\/url?q=https:\/\/whatisit.tech\/packets\/index.html&amp;sa=D&amp;ust=1513305734118000&amp;usg=AFQjCNFNQtIjC715GvzDlday_NPGJHuh9A\">Internet packets<\/a><\/span><span class=\"c5\">\u00a0(these are the smallest unit of information that travels through the internet) can peek. If you are handling information you don\u2019t want other people to look at HTTPS is the more secure protocol option. <\/span><span class=\"c5 c7\"><a class=\"c6\" href=\"https:\/\/www.google.com\/url?q=http:\/\/www.differencebetween.info\/difference-between-http-and-https&amp;sa=D&amp;ust=1513305734118000&amp;usg=AFQjCNHGfcAaiqp-l9uSMywg0am6xGRsuA\">Here\u2019s a quick comparison between both.<\/a><\/span><\/p>\n<h2 id=\"h.nzyc82g92rc6\" class=\"c11\"><span class=\"ez-toc-section\" id=\"7_Term_Index\"><\/span><span class=\"c42\">7. Term Index<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p class=\"c2\"><span class=\"c5 c7\"><a class=\"c6\" href=\"#id.5dmqaqdg9iic\">Client<\/a><\/span><\/p>\n<p class=\"c2\"><span class=\"c5 c7\"><a class=\"c6\" href=\"#id.br0rmegu337t\">Connection<\/a><\/span><\/p>\n<p class=\"c2\"><span class=\"c5 c7\"><a class=\"c6\" href=\"#id.vz2ldqcabl91\">HTML<\/a><\/span><\/p>\n<p class=\"c2\"><span class=\"c5 c7\"><a class=\"c6\" href=\"#id.rk8p9pk77bu6\">HTTP<\/a><\/span><\/p>\n<p class=\"c2\"><span class=\"c5 c7 c14\"><a class=\"c6\" href=\"#id.zbza9gudwz3n\">Hypertext<\/a><\/span><\/p>\n<p class=\"c2\"><span class=\"c5 c7\"><a class=\"c6\" href=\"#id.wh7h6p2rf3g\">Markup<\/a><\/span><\/p>\n<p class=\"c2\"><span class=\"c5 c7\"><a class=\"c6\" href=\"#id.os5yqw888vts\">Method<\/a><\/span><\/p>\n<p class=\"c2\"><span class=\"c5 c7\"><a class=\"c6\" href=\"#id.6rsjgm9zadph\">Protocol<\/a><\/span><\/p>\n<p class=\"c2\"><span class=\"c5 c7\"><a class=\"c6\" href=\"#id.i7iqrjteko78\">Resource<\/a><\/span><\/p>\n<p class=\"c2\"><span class=\"c5 c7\"><a class=\"c6\" href=\"#id.os5yqw888vts\">Request<\/a><\/span><\/p>\n<p class=\"c2\"><span class=\"c5 c7\"><a class=\"c6\" href=\"#id.s6giribeq4pe\">Response<\/a><\/span><\/p>\n<p class=\"c2\"><span class=\"c5 c7\"><a class=\"c6\" href=\"#id.cawiu339co1i\">Server<\/a><\/span><\/p>\n<p class=\"c2\"><span class=\"c5 c7\"><a class=\"c6\" href=\"#id.ixjid6pjyb77\">Session<\/a><\/span><\/p>\n<p class=\"c2\"><span class=\"c5 c7\"><a class=\"c6\" href=\"#id.4vlderxz0flv\">Tag<\/a><\/span><\/p>\n<p class=\"c2\"><span class=\"c5 c7\"><a class=\"c6\" href=\"#id.vansdfy9817f\">URI<\/a><\/span><\/p>\n<p class=\"c2\"><span class=\"c5 c7\"><a class=\"c6\" href=\"#id.q9zs3hqdm5q4\">URL<\/a><\/span><\/p>\n<p class=\"c2\"><span class=\"c5 c7\"><a class=\"c6\" href=\"#id.clim547fkrji\">URN<\/a><\/span><\/p>\n<p class=\"c2\"><span class=\"c5 c7\"><a class=\"c6\" href=\"#id.nt78p6da1r8l\">User agent<\/a><\/span><\/p>\n<p class=\"c2\"><span class=\"c5 c7\"><a class=\"c6\" href=\"#id.lay4rbjpva8z\">Web browser<\/a><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. HT\u2026 something: HTML and HTTP 2. That which we call a rose is a web resource: URIS, URLs and URNs 3. Overview of the protocol: connection, request and response 4. Asking nicely for content: what client requests look like 5. How the server responds 5.1 Common response status codes 6. Further reading and resources &hellip; <a href=\"https:\/\/itp.nyu.edu\/networks\/explanations\/a-gentle-introduction-to-http\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;A gentle introduction to HTTP&#8221;<\/span><\/a><\/p>\n","protected":false},"author":17,"featured_media":0,"parent":19,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-210","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/itp.nyu.edu\/networks\/wp-json\/wp\/v2\/pages\/210"}],"collection":[{"href":"https:\/\/itp.nyu.edu\/networks\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/itp.nyu.edu\/networks\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/itp.nyu.edu\/networks\/wp-json\/wp\/v2\/users\/17"}],"replies":[{"embeddable":true,"href":"https:\/\/itp.nyu.edu\/networks\/wp-json\/wp\/v2\/comments?post=210"}],"version-history":[{"count":24,"href":"https:\/\/itp.nyu.edu\/networks\/wp-json\/wp\/v2\/pages\/210\/revisions"}],"predecessor-version":[{"id":362,"href":"https:\/\/itp.nyu.edu\/networks\/wp-json\/wp\/v2\/pages\/210\/revisions\/362"}],"up":[{"embeddable":true,"href":"https:\/\/itp.nyu.edu\/networks\/wp-json\/wp\/v2\/pages\/19"}],"wp:attachment":[{"href":"https:\/\/itp.nyu.edu\/networks\/wp-json\/wp\/v2\/media?parent=210"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}