Warning, /maui/mauikit-documents/src/code/epub/qhttpserver/README.md is written in an unsupported language. File is not indexed.

0001 QHttpServer
0002 ===========
0003 
0004 A Qt HTTP Server - because hard-core programmers write web-apps in C++ :)
0005 
0006 It uses Ryan Dahl's [HTTP Parser](http://github.com/ry/http-parser) and is asynchronous and does not require any inheritance.
0007 
0008 **NOTE: QHttpServer is NOT fully HTTP compliant right now! DO NOT use it for
0009 anything complex**
0010 
0011 Installation
0012 ------------
0013 
0014 Requires Qt 4.
0015 
0016     qmake && make && su -c 'make install'
0017 
0018 To link to your projects put this in your project's qmake project file
0019 
0020     LIBS += -lqhttpserver
0021 
0022 By default, the installation prefix is /usr/local. To change that to /usr,
0023 for example, run:
0024 
0025     qmake -r PREFIX=/usr
0026 
0027 Usage
0028 -----
0029 
0030 Include the headers
0031 
0032     #include <qhttpserver.h>
0033     #include <qhttprequest.h>
0034     #include <qhttpresponse.h>
0035 
0036 Create a server, and connect to the signal for new requests
0037 
0038     QHttpServer *server = new QHttpServer;
0039     connect(server, SIGNAL(newRequest(QHttpRequest*, QHttpResponse*)),
0040             handler, SLOT(handle(QHttpRequest*, QHttpResponse*)));
0041 
0042     // let's go
0043     server->listen(8080);
0044 
0045 In the handler, you may dispatch on routes or do whatever other things
0046 you want. See the API documentation for what information
0047 is provided about the request via the QHttpRequest object.
0048 
0049 To send data back to the browser and end the request:
0050 
0051     void Handler::handle(QHttpRequest *req, QHttpResponse *resp)
0052     {
0053         resp->setHeader("Content-Length", 11);
0054         resp->writeHead(200); // everything is OK
0055         resp->write("Hello World");
0056         resp->end();
0057     }
0058 
0059 The server and request/response objects emit various signals
0060 and have guarantees about memory management. See the API documentation for
0061 these.
0062 
0063 Contributors
0064 ------------
0065 
0066 * Nikhil Marathe (maintainer)
0067 * David Wolinsy