Skip to content

MosheGroot/webserver21

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Webserv project

Goal:

Write own implementation of web server like nginx one with next capabilities:

  • custom configs
  • multiple servers handling at one or different ip:port pairs
  • multiple client-server connections
  • simple CGI
  • multiple routes in server, error pages, redirects and max client body size paramets
  • GET, POST and DELETE methods with HTTP/1.1 version of requests

Language: C++98

Result

  • Structured code with object-oriented principles splitted by 5 parts:
    • Config
    • Core
    • Http
    • CGI
    • Utils
  • Custom configs with multiple servers with next parameters:
    • ip and port
    • server_name
    • max client body size
    • locations:
      • uri
      • root
      • index
      • autoindex
      • allowed methods
      • cgi
      • redirect
  • Multiple servers at one or different ip:port socket
  • Multiplexing with low-level select function for non-blocking sockets problem-solving
  • GET, POST and DELETE methods
  • Autoindex pages
  • Execution of simple CGI bash scripts or binaries
  • Simple thread-unsafety logger to console and file

Runtime

Webserv.mp4

Contributors

PP189B Uliana-So AliceFromWardenfell
HTTP + requests processing + default pages Config + CGI + Kvast website Client-server connections, multiplexing and etc.

Testing

Current configuration

  • Kvast website at http://kvast.webserv.local image

  • Test website at webserv.local:8888 image

  • Default website at default.webserv.local:8888 image

(P.S. you need to configure domains in hosts file of your system for testing)

Configurating

Use this template for adding new server:

server
    ip   <...>
    port <...>
    server_name   <name1> <name2> <name3>
    max_body_size <number in bytes>
    location <uri>
        root      <...>
        index     <...>
        cgi       <...>
        redirect  <...>
        method    <m1> <m2> <m3>
        autoindex <on/off>
    location <uri>
        ...

Build and run

make

./webserver [path_to_config]