monkey icon indicating copy to clipboard operation
monkey copied to clipboard

New library mode

Open edsiper opened this issue 8 years ago • 1 comments

Monkey v1.7 comes with a new shared library mode (work in process). Some info about the old library mode:

Shared library mode was supported in 1.5 series, but due to Monkey architecture on that moment the lib mode was implemented as a hack. The new architecture base in 1.7 allows to implement a library mode in a smooth and clean way due to the code logic separation and new content handlers interface.

The new library mode already serves static content and is aware about the notion of virtualhosts, the first commit on this change e3db5e637544a3f12698c0b31f087435884b1bb5 allows to implement a simple web server in a few lines of code, e.g:

int main()
{
    int ret;
    mk_ctx_t *ctx;
    mk_vhost_t *vh;

    ctx = mk_create();
    mk_config_set(ctx, "Listen", "2020");

    vh = mk_vhost_create(ctx, NULL);
    mk_vhost_set(vh,
                 "Name", "default",
                 "DocumentRoot", "/var/www/site/");
    mk_start(ctx);

    return 0;
}

The next series of patches will implement the callbacks for a generic handler under the virtual host, so dynamic content will be served using new internal API. New version of Duda will use this interface.

...work in process...

edsiper avatar Apr 18 '16 17:04 edsiper

API status (functional):

  • virtual hosts
  • callbacks
  • HTTP set response status
  • HTTP send custom headers
  • HTTP send custom body content

edsiper avatar May 13 '16 14:05 edsiper