Welcome back. Let's talk about what happens behind
the scenes when your browser fetches data from a remote server.
The particular way that we're going to be most interested in having
one computer talks to another is using the HTTP protocol.
So that's when we have a URL that begins
http://www.si.umich.edu and maybe something after the slash.
The first thing that's going to happen,
is my computer is going to take this domain name
www.si.umich.edu convert it into an IP address as I illustrated a minute ago.
Then my computer makes a connection to the remote computer.
If I were using HTTPS,
that's the secure version,
then the first thing that my computer would do was send some information back and
forth to the si.umich.edu server that
would establish encryption keys so that all of
the rest of the communication would be encrypted
and nobody who intercepted that
communication would be able to figure out what we were saying to each other.
After that setup has happened,
now my browser will start to send messages and it will actually send text,
it'll send the word G-E-T,
GET and then it'll send whatever arguments were after the slash.
So it will say what path we're looking for,
it will also send some headers saying things like,
hey I'm a Chrome browser or I'm an Internet Explorer browser,
the current time is certain time,
it'll give a time stamp and a few other headers,
we will then receive back from that server some response headers.
Those response headers will say things like,
I'm sending you HTML and
the current timestamp is such and such and there are a few others,
I'm going to show you this in a minute.
Then most importantly, si.umich.edu is going to send me some HTML,
and that HTML my browser is going to take and turn it into
what we are used to seeing in a browser, a webpage.
So the browser renders that HTML.
Let's take a look and see what this looks like for the umich.edu website.
Here, I have a webpage open in my browser,
the URL is https://www.si.umich.edu,
and you can see that it's all pretty on the screen,
but what's really happening in the background?
What's happening in the background,
I'm using the Chrome debugger tool and I've got it set up to
show us that when I made that request,
my browser opened a connection and the first thing it did was that it made a GET request.
And this is the full URL that it asked for.
We can see all of the request headers.
So we asked for a GET,
we sent the path was just slash because I didn't have anything after the slash.
If I had asked for a particular page,
then we would see something more in the path down here.
The scheme or protocol was HTTPS,
then there's a whole bunch of other things that we won't go into.
The user agent was compatible with all of these things,
it's actually the Chrome browser that I'm using.
So these are all things that my browser sent to
the server and the server responded by sending back a whole bunch of response headers,
there's the timestamp of when it sent it back,
there's various things here including,
I can see a little information that the website is powered by PHP as
its backend and the content type is text/html in the UTF-8 encoding and so on.
So these are all things that my browser uses and
then the most important stuff that we got back was actually all of this HTML.
And all of this stuff got sent back and the browser managed to parse all of this,
this is just text.
This text is not what's normally shown on the webpage,
was shown on the webpage is this very thing
and that's the browser rendering all of that HTML.
If you don't know how to use the Chrome debugger,
it can be a little confusing but if you just want to see what the HTML is for any page,
you can do a Right click and you
Page Source and see all of that stuff that got sent back from the server.
So to summarize, when your browser fetches data from a remote web server,
it makes a connection,
it sends a few headers and asks for the path,
the arguments that it would like to receive,
it gets back some headers and especially it gets back HTML which
your browser renders and makes a pretty web page out of. See you next time.