资源预览内容
第1页 / 共23页
第2页 / 共23页
第3页 / 共23页
第4页 / 共23页
第5页 / 共23页
第6页 / 共23页
第7页 / 共23页
第8页 / 共23页
第9页 / 共23页
第10页 / 共23页
亲,该文档总共23页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
基于Web的应用系统开发 4. Web browsers, servers and HTTP 2 Overview lClient-server paradigm lWeb browsers lWeb servers lURL lMIME lHTTP 3 The client server paradigm lA widely used form of communication lServer application waits passively for contact from clients lA server provides a specific service lClient application actively initiates contact with the server lInformation can flow in both directions lTypical situation is many clients interacting with each server 4 Web Browsers lBrowsers are clients always initiate, servers react lAllow user to browse resources available on server either existing or dynamically built documents l Mosaic - NCSA (Univ. of Illinois), in early 1993 First to use a GUI, led to explosion of Web use Initially for X-Windows, under UNIX, but was ported to other platforms by late 1993 lCurrent common browsers Internet Explorer, Netscape, Opera, Mozilla Firefox, Safari, Google Chrome (as of 9/3/08) 5 Web Servers lProvide responses to browser requests lAll communications between browsers and servers use Hypertext Transfer Protocol (HTTP) lWeb servers run as background processes in the operating system Monitor a communications port on the host, accepting HTTP messages when they appear lCommon servers Apache, Internet Information Server (IS) 6 Uniform Resource Locators (URLs) lStandard way of specifying entities on networks lFirst part - protocol terminated by colon ( : ) common protocols are http, ftp, mailto, telnet, i.e.: http: ftp: mailto: telnet: lSecond part - varies according to protocol mailto - e-mail address e.g.: mailto: wjsun resource-oriented protocols (http, ftp etc) Host name + domain names (preceded by /) may optionally include username, password and port Pathname (usually related to the path of a file on the server) i.e. /fully-qualified-domain-name/path-to-document lOptional third parts Query string (preceded by ?) Fragment identifier (preceded by #) 7 Example URLs lmailto:wjsun l lhttp:/ :80/ l :8799/ lhttp:/uname:pword l l lftp:/uname:pword lftp:/ 8 General Server Characteristics lWeb servers have two main directories: 1. Server root (server system software) 2. Document root (servable documents) This will map to the URL of the full domain name, e.g.: User document root directory Directories of a standard name in the users home directory Usually this is called public_html The URL is then mapped as username e.g.: 9 General Server Characteristics lDocument root is accessed indirectly by clients Its actual location is set by the server configuration file Requests are mapped to the actual location E.g. doc root is topdocs and stored in /admin/web Site is When there is a request for Server searches for file with address /admin/web/topdocs/bulbs/tulips.html 10 Additional Server Features lVirtual document trees Part of servable document collection stored outside the document root lVirtual hosting Support for more than one site on a computer lProxy servers Serve documents that are in the document root of other machines 11 Multipurpose Internet Mail Extensions (MIME) lOriginally developed for email lUsed to specify document types transmitted over the Web MIME type attached by the server to the beginning of the document l Type specifications Form: type/subtype Examples: text/plain, text/html, image/gif, image/jpeg 12 MIME lServer gets type from the requested file names suffix (.html implies text/html) lBrowser gets the type explicitly from the server lExperimental types Subtype begins with x- e.g. video/x-msvideo Experimental types require the server to send a helper application or plug-in so the browser can deal with the file 13 World Wide Web Overview HTTP Server Apache MS IIS Client Netscape Navigator MS Internet Explorer HTTP request (URL) HTTP response (HTML data) 14 Design Paradigm of the WWW lWWW is a global hypertext system lThe page is the basic unit of the WWW lEach page has a unique identifier the URL lPages may contain links to data of any type lSome data (e.g. images) may be interpreted by the browser and displayed “inline” lPages may contain links to other URLs 15 The HTTP Protocol lInvented by Tim Berners-Lee in 1990 lRFC 1945 (1996) - HTTP/1.0 lRFC 2068 (1997) - HTTP/1.1 lRFC 2616 (1999) - HTTP/1.1 (update to 2068) 16 Features of HTTP lApplication level, client-server protocol Primarily for distributed hypermedia systems Flexible - thus has many other uses - e.g.: Nameservers Distributed I) Example 20 telnet HTTP request lA browsers is not necessary to communicate with a web server telnet http GET /respond.html HTTP/1.1 Host: 21 HTTP Response lMessage generated by a server after receiving and interpreting a request lResponses contain: Status line with the protocol version, a status code, and a “reason phrase” Response-Header (containing information about the server) Entity Header (meta-information) Entity Body (data) 22 Response messag
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号