Git Product home page Git Product logo

kcgi's Introduction

Synopsis

kcgi is an open source CGI and FastCGI library for C web applications. It is minimal, secure, and auditable; and fits within your BCHS software stack. This repository is consists of bleeding-edge code between versions: to keep up to date with the current stable release of kcgi, visit the kcgi website.

To get started with a kcgi project, see kcgi-framework for a set of files to get your project going.

Code Example

Implementing a CGI or FastCGI application with kcgi is easy (for values of easy greater than "knows C"). One usually specifies the pages recognised by the application and the known form inputs. kcgi then parses the request.

#include <stdarg.h> /* va_list */
#include <stdint.h> /* int64_t */
#include <stdlib.h>
#include <unistd.h> /* ssize_t */
#include <kcgi.h>
 
int main(void) {
  struct kreq r;
  const char *page = "index";
  if (KCGI_OK != khttp_parse(&r, NULL, 0, &page, 1, 0))
	return(EXIT_FAILURE);
  khttp_head(&r, kresps[KRESP_STATUS],
	"%s", khttps[KHTTP_200]);
  khttp_head(&r, kresps[KRESP_CONTENT_TYPE], 
	"%s", kmimetypes[r.mime]);
  khttp_body(&r);
  khttp_puts(&r, "Hello, world!\n");
  khttp_free(&r);
  return(EXIT_SUCCESS);
}

Installation

kcgi works out-of-the-box with modern UNIX systems. Simply download the latest version's source archive (or download the project from GitHub), compile with make, then sudo make install (or using doas). Your operating system might already have kcgi as one of its third-party libraries: check to make sure!

API Reference

See the kcgi(3) manpage for complete library documentation. You can also browse all functions.

Tests

The system contains a full regression suite and is also built to work with AFL. See the kcgi website for details on how to deploy (or write) tests.

License

All sources use the ISC (like OpenBSD) license. See the LICENSE.md file for details.

kcgi's People

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.