Web Fundamentals

23
Web Fundamentals 4 th September 2007 WWW, Internet, and other weird stuff

description

Understand the basics of worldwide web and internet. How HTTP works and DNS schemes

Transcript of Web Fundamentals

Page 1: Web Fundamentals

Web Fundamentals4th September 2007

WWW, Internet, and other weird stuff

Page 2: Web Fundamentals

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

Page 3: Web Fundamentals

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

Page 4: Web Fundamentals

What is (the) Web?

• You mean World Wide Web?

• Collection of interlinked hypertext documents.

• That means Hyperlinked documents

• Hyperlinks?

• URL

Page 5: Web Fundamentals

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.

Page 6: Web Fundamentals

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

Page 7: Web Fundamentals

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

Page 8: Web Fundamentals

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

Page 9: Web Fundamentals

Cookies

• Comes in different flavors

• Through HTTP Headers

• Persistent Cookie

• Session Cookie

• Secure Cookie

• HTTP Only Cookie

• 3rd Party Cookie

Page 10: Web Fundamentals

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

Page 11: Web Fundamentals

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

Page 12: Web Fundamentals

Moral of the story

• Programming languages are like religions

• All say same things

• Pray to same gods

• Keep up your spirits

Page 13: Web Fundamentals

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

Page 14: Web Fundamentals

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)

Page 15: Web Fundamentals

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

Page 16: Web Fundamentals

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

Page 17: Web Fundamentals

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

Page 18: Web Fundamentals

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?

Page 19: Web Fundamentals

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?

Page 20: Web Fundamentals

MVC

• Presentation – View

• Logic – Controller

• Business Objects - Model

Page 21: Web Fundamentals

• 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/

Page 22: Web Fundamentals

More Questions?

Page 23: Web Fundamentals

Thank You