Web I - 05 - HTTP Protocol

2,134 views

Published on

Lecture on HTTP for Web Development 1 Course suitable for degree following CIT/CIS/CS ACM model curriculum.

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,134
On SlideShare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
82
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Web I - 05 - HTTP Protocol

  1. 1. EASINGINTO WEBDEVELOPMENT5.5 HTTP
  2. 2. 1 INTRODUCTION 2 HTML 3 TABLES 4 FORMS 5 HTTP 6 CSS 7 CSS FRAMEWORKS 8 DIGITAL MEDIA2 9 USABILITY
  3. 3. HTTP EXAMPLE 1
  4. 4. 1. User makes request
  5. 5. 2. Browser sends HTTP request to serverGET /comp1274/randyc/lab10done/enter country htm HTTP/1 1 /comp1274/randyc/lab10done/enter_country.htm HTTP/1.1Accept: */*Accept-Language: en-us,en-ca;q=0.5Accept-Encoding: gzip, deflateUser-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NETCLR 1.1.4322; InfoPath.1; .NET CLR 2.0.50727)Host: csweb2.mtroyal.caConnection: Keep-Alive HTTP Request Browser Web Server
  6. 6. 3. Server receives and processes the HTTPrequest HTTP Request q Browser Web Server Retrieve Requested file
  7. 7. 4. Server sends HTTP responsebackHTTP/1.1HTTP/1 1 200 OKServer: Microsoft-IIS/5.0 ServerDate: Thu, 30 Mar 2006 19:50:54 GMTContent-Type: text/html HTTPAccept-Ranges: bytes ResponseLast-Modified: Fri, 24 Mar 2006 17:50:50 GMTContent-Length: 209 Browser<HTML><HEAD><TITLE>Enter A Country</TITLE></HEAD><BODY><FORM METHOD=POST ACTION=form_filter.asp> Enter Country Search: <INPUT TYPE=TEXT NAME=Search><P> <INPUT TYPE=SUBMIT></FORM></BODY></HTML>
  8. 8. 5. Browser displays response
  9. 9. 6. User submits data
  10. 10. 7. Browser sends HTTP request to serverPOST /comp1274/randyc/lab10done/form_filter.asp HTTP/1.1 p y pAccept: */*Referer: http://csweb2.mtroyal.ca/comp1274/randyc/lab10done/enter_country.htmAccept-Language: en-us,en-ca;q=0.5Accept Lang age en s en ca q 0 5Content-Type: application/x-www-form-urlencodedAccept-Encoding: gzip, deflateUser-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR1.1.4322; InfoPath.1; .NET CLR 2.0.50727)Host: csweb2.mtroyal.caContent-Length: 13Connection: Keep-AliveCache-Control: no-cacheSearch=Canada User entered form data goes here in the http request header as a name=value pair
  11. 11. Digression: What if GET rather than POST? g W G OS<FORM METHOD=GET ACTION=form_filter.asp>Then the user entered form data is added to the requested URLGET /comp1274/randyc/lab10done/form_filter.asp?Search=Canada HTTP/1.1Versus<FORM METHOD=POST ACTION=form_filter.asp>Then the user entered form data is added to the end of HTTP request headerPOST /comp1274/randyc/lab10done/form_filter.asp HTTP/1.1rest of HTTP request header goes hereSearch=Canada
  12. 12. 8. Server receives and processes the HTTPrequest HTTP Request q Browser Web Server Server processes the request
  13. 13. 9. Server script generates response sent backto b browserHTTP/1.1 200 OK /Server: Microsoft-IIS/5.0Date: Thu, 30 Mar 2006 19:51:06 GMTContent-Length: 164Content-Type: text/htmlCache control:Cache-control: private<HTML><HEAD><TITLE>Reading Recordsets</TITLE></HEAD><BODY><H2>Countries</H2><TABLE BORDER=1><TR><TD>2</TD><TD>Canada</TD></TR></TABLE> / /</BODY></HTML>
  14. 14. 10. Browser displays theresponse
  15. 15. HTTP EXAMPLE 2
  16. 16. 1. User makes request
  17. 17. 2. Browser sends HTTP request to serverGET /comp1274/randyc/lab10done/data_browser.asp HTTP/1.1Accept: */*Accept-Language: en-us,en-ca;q=0.5 p g g qAccept-Encoding: gzip, deflateUser-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NETCLR 1.1.4322; InfoPath.1; .NET CLR 2.0.50727)Host: csweb2.mtroyal.caConnection: Keep-Alive
  18. 18. 3. Server receives and processes the HTTPrequest HTTP Request q Browser Web Server Server processes the request
  19. 19. 4. Server script generates response sent backto b browserHTTP/1.1 200 OK /Server: Microsoft-IIS/5.0Date: Thu, 30 Mar 2006 19:51:06 GMTContent-Length: 1590Content-Type: text/htmlCache-control: private<HTML><HEAD><TITLE>Data Browser</TITLE></HEAD><BODY><HR>SELECT * FROM Movies WHERE RunTime < 90<HR><TABLE BORDER=1> <TR> <TD><B>Title</B></TD> <TD><B>Release Date</B></TD> <TD><B>Run Time</B></TD> </TR>...
  20. 20. 5. Browser displays the response
  21. 21. 6. User makes request (click on a link)
  22. 22. 7. Browser sends HTTP request to serverGET /comp1274/randyc/lab10done/movie.asp?ID=84 HTTP/1.1Accept: */*Referer: http://csweb2.mtroyal.ca/comp1274/randyc/lab10done/data_browser.aspAccept-Language: en-us,en-ca;q=0.5Accept-Encoding: gzip, deflateUser-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR1.1.4322; InfoPath.1; .NET CLR 2.0.50727)Host: csweb2.mtroyal.caConnection: Keep-Alive
  23. 23. 8. Server receives request, processes it, andgenerates responseHTTP/1.1 200 OKServer: Microsoft‐IIS/5.0Date: Thu, 30 Mar 2006 19:51:06 GMTContent‐Length: 585Content‐Type: text/htmlCache‐control: private p<HTML><HEAD><TITLE>Nightmare Before Christmas, The</TITLE></HEAD><BODY><H1>Nightmare Before Christmas, The</H1>Directed by <B>Henry Selick</B><BR>Released on  12/9/1994<BR>Released on 12/9/1994<BR>Movie length is 76 minutes<H2>Summary</H2>...
  24. 24. 9. Browser displays the response
  25. 25. HTTP EXAMPLE 3
  26. 26. 1. User makes request
  27. 27. 2. Browser sends HTTP request to serverGET /comp1274/randyc/lab10done/does_not_exist.asp HTTP/1.1 p y pAccept: */*Accept-Language: en-us,en-ca;q=0.5Accept-Encoding: g ipAccept Encoding gzip, deflateUser-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NETCLR 1.1.4322; InfoPath.1; .NET CLR 2.0.50727)Host: csweb2 mtroyal ca csweb2.mtroyal.caConnection: Keep-Alive
  28. 28. 3. Server receives and processes the HTTPrequest HTTP Request q Browser Web Server Server processes the request
  29. 29. 4. Server receives request, processes it, andgenerates responseHTTP/1.1 404 Object Not FoundServer: Microsoft-IIS/5.0Date: Thu, 30 Mar 2006 19:51:06 GMTContent-Length: 4040Content-Type: text/htmlCache-control: private p<html>...<title>The page cannot be found</title>...<body><table>...TheTh page you are l ki looking f for might h i ht have b been removed, h d it d had its...
  30. 30. 5. Browser displays the response

×