Giter Site home page Giter Site logo

httpserver's Introduction

HTTPServer

HTTPServer is a simple HTTP server written in C, capable of serving static files over the HTTP protocol.

Features

  • Supports HTTP GET requests for static files.
  • Multi-threaded design using pthreads to handle multiple client connections simultaneously.
  • Proper error handling for socket operations and file I/O.

Prerequisites

  • GCC compiler
  • Linux environment (tested on Arch Linux)

Usage

  1. Clone the repository:

    git clone https://github.com/yourusername/HTTPServer.git
  2. Navigate to the project directory:

    cd HTTPServer
  3. Make a directory to store the compiled code

    mkdir build
  4. Compile the server:

    make
  5. Run the server:

    ./server
  6. The server will start listening on port 8080 by default. You can change the port in the server.c file if needed.

  7. Access files using your web browser or HTTP client by specifying the file path in the URL, e.g., http://localhost:8080/index.html.

License

This project is licensed under the GNU GENERAL PUBLIC LICENSE Version 3.

Acknowledgements

  • This project was inspired by the desire to learn more about network programming and HTTP servers.
  • Special thanks to online resources and tutorials that helped me in understanding socket programming in C.

Feel free to contribute to this project by submitting pull requests or reporting issues.

httpserver's People

Contributors

seven719 avatar filip-nachov avatar

Stargazers

Krishna Gunjan 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.