Giter Site home page Giter Site logo

frank-chris / tritonhttp Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 772 KB

A web server that implements a subset of the HTTP/1.1 protocol using Go. The server supports concurrent connections, persistent connections, HTTP pipelining, and virtual hosting.

Makefile 1.74% Go 93.66% HTML 4.60%
concurrency go golang http-pipelining http-server persistent-connections virtual-hosting

tritonhttp's Introduction

TritonHTTP

A web server that implements a subset of the HTTP/1.1 protocol, from scratch in Go. The server supports concurrent connections, persistent connections, HTTP pipelining, and virtual hosting.

Description

TritonHTTP follows the general HTTP message format. It supports the following features:

  • HTTP version supported: HTTP/1.1
  • Request method supported: GET
  • Response status supported:
    • 200 OK
    • 400 Bad Request
    • 404 Not Found
  • Request headers:
    • Host (required)
    • Connection (optional, Connection: close has special meaning influencing server logic)
    • Other headers are allowed, but won't have any effect on the server logic
  • Response headers:
    • Date (required)
    • Last-Modified (required for a 200 response)
    • Content-Type (required for a 200 response)
    • Content-Length (required for a 200 response)
    • Connection: close (required in response for a Connection: close request, or for a 400 response)
    • Response headers should be written in sorted order for the ease of testing
    • Response headers should be returned in 'canonical form', meaning that the first letter and any letter following a hyphen should be upper-case. All other letters in the header string should be lower-case.

Usage

The source code for tools needed to interact with TritonHTTP can be found in cmd. The following commands can be used to launch these tools:

  1. make fetch - Allows you to construct custom responses and send them to the web server. Please refer to the README in fetch's directory for more information.

  2. make gohttpd - Starts up Go's inbuilt web-server.

  3. make tritonhttpd - Starts up TritonHTTP (localhost, port 8080).

Refer Makefile for more details.

Tests

Some basic tests can be found in cmd/tritonhttpd.

Source code

The source code for the web server can be found in tritonhttp/.

Virtual Hosting

In some cases, it is desirable to host multiple web servers on a single physical machine. This allows all the hosted web servers to share the physical server’s resources such as memory and processing, and in particular, to share a single IP address. This project implements virtual hosting by allowing TritonHTTP to host multiple servers. Each of these servers has a unique host name and maps to a unique docroot directory (in docroot_dirs/) on the physical server. Every request sent to TritonHTTP includes the “Host” header, which is used to determine the web server that each request is destined for.

tritonhttp's People

Contributors

frank-chris avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.