46 lines
996 B
Markdown
46 lines
996 B
Markdown
# AqCGI
|
|
|
|
AqCGI is a small library to help building CGI code in C to be used with
|
|
Apache2 and other HTTP servers.
|
|
|
|
It parses HTTP headers and URL-encoded strings. It also takes care of sending
|
|
responses including headers and error codes/messages.
|
|
|
|
|
|
## Build AqCGI
|
|
|
|
### Dependencies
|
|
|
|
AqCGI only depends on libgwenhywfar (see [gwenhywfar](https://www.aquamaniac.de/rdm/projects/gwenhywfar/files)).
|
|
|
|
### Build
|
|
Download and unpack tar.gz file, CD into the unpacked folder and build like this:
|
|
|
|
```
|
|
mkdir build
|
|
cd build
|
|
gwbuild -s ..
|
|
gwbuild -jNN (with NN being the number of parallel processes to use, e.g. 4 if compiling on quadcore cpu)
|
|
sudo gwbuild -i
|
|
```
|
|
|
|
## Use AqCGI
|
|
|
|
Working with AqCGI is as simple as this (in your main() function):
|
|
|
|
```
|
|
AQCGI_REQUEST *rq;
|
|
|
|
DBG_ERROR(NULL, "Init CGI");
|
|
AQCGI_Init();
|
|
rq=AQCGI_ReadRequest();
|
|
if (rq) {
|
|
// do something with the request
|
|
|
|
AQCGI_SendResponseWithStatus(rq, 200, "Ok");
|
|
AQCGI_Request_free(rq);
|
|
}
|
|
AQCGI_Fini();
|
|
```
|
|
|