15.08.2013 Views

General Computer Science 320201 GenCS I & II Lecture ... - Kwarc

General Computer Science 320201 GenCS I & II Lecture ... - Kwarc

General Computer Science 320201 GenCS I & II Lecture ... - Kwarc

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Definition 529 HTTP is used by a client (called user agent) to access web resources (addressed<br />

by Uniform Resource Locators (URLs)) via a http request. The web server answers<br />

by supplying the resource<br />

Most important HTTP requests (5 more less prominent)<br />

GET Requests a representation of the specified resource. safe<br />

PUT Uploads a representation of the specified resource. idempotent<br />

DELETE Deletes the specified resource. idempotent<br />

POST Submits data to be processed (e.g., from a web<br />

form) to the identified resource.<br />

Definition 530 We call a HTTP request safe, iff it does not change the state in the web<br />

server. (except for server logs, counters,. . . ; no side effects)<br />

Definition 531 We call a HTTP request idempotent, iff executing it twice has the same<br />

effect as executing it once.<br />

HTTP is a stateless protocol (very memory-efficient for the server.)<br />

c○: Michael Kohlhase 357<br />

Finally, we come to the last component, the web server, which is responsible for providing the web<br />

page requested by the user.<br />

Web Servers<br />

Definition 532 A web server is a network program that delivers web pages and supplementary<br />

resources to and receives content from user agents via the hypertext transfer protocol.<br />

Example 533 (Common Web Servers) apache is an open source web server that<br />

serves about 60% of the WWWeb.<br />

<strong>II</strong>S is a proprietary server provided by Microsoft.<br />

nginx is a lightweight open source web server.<br />

Even though web servers are very complex software systems, they come preinstalled on most<br />

UNIX systems and can be downloaded for Windows [XAM].<br />

c○: Michael Kohlhase 358<br />

Now that we have seen all the components we fortify our intuition of what actually goes down the<br />

net by tracing the http messages.<br />

Example: An http request in real life<br />

Connect to the web server (port 80) (so that we can see what is happening)<br />

telnet www.kwarc.info 80<br />

Send off the GET request<br />

GET /teaching/<strong>GenCS</strong>2.html http/1.1<br />

Host: www.kwarc.info<br />

User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.4)<br />

Gecko/20100413 Firefox/3.6.4<br />

Response from the server<br />

HTTP/1.1 200 OK<br />

Date: Mon, 03 May 2010 06:48:36 GMT<br />

204

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!