diff options
author | Patrick <Patrick.Murphy@multitech.com> | 2020-04-01 15:07:50 -0500 |
---|---|---|
committer | Patrick <Patrick.Murphy@multitech.com> | 2020-04-01 15:07:50 -0500 |
commit | f895e46a542d07fec1cdff621ff250b156f0069e (patch) | |
tree | 0d6682315d5eff4a1f92a90a084386b7db66818c /commissioning/fcgi_commission.cc | |
parent | a1558341bcbfbcb878726f5bd4b4dd6eda14d551 (diff) | |
download | commissioning-f895e46a542d07fec1cdff621ff250b156f0069e.tar.gz commissioning-f895e46a542d07fec1cdff621ff250b156f0069e.tar.bz2 commissioning-f895e46a542d07fec1cdff621ff250b156f0069e.zip |
reoriented repo layout
Diffstat (limited to 'commissioning/fcgi_commission.cc')
-rw-r--r-- | commissioning/fcgi_commission.cc | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/commissioning/fcgi_commission.cc b/commissioning/fcgi_commission.cc new file mode 100644 index 0000000..8d05e08 --- /dev/null +++ b/commissioning/fcgi_commission.cc @@ -0,0 +1,55 @@ + +/* +#include "fcgio.h" +#include <iostream> + +int main(void) { + // Backup the stdio streambufs + streambuf * cin_streambuf = cin.rdbuf(); + streambuf * cout_streambuf = cout.rdbuf(); + streambuf * cerr_streambuf = cerr.rdbuf(); + + FCGX_Request request; + + FCGX_Init(); + FCGX_InitRequest(&request, 0, 0); + + while (FCGX_Accept_r(&request) == 0) { + fcgi_streambuf cin_fcgi_streambuf(request.in); + fcgi_streambuf cout_fcgi_streambuf(request.out); + fcgi_streambuf cerr_fcgi_streambuf(request.err); + + cin.rdbuf(&cin_fcgi_streambuf); + cout.rdbuf(&cout_fcgi_streambuf); + cerr.rdbuf(&cerr_fcgi_streambuf); + + cout << "Content-type: text/html\r\n" + << "\r\n" + << "<html>\n" + << " <head>\n" + << " <title>Hello, World!</title>\n" + << " </head>\n" + << " <body>\n" + << " <h1>Hello, World!</h1>\n" + << " </body>\n" + << "</html>\n"; + + // Note: the fcgi_streambuf destructor will auto flush + } + + // restore stdio streambufs + cin.rdbuf(cin_streambuf); + cout.rdbuf(cout_streambuf); + cerr.rdbuf(cerr_streambuf); + + return 0; +} + +*/ + +#include <stdio.h> + +int main () { + printf("Hello, World!\n"); + return 0; +}
\ No newline at end of file |