If you are not sure please don\'t bother responding to the post. write a program
ID: 3649758 • Letter: I
Question
If you are not sure please don't bother responding to the post.
write a program using python or java that implements a simple web server. A client program, a web browser, will make a request to your server to retrieve a resource, and your server returns the requested resource or responds with the correct error code, in the case of an error. you are required to implement only the GET and HEAD requests for your server, even though there are also other request methods supported by HTTP.
The first line of the HTTP request is the most important line, and the only part of the request message you are required to process for this assignment. This line has the format shown below.
GET /index.html HTTP/1.0
^ ^ ^
| | |
<Request-method> Requested-file <http-version>
After processing the request, your server returns the response in the following format.
<status line>
<header lines>
<blank line>
<data>
An example response message would look like the following:
HTTP/1.0 200 OK
Server: My Simple Web Server version 1.0
Content-Length: 32
Content-Type: text/html
<html><body>Hello.</body></html>
Your program should return one of the following error codes if the request does not succeed.
400 Bad Request
404 Not Found
505 HTTP Version Not Supported
The Server, Content-Length, and Content-Type header lines are the only required parts of the response header lines for this assignment. Server is the name of your server
Explanation / Answer
def import lib require lib rescue LoadError `gem install #{lib}` require lib end import 'sinatra' import 'json'
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.