Coder Social home page Coder Social logo

wwebs's Introduction

wwebs - Willow's Web Server

wwebs is a weird (but hopefully not too weird) webserver.

how wwebs works

  1. A request comes in.
  2. Get the path of the request.
  3. Walk up the request's path until...
  • The path hits a file before its end. If the file is executable, use it. Otherwise, return 404.
  • The path hits a directory at its end. Use the index.
  • The path hits a file or directory without the "others read" permission bit set. Return 404.
  • The path misses at any point. Return 404.
  • The path hits its end.
  1. At every step of the path, check for .wwebs.toml, .logger#, .gatekeeper#, .req_transformer#, .res_transformer#
  2. Execute all of the gatekeepers, in ascending order first by depth, then by number. If any of them fail, skip to step 8, executing only response transformers as deep or shallower than the gatekeeper that failed.
  3. Execute all of the request transformers, in ascending order first by depth, then by number.
  4. Execute the target file, if it is executable, otherwise read it into the response body.
  5. Execute all of the response transformers, first in descending order by depth, then in ascending order by number.
  6. Send the response.

writing dynamic content

For content to be dynamic, it must have the o+r and o+x permission bits. Dynamic content is a normal executable file.

Dynamic content receives the following information:

  • /dev/stdin - The request body, if applicable.
  • HEADER_* - The request headers.
  • QUERY_* - The query strings.
  • VERB - The verb of the request.
  • REQUESTED - The full URL of the request.
  • STATUS - The status code of the response, if this content handles responses.

Dynamic content generates the following information:

  • /dev/stdout - The response body.
  • /dev/stderr - Output commands.
    • status ### - Set the status.
    • log ... - Write a logging message.
    • header key value - Add a response header.

wwebs's People

Contributors

spaghetus avatar

Watchers

 avatar  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.