SPEAKER 1: All right, let's take a look at how the staff solution actually operates, so that you get a sense, first off how the web server's supposed to run, and how you can actually get it running on your own computer. So picture it here. I've already installed in CS50 ID pset6 dot zip, per the specification. I've unzipped it, and I've CDed into my pset6 directory. One of the first things you're going to want to do, especially if you've been using a CS50 IDE to play along with recent lectures, wherein we've been using PHP in CS50 IDE, specifically, using that web server called Apache, whereby you can start and stop it with that command, Apache 50. First, go ahead and type "Apache 50 stop" just to make sure that if you were following along in recent days, and you turned on Apache, you're turning it off in this way by stopping the server. Now, what I'm going to do is exactly what the spec tells me to do. I'm going to go to tilda CS50 slash pset6 slash server, and just hit Enter. You'll notice that I'm yelled at with some usage information, whereby I should be running the program as server with an optional dash p and then a port number, which you can actually leave blank because by default, per the spec, the web server is going to assume that you want port 8080. Meanwhile, you might recall that port 8080 is not really standard, rather port 80 is the number we've talked about being the default for HTTP. Well, turns out that CS50 IDE is simply configured in a way, such that when you with a browser try to visit port 80 from the outside world, it's going to sort of magically port forward, or redirect itself, to port 8080 inside of your server itself. So the last thing here is the command line argument, the path to route. And by that I just mean, what folder do I want to tell the server to use to serve up files? In other words, if the user visits slash, what should he or she see? Well, let's go ahead and run exactly that again, this time specifying that I want the root of my web server to be the public directory, that comes with problem set six distribution code. When I hit Enter, you'll see in yellow here, a reminder as to what folder I'm actually using. In this case, it's a long string, "home ubuntu workspace pset6 public." And that last word is what's key. And then lastly, apparently, my server's now listening on port 8080. What I'm next going to do is recall that in CS50 ID in the top right hand corner of your screen, you're going to see a URL that is ide50-username.cs50.io. And indeed, if you click that, you'll be whisked away to another browser tab, that, in this case, is going to show me the contents of my web servers roots. In other words, the files you see here, cat dot HTML, cat dot JPEG, favicon dot ico, hello dot HTML, hello dot php, and test, are all of the same contents that you would see with LS inside of my public directory. And what's nice is that if I go ahead and click now on cat dot HTML, I see cat dot HTML. And if I click on cat dot JPEG, or hello dot HTML, or even type in my name David, and then click "say hello," you'll see that all of the files work because the staff solution, of course, installed in CS50 ID is fully functional. So it works exactly as your own solution should ultimately work. Meanwhile, if we go back to my terminal window, where I ran the server command, notice what the console has been saying. I see here that the first request that I received was literally get slash cat dot HTML, HTTP version 1.1. And then, in green what the staff solution has done is it's showing me the first line of output that the web server is responding with. In other words, we've already written the code that opens up that virtual envelope, containing that get request. And then we respond to the user but, simultaneously, print to the output screen here HTTP 1.1, 200 OK to confirm what we're putting in the return envelope, so to speak, that we're sending back to the user. And so what's going on here is that in the terminal window, we're running the web server, and, therefore, it's listening for HTTP requests on TCP port 8080. Meanwhile, in my web browser, as I click through each of those files, or even input my name David, and then click Submit, that is my browser talking to the web server. And what the web server's doing, then, in that terminal window is showing me exactly the first line that's been received in a virtual envelope and exactly the first line that's being responded with to that web client.