1 00:00:00,000 --> 00:00:05,294 [MUSIC PLAYING] 2 00:00:05,294 --> 00:00:07,210 DAVID MALAN: So it's after warriors of the net 3 00:00:07,210 --> 00:00:09,820 we have to go back in and clean it up the explanation of how 4 00:00:09,820 --> 00:00:10,900 the internet works. 5 00:00:10,900 --> 00:00:15,190 But we actually talk in CS50 more about HTTP 6 00:00:15,190 --> 00:00:17,390 as a representative protocol than about TCP/IP. 7 00:00:17,390 --> 00:00:19,330 Even though with the whole set up is about home networking 8 00:00:19,330 --> 00:00:20,500 and how the internet works. 9 00:00:20,500 --> 00:00:24,460 HTTP is really where we bring the conversation back to application layer 10 00:00:24,460 --> 00:00:25,030 programming. 11 00:00:25,030 --> 00:00:25,980 DOUG LLOYD: Right. 12 00:00:25,980 --> 00:00:28,570 DAVID MALAN: For the web, in this case and indeed with HTTP. 13 00:00:28,570 --> 00:00:31,094 We have an opportunity to talk about what a protocol is. 14 00:00:31,094 --> 00:00:33,010 The example I always give, if you'll humor me. 15 00:00:33,010 --> 00:00:34,740 Is, hello, nice to meet you. 16 00:00:34,740 --> 00:00:36,281 DOUG LLOYD: Nice to meet you as well. 17 00:00:36,281 --> 00:00:39,169 DAVID MALAN: And you acknowledge that initiative of a protocol 18 00:00:39,169 --> 00:00:40,210 that I just commenced in. 19 00:00:40,210 --> 00:00:43,060 And silly little human tradition, but it's an example of a protocol. 20 00:00:43,060 --> 00:00:43,810 I extend my hand. 21 00:00:43,810 --> 00:00:44,518 You extend yours. 22 00:00:44,518 --> 00:00:45,130 We shake. 23 00:00:45,130 --> 00:00:46,060 Transaction complete. 24 00:00:46,060 --> 00:00:50,620 So not unlike the TCP, pun intended, three way handshake. 25 00:00:50,620 --> 00:00:52,750 But with HTTP/2, we have some opportunities 26 00:00:52,750 --> 00:00:54,370 to discuss what it really is. 27 00:00:54,370 --> 00:00:57,430 And even though it is a protocol, which is fancy sounding. 28 00:00:57,430 --> 00:01:01,780 We try to help students realize that it's just textual messages inside 29 00:01:01,780 --> 00:01:03,516 of a virtual envelope, if you will. 30 00:01:03,516 --> 00:01:05,349 And one of the demonstrations we'll often do 31 00:01:05,349 --> 00:01:07,406 is take out an envelope and some sheets of paper. 32 00:01:07,406 --> 00:01:08,530 Write the messages on them. 33 00:01:08,530 --> 00:01:09,640 Put them inside. 34 00:01:09,640 --> 00:01:12,340 And if you really want to go down that road. 35 00:01:12,340 --> 00:01:17,190 You can start talking about how the HTTP packet is inside of the TCP packet, 36 00:01:17,190 --> 00:01:19,060 is inside of the IP packet, and so forth. 37 00:01:19,060 --> 00:01:20,110 All the way down to that. 38 00:01:20,110 --> 00:01:21,130 DOUG LLOYD: You can actually take a picture 39 00:01:21,130 --> 00:01:22,737 and cut it up into different pieces. 40 00:01:22,737 --> 00:01:23,570 [INTERPOSING VOICES] 41 00:01:23,570 --> 00:01:25,520 DOUG LLOYD: TCP reassemble it later on. 42 00:01:25,520 --> 00:01:27,190 DAVID MALAN: Indeed. 43 00:01:27,190 --> 00:01:30,250 DOUG LLOYD: Is there a reason that you wanted 44 00:01:30,250 --> 00:01:36,430 to focus on the Hypertext Transfer Protocol as opposed to SMTP, so email? 45 00:01:36,430 --> 00:01:38,797 I guess HTTP is familiar to students. 46 00:01:38,797 --> 00:01:40,630 DAVID MALAN: I'm just more familiar, indeed. 47 00:01:40,630 --> 00:01:47,659 Most people assume or equate the web with the internet. 48 00:01:47,659 --> 00:01:50,200 Even though there are certainly any number of other services. 49 00:01:50,200 --> 00:01:52,060 Like SMTP and email more generally. 50 00:01:52,060 --> 00:01:54,190 So HTTP is also the domain in which we're going 51 00:01:54,190 --> 00:01:56,680 to be playing with web programming. 52 00:01:56,680 --> 00:01:58,389 And so it just seems to make sense there. 53 00:01:58,389 --> 00:02:00,305 And students have seen it in various contexts. 54 00:02:00,305 --> 00:02:02,620 Sometimes you see cryptic looking things in the URL. 55 00:02:02,620 --> 00:02:03,580 Sometimes you don't. 56 00:02:03,580 --> 00:02:06,607 Sometimes the browser warns you that you're about to resubmit a form. 57 00:02:06,607 --> 00:02:08,440 So there's a lot of ways now to tie together 58 00:02:08,440 --> 00:02:10,120 things they've seen in the real world. 59 00:02:10,120 --> 00:02:12,520 And actually explain what's going on technologically. 60 00:02:12,520 --> 00:02:13,520 DOUG LLOYD: That's fair. 61 00:02:13,520 --> 00:02:15,940 You don't get those sort of error messages or visual cues 62 00:02:15,940 --> 00:02:18,764 from SMTP or something. 63 00:02:18,764 --> 00:02:20,680 DAVID MALAN: [INAUDIBLE] And this is nice too. 64 00:02:20,680 --> 00:02:23,920 Even though we throw away some of the more distracting HTTP headers. 65 00:02:23,920 --> 00:02:26,545 You can start to wrap your mind around these kinds of messages. 66 00:02:26,545 --> 00:02:28,660 And understand what it is that's going on. 67 00:02:28,660 --> 00:02:31,874 DOUG LLOYD: And it's not all that arcane to get. 68 00:02:31,874 --> 00:02:33,790 That's pretty intuitive what it's going to do. 69 00:02:33,790 --> 00:02:34,930 Yeah. 70 00:02:34,930 --> 00:02:36,317 DAVID MALAN: Indeed. 71 00:02:36,317 --> 00:02:39,400 And what's nice too is because once we start to reveal a few more headers. 72 00:02:39,400 --> 00:02:41,470 Like the set cookie or the cookie headers, 73 00:02:41,470 --> 00:02:45,690 can we discuss how you can build on top of an otherwise stateless protocol 74 00:02:45,690 --> 00:02:46,540 state. 75 00:02:46,540 --> 00:02:50,260 And then we can also talk about security, session hijacking, 76 00:02:50,260 --> 00:02:51,190 or theft of cookies. 77 00:02:51,190 --> 00:02:53,720 And why encryption in HTTPS is a good thing. 78 00:02:53,720 --> 00:02:55,990 Which brings us back then to week 2 and our discussion 79 00:02:55,990 --> 00:02:59,110 early on of cryptography, albeit with a more sophisticated cipher 80 00:02:59,110 --> 00:02:59,720 at this point. 81 00:02:59,720 --> 00:03:02,590 So there's a lot of nice intersections with topics 82 00:03:02,590 --> 00:03:05,870 past that this allows us to revisit and then go beyond. 83 00:03:05,870 --> 00:03:08,590 DOUG LLOYD: And one other great thing about the fact that we do 84 00:03:08,590 --> 00:03:11,500 take a look at HTTP headers. 85 00:03:11,500 --> 00:03:13,960 Is it gives us a chance to take a look in Chrome, 86 00:03:13,960 --> 00:03:15,460 the Chrome console of the Inspector. 87 00:03:15,460 --> 00:03:18,910 Which students will then later use in particular with JavaScript. 88 00:03:18,910 --> 00:03:22,134 So it gives them a sense of that tool that's been baked into their browser. 89 00:03:22,134 --> 00:03:24,300 That they might not have had a chance to use before. 90 00:03:24,300 --> 00:03:25,483 DAVID MALAN: Indeed. 91 00:03:25,483 --> 00:03:25,983