Using socket programing implement a simple but a complete web server in python

تفاصيل العمل

Using socket programming, implement a simple but a complete web server in python or java or C that is listening on port 9000. The user types in the browser something like http://localhost:9000/ar or http://localhost:9000/en

The program should check

1- if the request is / or /en (for example localhost:9000/ or localhost:9000/en) then the server should send main_en.html file with Content-Type: text/html.

The main_en.html file should contain

HTML webpage that contains

a. “ENCS3320-Simple Webserver” in the title

b. “Welcome to our course Computer Networks” (part of the phrase is in Blue)

c. Group members names and IDs

d. Some information about the group members. For instance, projects you have done during different course (programming, electrical, math, etc), skills, hobbies, etc.

e. Use CSS to make the page looks nice

f. Divide the page in different boxes and put student’s information in the different boxes

g. Include CSS as a separate file

h. An image with extention.jpg and an image with extension .png

i. A link to a local html file (an html file) and a link to https://www.w3schools.com...

2- If the request is /ar then the server response with main_ar.html which is an Arabic version of main_en.html

3- if the request is an .html file then the server should send the requested html file with Content-Type: text/html. You can use any html file.

4-

5- if the request is a .css file then the server should send the requested css file with Content-Type: text/css. You can use any CSS file

6-

7- if the request is a .png then the server should send the png image with Content-Type: image/png. You can use any image.

8- if the request is a .jpg then the server should send the jpg image with Content-Type: image/jpeg. You can use any image.

9- Use the status code 307 Temporary Redirect to redirect the following

a. If the request is /go then redirect to google website

b. If the request is /cn then redirect to cnn website

c. If the request is /bzu then redirect to birzeit university website

10- If the request is wrong or the file doesn’t exist the server should return a simple HTML webpage that contains (Content-Type: text/html)

1- “HTTP/1.1 404 Not Found” in the response status

2- “Error” in the title

3- “The file is not found” in the body in red

4- Your names and IDs in Bold

5- The IP and port number of the client

بطاقة العمل

اسم المستقل
عدد الإعجابات
0
عدد المشاهدات
282
تاريخ الإضافة
تاريخ الإنجاز
المهارات