What Happens When You Click a Link? – Computerphile

What Happens When You Click a Link? – Computerphile


that server could be overloaded it’s
having trouble serving out all the data and so you’re making these requests but
it’s just maybe it’s losing the request or it’s something is crashing or
something’s not working ready so you’re not going to get this data back and it
might be in that case of hitting refresh refresh is causing these
requests to be reissued you get lucky and it means that you get your page back
and somebody else doesn’t and so you buy your raffle tickets and somebody else doesn’t you clicked on this URL so what’s gonna happen this kind of
breaks up into in this case about three different components so you’ve got the path in the URL you’ve
got the name domain name tells you which website it is and you got protocol the
schema is called the scheme which is the protocol is going to use this case the
standard protocol HTTP you clicked on that wherever that is it could be an
email could be in a web browser it could be something you’ve tightened by and the
URL bar in your browser whatever it might be you clicked on it
and what’s going to happen as a result of that so what logically speaking of that
there’s a sort of high-level what has to happen is your computer now needs to
make a connection or your phone or whatever might be no need to make a
connection to the server that contains that data and send a request about data
and receive data back again so the first thing it’s going to do is
work out which machine is a need to connect it because this is the internet
things don’t have names that go IP addresses and so it needs to translate
the name which in this case example.com into some IP address so it can actually
get data to the destination because on the routine stuff that we’ve talked
about all that data all those packets are being routed through the network
based on their destination address you’ve got to put a destination address
in the packet and in this case you want to find the destination address the IP
address that corresponds to example.com so you look up the name and
you get the IP address there’s a couple ways this can happen
kind of the communest ones are it might be a statically configured
there’ll be a file on your system called post doc txt or medical side different
things on different systems but it says when you see this name is this address more commonly what will happen is it
will run a protocol called dns stands for the domain name system essentially
what happens with that is that your system before it tries to actually
connect this will construct a request that basically has a question the question will be what is example.com construct that as a request it may be
able to answer that locally so if you’ve made a previous connection to
example.com recently it might be that you already have a
translation to hand and so that your computer is only do anything other than
reuse the same answer but if you’ve never clicked on that
before then it’s going to need to send that request out into the domain name
system to try and get a response back to say what IP address should i connect to
the protocol is quite simple it’s a one-shot is the question what’s
the answer but the service is constructed to operate this is quite
complex there’s a lot of hierarchy in it lots of other service that will be
running in your you make a query to one server which may have to send a query on
to another server which was in turn on the server which eventually will have a
response that can get set back to you but let’s say all that happens and so you get back the answer that
let’s say it’s you know 10.0.0.1 second argument so you now know that to connect to
example.com you have to send packets to the machine with the address 10.0.0.1
to get this answer so then you have to create a connection to you actually go
to connect the machine so you’re going to use a protocol tcp to
do this and what that does is it sets of the connection to this destination and
then allows you to send a request for this path over that connection so the weighty speed works is you’re
going to have let’s say you’ve got your client here the example.com server 10.0.0.1 there so you’re gonna send a packet and replied with a packet you
apply the packet this is called the three-way handshake
these are called syn syn ack ack so synchronize synchronize acknowledged
knowledge and at this point here you create the connection so both sides
now not to the other side exists and is trying to communicate with them and
where they are and how to get there was gonna stop you’ve now got this situation set up
we’ve got a connection so then what happens is he will actually send an HTTP
command over this connection you’ve created by transmitting a packet to the
example.com use this protocol tcp and in that packet let’s say it’s the old version of HTTP 1.0 there will be a command that will
be something like get some path HTTP 1.0 and then it will be a new line
in line we actually used to be command the HTTP
protocol operating here is this get some path HTTP 1.0 your new line and that’s the
HTTP command has been sent and so that gets sent through across this connection
to the server which can then respond with whatever it is that’s associated
with the data so that might be a web page for example and so that web page
might get sent back in a single package might be so big it gets sent in multiple
packets the server interprets this URL this path some path turns into data
somehow the Internet of Things it stuff coming up it might be that what actually
happens there is that your fridge is turned off or washing machine gets turned on
so now you can be anything that happens there and then some data is read the
results from that is sent back to you so in the web 1.0 that would have been a
file will be found in the fastest and sent to you and web 2.0 it’s
much more i said dynamic databases construction of assemblage of multiple
components to construct a page that they get sent back to you in fact it can happen in a kind of x so
this is the case for sending data back responding to this single URL commonly
what happens on the web page you get a web page into your browser having
clicked on a link and that web page won’t be everything that it requires
self-contained it will contain references to other web pages that
contain references comedy to a CSS stylesheet it will contain a reference
to some JavaScript maybe several javascript libraries and so what happens
as a result of this is that lets say this this data comes back here and it
contains other references to some javascript file and it contains a
reference to style.com blast / food . CSS and will
contain more preference like that and then what would have to happen is your
web browser will interpret this as it’s trying to render this page is trying to
put the page open from to you and it will start having to make connections to
each of these sites so that those data comes back my actually cause your
browser to fire a lot more of the sense that yeah and so
in love each of its most available for our it’s a lot of it will be fine but
it’s a neat but each this process would have to be going through each of those
so they’ll have to be a dns resolution of some jas . , and start , whatever the
science there will have to be a TCP handshake that will go out to each of
those sites they will then have to be to get / jas file . jas that will have to
be to get food CSS HTTP 10 http/2 10 and so this simple
act of having clicked on that link could cause many name resolutions to happen
could cause many connections to be set up and it could cause lots of later and
commands to be issued in order to allow your browser to pull together everything
it needs to put that webpage on the screen from to you it doesn’t come
immediately so I click it again and again and again and i think it because
it’s not working does that all happen over and over again with the bird potentially yes it will depend on
exactly how that’s interpreted so it might be that the browser decide
to ignore some of that because already busy it might be that it’s going to reach the
whole thing it might be that it stops what’s been happening early and just
throw it all away and starts again it might be that lets what’s already
happening continue in the background in that hope that that’s going to finish
sooner than the need to click that you just also some of the market
intelligence going on there but generally speaking it might be quicker
to not click again yeah it’s only you need the often you
need to get a little bit of time to respond because it’s a complex page or
the or the internet is busy there’s lots of congestion or the server is busy it’s
overloaded it can take some time to respond on the other hand one of the things that
can happen because of the way these protocols work is in this step in
particular the syn step this initial connection setup fails so that fails
down there that can take a long time for the system to retry that the other thing
is that if this DNS resolution fails it’s not reliable on the protocol
and DNS doesn’t retry for you the application has to request that to
happen all the operating system usually will request that to happen because this
gets initiated usually by your browser of making a function call system called
the operating system to say please could you look up his name for me then the
u.s. will do something background if that fails or that’s
taking too long then again sometimes it might be that
clicking again actually does speed it up because it forces that to happen
sooner so there’s no direct answer to that
literally tell you that’s it because there’s so many different
components in this and you’ve got the whole internet as well as all the other
bag of components it’s complex there’s lots of stuff
happening it’s a complicated system we’d like to thank or double dot com for
sponsoring this computer file video and if you like books get over to
audible.com / computer file for the chance to check out an audio book for
free today would like to recommend Kim’s etters countdown to zero day it’s all
about Stuxnet the worm that sabotage Iran’s nuclear effort and it tells the
story of how it was discovered and how it works to get over to audible.com /
computer file check out countdown to zero day by kim zetter and thanks once
again to audible.com for sponsoring computer file for this video when it was the Pakistan network
operator they tried to inject information into bgp to prevent people
connecting to youtube from within their network but because of the way they did
that that information propagated and it caused lots of other networks to also
fail to be able to connect to youtube

Comments

  1. Post
    Author
  2. Post
    Author
    Myx0

    HTTP/1.1 solves the problem (among others) of having multiple websites sharing a single IP address… The domain name is passed to the server (along with the path), allowing the server to route the request to the correct website.

  3. Post
    Author
  4. Post
    Author
    arthare

    So would be faster to connect to a webpage by directly using the IP instead of the domain name? Or would it just trigger a DNS process asking what 10.0.0.1 is?

  5. Post
    Author
    brian whittle

    It does not happen much these days but waiting for some frigging advert to be downloaded used to hang or slow down the loading of the page, really annoying.

  6. Post
    Author
    Xano Trevisan Kothe

    The background it's even more complex when we talk about highly distribuited systems. At same time we could (programmers, engineers, scients) make it incredibly easy for end user and, of course, highly lucrative for a lot of sectors.

  7. Post
    Author
  8. Post
    Author
    Laetitia Baschenis

    Hello
    I'm French but I do understand English, well most of the time. Expect that in this video, I just couldn't understand everything and I wonder if it's not because of the weird accent or perhaps he just doesn't speak clearly. I don't know. Can someone tell me if I'm just out of my mind, and in this case, I'll see someone, or confirm that he has a strange enunciation ?

  9. Post
    Author
  10. Post
    Author
  11. Post
    Author
    Kantenkugel

    Wouldn't the very first thing be to check the protocol and associate the link with the correct program for a link of that protocol?

  12. Post
    Author
  13. Post
    Author
  14. Post
    Author
  15. Post
    Author
    Grimsteel

    The last step is that the web browser renders the web page.
    It interprets the code and renders the web site as it thinks it's suppose to be. 
    That's why different web sites might look different on different browsers.

  16. Post
    Author
  17. Post
    Author
  18. Post
    Author
  19. Post
    Author
  20. Post
    Author
    Zandonus

    I vaguely remember from a lecture that the syn-ack's are where all sorts of nasty things can potentially happen. Pretending to be someone you're not, the haxxor pretending to be the server, packet loss. 

  21. Post
    Author
  22. Post
    Author
  23. Post
    Author
  24. Post
    Author
    Cyber Monterey

    The whole thing could be explained in 3 minutes. No need to be wordy for the three way handshake… But a nice British accent:)

  25. Post
    Author
  26. Post
    Author
  27. Post
    Author
  28. Post
    Author
  29. Post
    Author
  30. Post
    Author
  31. Post
    Author
    cosmicWill

    I have a question that maybe you guys can answer. Let me explain. If you take a picture of a computer screen with your phone, lines appear on the image( obviously). However, the interesting part is when you zoom in and out of the image the lines begin to move and grow larger and then smaller again. It almost seems like a wave moving across the image. I have tried it on a few different android phones and it always happens. Can anyone explain why its happening? 

  32. Post
    Author
  33. Post
    Author
  34. Post
    Author
    Zantorc

    Except 10.0.0.1 is a private IP so it's a non-routable address – it will never get onto the internet. The 10.X.X.X range is for use on local area networks.

  35. Post
    Author
    Tide

    "It's a complicated system" does imply that it's one system, that is were you're wrong :O ….. Rather make it somewhat more plural as in systems

  36. Post
    Author
  37. Post
    Author
  38. Post
    Author
  39. Post
    Author
    Piotr Bączek

    Hey @Computerphile , maybe you could make a video about Google's material design and it's impact on creating websites? CSS's are cascading stylesheets but with material you can enclose style just to current element with shadow DOM. How is it done?

  40. Post
    Author
  41. Post
    Author
  42. Post
    Author
  43. Post
    Author
  44. Post
    Author
  45. Post
    Author
  46. Post
    Author
    kd1s

    Oh I know how it works – and how to diagnose issues relating to it. When you've been in the I.T.field for as long as I have you tend to know this by rote. 

  47. Post
    Author
  48. Post
    Author
    Neueregel

    Good info. Please, consider asking Dr. Mortier about VPN in the future. He seems very knowledgeable. I have  a hard time understanding how VPN networks work.

  49. Post
    Author
  50. Post
    Author
  51. Post
    Author
  52. Post
    Author
    Toyman Blood

    Just this warning: do not click on a link that has pr0n or shitty music that contains spyware or adware to it. It eats your CPU alive like magic.

  53. Post
    Author
  54. Post
    Author
  55. Post
    Author
  56. Post
    Author
  57. Post
    Author
  58. Post
    Author
    EpsteinsPlasticSurgeon

    This is why we need more SPA's in the browser you have html5 now web developers pick up your app game 😉

  59. Post
    Author
    Manabender

    I just noticed this…

    In google chrome, the URL bar color-codes the URL. The schema is in green, the domain is in black, and the path is in grey.

  60. Post
    Author
    Zhab80

    Hmmm, no mentions of ports anywhere. Kinda important… How does the computer knows that this webpage is meant for the 3rd tab of chrome rather than your 2nd tab of firefox ? Ports.

    How does the computer knows that this url is meant to connect to a webpage server rather than a mail server or a video game server ? Ports.

    By the way… ports is what TCP actually handle. The IP protocol is the one that handle IP address (I guess that is why they are called IP address), You can't get far with just one of these, which is why you usually hear about TCP/IP in pair like that.

  61. Post
    Author
    SevenDeMagnus

    How many combination (or it that permutation?) can those 3 parts makes? Would there be a time when all addresses are taken and there's no combination or permutation that can be made, anymore? Thanks.

  62. Post
    Author
  63. Post
    Author
  64. Post
    Author
    Trevin Beattie

    Of course if the Web site is using any kind of JavaScript on its links, this whole description goes out the window. (Grumble)

  65. Post
    Author
  66. Post
    Author
    outofthebox7

    When I press a link, does the final product (some page) download to my computer, or do I see it on the other person's computer?
    Sorry, I'm learning.

  67. Post
    Author
  68. Post
    Author
  69. Post
    Author
    Ciao!

    What happens if you click on a link in a spam? Can something get installed on your laptop automatically, without your authorization?

  70. Post
    Author
    Slawomir P Wojcik

    When I was telling kids about it I was always using full names: Transfer Control Protocol, Domain Name Server, Hypertext Transfer Protocol. It is easier, much easier, to get the acronym when you know the full name and the meaning, than the other way round. An advantage of a "living" class is, that one can keep pupils involved by asking questions. The easiest and surest thing is to make it graphical: write some pseudo-DNS as a table, have some bits of paper with proper structure as packets. I takes a whole lesson, rather than 9:50, but it is worth it. Kids tends to know it well afterwards. Pity, that due to my convictions I am not allowed to teach any more.

  71. Post
    Author
    Henry Wijaya

    If machine code is dependent on the hardware, why can compiled code be run on any platform with the same OS?

  72. Post
    Author
  73. Post
    Author

Leave a Reply

Your email address will not be published. Required fields are marked *