Best代写-最专业靠谱代写IT | CS | 留学生作业 | 编程代写Java | Python |C/C++ | PHP | Matlab | Assignment Project Homework代写

C++代写 | # Gunrock Web Server

C++代写 | # Gunrock Web Server


# Gunrock Web Server

This web server is a simple server used in ECS 150 for teaching about multi-threaded programming and operating systems. This version of the server can only handle one client at a time and simply serves static files. Also, it will close each connection after reading the request and responding, but generally is still HTTP 1.1 compliant.


This server was written by Sam King from UC Davis and is actively maintained by Sam as well. The `http_parse.c` file was written by [Ryan Dahl]( and is licensed under the BSD license by Ryan. This programming assignment is from the [OSTEP]( textbook (tip of the hat to the authors for writing an amazing textbook).


# Quickstart

To compile and run the server, open a terminal and execute the following commands:


$ git clone

$ cd gunrock_web

$ make

$ ./gunrock_web



To test it out, you can either open up a web browser on the same machine and give it this url `http://localhost:8080/hello_world.html` or if you want to use curl on the command line you can test it out like this:


$ # get a basic HTML file

$ curl http://localhost:8080/hello_world.html

$ # get a basic HTML file with more detailed information

$ curl -v http://localhost:8080/hello_world.html

$ # head a basic HTML file

$ curl –head http://localhost:8080/hello_world.html

$ # test out a file that does not exist (404 status code)

$ curl -v http://localhost:8080/hello_world2.html

$ # test out a POST, which isn’t supported currently (405 status code)

$ curl -v -X POST http://localhost:8080/hello_world.html



We also included a full website that you can use for testing, try pointing your browser to: `http://localhost:8080/bootstrap.html`


# Overview


In this assignment, you will be developing a concurrent web server. To

simplify this project, we are providing you with the code for a non-concurrent

(but working) web server. This basic web server operates with only a single

thread; it will be your job to make the web server multi-threaded so that it

can handle multiple requests at the same time.


The goals of this project are:

– To learn the basic architecture of a simple web server

– To learn how to add concurrency to a non-concurrent system

– To learn how to read and modify an existing code base effectively


Useful reading from [OSTEP]( includes:

– [Intro to threads](

– [Using locks](

– [Producer-consumer relationships](

– [Server concurrency architecture](


# HTTP Background


Before describing what you will be implementing in this project, we will

provide a very brief overview of how a classic web server works, and the HTTP

protocol (version 1.1) used to communicate with it; although web browsers and

servers have [evolved a lot over the


the old versions still work and give you a good start in understanding how

things work. Our goal in providing you with a basic web server is that you can

be shielded from learning all of the details of network connections and the

HTTP protocol needed to do the project; however, the network code has been

greatly simplified and is fairly understandable should you choose to to study



Classic web browsers and web servers interact using a text-based protocol

called **HTTP** (**Hypertext Transfer Protocol**). A web browser opens a

connection to a web server and requests some content with HTTP. The web server

responds with the requested content and closes the connection. The browser

reads the content and displays it on the screen.


HTTP is built on top of the **TCP/IP** protocol suite provided by the

operating system. Together, TCP and IP ensure that messages are routed to

their correct destination, get from source to destination reliably in the face

of failure, and do not overly congest the network by sending too many messages

at once, among other features. To learn more about networks, take a networking

class (or many!), or read [this free book](