WWW, HTTP, GET, POST, Cookies Svetlin Nakov Telerik Corporation

Slides:



Advertisements
Similar presentations
World Wide Web Basics Original version by Carolyn Watters (Dalhousie U. Computer Science)
Advertisements

HTTP HyperText Transfer Protocol. HTTP Uses TCP as its underlying transport protocol Uses port 80 Stateless protocol (i.e. HTTP Server maintains no information.
HTTP Hypertext Transfer Protocol. HTTP messages HTTP is the language that web clients and web servers use to talk to each other –HTTP is largely “under.
How the web works: HTTP and CGI explained
World Wide Web1 Applications World Wide Web. 2 Introduction What is hypertext model? Use of hypertext in World Wide Web (WWW) – HTML. WWW client-server.
TCP/IP Protocol Suite 1 Chapter 22 Upon completion you will be able to: World Wide Web: HTTP Know how HTTP accesses data on the WWW Objectives.
Introduction to HTML 2006 CIS101. What is the Internet? Global network of computers that are connected and communicate via a series of Protocols Protocols.
The World Wide Web and the Internet Dr Jim Briggs 1WUCM1.
Chapter 2 Application Layer Computer Networking: A Top Down Approach Featuring the Internet, 3 rd edition. Jim Kurose, Keith Ross Addison-Wesley, July.
Web, HTTP and Web Caching
HTTP Overview Vijayan Sugumaran School of Business Administration Oakland University.
2/9/2004 Web and HTTP February 9, /9/2004 Assignments Due – Reading and Warmup Work on Message of the Day.
Hypertext Transport Protocol CS Dick Steflik.
Client, Server, HTTP, IP Address, Domain Name. Client-Server Model Client Bob Yahoo Server yahoo.com/finance.html A text file named finance.html.
 What is it ? What is it ?  URI,URN,URL URI,URN,URL  HTTP – methods HTTP – methods  HTTP Request Packets HTTP Request Packets  HTTP Request Headers.
Rensselaer Polytechnic Institute CSC-432 – Operating Systems David Goldschmidt, Ph.D.
Human-Computer Interface Course 5. ISPs and Internet connection.
1 HTML and CGI Scripting CSC8304 – Computing Environments for Bioinformatics - Lecture 10.
WWW, HTTP, AJAX, JSONP Nikolay Kostov Telerik Software Academy Senior Software Developer and Trainer
Network Applications Outline Simple Mail Transfer Protocol
FTP (File Transfer Protocol) & Telnet
Simple Web Services. Internet Basics The Internet is based on a communication protocol named TCP (Transmission Control Protocol) TCP allows programs running.
Mail (smtp), VoIP (sip, rtp)
HyperText Transfer Protocol (HTTP).  HTTP is the protocol that supports communication between web browsers and web servers.  A “Web Server” is a HTTP.
CSC 2720 Building Web Applications Getting and Setting HTTP Headers (With PHP Examples)
CP476 Internet Computing Lecture 5 : HTTP, WWW and URL 1 Lecture 5. WWW, HTTP and URL Objective: to review the concepts of WWW to understand how HTTP works.
TCP/IP Protocol Suite 1 Chapter 22 Upon completion you will be able to: World Wide Web: HTTP Understand the components of a browser and a server Understand.
2: Application Layer1 CS 4244: Internet Software Development Dr. Eli Tilevich.
Application Layer 2 Figures from Kurose and Ross
Rensselaer Polytechnic Institute Shivkumar Kalvanaraman, Biplab Sikdar 1 The Web: the http protocol http: hypertext transfer protocol Web’s application.
Maryam Elahi University of Calgary – CPSC 441.  HTTP stands for Hypertext Transfer Protocol.  Used to deliver virtually all files and other data (collectively.
HTTP, AJAX and REST How HTTP and Web Services Work? SoftUni Team Technical Trainers Software University
© Janice Regan, CMPT 128, Jan 2007 CMPT 371 Data Communications and Networking HTTP 0.
Copyright (c) 2010, Dr. Kuanchin Chen1 The Client-Server Architecture of the WWW Dr. Kuanchin Chen.
The HTTP Protocol HTTP, Requests, Responses, Forms, MIME, Caching, Redirects SoftUni Team Technical Trainers Software University
1 Welcome to CSC 301 Web Programming Charles Frank.
CS 6401 The World Wide Web Outline Background Structure Protocols.
1 HTTP EECS 325/425, Fall 2005 September Chapter 2: Application layer r 2.1 Principles of network applications m app architectures m app requirements.
HTTP1 Hypertext Transfer Protocol (HTTP) After this lecture, you should be able to:  Know how Web Browsers and Web Servers communicate via HTTP Protocol.
WWW, HTTP, AJAX, JSONP Learning & Development Team Telerik Software Academy.
CIS679: Lecture 13 r Review of Last Lecture r More on HTTP.
1-1 HTTP request message GET /somedir/page.html HTTP/1.1 Host: User-agent: Mozilla/4.0 Connection: close Accept-language:fr request.
World Wide Web “WWW”, "Web" or "W3". World Wide Web “WWW”, "Web" or "W3"
Part 2 – WWW and HTTP Nikolay Kostov Telerik Corporation
Appendix E: Overview of HTTP ©SoftMoore ConsultingSlide 1.
1 WWW. 2 World Wide Web Major application protocol used on the Internet Simple interface Two concepts –Point –Click.
Operating Systems Lesson 12. HTTP vs HTML HTML: hypertext markup language ◦ Definitions of tags that are added to Web documents to control their appearance.
2: Application Layer 1 Chapter 2: Application layer r 2.1 Principles of network applications  app architectures  app requirements r 2.2 Web and HTTP.
CITA 310 Section 2 HTTP (Selected Topics from Textbook Chapter 6)
Web Technologies Lecture 1 The Internet and HTTP.
HTTP Here, we examine the hypertext transfer protocol (http) – originally introduced around 1990 but not standardized until 1997 (version 1.0) – protocol.
Module: Software Engineering of Web Applications Chapter 2: Technologies 1.
Web Services. 2 Internet Collection of physically interconnected computers. Messages decomposed into packets. Packets transmitted from source to destination.
27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Internet Applications (Cont’d) Basic Internet Applications – World Wide Web (WWW) Browser Architecture Static Documents Dynamic Documents Active Documents.
CS 6401 The World Wide Web Outline Background Structure Protocols.
Overview of Servlets and JSP
Data Communications and Computer Networks Chapter 2 CS 3830 Lecture 7 Omar Meqdadi Department of Computer Science and Software Engineering University of.
COMP2322 Lab 2 HTTP Steven Lee Jan. 29, HTTP Hypertext Transfer Protocol Web’s application layer protocol Client/server model – Client (browser):
WWW and HTTP Nikolay Kostov Telerik Software Academy Senior Software Developer and Trainer
Application Layer 2-1 Chapter 2 Application Layer Computer Networking: A Top Down Approach 6 th edition Jim Kurose, Keith Ross Addison-Wesley March 2012.
Simple Web Services. Internet Basics The Internet is based on a communication protocol named TCP (Transmission Control Protocol) TCP allows programs running.
INTRODUCTION Dr Mohd Soperi Mohd Zahid Semester /16.
© Janice Regan, CMPT 128, Jan 2007 CMPT 371 Data Communications and Networking HTTP 0.
Fiddler and Your Website Robert Boedigheimer. About Me Web developer since 1995 Columnist for aspalliance.com Pluralsight Author 3 rd Degree Black Belt,
HTML Forms, HTTP Request & HTTP Response
HTTP – An overview.
Web Technologies HTTP, Servers, Clients SoftUni Team
CSCI-351 Data communication and Networks
Presentation transcript:

WWW, HTTP, GET, POST, Cookies Svetlin Nakov Telerik Corporation

 WWW and the HTTP protocol  The HTTP protocol  The request-response model  GET vs. POST methods  HTTP Response Codes  Cookies  Web Development Tools 2

HTTP Protocol: the Heart of the WWW

 WWW = World Wide Web = Web  Global distributed information system in Internet  A service in Internet (like , DNS,...)  Consists of set of documents (and other resources) located on different Internet servers  Accessed through standard protocols like HTTP, HTTPS and FTP by their URL  Web servers provide Web content  Web browsers display the Web content 4

 Structural components  Internet – provides data transfer channels over the TCP and HTTP protocols  Clients (Web browsers) – display Web content  Web servers – IIS, Apache, Tomcat, GWS, etc.  Semantic components  Hyper Text Transfer Protocol (HTTP)  Hyper Text Markup Language (HTML)  Uniform Resource Locator (URL)  Uniform Resource Identifiers (URIs) 5

 Clients use Web browser application to request resources from the Web servers via HTTP  Resources have unique URL address  Servers send the requested resource as a response  Or reply with an error message  Web pages are resources in WWW  HTML text, graphics, animations and other files  Web sites  Web sites are sets of Web pages in WWW 6

 Client’s browser renders Web pages returned by the Web servers  Pages are in HTML (Hyper Text Markup Language)  Browsers shows the text, graphics, sounds, etc.  HTML pages contain hyperlinks to other pages  The entire WWW system runs over standard networking protocols  TCP, DNS, HTTP, FTP, …  The HTTP protocol is fundamental for WWW 7

 Uniform Resource Locator (URL)  Unique resource location in WWW, e.g.  It is just a formatted string, consisting of:  Protocol for communicating with the server (e.g., http, ftp, https,...)  Name of the server or IP address + optional port (e.g. mail.bg:8080 )  Path and name of the resource (e.g. index.php )  Parameters (optional, e.g. ?id=27&lang=en ) 8

 URLs are encoded according RFC 1738 :  All other characters are escaped with the formula:  Example: space has decimal code 32, in hex – 20, so space in URL becomes %20  Space can also be encoded as " + " 9 “... Only alphanumeric [0-9a-zA-Z], the special characters $-_.+!*'() and reserved characters used for their reserved purposes may be used unencoded within an URL.” %[character hex code in ISO-Latin character set]

 Some valid URLs:  Some invalid URLs: 10 UTF-8&rlz=1T4GGLL_enBG369BG369&q=http+get+vs+post %D0%B5%D1%80%D0%B8%D0%B Should be: ?q=C%23+.NET Should be: ?q=%D0%B1%D0%B8%D1%80%D0%B0

 Hyper Text Markup Language (HTML)  Notation for describing formatted text with images and hyperlinks  Interpreted and displayed by the Web browsers  A Web (HTML) page consists of:  HTML file  CSS stylesheet file (optional)  A bunch of images (optional)  Other resources (optional) 11

 HTML is straight-forward and easy to learn  HTML documents are plain text files  Easy to add formatting, hyperlinks, bullets, etc.  Images can be added as separate files  Can be automatically generated by authoring programs  Tools to help users creating HTML pages  E.g. FrontPage, Dreamweaver, Visual Studio  WYSIWYG HTML editors 12

13 <html> HTML Example HTML Example Heading 1 Heading 1 Sub heading 2 Sub heading 2 Sub heading 3 Sub heading 3 This is my first paragraph This is my first paragraph This is my second paragraph This is my second paragraph <div align="center" <div align="center" style="background:skyblue"> style="background:skyblue"> This is a div This is a div </html>

 Hyper Text Transfer Protocol (HTTP)  Client-server protocol for transferring Web resources (HTML files, images, styles, etc.)  Important properties of HTTP  Request-response model  Text-based format  Relies on a unique resource URLs  Provides resource metadata (e.g. encoding)  Stateless (cookies can overcome this) 14

How HTTP Works?

 Client program  Running on end host  E.g. Web browser  Requests a resource  Server program  Running at the server  E.g. Web server  Provides resources GET /index.html HTTP/1.0 HTTP/ OK "Welcome to our Web site!" 16

GET /academy/about.aspx HTTP/1.1 Host: User-Agent: Mozilla/5.0 <CRLF> 17 HTTP/ OK Date: Mon, 5 Jul :09:03 GMT Server: Microsoft-HTTPAPI/2.0 Last-Modified: Mon, 12 Jul :33:23 GMT Content-Length: 54 <CRLF><html><title>Hello</title> Welcome to our site Welcome to our site  HTTP request: The empty line denotes the end of the request header The empty line denotes the end of the response header  HTTP response:

 Request message sent by a client consists of  Request line – request method (GET, POST, HEAD,...), resource URI, and protocol version  Request headers – additional parameters  Body – optional data  E.g. posted form data, files, etc. 18 HTTP/ HTTP/ <headers> <body>

19 GET /academy/winter aspx HTTP/1.1 Host: Accept: */* Accept-Language: bg Accept-Encoding: gzip, deflate User-Agent: Mozilla/4.0(compatible;MSIE 6.0; Windows NT 5.0) Connection: Keep-Alive Cache-Control: no-cache <CRLF>  Example of HTTP GET request: HTTP request line HTTP headers The request body is empty

20 POST /webmail/login.phtml HTTP/1.1 Host: Accept: */* Accept-Language: bg Accept-Encoding: gzip, deflate User-Agent: Mozilla/4.0(compatible;MSIE 6.0; Windows NT 5.0) Connection: Keep-Alive Cache-Control: no-cache Content-Length: 59 <CRLF>LOGIN_USER=menteDOMAIN_NAME=abv.bgLOGIN_PASS=top*secret!<CRLF>  Example of HTTP POST request: HTTP request line HTTP headers The request body contains the submitted form data

 Fetches the resource only if it has been changed at the server  Server replies with “ 304 Not Modified ” if the resource has not been changed  Or “ 200 OK ” with the latest version otherwise 21 GET /academy/join.aspx HTTP/1.1 Host: User-Agent: Gecko/ Firefox/3.6 If-Modified-Since: Tue, 9 Mar :12:23 GMT <CRLF>  Example of HTTP conditional GET request:

 Response message sent by the server  Status line – protocol version, status code, status phrase  Response headers – provide meta data  Body – the contents of the response (the requested resource) 22 HTTP/ HTTP/

 Example of HTTP response from the Web server: 23 HTTP/ OK Date: Fri, 17 Jul :09:18 GMT+2 Server: Apache/ (Linux) Accept-Ranges: bytes Content-Length: 84 Content-Type: text/html <CRLF><html> Test Test Test HTML page. Test HTML page. </html> HTTP response status line HTTP response headers The HTTP response body

24 HTTP/ Not Found Date: Fri, 17 Jul :09:18 GMT+2 Server: Apache/ (Linux) Connection: close Content-Type: text/html <CRLF><HTML><HEAD> 404 Not Found 404 Not Found </HEAD><BODY> Not Found Not Found The requested URL /img/telerik-logo.gif was not found on this server. The requested URL /img/telerik-logo.gif was not found on this server. Apache/ Server at Port 80 Apache/ Server at Port 80 </BODY></HTML>  Example of HTTP response with error result: Response status line HTTP response headers The HTTP response body

 The Content-Type header at the server specifies how the output should be processed  Examples: 25 Content-Type: text/html; charset=utf-8 UTF-8 encoded HTML page. Will be shown in the browser. Content-Type: application/pdf Content-Disposition: attachment; filename="Financial-Report-April-2010.pdf" filename="Financial-Report-April-2010.pdf" This will download a PDF file named Financial-Report-April-2010.pdf

 HTTP request methods:  GET  Return the specified resource, run a program at the server, or just download file, …  HEAD  Return the meta-data associated with a resource (headers only)  POST  Update a resource, provide input data for processing at the server, … 26

 HTTP response code classes  1xx : informational (e.g., “ 100 Continue ”)  2xx : success (e.g., “ 200 OK ”)  3xx : redirection (e.g., “ 304 Not Modified ”, " 302 Found ")  4xx : client error (e.g., “ 404 Not Found ”)  5xx : server error (e.g., “ 503 Service Unavailable ”)  " 302 Found " is used for redirecting the Web browser to another URL 27

 HTTP browser redirection example  HTTP GET requesting a moved URL:  The HTTP response says the browser should request another URL: 28 GET / HTTP/1.1 Host: academy.telerik.com User-Agent: Gecko/ Firefox/3.6 <CRLF> HTTP/ Moved Permanently Location: …

 Cookie  Cookies are small pieces of data stored by the client on behalf of the server  Included in all future HTTP requests to the server 29 Request Response Set-Cookie: XYZ Next request Cookie: XYZ

 The client requests some URL:  The server sets a cookie in the HTTP response:  In further requests to google.bg the Web browser sends the cookie in the HTTP header: 30 GET / HTTP/1.1 Host: HTTP/ OK Set-Cookie: PREF=ID=c0bf5fd5c3a25209; expires=Wed, 11-Jul :13:22 GMT; domain=.google.bg GET / HTTP/1.1 Host: Cookie: PREF=ID=c0bf5fd5c3a25209

31

 Firebug plug-in for Firefox  A must have for Web developers  The ultimate tool for monitoring, editing and debugging HTTP, HTML, CSS, JavaScript, etc.  Free, open-source –  Fiddler – HTTP proxy  Intercepts the HTTP traffic  Analyzes the HTTP conversation  Free tool –

 Wireshark packet analyzer  Low-level packet sniffer  Intercepts the entire IP network traffic  Can reconstruct the HTTP conversation  Can intercept any (unencrypted) protocol  IP, ICMP, TCP, UDP, HTTP, DNS, SMTP, POP3  Can intercept passwords sent in clear-text  Free, open-source project –

Questions?