• 沒有找到結果。

HTTP Server

N/A
N/A
Protected

Academic year: 2022

Share "HTTP Server"

Copied!
11
0
0

加載中.... (立即查看全文)

全文

(1)

HTTP Server

2005/03/30

(2)

Reference

„

W. Richard Stevens, “Unix Network Programming 2/e Volume 1” ,1998

„

James F. Kurose and Keith W. Ross, "Computer

Networks: A Top-Down Approach Featuring the Internet 3/e“, 2002.

„

IETF RFC 2616,“Hypertext Transfer Protocol --

HTTP/1.1 “

(3)

HTTP connections

Nonpersistent HTTP

„

At most one object is sent over a TCP

connection.

„

HTTP/1.0 uses

nonpersistent HTTP

Persistent HTTP

„

Multiple objects can be sent over single TCP connection between client and server.

„

HTTP/1.1 uses

persistent connections

in default mode

(4)

HTTP Request Message Format

(5)

HTTP Response Message Format

version status reason

Message Body

(6)

Message Format Example

„

Request message

„

Response message

GET /index.html HTTP/1.1 Connection: close

User-agent: Mozilla/4.0 Accept-language: fr

HTTP/1.1 200 OK Connection: close

Date: Thu, 06 Aug 1998 12:00:15 GMT Last-Modified: Mon, 22 Jun 1998 09:23:24 Content-Length: 6821

Content-Type: text/html (data data)

(7)

HW2:HTTP Server

„

You have to implement a simple HTTP

Server with Persistent and Non-Persistent functions

„

In request message

‰

Connection: close

„ Means non-persistent connection

‰

Connection: Keep-Alive

„ Means persistent connection

„ Server should keep the connection alive a default time(10s) and send back the Keep-Alive header

„ Ex. Keep-Alive: timeout=10, max=100

(8)

HW2:HTTP Server

„

URL in request line

‰ Filename is related to the working directory

„ Ex. /index.htm means to get ./index.htm

‰ Default is to get index.html or index.htm

„ Ex. / means to get ./index.html or ./index.htm

‰ No need to support directory, but is encourged

‰ If file doesn’t exist, reply 404 not found.

„

In the response message

‰ Connection, Date, Content-Length, Content-Type, Last- Modified should be supported

‰ Keep-Alive is optional (depends on Connection)

(9)

HW2:HTTP Server

„

Possible value of the header

‰

Connection

„ close, Keep-Alive

‰

Date, Last-Modified

„ Thu, 06 Aug 1998 12:00:15 GMT

‰

Content-Length

„ file size

‰

Content-Type

„ text/html, image/jpg (only have to support these)

(10)

HW2:HTTP Server

„

HTTP Server execution format

„

Your program must be gcc 3.3.1 compatible

„

Name your program in this way

‰ b91902xxx_s.cc for HTTP Server (suffix may be c, cc, cpp)

„

Make your program as a tarball

„

Email the tarball to

[email protected]

‰ Subject:[network hw2]b91902xxx name

„

Due after four weeks (4/27 PM2:20)

HttpServer server_port

tar zcvf b91902xxx_hw2.tar.gz b91902xxx_s.cc

(11)

Something Useful

„

IE, Mozilla, ..

„

Ethereal (http://www.ethereal.com)

„

String related function

‰

strcmp(), strchr(), strtok(), …

參考文獻

相關文件

The format of the URI in the first line of the header is not specified. For example, it could be empty, a single slash, if the server is only handling XML-RPC calls. However, if the

Web Server: www.vghtc.gov.tw FTP server : ftp.vghtc.gov.tw SMTP Server : mail.vghtc.gov.tw POP Server

專門負責 IP 位址配給賦予的主機,下列何者正確?(A)DHCP Server (B)Domain Name Server (C)HTTP Se Rver (D)File & Printing

 Before the scheduled commencement date of the summer holiday, schools, to meet practical needs, should keep the school premises and boarding section open,

一個 vector space V , 若給定一組 basis 後, 由於 V 中的元素用這組 basis 都只有唯一 的表法, 所以我們可以將 V 中的元素用熟悉的向量坐標來表示.. 另一方面, 一個 linear transformation,

操作流程: 系統選單->財產管理系統->點選報廢申請單->填寫報廢申請單資料(主 單、明細)->點選確認

The paper wishes to deal with Oriental Hermeneutic approach under Chan Chinese Buddhism as a perspective: to show the path of metaphor alive, and the recent studies on the project

[r]