Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/rafaeljusto/cgiplus

Tiny C++ tool to parse web requests
https://github.com/rafaeljusto/cgiplus

Last synced: about 10 hours ago
JSON representation

Tiny C++ tool to parse web requests

Awesome Lists containing this project

README

        

CGIplus
=======

**CGIplus** is a C++ tool to parse CGI requests. Some features that
you will find:

* Easy interface - use [] and () operators to get (Cgi) or define
(Builder) GET/POST data and Cookie respectively

* Protection against cross-site scripting - Some special symbols are
removed from the input data

Prerequisits
------------

* g++ 4.6 -
* python 2.7 -
* scons 2.0 -
* libboost-system-dev 1.4 -
* libboost-test-dev 1.4 -
* libboost-regex-dev 1.4 -

The project was compiled using the above compilers and libraries,
higher versions should work well.

Installation
------------

Define the compiler using the CXX environment variable, by default
is used "g++".

# scons
# scons install

For API documentation:

# scons doc

Usage
-----

Source code:

#include

#include
#include

int main()
{
// Simulating inputs
setenv("QUERY_STRING", "test=abc123", 1);
setenv("REQUEST_METHOD", "GET", 1);

string form = "The test has as content: ";

cgiplus::Cgi cgi;
cgiplus::Builder builder;

builder.setForm(form);
builder["content"] = cgi["test"];
builder.show();

return 0;
}

Compliling:

g++ -std=c++0x test.cpp -o test -lcgiplus -lboost_regex

Output:

Content-type: text/html

The test has as content: abc123

Contact
-------

Rafael Dantas Justo

License
-------

CGIplus Copyright (C) 2012 Rafael Dantas Justo

This file is part of CGIplus.

CGIplus is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

CGIplus is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with CGIplus. If not, see .