eddic / fastcgipp Goto Github PK
View Code? Open in Web Editor NEWfastcgi++: A C++ FastCGI and Web development platform:
Home Page: https://fastcgipp.isatec.ca
License: GNU Lesser General Public License v3.0
fastcgi++: A C++ FastCGI and Web development platform:
Home Page: https://fastcgipp.isatec.ca
License: GNU Lesser General Public License v3.0
fastcgipp/include/fastcgi++/log.hpp:94:69: error: declaration of ‘lock’ shadows a previous local [-Werror=shadow]
...
fastcgipp/src/sockets.cpp:547:25: note: in expansion of macro ‘FAIL_LOG’
This is just one example. Using the lock_guard called lock shadows any other variable called lock. You could use a variadic template instead and acheive the same results. Just use , instead of <<. I can submit a PR if you want.
in src/sockets.cpp:
m_data(new Data(-1, false, *static_cast<SocketGroup*>(nullptr))),
As the title gives: use of undeclared identifier 'HOST_NAME_MAX', when cmake, make under OS X 10.11.6
I have the following situation (fastcgi server):
When a request comes in, I push off all handling of the request to a threadpool and wait for a Fastcgipp::Message to be returned from a function.
If the connection is closed (e.g. if the server/clients's timeout is reached) the request's destructor is called which invalidates things like the request's environment.
If I then try to access the environment from the threadpool thread my process can segfault.
Would it be possible to either:
when i make fastcgi++,it's failed.It needs the header file ,but I could not find this file.I tried to update libstdc++ by 'yum',but it told me is lastest.
so how can I get the file codecvt to slove this problem?
Since there's no PATH_INFO
param in what nginx
send to gnu.fcgi
.
the following condition is always false.
Lines 102 to 104 in f321a1d
possible solution is to use requestUri
, since the URI is not started with gnu.png
, so use find()
here.
Line 104 in f321a1d
possible patch:
(the cmakelist.txt change is for debian stable which still uses cmake 3.7 that does not support target_compile_features(fastcgipp PRIVATE cxx_std_14)
,
just FYI if you're willing to make it build with cmake 3.7)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 99d7e0d..5031dbc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.8)
+cmake_minimum_required(VERSION 3.7)
project(fastcgi++ VERSION 3.1 LANGUAGES CXX)
string(TIMESTAMP BUILD_TIME UTC)
@@ -111,7 +111,10 @@ set_target_properties(fastcgipp PROPERTIES VERSION ${PROJECT_VERSION}
find_package(Threads REQUIRED)
target_link_libraries(fastcgipp PUBLIC Threads::Threads)
-target_compile_features(fastcgipp PRIVATE cxx_std_14)
+#target_compile_features(fastcgipp PRIVATE cxx_std_14)
+set(CMAKE_CXX_STANDARD 14)
+set(CMAKE_CXX_STANDARD_REQUIRED on)
+set(CMAKE_CXX_EXTENSIONS off)
if(UNIX)
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
target_compile_options(fastcgipp PRIVATE -Wall -Werror -fno-omit-frame-pointer)
diff --git a/examples/gnu.cpp b/examples/gnu.cpp
index 26690e6..c9c9e5e 100644
--- a/examples/gnu.cpp
+++ b/examples/gnu.cpp
@@ -99,9 +99,7 @@ L"</html>";
//! [Response]
bool response()
{
- if(
- environment().pathInfo.size() == 1
- && environment().pathInfo[0] == L"gnu.png")
+ if(environment().requestUri.find(L"gnu.png") != environment().requestUri.npos)
image();
else
html();
I've tested the patch, seem work fine.
Scanning dependencies of target fastcgipp
[ 20%] Building CXX object CMakeFiles/fastcgipp.dir/src/log.cpp.o
cc1plus: error: invalid option argument ‘-Og’
cc1plus: error: unrecognized command line option "-std=c++14"
cc1plus: error: unrecognized command line option "-std=c++14"
make[2]: *** [CMakeFiles/fastcgipp.dir/src/log.cpp.o] Error 1
make[1]: *** [CMakeFiles/fastcgipp.dir/all] Error 2
make: *** [all] Error 2
/src/sockets.cpp:523:27: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
if(events == pollIn)
^
/src/sockets.cpp:538:27: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
if(events == pollIn)
compile with gcc5.2
how to deal with it ?
Compilation error with gcc 7.1.1
fastcgipp/include/fastcgi++/fcgistreambuf.hpp:73:28: error: «function» in namespace «std» does not name a template type
const std::function<void(const Socket&, std::vector<char>&&)>
patch:
diff --git a/include/fastcgi++/fcgistreambuf.hpp b/include/fastcgi++/fcgistreambuf.hpp
index 6436d07..1f4b3a8 100644
--- a/include/fastcgi++/fcgistreambuf.hpp
+++ b/include/fastcgi++/fcgistreambuf.hpp
@@ -34,6 +34,7 @@
#include "fastcgi++/block.hpp"
#include <istream>
+#include <functional>
//! Topmost namespace for the fastcgi++ library
namespace Fastcgipp
FAILED: CMakeFiles/fastcgipp.dir/src/log.cpp.o
/Users/didi/bin/c++ -Dfastcgipp_EXPORTS -Iinclude -I/Users/didi/keepwatch/libs/fastcgipp/include -I/Users/didi/include -std=c++14 -Wall -Werror -Wold-style-cast -pthread -fPIC -MD -MT CMakeFiles/fastcgipp.dir/src/log.cpp.o -MF CMakeFiles/fastcgipp.dir/src/log.cpp.o.d -o CMakeFiles/fastcgipp.dir/src/log.cpp.o -c /Users/didi/keepwatch/libs/fastcgipp/src/log.cpp
/Users/didi/keepwatch/libs/fastcgipp/src/log.cpp: 在函数‘std::__cxx11::wstring Fastcgipp::Logging::getHostname()’中:
/Users/didi/keepwatch/libs/fastcgipp/src/log.cpp:51:25: 错误:‘HOST_NAME_MAX’在此作用域中尚未声明
char buffer[HOST_NAME_MAX+2];
^
/Users/didi/keepwatch/libs/fastcgipp/src/log.cpp:52:25: 错误:‘buffer’在此作用域中尚未声明
gethostname(buffer, sizeof(buffer));
^
/Users/didi/keepwatch/libs/fastcgipp/src/log.cpp: 在函数‘std::__cxx11::wstring Fastcgipp::Logging::getProgram()’中:
/Users/didi/keepwatch/libs/fastcgipp/src/log.cpp:75:25: 错误:‘program_invocation_name’在此作用域中尚未声明
program_invocation_name,
Following the build instructions, I got 2 compilation errors, both about variables ("buffer" and "padStart") on the same line in the file http.hpp. The variables could possibly be used without an initialisation.
Built all okay on Ubuntu Xenial Server (x32_64) but socket tests failed. I shut down Nginx and PHP just in case but unfortunately no difference. Please let me know if you would like any more info...
3/4 Testing: Fastcgipp::Sockets
3/4 Test: Fastcgipp::Sockets
Command: "/home/peter_devoy/fastcgi++.build/sockets_test"
Directory: /home/peter_devoy/fastcgi++.build
"Fastcgipp::Sockets" start time: Apr 29 23:03 BST
Output:
----------------------------------------------------------
[error] Unable to connect to 127.0.0.1:12229
[fail] Unable to connect to server
<end of output>
Test time = 0.00 sec
----------------------------------------------------------
Test Failed.
"Fastcgipp::Sockets" end time: Apr 29 23:03 BST
"Fastcgipp::Sockets" time elapsed: 00:00:00
----------------------------------------------------------
Part of modern CMake is exporting a ProjectConfig.cmake file and installing to lib/cmake/project. It would be nice for CMake users to be able to simply:
find_package(Fastcgipp REQUIRED)
add_executable(foo foo.cpp)
target_link_libraries(foo PRIVATE Fastcgipp::fastcgipp)
fcntl(listen, F_SETFL, (fcntl(listen, F_GETFL)|O_NONBLOCK)^O_NONBLOCK);
It gets current socket flags, appends O_NONBLOCK to them with logic OR, and THEN, for some reason, does XOR with O_NONBLOCK, which leads to dropping of O_NONBLOCK flag).
Bad reinterpret cast:
reinterpret_cast<uint16_t>(write) = 0xffff;
should be
reinterpret_cast<uint16_t>(&*write) = 0xffff;
Vector iterator reused between different vectors (which is not allowed):
In template void Fastcgipp::Http::decodeUrlEncoded(
nameEnd is first used as
auto nameEnd(dataEnd);
but later is resued in this statement:
nameEnd = percentEscapedToRealBytes(
nameStart,
data,
buffer.begin());
Where it becomes an iterator from "buffer".
I'm sure there are many more errors here, but at this point, I kind gave up, this library is not ready to be used in production.
../src/http.cpp:626:10: error: class template 'Environment' was previously declared as a struct template [-Werror,-Wmismatched-tags]
template class Fastcgipp::Http::Environment;
^
../include/fastcgi++/http.hpp:251:38: note: previous use is here
template struct Environment
^
../src/http.cpp:626:10: note: did you mean struct here?
template class Fastcgipp::Http::Environment;
^~~~~
struct
../src/http.cpp:627:10: error: class template 'Environment' was previously declared as a struct template [-Werror,-Wmismatched-tags]
template class Fastcgipp::Http::Environment<wchar_t>;
^
../include/fastcgi++/http.hpp:251:38: note: previous use is here
template struct Environment
I came across this problem sometimes.
Jul 10 00:00:03 machinename /fastcgidemo [1452] [error]: Poll gave fd 26 which isn't in m_sockets.
It was likely that socket gourps was in disorder.i want to know what can lead to this error and how to solve.
-- Configuring done
CMake Warning (dev):
Policy CMP0042 is not set: MACOSX_RPATH is enabled by default. Run "cmake
--help-policy CMP0042" for policy details. Use the cmake_policy command to
set the policy and suppress this warning.
MACOSX_RPATH is not specified for the following targets:
fastcgipp
Compiling with GCC 5.3.1 or 6.1 on an i586 openSUSE machine the build always exits with an error:
src/request.cpp:106:64: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
[ 108s] && environment().contentLength > m_maxPostSize)
[ 108s] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
[ 108s] /home/abuild/rpmbuild/BUILD/fastcgi++-3.0beta/src/request.cpp: In instantiation of 'std::unique_lockstd::mutex Fastcgipp::Request::handler() [with charT = wchar_t]':
[ 108s] /home/abuild/rpmbuild/BUILD/fastcgi++-3.0beta/src/request.cpp:58:76: required from here
[ 108s] /home/abuild/rpmbuild/BUILD/fastcgi++-3.0beta/src/request.cpp:106:64: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
The reason is that contentLength
is unsigned
and m_maxPostSize
is ssize_t
.
A solution would be to use size_t instead of ssize_t and use std::npos instead of -1 (ok they are quite equal ;-) ) to determine if unlimited or not.
Using gcc 7.3.0 on Ubuntu 18.04 (32 and 64 bits), the fcgistreambuf_test program throws a "pure virtual method called" error when the destructor of streambuf is called. gdb shows:
#5 0x00007ffff77d980f in __cxa_pure_virtual () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#6 0x000055555555be95 in Fastcgipp::WebStreambuf<wchar_t, std::char_traits<wchar_t> >::sync (
this=0x7fffffff6340)
at ../fastcgipp/include/fastcgi++/webstreambuf.hpp:229
#7 0x000055555555ba36 in Fastcgipp::WebStreambuf<wchar_t, std::char_traits<wchar_t> >::~WebStreambuf (
this=0x7fffffff6340, __in_chrg=<optimized out>)
at ../fastcgipp/include/fastcgi++/webstreambuf.hpp:240
#8 0x000055555555c428 in Fastcgipp::FcgiStreambuf<wchar_t, std::char_traits<wchar_t> >::~FcgiStreambuf (
this=0x7fffffff6340, __in_chrg=<optimized out>)
at ../fastcgipp/include/fastcgi++/fcgistreambuf.hpp:55
#9 0x000055555555a99e in main () at ../fastcgipp/tests/fcgistreambuf.cpp:312
It seems it is because base class WebStreambuf destructor calls sync which calls emptyBuffer which is a pure function defined in the parent class FcgiStreambuf. And since destructors are called in sequence, FcgiStreambuf is already destroyed when WebStreambuf destructor is executed.
Was working fine in previous versions where sync was called from FcgiStreambuf destructor (tested with commit 3bf169a).
Delete me! Sorry, I was mistaken.
Thanks!
Hi @eddic:
I cloned fastcgipp,and compile it successfully,then,I run make helloworld.fcgi to generate executable. But I found it listen none port, no bind syscall used, and listen complain "illege seek" error. My question is how run it correctly
Is there a way to get the raw FCGI Parameters? Your Environment class auto-parses most of them, but it is missing a few that we use. How do I access the raw FCGI parameters of a request?
Similar issue mentioned by MatthewButterfly:
/home/adminuser/fastcgi++/src/sockets.cpp: In member function ‘Fastcgipp::Socket Fastcgipp::SocketGroup::poll(bool)’:
/home/adminuser/fastcgi++/src/sockets.cpp:523:27: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
if(events == pollIn)
^
/home/adminuser/fastcgi++/src/sockets.cpp:538:27: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
if(events == pollIn)
This is on Centos 6.8 with devtoolset-4 and cmake3 installed.
I changed both instances to use if(events & pollIn) and compile worked.
I haven't tested the binary produced but I assume it'll work as you only want to check if the EPOLLIN bits are set in the events.
Hi!
Examples doesn't work. Any time run i receive error: "[error]: Unable to listen on default FastCGI socket: Socket operation on non-socket".
sockets_test is pass ok.
HTTP/1.1 200 OK
Server: nginx/1.8.0
Date: Tue, 05 Dec 2017 08:13:47 GMT
Content-Type: text/html; charset=UTF-8
i want to set status code 204. how to do it.
At the moment the server will return a 500 server error if unknown POST data is received.
But sometimes you want to receive it (e.g. when getting json).
In this case I would like to simply access the post buffer and work with the raw data (parse the json with my Request class).
Am I safe to assume from request.hpp#L36 there should be an exceptions.hpp in https://github.com/eddic/fastcgipp/tree/master/include/fastcgi++ ?
it does segfault in http.cpp, fastcgipp version 2.1 in
void Fastcgipp::Http::Environment::parsePostsUrlEncoded()
I did not figured out how to fix it yet.
The FastCGIPP::SocketGroups::listen( const char*, uint, const char*, const char*)
fails
to create a file for the socket that can be referenced by NGINX fastcgi_pass directive.
Start a FastCGI with the following line to create a socket ...
const char* sockfilepath = "/tmp/hello.sock" ;
manager.listen(sockfilepath, 0xffffffffUL, "nobody" ) ) ;
Simple NGINX config.
http {
server {
location /hello {
fastcgi_pass unix:/tmp/hello.sock ;
}
}
}
Results in the following error.
2017/01/09 20:17:20 [crit] 7#7: *1 connect() to unix:/tmp/hello.sock failed (2: No such file or directory) while connecting to upstream, client: 172.17.0.1, server: localhost, request: "GET /hello HTTP/1.1", upstream: "fastcgi://unix:/tmp/hello.sock:", host: "localhost:8888"
... because the file is not being created.
I am having multiple issues under Ubuntu with gcc 5.4.0.
After running make and make install, I try to build the examples. However, I get this error:
#error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
I didn't see any warnings/errors prior. Is there something I am missing?
I seem found a problem with the Session Example.
Session.fcgi were not share the s_sessions in different process.
I had open 25 process to launch the Session.fcgi ,
When I reflash the Site too fast , the nginx will use other process(because the first process is using)
and then the session size is zero in second process.
Statically linked executable refuses to start web app.
On running make test
the following output is shown
Test project /home/ken/Applications/fastcgipp/fastcgipp/build_static
Start 1: protocol
1/5 Test #1: protocol ......................... Passed 0.01 sec
Start 2: http
2/5 Test #2: http ............................. Passed 4.03 sec
Start 3: sockets
3/5 Test #3: sockets ..........................***Exception: SegFault 1.08 sec
Start 4: transceiver
4/5 Test #4: transceiver ......................***Exception: SegFault 0.00 sec
Start 5: fcgistreambuf
5/5 Test #5: fcgistreambuf .................... Passed 0.00 sec
60% tests passed, 2 tests failed out of 5
Total Test time (real) = 5.13 sec
The following tests FAILED:
3 - sockets (SEGFAULT)
4 - transceiver (SEGFAULT)
Errors while running CTest
make: *** [Makefile:130: test] Error 8
Running ./sockets_test
outputs
Jan 31 00:19:53 kioko ./sockets_test[25309] [info]: fd .
Jan 31 00:19:53 kioko ./sockets_test[25309] [info]: fd ..
Jan 31 00:19:53 kioko ./sockets_test[25309] [info]: fd 0 -> /dev/pts/0
Jan 31 00:19:53 kioko ./sockets_test[25309] [info]: fd 1 -> /dev/pts/0
Jan 31 00:19:53 kioko ./sockets_test[25309] [info]: fd 2 -> /dev/pts/0
Jan 31 00:19:53 kioko ./sockets_test[25309] [info]: fd 3 -> /proc/25309/fd
Jan 31 00:19:53 kioko ./sockets_test[25309] [diagnostic]: SocketGroup::SocketGroup(): Initialized
Jan 31 00:19:53 kioko ./sockets_test[25309] [diagnostic]: SocketGroup::SocketGroup(): Initialized
Segmentation fault
And for ./transceiver_test
Segmentation fault
Dynamic linkage launches the web app but still fails ./sockets_test
only
cmake -DCMAKE_BUILD_TYPE=RELEASE ../fastcgipp-master
-- The CXX compiler identification is GNU 5.4.0
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
-- Configuring done
-- Generating done
-- Build files have been written to: /home/anatoly/CppProjects/fastcgi++.build
make
Scanning dependencies of target fastcgipp
[ 9%] Building CXX object CMakeFiles/fastcgipp.dir/src/log.cpp.o
[ 18%] Building CXX object CMakeFiles/fastcgipp.dir/src/block.cpp.o
[ 27%] Building CXX object CMakeFiles/fastcgipp.dir/src/http.cpp.o
[ 36%] Building CXX object CMakeFiles/fastcgipp.dir/src/protocol.cpp.o
[ 45%] Building CXX object CMakeFiles/fastcgipp.dir/src/sockets.cpp.o
[ 54%] Building CXX object CMakeFiles/fastcgipp.dir/src/transceiver.cpp.o
[ 63%] Building CXX object CMakeFiles/fastcgipp.dir/src/fcgistreambuf.cpp.o
[ 72%] Building CXX object CMakeFiles/fastcgipp.dir/src/webstreambuf.cpp.o
[ 81%] Building CXX object CMakeFiles/fastcgipp.dir/src/request.cpp.o
[ 90%] Building CXX object CMakeFiles/fastcgipp.dir/src/manager.cpp.o
[100%] Linking CXX shared library libfastcgipp.so
[100%] Built target fastcgipp
make tests
[ 52%] Built target fastcgipp
Scanning dependencies of target sockets_test
[ 57%] Building CXX object CMakeFiles/sockets_test.dir/tests/sockets.cpp.o
[ 61%] Linking CXX executable sockets_test
[ 61%] Built target sockets_test
Scanning dependencies of target fcgistreambuf_test
[ 66%] Building CXX object CMakeFiles/fcgistreambuf_test.dir/tests/fcgistreambuf.cpp.o
[ 71%] Linking CXX executable fcgistreambuf_test
[ 71%] Built target fcgistreambuf_test
Scanning dependencies of target http_test
[ 76%] Building CXX object CMakeFiles/http_test.dir/tests/http.cpp.o
[ 80%] Linking CXX executable http_test
[ 80%] Built target http_test
Scanning dependencies of target transceiver_test
[ 85%] Building CXX object CMakeFiles/transceiver_test.dir/tests/transceiver.cpp.o
[ 90%] Linking CXX executable transceiver_test
[ 90%] Built target transceiver_test
Scanning dependencies of target protocol_test
[ 95%] Building CXX object CMakeFiles/protocol_test.dir/tests/protocol.cpp.o
[100%] Linking CXX executable protocol_test
[100%] Built target protocol_test
Scanning dependencies of target tests
[100%] Built target tests
Running tests...
Test project /home/anatoly/CppProjects/fastcgi++.build
Start 1: protocol
1/5 Test #1: protocol ......................... Passed 0.00 sec
Start 2: http
2/5 Test #2: http ............................. Passed 4.01 sec
Start 3: sockets
3/5 Test #3: sockets ..........................***Failed 1.88 sec
Start 4: transceiver
4/5 Test #4: transceiver ...................... Passed 0.20 sec
Start 5: fcgistreambuf
5/5 Test #5: fcgistreambuf .................... Passed 0.00 sec
80% tests passed, 1 tests failed out of 5
Total Test time (real) = 6.10 sec
The following tests FAILED:
3 - sockets (Failed)
Errors while running CTest
Makefile:127: recipe for target 'test' failed
make: *** [test] Error 8
Ubuntu 16.04
any plan to support mysql8? specifically the mysqlx plugin/protocol for RDBS+Document Store.
using fastcigpp,i can get standard headers,such as HTTP_HOST,HTTP_COOKIE,SERVER_ADDR etc. how can i get user defined headers,such as xxx_header1,xxxx_header2 etc.
If I wanted to access an environment variable like the script_name and then use that to determine which class to hand to the Fastcgipp::Manager would be the simplest way to go about doing this? I'm using v 2.1
The library uses Thread::Thread and therefore calls find_package(Threads REQUIRED)
.
The problem is, that it only calls it on it's own CMakeLists.txt and not within it's FastcgippConfig.cmake.
This results in an error running cmake configure on a project which is using Fastcgipp but not Thread in first place:
...
Target "FastCgi" links to target "Threads::Threads" but the target was not
found. Perhaps a find_package() call is missing for an IMPORTED target, or
an ALIAS target is missing?
...
/root/app/fastcgi++/src/sockets.cpp: In member function ‘Fastcgipp::Socket Fastcgipp::SocketGroup::poll(bool)’:
/root/app/fastcgi++/src/sockets.cpp:448:27: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
if(events == pollIn)
Using setsockopt SO_REUSEADDR (or SO_REUSEPORT if Linux >= 3.9, I'd assume yes these days) before bind/listen can make it so that a server that segfaults can start listening right away. I didn't need to worry about this on 2.1 because I used the spawn-fcgi program which I never got to segfault. A great description of these options and how they differ between operating systems it is on stackoverflow.
I had written a small web server using this library. I used to compile the program using shell scripts and it worked because I directly linked with -lfastcgipp
. As a part of my refactor, I want to use build systems (for obvious reasons). I chose meson which could not find fastcgi++. I learned that the pkg-config was not able to find fastcgi++. This is the output of pkg-config --cflags --libs fastcgi++
Package fastcgi++ was not found in the pkg-config search path.
Perhaps you should add the directory containing `fastcgi++.pc'
to the PKG_CONFIG_PATH environment variable
Package 'fastcgi++', required by 'virtual:world', not found
Note: The PKG_CONFIG_PATH variable is empty
A quick google search about pkg-config fastcgi++
brings me to the documentation of fastcgi++ 2.1 which states:
A pkg-config file will be installed so you can compile against the libraries with
g++ -o script.fcgi script.cpp pkg-config –libs –cflags fastcgi++
But the documentation of 3.0 does not state that.
I installed fastcgi++ as mention in the readme without SQL support. have I done something wrong? Or is the support removed in verison 3?
Was getting a "Socket read() error on fd 8: Resource temporarily unavailable" when uploading files larger than ~500kb using the library being an nginx proxy. (nginx throws a 502 to the client and "writev() failed (32: Broken pipe) while sending request to upstream" to the error log)
Adding a hacky retry loop that's around the read call (socket.cpp:74 - commit fc9bfc4) seems to fix the issue for my purposes (can upload 20mb+ now) - but I didn't track down the underlying cause.
Hope this helps,
Cheers
Hello,
I am not familiar with cmake; I just know how to run it.
I am however very familiar with Linux on the command line.
It would be nice if we could make libfastcgipp.a
because of various C++ ABI issues on Linux (e.g. the libstdc++.so
could be different on my Linux laptop and on the Linux VPS I am renting).
BTW, I could soon use libfastcgipp.so
in the http://refpersys.org/ project
Regards
Basile Starynkevitch
[email protected] (near Paris, France)
I compiled the example echo.cpp, launched with spawn-fcgi. and set up nginx
But when I accessed it in browsers, although it replied the correct webpage, most of time, it replied 504 error
Sometimes it crashes.
Do you have any suggestions?
When I was in vs2013 compile fastcgipp - master/examples under the helloworld, tip unable to open include file: "fastcgi++ / config. HPP" : No to the file or directory I really don't have the file view under the directory
cmake version 3.13.1
$ sudo apt-get install libpq-dev postgresql-server-dev-all
$ git clone https://github.com/eddic/fastcgipp.git fastcgi++
...
$ cd fastcgi++
$ mkdir build
$ cd build
$ cmake -DCMAKE_BUILD_TYPE=RELEASE -DSQL=true ..
-- The CXX compiler identification is GNU 6.3.0
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PostgreSQL: /usr/lib/x86_64-linux-gnu/libpq.so (found version "9.6.12")
-- Looking for C++ include pthread.h
-- Looking for C++ include pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
-- Configuring done
-- Generating done
-- Build files have been written to: /home/user/fastcgi++/build
$ make
Scanning dependencies of target fastcgipp
[ 5%] Building CXX object CMakeFiles/fastcgipp.dir/src/log.cpp.o
[ 11%] Building CXX object CMakeFiles/fastcgipp.dir/src/block.cpp.o
[ 17%] Building CXX object CMakeFiles/fastcgipp.dir/src/http.cpp.o
[ 23%] Building CXX object CMakeFiles/fastcgipp.dir/src/protocol.cpp.o
[ 29%] Building CXX object CMakeFiles/fastcgipp.dir/src/sockets.cpp.o
[ 35%] Building CXX object CMakeFiles/fastcgipp.dir/src/transceiver.cpp.o
[ 41%] Building CXX object CMakeFiles/fastcgipp.dir/src/fcgistreambuf.cpp.o
[ 47%] Building CXX object CMakeFiles/fastcgipp.dir/src/webstreambuf.cpp.o
[ 52%] Building CXX object CMakeFiles/fastcgipp.dir/src/request.cpp.o
[ 58%] Building CXX object CMakeFiles/fastcgipp.dir/src/manager.cpp.o
[ 64%] Building CXX object CMakeFiles/fastcgipp.dir/src/address.cpp.o
[ 70%] Building CXX object CMakeFiles/fastcgipp.dir/src/mailer.cpp.o
[ 76%] Building CXX object CMakeFiles/fastcgipp.dir/src/email.cpp.o
[ 82%] Building CXX object CMakeFiles/fastcgipp.dir/src/parameters.cpp.o
/home/kas/work/git/fastcgi++/src/parameters.cpp:38:31: fatal error: server/utils/inet.h: No such file or directory
#include <server/utils/inet.h>
^
compilation terminated.
CMakeFiles/fastcgipp.dir/build.make:231: recipe for target 'CMakeFiles/fastcgipp.dir/src/parameters.cpp.o' failed
make[2]: *** [CMakeFiles/fastcgipp.dir/src/parameters.cpp.o] Error 1
CMakeFiles/Makefile2:168: recipe for target 'CMakeFiles/fastcgipp.dir/all' failed
make[1]: *** [CMakeFiles/fastcgipp.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2
Is there a way to process post data of content type: application/json
I keep getting a warning in my apache2 log file
[warning]: Unknown content type from client
Hi,
when receiving a request, if the query string ends by separator "&", the separator is added to the last value:
p is set to "a&" instead of "a".
C++ code showing the problem:
#include "fastcgi++/http.hpp"
#include <iostream>
int main()
{
const char input[] = "p=a&";
std::multimap<std::wstring, std::wstring> output;
Fastcgipp::Http::decodeUrlEncoded(
input,
input+sizeof(input)-1,
output);
for ( auto & parameter : output )
std::wcout << parameter.first << "=" << parameter.second << std::endl;
}
Thanks for a great library.
To get this to compile on OSX, can you add to the top of sockets.cpp
#ifndef POLLRDHUP
#define POLLRDHUP 0x2000
#endif
#ifndef MSG_NOSIGNAL
# define MSG_NOSIGNAL 0
# ifdef SO_NOSIGPIPE
# define CEPH_USE_SO_NOSIGPIPE
# else
# error "Cannot block SIGPIPE!"
# endif
#endif
And add to log.cpp:
#if __APPLE__
#ifndef HOST_NAME_MAX
#define HOST_NAME_MAX 255
#endif
#ifndef program_invocation_name
#define program_invocation_name "fastcgi"
#endif
#endif
The example app mail.fcgi
will inifinitly retry with bad sender address.
I found thousands of fail logs after input a bad send address, I think this might be a trouble to your server.
May 05 19:17:45 aa email.fcgi[15698] [error]: Bad reply from SMTP server after MAIL: 501 <oh>: sender address must contain a domain
May 05 19:17:46 aa email.fcgi[15698] [error]: Bad reply from SMTP server after MAIL: 501 <oh>: sender address must contain a domain
...
...
May 05 19:17:46 aa email.fcgi[15698] [error]: Bad reply from SMTP server after MAIL: 501 <oh>: sender address must contain a domain
May 05 19:17:46 aa email.fcgi[15698] [error]: Bad reply from SMTP server after MAIL: 501 <oh>: sender address must contain a domain
Building the examples finishes with the error:
/usr/local/include/fastcgi++/request.hpp:36:36: fatal error: fastcgi++/exceptions.hpp: No such file or directory
compilation terminated.
exceptions.hpp was really deleted in 09b65f4
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.