web fundamentals
DESCRIPTION
Understand the basics of worldwide web and internet. How HTTP works and DNS schemesTRANSCRIPT
Web Fundamentals4th September 2007
WWW, Internet, and other weird stuff
This is not a presentation
• But more of a Discussion
• Maximum questions
• Maximum answers (if possible)
• You are allowed to sleep
• You will get a copy of these slides
• But slides are less important.
• Exercises will be there
What is Internet?
• Internet is a global network of smaller networks.
• Internet is the largest network.• It is owned by NOBODY• Smaller network: 1-1000 computers• Satellites, Submarine Optical cables• Backbone• The biggest name is Cisco
What is (the) Web?
• You mean World Wide Web?
• Collection of interlinked hypertext documents.
• That means Hyperlinked documents
• Hyperlinks?
• URL
HTTP?
• HTTP is an application level protocol for transferring data through WWW.
• Hyper Text Transfer Protocol
• HTTP 0.9 / 1.0 / 1.1 / 1.2
• HTTPS (S for Secure)
• HTML – Header, content.
• They say HTTP is stateless.
DNS
• DNS is like post office
• Some post offices will be knowing some addresses
• DNS servers will have addresses like thiswww.google.com => 64.67.33.200
• Multiple Name servers for reliability
Domain Name
• Netkode.com
• Mail.netkode.net
• Abc.mail.netkode.net
• http://mail.netkode.net/
• http://mail.netkode.net:80/
• http://mail.netkode.net:80/inbox/index.jsp
Port
A simple web request
BrowserName Server
Internet
Web Server
IIS, Apache, Lighttpd etc.
BIND, PowerDNS, djbdns
HTTP Response
DNS Lookup
http://bookmarks.rediff.com/recent/
bookmarks.rediff.com => 210.210.93.86
Cookies
• Comes in different flavors
• Through HTTP Headers
• Persistent Cookie
• Session Cookie
• Secure Cookie
• HTTP Only Cookie
• 3rd Party Cookie
How Cookies work?
2) Response from Web server
3) 2nd request from browser
1) Request from BrowserGET /index.html HTTP/1.1Host: bookmarks.rediff.com
HTTP/1.1 200 OKContent-type: text/html
Set-Cookie: name=value; expires=date; path=/; domain=.rediff.com (content of page)
GET /popular/ HTTP/1.1Host: bookmarks.rediff.comCookie: name=valueAccept: */*
expires=Fri, 31-Dec-2027 23:59:59
Session
• One type of state management mechanism
• A number of continuous request response sequences.
• The key is called SESSIONID
• PHPSESSID, ASPNETSESSIONID, jsessionid, SESSION_ID, mySESSID
GET /popular/ HTTP/1.1Host: bookmarks.rediff.comCookie: PHPSESSID=4dy1q2e3d44c5dj343s3aq9
Moral of the story
• Programming languages are like religions
• All say same things
• Pray to same gods
• Keep up your spirits
Session Security
• Session id is like your browser’s password
• ‘non-guessable’ session id- even you can’t
• Random numbers?
• ‘Yet to solve’ mathematical problem.
• X is your ultra top secret algorithm.
X sessionid
CPU temperature
Current date time
Other junk stuff
Session Security
• And this algorithm can be as simple as MD5 or SHA1
• These are called random hash code
• Irreversible id => pseudo random id
• Irreversible (only theoretically)
Forms
• Method for data transfer from client to server (part of HTTP methods)
• GET and POST
• GET– Through URL– Limited data
• POST – through HTTP Headers– More (complex) data
HTTP Error codes
• 1xx – Informational• 2xx – Success
• 200 OK
• 3xx – Redirection• 304 Not Modified
• 4xx – Client Error• 404 Not Found
• 5xx – Server Error• 500 Server Error
Multi Tier App
DatabaseServer
Application Server
App Server- Biz Logic- Processing- Modifying Data
J2EE, ASP.NET, PHP, RoR, PythonApache/TomCat, IIS, lightTPD MS SQL, MySQL, Oracle
Web Server
Internet
Web Server- Static File Serving- Caching- Proxying Database Server
- Storage of Data- Retrieval- Some Biz logic
Simple Question
• Netkode.com is hosted on 64.64.1.7 IP
• Will http://www.netkode.com» Or
• http://64.64.1.7/ will load the page faster?
Believe me
• 3 Tier Architecture is NOT MVC (Model View Controller)
• Multi tier is an architecture concept
• MVC is a software design concept
• Excuse me. MVC?
MVC
• Presentation – View
• Logic – Controller
• Business Objects - Model
• Which all are valid URLs
http://cnn_india.com/index.asp
https://cnnindia.com:8080/
http://cnnindia.in/news 2007.asp
http://wwww.cnn-india.co.in/
More Questions?
Thank You