Skip to content

A very tiny HTTP file server written in pure C (<80kb), compilable for Windows and Linux.

Notifications You must be signed in to change notification settings

hwpoison/tinyc-http-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TinyC http-server

A very basic HTTP server in C

Is a multithread lightweight web server written in pure C. Compilable for Windows and Linux for server static content and media files from a directory.

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:
        --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 from / to a specified route. eg: simple_web/index.html
        --folder <folder_path>: Just serve from a specified folder content. eg: simple_web/ 
        --no-logs: Disable logging.
        --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

About

A very tiny HTTP file server written in pure C (<80kb), compilable for Windows and Linux.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •