Skip to content

Commit

Permalink
The example has been fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitigr committed May 14, 2019
1 parent 99d00d6 commit 1d0e258
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,23 @@ Hello, World

int main(int, char**)
{
#ifdef _WIN32
const char* const crlf = "\n";
const char* const crlfcrlf = "\n\n";
#else
const char* const crlf = "\r\n";
const char* const crlfcrlf = "\r\n\r\n";
#endif

try {
const auto port = 9000;
const auto backlog = 64;
const auto server = dmitigr::fcgi::Listener_options::make("0.0.0.0", port, backlog)->make_listener();
server->listen();
while (true) {
if (const auto conn = server->accept()) {
conn->out() << "Content-Type: text/plain\r\n\r\n";
conn->out() << "Hello from dmitigr::fcgi!";
conn->out() << "Content-Type: text/plain" << crlfcrlf;
conn->out() << "Hello from dmitigr::fcgi!" << crlf;
}
}
} catch (const std::exception& e) {
Expand Down
12 changes: 10 additions & 2 deletions tests/hello.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,23 @@

int main(int, char**)
{
#ifdef _WIN32
const char* const crlf = "\n";
const char* const crlfcrlf = "\n\n";
#else
const char* const crlf = "\r\n";
const char* const crlfcrlf = "\r\n\r\n";
#endif

try {
const auto port = 9000;
const auto backlog = 64;
const auto server = dmitigr::fcgi::Listener_options::make("0.0.0.0", port, backlog)->make_listener();
server->listen();
while (true) {
if (const auto conn = server->accept()) {
conn->out() << "Content-Type: text/plain\r\n\r\n";
conn->out() << "Hello from dmitigr::fcgi!";
conn->out() << "Content-Type: text/plain" << crlfcrlf;
conn->out() << "Hello from dmitigr::fcgi!" << crlf;
}
}
} catch (const std::exception& e) {
Expand Down

0 comments on commit 1d0e258

Please sign in to comment.