Coder Social home page Coder Social logo

xyphenore / web-server Goto Github PK

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

A multithreaded Web server. Don't use it, it's an exercise of the Rust Book. Providing a Rust implementation and a C++ implementation.

License: GNU Lesser General Public License v3.0

Rust 98.41% HTML 1.59%

web-server's Introduction

Multithreaded Web server

Implementation of a multithreaded Web server like the exercise of the Rust Book.

Please don't use it or use it at your risks. You can use ActixWeb.

Version Rust LGPL3.0 License Build

Table of contents

Tech Stack

Requirements:

  • Rust 2021
  • Cargo 1.79.0

Setup

You can download the project and build it with Meson.

Clone the project:

git clone https://github.com/Xyphenore/web-server.git

Build it:

cargo build

Run it

cargo run

Generate the documentation

cargo doc

Open the target/doc/web_server/index.html in the directory target/doc/web_server.

cd target/doc/web_server

web-server's People

Contributors

xyphenore avatar

Watchers

 avatar

web-server's Issues

Improve performance of compilation

  • : Move definitions of bigger methods in cpp files.
  • : Move definitions of inline smaller (one line) methods outside classes.

If some functions in tools.hpp are only used in one cpp file, move the function in the cpp file and make it static.

Parallelize the uppercase conversion

Use std::transform and std::execution::par_unseq.

Because std::transform can be parallelized instead of std::for_each that use the in-order execution.

Finish the refactor for Response and Request

Objects:

  • Response
    • Finish the format of the outgoing string
  • Request
    • Use Method and Status objects directly
  • RequestHandler
    • Update to wait a Response from registered listeners
  • Method
    • Don't panic when the method is built from a strinf incoming from the network, must return an error

Routes:

  • Get index
    • Use the new Request
    • Return a Response
  • Get Not found
    • Use the new Request
    • Return a Response

Add run guide

Add to README.md a guide to run the Rust version and CPP version of the web server.

Optimize the memory usage

Restructure attributes of structs to compact the memory using alignment.

Check if the use of reference decreases the memory usage.

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.