Friday, September 23, 2011

Http protocol explained 1

All internet structure is build on two protocols: Tcp/ip and upd. Last one by itself don't ensure connection integrity, so it isn't used very often. There are many libraries for data sending over internet using TPC/IP, so I don't discus it in details. TCP/IP basics is as follows:


1. client opens socket and sends connection initiation data to server
2. server opens connection socket and keeps it open for specific ip
3. client and server exchange data
4. client or server sends connection closing string
5. client and server closes socket


Talking about http protocols, they uses TPC/IP for every byte exchange. And best part of it - all data is human readable... Like bigger part of all, non-encripted, higher level internet protocols. Don't believe? Just take any telnet terminal, connect to google.com using port 80 hit <enter>, type "GET /index.html" without coutes and hit enter again.
You should get response similar to this:


GET index.html
HTTP/1.0 302 Found
Location: http://www.google.com/
Cache-Control: private
Content-Type: text/html; charset=UTF-8
X-Content-Type-Options: nosniff
Date: Fri, 23 Sep 2011 16:34:11 GMT
Server: sffe
Content-Length: 219
X-XSS-Protection: 1; mode=block
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
                                                                              <T
ITLE>302 Moved</TITLE></HEAD><BODY>
                                   <H1>302 Moved</H1>
                                                     The document has moved
                                                                           <A HR
EF="http://www.google.com/">here</A>.
</BODY></HTML>

section between <HTML> and </HTML> looks familiar? rest of data is html headers

No comments:

Post a Comment