Giter Site home page Giter Site logo

qq431169079 / lwhhttpwss Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ekremkaracan/lwhhttpwss

0.0 1.0 0.0 151 KB

Lightweight, single threaded http and websockets server, completely written in C.

License: MIT License

C 91.35% Makefile 8.65%

lwhhttpwss's Introduction

lwhhttpwss

Lightweight, single threaded http and websockets server, completely written in C.

It does preallocate necessary resources for predetermined maximum number of connections.

Memory footprint stays pretty much the same over the time

Static content is stored in <binaryname>.web.data and <binaryname>.web.index files in <binarypath>/data directory.

<binarypath>/data/<binaryname>.web.data
Both compressed and uncompressed web content.
<binarypath>/data/<binaryname>.web.index
Simple, fast specialized btree index of content file names.
To create or update these files mkcache service program must be used.
Server checks modification time of these files periodically.
If it is changed it loads them to memory, starts serving them and frees the last one seamlessly.
This is the only condition malloc and free used after program start.
When you run mkcache
It scans all files in <sourcepath> matching extensions in <mkcachepath>/mime.types file.
mime.types
<0|1> <mime type> <extension> ...
0 : Do not compress
1 : Compress
If file is marked for compression and compression gain is more than %40, stores both compressed and uncompressed content.
Otherwise it just stores uncompressed content.
Then generated temporary files are moved to <cachepath>.
About command line parameters
Command line parameters are stored in a /conf/.cnf file.
Once program is run with no parameters given, default values are stored. If you supply a valig parameter it will be stored in this file.
It parses and stores valid program parameters.
It reads rest of the valid parameters from config file.
If no value of parameter is not stored in the config file, assigns hardcoded default value and stores.
Most common parameters
-v // Not stored
Prints version and build number (auto generated by version.h and time of build), and exits.
eg. 1.1.D20170513T011707
-a // not stored
Prints app name (hardcoded internal application name) and exits
-va // not stored
Prints app name and version and exits.
daemon=<1|0> // stored
1 : Run as a daemon. Uses daemon(1, 0) library call.
In daemon mode all log messages are directed to syslog. So avoid dumping unnecessary messages, keep your log clean and meaningful.
More to come

lwhhttpwss's People

Contributors

ekremkaracan avatar

Watchers

 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.