Skip to content

zer0matt/tinyc-http-server

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TinyC http-server

A very basic HTTP server in C

Is a lightweight web server written in C using sockets. Compilable for Windows and Linux for server static content and media files.

Basic usage

Usage:

tinyc.exe --port <port> --folder <folder_path>

Example:

tinyc.exe --port 5656 --folder /simple_web --backlog 4 --no-print

For help usage:

tinyc.exe --help

Options

Basic usage: tinyc --port 8081 --folder /my_web
 example: tinyc --port 3543 --folder simple_web/index.html

Options:
        --folder <folder_path>: Folder to serve. By default serve all executable location dir content.
        --ip: Set server IP. Default: ANY (Local/Network).
        --port <port_number>: Port number. Default is 8081
        --backlog <number>: Max server listener.
        --max-threads <number>: Max server threads.
        --default-redirect <file_path>/: redirect / to default file route. ex: simple_web/index.html
        --no-print : No print log (less mem consumption).
        --no-file-explorer: Disable file explorer.
  • If you dont specify any args, servers will run on localhost:8081 by default serving executable location content.

How to build

Has two versions, default multithread (all) using pthread and monothread using nothing (monothread).

make all
make monothread

Tested on

WindowsGCCgcc (x86_64-posix-seh-rev1, Built by MinGW-Builds project) 13.1.0
LinuxGCCgcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0

TODO: add utf-8 support for Windows

About

A tiny HTTP single file multithread server written with pure C (<80kb), server static content and media files. Includes basic file explorer.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • C 92.3%
  • HTML 6.1%
  • Makefile 1.6%