GithubHelp home page GithubHelp logo

wolkykim / qhttpd Goto Github PK

View Code? Open in Web Editor NEW
27.0 7.0 13.0 306 KB

qHttpd is a customizable HTTP server framework in C.

Home Page: http://wolkykim.github.io/qhttpd/

License: Other

HTML 0.17% Shell 3.83% C 90.13% CSS 1.37% Makefile 2.49% M4 2.02%

qhttpd's Introduction

qHttpd

What's qHttpd?

The goal of qHttpd Project is building a highly customizable HTTP server which can be used in many projects not only as a HTTP contents delivery purpose but also an internal protocol purpose.

Are you looking for customizable HTTP server for your own software development needs? Are you considering to develop a protocol like a HTTP protocol to use as a inter-communication protol for your software? Do you want to modify standard HTTP protocol and add your own methods to fit in your needs? If your answer is YES to one of these questions, qHttpd is just for you. Take a look. It's simple, fast and compact!

Features

  • Supports HTTP/1.1, HTTP/1.0, HTTP/0.9
  • Supports completely working codebase for standard HTTP methods: OPTIONS, HEAD, GET, PUT(supports chunked transfer-encoding)
  • Also supports WebDAV extension: PROPFIND, PROPPATCH, MKCOL, MOVE, DELETE, LOCK, UNLOCK
  • Includes C hooking/customizing samples codes.
  • Supports external LUA script hooking.
  • Supports HTTP Basic Auth Module (refer http_auth.c)
  • Supports Virtual Host (refer hook.c)
  • You can easily customize/add methods.
  • Supports server statistics page.
  • Supports mime types.
  • Supports rotating file log.

How easy adding a new method?

Example) Adding a new method in C

int hookRequestHandler(struct HttpRequest *pReq, struct HttpResponse *pRes) {
        int nResCode = 0;

        // method hooking
        if(!strcmp(pReq->pszRequestMethod, "MY_METHOD")) {
                nResCode = my_method(pReq, pRes);
        }
        return nResCode;
}

int my_method(struct HttpRequest *pReq, struct HttpResponse *pRes) {
        const char *txt = "Nice to meet you~"

        httpResponseSetCode(pRes, HTTP_CODE_OK, true);
        httpHeaderSetStr(pRes->pHeaders, "MY_HEADER", "Hi~");
        httpResponseSetContent(pRes, "httpd/plain", txt, strlen(txt));
}

Example) Modifying response using LUA script

function responseHandler()
      local code = response:getCode();

      out = assert(io.open("/tmp/test.log", "a+"));
      out:write("Response Code = ",code,"\n");
      out:write("\n");
      out:close();

      if (code == 200) then
              response:setHeader("Server", "milk/1.0.0");
      end
      return 0;
end

qhttpd's People

Contributors

wolkykim avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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