Yasin DEMİR

#herseypaylasmakicin

——————————————————————————————-

CPE/ISE 432 Computer Network Design and Application

Web Server Project Details

——————————————————————————————-

Objectives:
After finishing this project students develop own web server application.
Recommendations & Rules:
• The application must be written in C/C++ .
• Application should operate in concurrent mode. (So application serve more than one
user at a time)
• Don’t use any special library for protocols when coding. Write your own functions if
it’s necessary.
• Unless otherwise explicitly specified, all written assignments or code that is submitted
is to be entirely the student’s own work. Using any code or copying any assignment
from others is strictly prohibited without advance prior permission from the instructor.
• All students’ work is their own. Students who do share their work with others are as
responsible for academic dishonesty as the student receiving the material.
• Students who encourage others to cheat or plagiarize, or students who are aware of
plagiarism or cheating and do not report it are also participating in academically
dishonest behavior.
• In this case (academically dishonest behavior), students to be punished with no grade.
Project Details:
1) Server should bind (listen) port that defined in application configuration file. This port uses
for command exchange and data transfer purpose. All data exchange should use TCP
transport layer protocol for reliability.
2) Server must have a configuration file (text file). This file includes configuration parameters
of server. Configuration files examples given at Appendix section.
3) Web Server application should operate as defined in RFC 2616.
It should support HTTP Persistent connection without pipelining.
Only should support html or text Content types.
Following methods should be implemented.
GET
HEAD
4) Following Request Header Fields should be implemented.
Host
User-Agent
Accept
Accept-Language
Accept-Charset
If-Modified-Since
5) Following Response status and headers should be implemented.
Response Status:
200 OK
301 Moved Permanently
304 Not Modified
400 Bad Request
404 Not Found
500 Internal Server Error
Response Headers:
Date
Server
Last-Modified
Content-Length
Content-Type
Testing Phases:
Web server application tests should to be performed by any Web Browser (Firefox, IE, Opera
etc.).
1) After client initiates connection it send’s request line to server. You can only
implement
GET
and
HEAD
methods.
If
we
typed
“http://www.ciu.edu.tr/en/index.html “ web client send it as given below:
GET /en/index.html HTTP/1.1
Host: www.ciu.edu.tr
User-Agent: Mozilla/5.0
Accept: text/html
Accept-Language: en,tr
Accept-Charset: ISO-8859-1
If –Modified-Since: Sun, 16 May 2010 17:13:47 GMT
2) After request processed by server response should send back to client.
HTTP/1.1 200 OK
Date: Mon, 26 Jul 2010 22:42:57 GMT
Server: CiU Web Server 0.1
Last-Modified: Sun, 13 Apr 2010 22:23:47 GMT
Content-Length: 2522
Content-Type: text/html
<html>
<body>
</body>
this is test message …..
this is test message …..
this is test message …..
</html>
*Bonus) if you implement a basic calculator (for 4 arithmetical operations) GET or
HEAD method you can get +20 points. Calculator enable if your URL has “?” symbol.
And Responses should be given as a HTML file.
Ex: Request line
GET /?10+20 HTTP/1.1
Host: www.somewhere.edu
Response:
HTTP/1.1 200 OK
Date: Mon, 26 Jul 2010 22:42:57 GMT
Server: CiU Web Server 0.1
Last-Modified: Sun, 13 Apr 2010 22:23:47 GMT
Content-Length: 2522
Content-Type: text/html
<html>
<title>Result</title>
<p>10 +20 = 30 </p>
</html>
If you tried unsupported calculation you can use response code “400 Bad Request”
Ex: Request line
GET /?10!+20 HTTP/1.1
Host: www.somewhere.edu
Response:
HTTP/1.1 400 Bad Request
Date: Mon, 26 Jul 2010 22:42:57 GMT
Server: CiU Web Server 0.1
APPENDIX
server.cfg:
—————————————————————————————————————–
# This is Multiprotocol Server configuration file. Its have several attributes.
# The lines begin with # accepted as comment line.
# ListenIp defines listen ip address of application
# If its defined as All its listen all ip address or if defined ip address its only listen this
# ip address
ListenIp=All
# ListenPort defines listening port of application
ListenPort=80
# ServerHomeDirectory defines server root directory
ServerRoot_Dir=/home/test/webserver
# ServerName defines server host name
ServerName=www.foo.com
——————————————————————————————————————
Proje başarı ile yapılmış ve çok buyuk kısmı  tamamlanmış olup sizlerle paylaşıma açılmıştır.
Projeyi buradan indirebilirsiniz….
Proje için çok yararlı olacağını düşündüğüm beej’s guide rehberini buradan (ingilizce türkçe) açıp titizlikle okuyun lütfen…
Yasin DEMİR