Its been a long time since i have posted something here, owing to the fact that I was busy in the monotonous work.
Anycase, todays topic is how the browser works, I am amazed at how many people take it for granted and don't really understand the basics behind it,
Like the way I like it, lets start with some practical stuff then I will explain what we did in the exercise.
This is what you need , (Assuming you are reading this, you will have them)
1. PC connected to the Internet directly, without using a Explicit proxy (Transparent Proxies are ok),
How to Check:
If you don't know if your PC is proxied or not, a good way to check is your Internet Explorer, Go to Tools --> Internet Options --> Connections
Click on the LAN Settings button, Make sure there is nothing checked, if you are able to browse internet, means you either have no proxy or a transparent proxy (Both are OK)
If you use Linux, you might already know how to do it ... But here is the way anyway, get into the terminal and type the command
2. A command line agent which has telnet enabled, If you are on windows vista or 7, you may not have it.
How to check:
Start --> Run
Type the command "cmd" (Without quotes) The command prompt opens, type telnet and hit the enter button, if you get a "Microsoft Telnet" then you are fine
All the linux terminals have telnet clients (Unless you explicitly removed it), so if you running linux, you are ok
In windows Vista and 7, here is how you install it, Go to Control Panel --> Add remove Programs, Click on the Add remove Windows Components and select the Telnet client and click on Ok, it will install the client for you
Well, Thats it .... for HTTP command line testing you need thats all
Lets start with a simple google page download trick, so you see what your browser does
Open the terminal
type the following
telnet www.google.co.in 80
Now if you get a Blank screen in windows (and the prompt will request for more input in linux)
type the following
GET / HTTP/1.1
(Hit Enter 2 times)
Also, if you are on Windows, you wont see what you are typing, thats ok ... Once you do, the terminal will spit html codes on your screen... Cool!!!
Now let us see what we did... We mimic the browser in the way it works.
OK, Now having seen the practical example, lets go to the theory how it works and before I start, I also want you to notice one more thing, when you type the "google.co.in" in the browser, see what it becomes.
It changes into http://google.co.in/ (Please note that in this whole example I am using the google.co.in and not the .com, because we haven't spoken about redirection yet)
this full thing (http://google.co.in/) is called the URL or the Uniform Resource Locator, This address has 3 parts to it.
http:// -- This is the protocol that the resource needs to be accessed on
google.co.in -- Host name of the resource
/ -- The Trailing "/" is the URI (Uniform Resource Identifier)
If you don't mention anything, it will automatically append the "/" as that symbolizes the root directory of the web server.
The first part is important, we have different ways to access resources like,
http:// (Unencrypted Hyper Text Transfer Protocol)
https:// (Secure HTTP - Encrypted)
ftp:// (File Transfer Protocol)
ftps:// (Secure FTP)
telnet:// (Tel Networking)
so on and so forth. The most used ones by an average Internet user are the the first 3 in the line.
Each protocol has its own access methods, (Mental Note : STOP Digressing)
As far as HTTP is concerned, there are 2 important methods GET and POST. GET is the most used, for fetching of web pages. POST is used to, well ... POST variables out to the web server (Like Credit Card Information when you are purchasing some thing, etc)
ok, having said this, Lets analyse what we did first ...
"telnet www.google.co.in 80", In this we just connected to the Web Server on port 80. Even there was some fundamental behind it, the www.google.co.in is referenced on the internet by an IP address, so the telnet program, went ahead and did a DNS lookup and found the IP address and then connected to the IP on port 80 (which is the default http port)
Once it was connected, it waited for us to give some commands to it, Now since we have already connected to the google server, all we need to do is ask for some thing and that is what we did in the next line
GET / HTTP/1.1
This means, we said, GET me the "/" page and use the HTTP1.1 Standard (More on this on some other post)
Next we said,
Where we set our header that we said, we are trying to access for google.co.in server (This was not needed in the HTTP1.0 standard, but more on that later)
Then we said
Meaning, please close the connection to the server after you have downloaded the page. The Server then goes ahead and gives us the HTML code , with a header.
Our browser renders that html and shows us the beautiful pages that we see.
So, these are the steps that a browser does in the back ground when we hit one site, not to go through the links and download pictures and stuff.
In practicality, here is what happens
1. Browser checks if there is a Proxy Server (If No Proceed Below steps else go to the proxy steps)
2. Do a DNS lookup on the Name and get an IP address
3. Connect to the IP on the port 80
4. Request a page
5. Display the page with its components
(Its actually more complicated than this, but this is the basic ides), so if the internet is not working, how would you test ... do the same thing in the local order
Note: If using the Proxy server, then this wont apply
Step1 : Check if the Computer has an IP addresss
go to the command prompt and type the command ipconfig /all
Make sure you have a VALID IP, not 169.x or 127.x
Make sure you have DNS server IP address
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Dell Wireless 1397 WLAN Mini-Card
Physical Address. . . . . . . . . : F0-7B-CB-89-14-CC
Dhcp Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
IP Address. . . . . . . . . . . . : 192.168.0.109
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.0.1
DHCP Server . . . . . . . . . . . : 192.168.0.1
DNS Servers . . . . . . . . . . . :22.214.171.124
Lease Obtained. . . . . . . . . . : Sunday, November 21, 2010 6:46:27 PM
Lease Expires . . . . . . . . . . : Monday, November 22, 2010 6:46:27 PM
You can see I have an IP address, if this is a problem, then the problem is with DHCP server or Static IP
Ok, now that out of the way, check if the DNS Server is working
from the command prompt, execute the command
You should get an IP address of google.com
C:\> nslookup google.com
Addresses: 126.96.36.199, 188.8.131.52, 184.108.40.206, 220.127.116.11
In this case, your IE should be able to get to the site, if still not happening, do the telnet test, if that works, there is some problem with IE settings.
Well, I assume, you understood, the basics behind how a simple website is pulled by our browser.
Next Post ... HTTPS Troubleshooting ... Advanced