MulleCivetWeb is a "WebServer as a library". It is based on civetweb.
Release Version | Release Notes |
---|---|
RELEASENOTES |
You typically interact with MulleCivetWeb by creating a MulleCivetWebServer object, and by attaching a MulleCivetWebRequestHandler to it:
@interface MyRequestHandler : NSObject < MulleCivetWebRequestHandler>
@end
int main( int argc, char *argv[])
{
MulleCivetWebServer *server;
MyRequestHandler *handler;
server = [MulleCivetWebServer object];
// the server is already running now!
handler = [MyRequestHandler object];
[server setRequestHandler:handler];
return( 0);
}
The request handler will receive MulleCivetWebRequests
and return
MulleCivetWebResponses
:
@implementation MyRequestHandler
- (MulleCivetWebResponse *) webResponseForWebRequest:(MulleCivetWebRequest *) request
{
MulleCivetWebTextResponse *response; // subclass of MulleCivetWebResponse
response = [MulleCivetWebTextResponse webResponseForWebRequest:request];
[response appendFormat:@"Method is %@\n",
[request method] == MulleHTTPPost ? @"POST" : @"GET"]
[response appendFormat:@"Accept-Encoding is %@",
[request headerValueForKey:MulleHTTPAcceptEncodingKey]];
[response appendString:@"Hello World"];
return( response);
}
@end
That's it.
MulleCivetWeb add the following principal classes:
Class | Description |
---|---|
MulleCivetWebServer |
The WebServer class. Add your request handler to it. |
MulleCivetWebRequest |
Requests as received by the MulleCivetWebServer |
MulleCivetWebResponse |
Responses returned by a request handler. They contain header |
MulleCivetWebTextResponse |
Subclass of MulleCivetWebResponse to produce plain text, JSON, |
Use mulle-sde to add MulleCivetWeb to your project:
mulle-sde add github:MulleWeb/MulleCivetWeb
Use mulle-sde to build and install MulleCivetWeb and all dependencies:
mulle-sde install --prefix /usr/local \
https://github.com//MulleCivetWeb/archive/latest.tar.gz
Install the requirements:
Requirements | Description |
---|---|
MulleObjCHTTPFoundation | 🎫 HTTP and HTML utility methods and classes for mulle-objc |
MulleFoundation | 💍 Umbrella library for the MulleFoundation |
mulle-objc-list | 📒 Lists mulle-objc runtime information contained in executables. |
Download the latest tar or zip archive and unpack it.
Install MulleCivetWeb into /usr/local
with cmake:
cmake -B build \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DCMAKE_PREFIX_PATH=/usr/local \
-DCMAKE_BUILD_TYPE=Release &&
cmake --build build --config Release &&
cmake --install build --config Release
All platforms and compilers supported by mulle-c11.
Nat! for Mulle kybernetiK