Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I was wondering what happens when we type a url like http://www.mydomain.com ? How does it know where to go to get the pages of mydomain.com? How does all this happen?

share|improve this question

migrated from serverfault.com Jan 6 '12 at 12:16

This question came from our site for professional system and network administrators.

    
Why the downovtes? It's a very basic question but I don't see anything particularly wrong with it. –  kce Jan 6 '12 at 8:30
1  
I didn't downvote it, but it's not clear how much detail the OP wants (and whether they even know that this is a very wide open question). Do the just want an explanation of DNS? Routing? TCP? –  nickgrim Jan 6 '12 at 11:25
add comment

1 Answer

An URL is just an address, a reference. So here is how it is happening:

  1. the user enters the URL in the browser. This is handled by the keyboard driver that will send keyboard events to the browser, that will respond by updating the address bar with the typed characters
  2. the browser parse the URL in various parts as defined by RFC 3986
  3. the browser select the host part and it will use the internal resolver library to find the IP address. The most used resolver is DNS. For this the resolver library that is mapped inside the application will make a UDP request on port 53 on the DNS server configured for the client machine. The DNS server will search for the request in the internal cache and if it is expired or missing it will make a recursive request trying to find the address.
  4. the browser connects to the HTTP server on the default port (TCP/80).
  5. the browser sends a GET request and specifies also a HOST header as per HTTP/1.1 see RFC 2616
  6. the http server will parse the request and dispatch the request to the virtual host specified in the request
  7. the application return the generated content (usually a HTML) to the browser
  8. the browser parse the result, generate some JavaScript/DOM events, and renders the page (e.g. Gecko engine in FireFox).

This is a very very condensed explication. I do not speak about SSL, compression, language and character encoding negotiation, authentication, CGI, pipe-lining and keep-alives.

share|improve this answer
    
isnt there any role of DNS and ISP in it? –  OM The Eternity Jan 6 '12 at 5:43
    
DNS is, usually, used by resolver library for gethostbyname() call to translate from hostnames to IP addresses. –  Mircea Vutcovici Jan 6 '12 at 5:54
    
ISP is used on the OSI layers bellow TCP. –  Mircea Vutcovici Jan 6 '12 at 5:55
    
To understand what is happening use a network sniffer like Wireshark and a HTTP debug proxy like Fiddler –  Mircea Vutcovici Jan 6 '12 at 5:57
    
I downvoted this. It's a detailed answer, but I don't think it's an answer to what the OP's actually asking. It seems like the OP's after an explanation of DNS and you sort of skipped over that in your step 3. –  nickgrim Jan 6 '12 at 11:24
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.