Skip to content
Snippets Groups Projects
Select Git revision
  • master default
1 result

buggy-web-server

  • Clone with SSH
  • Clone with HTTPS
  • Forked from an inaccessible project.

    An example, not entirely stable, web server

    Prerequisites

    • Linux or MacOS
    • Optionally: the C++ IDE juCi++
      • If you do not install juCi++, you will need to install additional dependencies such as g++, cmake and make

    Installing dependencies

    Debian based distributions

    sudo apt-get install libboost-thread-dev libboost-regex-dev

    Arch Linux based distributions

    sudo pacman -S boost

    MacOS

    brew install boost

    Download

    git clone https://gitlab.stud.iie.ntnu.no/eidheim/buggy-web-server

    Compile and run

    Alternative 1

    In a terminal:

    juci buggy-web-server

    In juCi++, choose Compile and Run in the Project menu.

    Alternative 2

    In a terminal:

    cd buggy-web-server
    mkdir build
    cd build
    cmake ..
    make
    ./web_server  # Press control-c to stop the server

    See web page

    Alternative 1

    Open http://localhost:8080 in a web browser

    Alternative 2

    In a terminal:

    telnet localhost 8080
    GET / HTTP/1.1        # Press enter twice here
    

    Debugging

    First, stop the web server (if it is running). In juCi++, choose Kill Last Process in the Project menu.

    In a terminal:

    cd build
    mkdir debug
    cd debug
    cmake -DCMAKE_BUILD_TYPE=Debug ../..
    make
    gdb ./web_server                     # In MacOS, instead use: lldb ./web_server
    run

    Backtrace of a stopped process

    bt