GithubHelp home page GithubHelp logo

splunk / pion Goto Github PK

View Code? Open in Web Editor NEW
298.0 55.0 94.0 3.92 MB

Pion Network Library (Boost licensed open source)

License: Boost Software License 1.0

Shell 0.44% Perl 1.14% C++ 88.85% XSLT 0.92% CMake 3.00% Assembly 0.33% Batchfile 0.18% HTML 0.11% Makefile 0.71% M4 2.68% Pascal 1.63%

pion's Introduction

Pion Network Library

C++ framework for building lightweight HTTP interfaces

Build Status

Project Home: https://github.com/splunk/pion

Retrieving the code

git clone https://github.com/splunk/pion.git
cd pion

Building the code

For XCode: use pion.xcodeproj

For Visual Studio: use pion.sln

On Unix platforms (including Linux, OSX, etc.) you can run

./autogen.sh
./configure

to generate Makefiles using GNU autotools, followed by

make

to build everything except the unit tests.

You can build and run all the unit tests with

make check

Generate build using CMake

CMake is cross-platform build generator. Pion required cmake version 2.8.10+

To generate build call

cmake <path to pion clone> [-G <generator name>] [-D<option>...]

for example to generate MSVS2012 Win64 solution run

git clone [email protected]:splunk/pion.git
cd pion/build
cmake .. -G"Visual Studio 11 Win64"

this will create pion_solution.sln for MSVS2012/Win64

if cmake can't find dependency, use -D to control Find modules search behaviour

-DBOOST_ROOT=<path to installed boost libraries>
-DZLIB_ROOT=<path to installed zlib>
-DOPENSSL_ROOT_DIR=...
-DLOG4CPLUS_ROOT=...

Third Party Libraries

Pion requires the Boost C++ libraries version 1.35 or greater. Please see the README.boost file within the doc subdirectory for instructions on how to download, build and install Boost.

For logging, Pion may be configured to:

  • use std::cout and std::cerr for logging (the default configuration)

  • use one of the following open source libraries:

  • disable logging entirely (run configure --disable-logging)

Detailed build instructions are available for all of the platforms supported by Pion within the doc subdirectory (README.platform).

License

Copyright © 2007-2016 Splunk Inc.

The Pion Network Library is published under the Boost Software License. See COPYING for licensing information.

pion's People

Contributors

abhidhar avatar cmbuilder avatar daminetreg avatar eduardobmc avatar hasselmm avatar jhol avatar jzwinck avatar maksqwe avatar maysl avatar mikedickey avatar pmed avatar snikulov avatar uzakmat avatar valazath avatar vshcherbakov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pion's Issues

Replace logging macros by inline functions

Shouldn't the logging macros get replaced by inline functions? The currently needed all-upper-case macros look rather disruptive in otherwise all-lower-case code. IMHO. Can prepare a pull request if you agree that this deserves a look.

cmake CMAKE_SOURCE_DIR versus PROJECT_SOURCE_DIR

I am trying to integrate pion into a larger cmake-based project via add_subdirectory(pion pion-build).

This is rather difficult because the pion CMakeLists.txt uses CMAKE_ variables instead of the equivalent PROJECT_ variables. One unfortunate consequence is that the pion policy of not being able to build in-source escalates to the larger project.

If the pion CMakeLists.txt used the PROJECT_ variables instead, then I can build pion outside-source with the "pion-build" workaround in the add_subdirectory() above.

The variables that I needed to changes were:

  • CMAKE_SOURCE_DIR -> PROJECT_SOURCE_DIR
  • CMAKE_BINARY_DIR -> PROJECT_BINARY_DIR

And for good measure (see also #36) I also needed to remove the /Bin part of COMMON_BIN_PATH.

Unable to build on Ubuntu 14.10

I've been trying to build and compile on Ubuntu 14.10 but i always get this error
saad@Infinity:/Desktop/pion$ ./autogen.sh
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, m4'. libtoolize: linking filem4/ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, m4'. libtoolize: linking filem4/libtool.m4'
libtoolize: linking file m4/ltoptions.m4' libtoolize: linking filem4/ltsugar.m4'
libtoolize: linking file m4/ltversion.m4' libtoolize: linking filem4/lt
obsolete.m4'
configure.ac:21: installing 'm4/compile'
configure.ac:24: installing 'm4/config.guess'
configure.ac:24: installing 'm4/config.sub'
configure.ac:15: installing 'm4/install-sh'
configure.ac:15: installing 'm4/missing'
services/Makefile.am: installing 'm4/depcomp'
parallel-tests: installing 'm4/test-driver'
saad@Infinity:/Desktop/pion$ ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking how to print strings... printf
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert x86_64-unknown-linux-gnu file names to x86_64-unknown-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-unknown-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... dlltool
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @file support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for mt... mt
checking if mt is a manifest tool... no
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking for shl_load... no
checking for shl_load in -ldld... no
checking for dlopen... no
checking for dlopen in -ldl... yes
checking whether a program can dlopen itself... yes
checking whether a statically linked program can dlopen itself... no
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for doxygen... no
configure: WARNING: doxygen not found - will not generate any doxygen documentation
checking for perl... /usr/bin/perl
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking how to run the C++ preprocessor... g++ -E
checking for ld used by g++... /usr/bin/ld -m elf_x86_64
checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld... yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking for g++ option to produce PIC... -fPIC -DPIC
checking if g++ PIC flag -fPIC -DPIC works... yes
checking if g++ static flag -static works... yes
checking if g++ supports -c -o file.o... yes
checking if g++ supports -c -o file.o... (cached) yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking dynamic linker characteristics... (cached) GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking for C++ compiler vendor... gnu
checking for specific CPU architecture... no
checking for debugging... no
checking for plug-ins directory... /usr/local/share/pion/plugins
checking for boostlib >= 1.35... yes
checking boost library extension... "(none)"
checking for boost::date_time library... ok
checking for boost::system library... ok
checking for boost::thread library... ok
checking for boost::filesystem library... ok
checking for boost::regex library... ok
checking for boost::test library... ok
checking for cygwin directory... no
checking for malloc_trim() support... yes
checking unordered_map usability... no
checking unordered_map presence... no
checking for unordered_map... no
checking tr1/unordered_map usability... yes
checking tr1/unordered_map presence... yes
checking for tr1/unordered_map... yes
checking if unordered_map is ok... ok
checking for gzip compression support (zlib)... yes
checking zlib.h usability... yes
checking zlib.h presence... yes
checking for zlib.h... yes
checking linking with zlib... ok
checking for bzip2 compression support (bzlib)... yes
checking bzlib.h usability... no
checking bzlib.h presence... no
checking for bzlib.h... no
configure: error: Unable to find the bzlib headers
saad@Infinity:
/Desktop/pion$ make
make: *** No targets specified and no makefile found. Stop.
saad@Infinity:~/Desktop/pion$ sudo apt-get install bzlib
[sudo] password for saad:
Sorry, try again.
[sudo] password for saad:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package bzlib


I've searched for bzlib package and haven't been able to locate it?

Thanks

log4cxx as the Logger for pion-net

Hi,

The class log4cxx::Logger doesn't have a method called "get_logger". The right method is called "getLogger". You can see this in include/pion/logger.hpp.

Good job,
Tibério Menezes.

Building PION error: where to put boost libraries?

I downloaded and build the latest Boost librearies from: http://www.boost.org/ . The using bjam I created the libs. I've got these at external harddrive now. Where should I put these for PION to find them while running ./configure ?

pi@raspberrypi ~/pion $ ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking build system type... armv6l-unknown-linux-gnueabihf
checking host system type... armv6l-unknown-linux-gnueabihf
checking how to print strings... printf
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert armv6l-unknown-linux-gnueabihf file names to armv6l-unknown-linux-gnueabihf format... func_convert_file_noop
checking how to convert armv6l-unknown-linux-gnueabihf file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... dlltool
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @file support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for mt... mt
checking if mt is a manifest tool... no
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking for shl_load... no
checking for shl_load in -ldld... no
checking for dlopen... no
checking for dlopen in -ldl... yes
checking whether a program can dlopen itself... yes
checking whether a statically linked program can dlopen itself... no
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for doxygen... no
configure: WARNING: doxygen not found - will not generate any doxygen documentation
checking for perl... /usr/bin/perl
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking how to run the C++ preprocessor... g++ -E
checking for ld used by g++... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes
checking for g++ option to produce PIC... -fPIC -DPIC
checking if g++ PIC flag -fPIC -DPIC works... yes
checking if g++ static flag -static works... yes
checking if g++ supports -c -o file.o... yes
checking if g++ supports -c -o file.o... (cached) yes
checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... (cached) GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking for C++ compiler vendor... gnu
checking for specific CPU architecture... no
checking for debugging... no
checking for plug-ins directory... /usr/local/share/pion/plugins
checking for boostlib >= 1.35... yes
checking boost library extension... "(none)"
checking for boost::date_time library... not found
configure: error: Unable to link with the boost::date_time library
pi@raspberrypi ~/pion $

I did all from: https://github.com/cloudmeter/pion/blob/develop/doc/README.boost
but the last paragraph

"To install, you can now just copy the files in stage/lib into your
library include path, and copy the boost/ directory into your header
include path."
What does it mean? Where to copy those?

Thank you for any pointing into the right direction.

Configure with --with-debug fails on OpenSuse 12.2

Hi,
configuring with --with-debug flag on OpenSuse 12.2 (g++ 4.7, boost 1.49) result in the the following error while compiling:

undefined reference to `vtable for __gnu_cxx::recursive_init_error'

fixed linking -lsupc++

commit 593c3b2 (develop branch)

Set-cookie parsing

Hi,

I'm talking about:

bool parser::parse_cookie_header(ihash_multimap& dict, const char *ptr, const size_t len, bool set_cookie_header)
in src/http_parser.cpp

From what I understand this function was for breaking an individual cookie in its components and to put them in a dictionnary.

Well it seems this function is called for every cookie, that all individual components are mixed together and added as cookies themselves.

P. ex. , if I download one page, this is what a call to pion::http::response_ptr::write give me :

Set-Cookie: PREF=ID=b255244245f28df7:FF=0:TM=1407897815:LM=1407897815:S=p0ASItwZjDttyxBq; expires=Fri, 12-Aug-2016 02:43:35 GMT; path=/; domain=.google.fr
Set-Cookie: path="/"; Version=1; Path=/
Set-Cookie: path="/"; Version=1; Path=/
Set-Cookie: HttpOnly=""; Version=1; Path=/
Set-Cookie: domain=".google.fr"; Version=1; Path=/
Set-Cookie: domain=".google.fr"; Version=1; Path=/
Set-Cookie: 12-Aug-201602:43:35GMT=""; Version=1; Path=/
Set-Cookie: expires="Thu"; Version=1; Path=/
Set-Cookie: expires="Fri"; Version=1; Path=/
Set-Cookie: NID="67=CBnGymFTcCnhhkVxY0pfFRIY_C8cWJx5j0ATXCifbiv7Plcl60Gq6OrznUOoi9ng24WV0U06zHhPkeg4WcWS7UjlFP-tRoLQknBWhZd7ADe479UoUNMNkZE38g5qSZfu"; Version=1; Path=/
Set-Cookie: 12-Feb-201502:43:35GMT=""; Version=1; Path=/
Set-Cookie: PREF="ID=b255244245f28df7:FF=0:TM=1407897815:LM=1407897815:S=p0ASItwZjDttyxBq"; Version=1; Path=/
Set-Cookie: NID=67=CBnGymFTcCnhhkVxY0pfFRIY_C8cWJx5j0ATXCifbiv7Plcl60Gq6OrznUOoi9ng24WV0U06zHhPkeg4WcWS7UjlFP-tRoLQknBWhZd7ADe479UoUNMNkZE38g5qSZfu; expires=Thu, 12-Feb-2015 02:43:35 GMT; path=/; domain=.google.fr; HttpOnly

And as control this is what I get from wireshark:

Set-Cookie: PREF=ID=b255244245f28df7:FF=0:TM=1407897815:LM=1407897815:S=p0ASItwZjDttyxBq; expires=Fri, 12-Aug-2016 02:43:35 GMT; path=/; domain=.google.fr
Set-Cookie: NID=67=CBnGymFTcCnhhkVxY0pfFRIY_C8cWJx5j0ATXCifbiv7Plcl60Gq6OrznUOoi9ng24WV0U06zHhPkeg4WcWS7UjlFP-tRoLQknBWhZd7ADe479UoUNMNkZE38g5qSZfu; expires=Thu, 12-Feb-2015 02:43:35 GMT; path=/; domain=.google.fr; HttpOnly

request resource displayed without escaping in FileService error page html

The resource from the request is displayed in FileService's error html, such as the 404 page. Since the resource isn't escaped, it allows a possible XSS attack if you can get someone to click a malicious link. I found out about this from someone testing with nikto, and it seems to be the "Error Page Example" issue described here https://www.owasp.org/index.php/Cross-site_Scripting_%28XSS%29.

To fix it, I think all that would need done is to html escape the resource.

I'm using an old version of pion (3.0.5), but it didn't look like it has been fixed from a quick look at the latest version.

Compilation error in src/process.cpp when boost <= 1.44.0

I just tried to compile pion with boost 1.44.0. (I know it is an old version but this specific version is a requirement when building Adobe InDesign CS6 plugins.)
The error is introduced with the following commit:
9a3093d
where a line:
p.make_preferred();
was inserted.

As far as I have understood the boost code, make_preferred() is introduced with v3 of boost::filesystem.
So the line needs to be moved to after the following #if so it only takes effect when compiling with boost versions that use v.3 or higher. For boost version 1.44.0 and earlier which use v2 of boost::filesystem, this does not compile. In v.2 the return p.file_string() routine used in the #else part already does the conversion make_preferred() do in v3, so no changes for v.2 should be necessary.

So the fix should look like:

std::string process::generate_dumpfile_name()
{
...
     p /= ss.str();
     p.normalize();
-    p.make_preferred();

 # if defined(BOOST_FILESYSTEM_VERSION) && BOOST_FILESYSTEM_VERSION >= 3
+    p.make_preferred();
     return p.string();
#else
    return p.file_string();
#endif 

}

Cookies while writing a request

pion::http::message::append_headers function doesn't manage cookies, so with the following code:

////////////////////////////////////////////////////////////////////////////////////////
pion::http::request_ptr request(new pion::http::request);

// Setup the request method, resource, etc etc
...

request->add_cookie("JSESSIONID", "blahblahblah");

pion::http::request_writer_ptr writer =
pion::http::request_writer::create(connection, request, ....)

writer->send();
//////////////////////////////////////////////////////////////////////////////////

Will send the request but without Cookies.

Am I missing something or is this a bug?

I've temporarily fixed this issue replacing the function with:

inline void append_headers(write_buffers_t& write_buffers) {
// add HTTP headers
for (ihash_multimap::const_iterator i = m_headers.begin(); i != m_headers.end(); ++i) {
write_buffers.push_back(boost::asio::buffer(i->first));
write_buffers.push_back(boost::asio::buffer(HEADER_NAME_VALUE_DELIMITER));
write_buffers.push_back(boost::asio::buffer(i->second));
write_buffers.push_back(boost::asio::buffer(STRING_CRLF));
}

    // add Cookies

    ihash_multimap::const_iterator iend =  m_cookie_params.end();
    for (ihash_multimap::const_iterator i = m_cookie_params.begin(); i != iend; ++i)
    {
         write_buffers.push_back(boost::asio::buffer(HEADER_COOKIE));
         write_buffers.push_back(boost::asio::buffer(HEADER_NAME_VALUE_DELIMITER));
         write_buffers.push_back(boost::asio::buffer(i->first + "=" + i->second));
         write_buffers.push_back(boost::asio::buffer(STRING_CRLF));
    }

    // add an extra CRLF to end HTTP headers
    write_buffers.push_back(boost::asio::buffer(STRING_CRLF));
}

Please let me know if I'm following a wrong approach to send an http message or if it is really a bug.
Thx and congratulations for the powerfull lib.

Bug in HTTPWriter::send_more_data ?

There is a branch

    if (! m_tcp_conn->is_open())
        finished_writing(boost::asio::error::connection_reset);

at begin of method HTTPWriter::send_more_data.
Maybe "return" was lost here???

Because calling of "finished_writing(boost::asio::error::connection_reset)" here leads calling finishedWriting twice. One calling from this brunch and one later from callback initiated by m_tcp_conn->async_write.

Moreover if we detected non open connection at begining, is there any reason to execute buffers preparing, calling m_tcp_conn->async_write???

full code of send_more_data below:

inline void send_more_data(const bool send_final_chunk, SendHandler send_handler)
{
    // make sure that we did not lose the TCP connection
    if (! m_tcp_conn->is_open())
        finished_writing(boost::asio::error::connection_reset);
    // make sure that the content-length is up-to-date
    flushContentStream();
    // prepare the write buffers to be sent
    http::message::write_buffers_t write_buffers;
    prepare_write_buffers(write_buffers, send_final_chunk);
    // send data in the write buffers
    m_tcp_conn->async_write(write_buffers, send_handler);
}

make Error

I-m trying to install PION Network Library 4.0.7
After ./configure I run make and obtain the following error:

../include/pion/PionScheduler.hpp: In member function 'virtual void pion::PionMultiThreadScheduler::stopThreads()':
../include/pion/PionScheduler.hpp:216: error: 'LOG4CPLUS_DEBUG' was not declared in this scope
PionScheduler.cpp: In member function 'virtual void pion::PionScheduler::shutdown()':
PionScheduler.cpp:33: error: 'LOG4CPLUS_INFO' was not declared in this scope
PionScheduler.cpp:37: error: invalid operands of types 'const char [13]' and 'uint32_t' to binary 'operator<<'
PionScheduler.cpp: In member function 'void pion::PionScheduler::processServiceWork(boost::asio::io_service&)':
PionScheduler.cpp:120: error: 'LOG4CPLUS_ERROR' was not declared in this scope
PionScheduler.cpp:122: error: 'LOG4CPLUS_ERROR' was not declared in this scope
PionScheduler.cpp: In member function 'virtual void pion::PionSingleServiceScheduler::startup()':
PionScheduler.cpp:136: error: 'LOG4CPLUS_INFO' was not declared in this scope
PionScheduler.cpp: In member function 'virtual void pion::PionOneToOneScheduler::startup()':
PionScheduler.cpp:161: error: 'LOG4CPLUS_INFO' was not declared in this scope
make[2]: *** [PionScheduler.lo] Error 1
make[2]: Leaving directory /home/pion-net-4.0.7/common/src' make[1]: *** [check-recursive] Error 1 make[1]: Leaving directory/home/pion-net-4.0.7/common'
make: *** [check-recursive] Error 1

(I have installed the log4cplus version 1.1)

memset not defined

header is missing in algorithm.cpp causing "memset not defined error"

Build with MinGW fails

Tried to build pion with MinGW (gcc 4.8.1) under Windows 7 64 bit (MSYS environment).
autogen.sh runs normal, but it generates configure file with two errors (probably one error duplicated) - there is empty else ...fi section at lines before line 17839 and 17938 (in my case). Had to remove lines with else.

After this issue is corrected configure runs untill it comes to boost library.

checking for boostlib >= 1.35... configure: error: We could not detect the boost  libraries (version 1.35 or higher). If you have a staged boost library (still not installed) please specify $BOOST_ROOT in your environment and do not give a PATH to --with-boost option.  If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation.

My boost library is located in non-standard location (actually I have several boost libraries of different versions). I had tried to define BOOST_ROOT environment variable as it is written in error message, but without success.

export BOOST_ROOT="/c/MinGW/boost_1_55_0/boost"

When i move folders with boost header files to include dir this test passes. But I do not know where should i put boost library (*.a) files.

I had also tried to define --libdir and --includedir in configure parameters without any success. (with ":" and " " as delimiters)

./configure --libdir="/C/MinGW/lib /C/MinGW/boost_1_55_0" --includedir="/C/MinGW/include /C/MinGW/boost_1_55_0"

It looks like there is no effect of this parameters on configure script execution
Could you help me to configure build environment?
Maybe I am doing something wrong.
I am very interested in pion library but still unable to build it.

a boost 1.54 onward ' BOOST_SYSTEM_NOEXCEPT' compatibility

Hi, to build with other projects dependent on boost 1.54.0, I found I needed to alter two lines. Now I haven't then built with 1.53 or earlier to see what happens
.........
diff --git a/include/pion/http/message.hpp b/include/pion/http/message.hpp
index 906114c..57350fa 100644
--- a/include/pion/http/message.hpp
+++ b/include/pion/http/message.hpp
@@ -58,7 +58,7 @@ public:
: public boost::system::error_category
{
virtual ~receive_error_t() {}

  •    virtual inline const char *name() const { return "receive_error_t"; }
    
  •    virtual inline const char *name() const BOOST_SYSTEM_NOEXCEPT { return "receive_error_t"; }
     virtual inline std::string message(int ev) const {
         std::string result;
         switch(ev) {
    
    diff --git a/include/pion/http/parser.hpp b/include/pion/http/parser.hpp
    index 1890c37..037cb49 100644
    --- a/include/pion/http/parser.hpp
    +++ b/include/pion/http/parser.hpp
    @@ -71,7 +71,7 @@ public:
    : public boost::system::error_category
    {
    public:
  •    const char *name() const { return "parser"; }
    
  •    const char *name() const BOOST_SYSTEM_NOEXCEPT { return "parser"; }
     std::string message(int ev) const {
         switch (ev) {
         case ERROR_METHOD_CHAR:
    

boost::filesystem library... not found

I get the following error during my PION installation in Oracle Linux 5.5>
Unable to link with the boost::filesystem library

The curious is that others libraries can be found and there are in the same directory /usr/local/boost_1_45_0/stage/lib
(
checking for boost::date_time library... ok
checking for boost::thread library... ok
checking for boost::system library... ok
checking for boost::filesystem library... not found
)
Can anyone help me on this..
Thanks

tcp_server tries to gain admin rights for port 0

Not specifying a port number for tcp_server results in an ephemeral port number being selected by bind().

Unfortunately the initial port number of zero causes tcp_server.cpp:84 to try to gain admin rights where they are not needed. This causes an incorrect error in the log.

The check should probably be more like:

pion::admin_rights use_admin_rights((get_port() > 0) && (get_port() < 1024)); 

parser busy loop

Setting a payload handler callback on the parser produce sometime a busy loop around

http_parser.cpp line 58

do{
....
} while(boost::indeterminate(rc) && ! eof()) 

It seems to me that in the consume_content_as_next_chunk method the m_read_ptr has to be incremented also if m_payload_handler is set:

http_parser.cpp line 1450

if (m_payload_handler) {
            if (m_bytes_last_read)
            {
                m_payload_handler(m_read_ptr, m_bytes_last_read);
                m_read_ptr += m_bytes_last_read;
            }
        } else ....

With this change, my program is back to work fine

shared-lib-without-dependency-information and missing-call-to-setgroups

Hello!
I to build package (pion-5.0.7) and OBS output gave me the following warning:

pion-plugins.i586: W: shared-lib-without-dependency-information /usr/lib/pion/plugins/hasNoCreate.so

libpion-5_0.i586: W: missing-call-to-setgroups-before-setuid /usr/lib/libpion-5.0.so
This executable is calling setuid and setgid without setgroups or initgroups.
There is a high probability this mean it didn't relinquish all groups, and
this would be a potential security issue to be fixed. Seek POS36-C on the web
for details about the problem.

Thank you for the attention, hope this report helps development.

cmake does not generate config.hpp

If you use cmake to generate makefiles on the develop branch, it does not generate include/pion/config.hpp resulting in the following error message in my own server:

/home/breese/src/transenna/remote/pion/include/pion/http/server.hpp:21:10: fatal error: 'pion/config.hpp' file not found
#include <pion/config.hpp>
         ^
1 error generated.

Plugins installed to wrong directory

The plugins are installed to the wrong directory. Currently they get installed to $datadir/pion/plugins (e.g. /usr/local/share/pion/plugins), which is for platform indepentent data files only. Plugins, like all other libraries belong to $libdir/pion/plugins.

Error C2664 building with VS 2013

I tried to compile with VS 2013 and I get these errors :

1>------ Build started: Project: pion, Configuration: Debug_DLL_full Win32 ------
1> 1 fichier(s) copié(s).
1> tcp_server.cpp
1>C:\boost\include\boost-1_58\boost/bind/bind.hpp(313): error C2664: 'void boost::_mfi::mf1<void,pion::tcp::server,pion::tcp::connection_ptr &>::operator ()(T *,A1) const' : cannot convert argument 2 from 'const boost::shared_ptr' to 'boost::shared_ptr '
1> with
1> [
1> T=pion::tcp::server
1> , A1=pion::tcp::connection_ptr &
1> ]
1> and
1> [
1> T=pion::tcp::connection
1> ]
1> and
1> [
1> T=pion::tcp::connection
1> ]
1> Conversion loses qualifiers
1> C:\boost\include\boost-1_58\boost/bind/bind.hpp(905) : see reference to function template instantiation 'void boost::_bi::list2boost::_bi::value<T,boost::arg<1>>::operator ()<F,boost::_bi::list1<const boost::shared_ptrpion::tcp::connection &>>(boost::_bi::type,F &,A &,int)' being compiled
1> with
1> [
1> T=pion::tcp::server *
1> , F=boost::_mfi::mf1<void,pion::tcp::server,pion::tcp::connection_ptr &>
1> , A=boost::_bi::list1<const boost::shared_ptrpion::tcp::connection &>
1> ]
1> C:\boost\include\boost-1_58\boost/bind/bind.hpp(905) : see reference to function template instantiation 'void boost::_bi::list2boost::_bi::value<T,boost::arg<1>>::operator ()<F,boost::_bi::list1<const boost::shared_ptrpion::tcp::connection &>>(boost::_bi::type,F &,A &,int)' being compiled
1> with
1> [
1> T=pion::tcp::server *
1> , F=boost::_mfi::mf1<void,pion::tcp::server,pion::tcp::connection_ptr &>
1> , A=boost::_bi::list1<const boost::shared_ptrpion::tcp::connection &>
1> ]
1> C:\boost\include\boost-1_58\boost/function/function_template.hpp(159) : see reference to function template instantiation 'void boost::_bi::bind_t<void,boost::_mfi::mf1<void,pion::tcp::server,pion::tcp::connection_ptr &>,boost::_bi::list2boost::_bi::value<T,boost::arg<1>>>::operator ()boost::shared_ptrpion::tcp::connection(A1 &&)' being compiled
1> with
1> [
1> T=pion::tcp::server *
1> , A1=boost::shared_ptrpion::tcp::connection
1> ]
1> C:\boost\include\boost-1_58\boost/function/function_template.hpp(159) : see reference to function template instantiation 'void boost::_bi::bind_t<void,boost::_mfi::mf1<void,pion::tcp::server,pion::tcp::connection_ptr &>,boost::_bi::list2boost::_bi::value<T,boost::arg<1>>>::operator ()boost::shared_ptrpion::tcp::connection(A1 &&)' being compiled
1> with
1> [
1> T=pion::tcp::server *
1> , A1=boost::shared_ptrpion::tcp::connection
1> ]
1> C:\boost\include\boost-1_58\boost/function/function_template.hpp(153) : while compiling class template member function 'void boost::detail::function::void_function_obj_invoker1<FunctionObj,R,T0>::invoke(boost::detail::function::function_buffer &,T0)'
1> with
1> [
1> FunctionObj=boost::_bi::bind_t<void,boost::_mfi::mf1<void,pion::tcp::server,pion::tcp::connection_ptr &>,boost::_bi::list2<boost::_bi::value<pion::tcp::server *>,boost::arg<1>>>
1> , R=void
1> , T0=boost::shared_ptrpion::tcp::connection
1> ]
1> C:\boost\include\boost-1_58\boost/function/function_template.hpp(940) : see reference to function template instantiation 'void boost::detail::function::void_function_obj_invoker1<FunctionObj,R,T0>::invoke(boost::detail::function::function_buffer &,T0)' being compiled
1> with
1> [
1> FunctionObj=boost::_bi::bind_t<void,boost::_mfi::mf1<void,pion::tcp::server,pion::tcp::connection_ptr &>,boost::_bi::list2<boost::_bi::value<pion::tcp::server *>,boost::arg<1>>>
1> , R=void
1> , T0=boost::shared_ptrpion::tcp::connection
1> ]
1> C:\boost\include\boost-1_58\boost/function/function_template.hpp(940) : see reference to class template instantiation 'boost::detail::function::void_function_obj_invoker1<FunctionObj,R,T0>' being compiled
1> with
1> [
1> FunctionObj=boost::_bi::bind_t<void,boost::_mfi::mf1<void,pion::tcp::server,pion::tcp::connection_ptr &>,boost::_bi::list2<boost::_bi::value<pion::tcp::server *>,boost::arg<1>>>
1> , R=void
1> , T0=boost::shared_ptrpion::tcp::connection
1> ]
1> C:\boost\include\boost-1_58\boost/function/function_template.hpp(728) : see reference to function template instantiation 'void boost::function1<void,boost::shared_ptr>::assign_to(Functor)' being compiled
1> with
1> [
1> T=pion::tcp::connection
1> , Functor=boost::_bi::bind_t<void,boost::_mfi::mf1<void,pion::tcp::server,pion::tcp::connection_ptr &>,boost::_bi::list2<boost::_bi::value<pion::tcp::server *>,boost::arg<1>>>
1> ]
1> C:\boost\include\boost-1_58\boost/function/function_template.hpp(728) : see reference to function template instantiation 'void boost::function1<void,boost::shared_ptr>::assign_to(Functor)' being compiled
1> with
1> [
1> T=pion::tcp::connection
1> , Functor=boost::_bi::bind_t<void,boost::_mfi::mf1<void,pion::tcp::server,pion::tcp::connection_ptr &>,boost::_bi::list2<boost::_bi::value<pion::tcp::server *>,boost::arg<1>>>
1> ]
1> tcp_server.cpp(183) : see reference to function template instantiation 'boost::function1<void,boost::shared_ptr>::function1<boost::_bi::bind_t<void,boost::_mfi::mf1<void,pion::tcp::server,pion::tcp::connection_ptr &>,boost::_bi::list2boost::_bi::value<pion::tcp::server,boost::arg<1>>>>(Functor,int)' being compiled
1> with
1> [
1> T=pion::tcp::connection
1> , Functor=boost::_bi::bind_t<void,boost::_mfi::mf1<void,pion::tcp::server,pion::tcp::connection_ptr &>,boost::_bi::list2<boost::_bi::value<pion::tcp::server *>,boost::arg<1>>>
1> ]
1> tcp_server.cpp(183) : see reference to function template instantiation 'boost::function1<void,boost::shared_ptr>::function1<boost::_bi::bind_t<void,boost::_mfi::mf1<void,pion::tcp::server,pion::tcp::connection_ptr &>,boost::_bi::list2boost::_bi::value<pion::tcp::server,boost::arg<1>>>>(Functor,int)' being compiled
1> with
1> [
1> T=pion::tcp::connection
1> , Functor=boost::_bi::bind_t<void,boost::_mfi::mf1<void,pion::tcp::server,pion::tcp::connection_ptr &>,boost::_bi::list2<boost::_bi::value<pion::tcp::server *>,boost::arg<1>>>
1> ]
1> http_server.cpp
1>C:\boost\include\boost-1_58\boost/bind/bind.hpp(457): error C2664: 'void boost::_mfi::mf3<void,pion::http::server,pion::http::request_ptr &,pion::tcp::connection_ptr &,const boost::system::error_code &>::operator ()(T *,A1,A2,A3) const' : cannot convert argument 2 from 'const pion::http::request_ptr' to 'boost::shared_ptrpion::http::request '
1> with
1> [
1> T=pion::http::server
1> , A1=pion::http::request_ptr &
1> , A2=pion::tcp::connection_ptr &
1> , A3=const boost::system::error_code &
1> ]
1> Conversion loses qualifiers
1> C:\boost\include\boost-1_58\boost/bind/bind.hpp(934) : see reference to function template instantiation 'void boost::_bi::list4boost::_bi::value<T,boost::arg<1>,boost::arg<2>,boost::arg<3>>::operator ()<F,boost::_bi::list3<const boost::shared_ptrpion::http::request &,const boost::shared_ptrpion::tcp::connection &,const boost::system::error_code &>>(boost::_bi::type,F &,A &,int)' being compiled
1> with
1> [
1> T=pion::http::server *
1> , F=boost::_mfi::mf3<void,pion::http::server,pion::http::request_ptr &,pion::tcp::connection_ptr &,const boost::system::error_code &>
1> , A=boost::_bi::list3<const boost::shared_ptrpion::http::request &,const boost::shared_ptrpion::tcp::connection &,const boost::system::error_code &>
1> ]
1> C:\boost\include\boost-1_58\boost/bind/bind.hpp(934) : see reference to function template instantiation 'void boost::_bi::list4boost::_bi::value<T,boost::arg<1>,boost::arg<2>,boost::arg<3>>::operator ()<F,boost::_bi::list3<const boost::shared_ptrpion::http::request &,const boost::shared_ptrpion::tcp::connection &,const boost::system::error_code &>>(boost::_bi::type,F &,A &,int)' being compiled
1> with
1> [
1> T=pion::http::server *
1> , F=boost::_mfi::mf3<void,pion::http::server,pion::http::request_ptr &,pion::tcp::connection_ptr &,const boost::system::error_code &>
1> , A=boost::_bi::list3<const boost::shared_ptrpion::http::request &,const boost::shared_ptrpion::tcp::connection &,const boost::system::error_code &>
1> ]
1> C:\boost\include\boost-1_58\boost/function/function_template.hpp(159) : see reference to function template instantiation 'void boost::_bi::bind_t<void,boost::_mfi::mf3<void,pion::http::server,pion::http::request_ptr &,pion::tcp::connection_ptr &,const boost::system::error_code &>,boost::_bi::list4boost::_bi::value<T,boost::arg<1>,boost::arg<2>,boost::arg<3>>>::operator ()boost::shared_ptr<pion::http::request,boost::shared_ptrpion::tcp::connection,const boost::system::error_code&>(A1 &&,A2 &&,A3)' being compiled
1> with
1> [
1> T=pion::http::server *
1> , A1=pion::http::request_ptr
1> , A2=boost::shared_ptrpion::tcp::connection
1> , A3=const boost::system::error_code &
1> ]
1> C:\boost\include\boost-1_58\boost/function/function_template.hpp(159) : see reference to function template instantiation 'void boost::_bi::bind_t<void,boost::_mfi::mf3<void,pion::http::server,pion::http::request_ptr &,pion::tcp::connection_ptr &,const boost::system::error_code &>,boost::_bi::list4boost::_bi::value<T,boost::arg<1>,boost::arg<2>,boost::arg<3>>>::operator ()boost::shared_ptr<pion::http::request,boost::shared_ptrpion::tcp::connection,const boost::system::error_code&>(A1 &&,A2 &&,A3)' being compiled
1> with
1> [
1> T=pion::http::server *
1> , A1=pion::http::request_ptr
1> , A2=boost::shared_ptrpion::tcp::connection
1> , A3=const boost::system::error_code &
1> ]
1> C:\boost\include\boost-1_58\boost/function/function_template.hpp(153) : while compiling class template member function 'void boost::detail::function::void_function_obj_invoker3<FunctionObj,R,T0,T1,T2>::invoke(boost::detail::function::function_buffer &,T0,T1,T2)'
1> with
1> [
1> FunctionObj=boost::_bi::bind_t<void,boost::_mfi::mf3<void,pion::http::server,pion::http::request_ptr &,pion::tcp::connection_ptr &,const boost::system::error_code &>,boost::_bi::list4<boost::_bi::value<pion::http::server *>,boost::arg<1>,boost::arg<2>,boost::arg<3>>>
1> , R=void
1> , T0=pion::http::request_ptr
1> , T1=pion::tcp::connection_ptr
1> , T2=const boost::system::error_code &
1> ]
1> C:\boost\include\boost-1_58\boost/function/function_template.hpp(940) : see reference to function template instantiation 'void boost::detail::function::void_function_obj_invoker3<FunctionObj,R,T0,T1,T2>::invoke(boost::detail::function::function_buffer &,T0,T1,T2)' being compiled
1> with
1> [
1> FunctionObj=boost::_bi::bind_t<void,boost::_mfi::mf3<void,pion::http::server,pion::http::request_ptr &,pion::tcp::connection_ptr &,const boost::system::error_code &>,boost::_bi::list4<boost::_bi::value<pion::http::server *>,boost::arg<1>,boost::arg<2>,boost::arg<3>>>
1> , R=void
1> , T0=pion::http::request_ptr
1> , T1=pion::tcp::connection_ptr
1> , T2=const boost::system::error_code &
1> ]
1> C:\boost\include\boost-1_58\boost/function/function_template.hpp(940) : see reference to class template instantiation 'boost::detail::function::void_function_obj_invoker3<FunctionObj,R,T0,T1,T2>' being compiled
1> with
1> [
1> FunctionObj=boost::_bi::bind_t<void,boost::_mfi::mf3<void,pion::http::server,pion::http::request_ptr &,pion::tcp::connection_ptr &,const boost::system::error_code &>,boost::_bi::list4<boost::_bi::value<pion::http::server *>,boost::arg<1>,boost::arg<2>,boost::arg<3>>>
1> , R=void
1> , T0=pion::http::request_ptr
1> , T1=pion::tcp::connection_ptr
1> , T2=const boost::system::error_code &
1> ]
1> C:\boost\include\boost-1_58\boost/function/function_template.hpp(728) : see reference to function template instantiation 'void boost::function3<void,pion::http::request_ptr,pion::tcp::connection_ptr,const boost::system::error_code &>::assign_to(Functor)' being compiled
1> with
1> [
1> Functor=boost::_bi::bind_t<void,boost::_mfi::mf3<void,pion::http::server,pion::http::request_ptr &,pion::tcp::connection_ptr &,const boost::system::error_code &>,boost::_bi::list4<boost::_bi::value<pion::http::server *>,boost::arg<1>,boost::arg<2>,boost::arg<3>>>
1> ]
1> C:\boost\include\boost-1_58\boost/function/function_template.hpp(728) : see reference to function template instantiation 'void boost::function3<void,pion::http::request_ptr,pion::tcp::connection_ptr,const boost::system::error_code &>::assign_to(Functor)' being compiled
1> with
1> [
1> Functor=boost::_bi::bind_t<void,boost::_mfi::mf3<void,pion::http::server,pion::http::request_ptr &,pion::tcp::connection_ptr &,const boost::system::error_code &>,boost::_bi::list4<boost::_bi::value<pion::http::server *>,boost::arg<1>,boost::arg<2>,boost::arg<3>>>
1> ]
1> http_server.cpp(33) : see reference to function template instantiation 'boost::function3<void,pion::http::request_ptr,pion::tcp::connection_ptr,const boost::system::error_code &>::function3<boost::_bi::bind_t<void,boost::_mfi::mf3<void,pion::http::server,pion::http::request_ptr &,pion::tcp::connection_ptr &,const boost::system::error_code &>,boost::_bi::list4boost::_bi::value<T,boost::arg<1>,boost::arg<2>,boost::arg<3>>>>(Functor,int)' being compiled
1> with
1> [
1> T=pion::http::server *
1> , Functor=boost::_bi::bind_t<void,boost::_mfi::mf3<void,pion::http::server,pion::http::request_ptr &,pion::tcp::connection_ptr &,const boost::system::error_code &>,boost::_bi::list4<boost::_bi::value<pion::http::server *>,boost::arg<1>,boost::arg<2>,boost::arg<3>>>
1> ]
1> http_server.cpp(33) : see reference to function template instantiation 'boost::function3<void,pion::http::request_ptr,pion::tcp::connection_ptr,const boost::system::error_code &>::function3<boost::_bi::bind_t<void,boost::_mfi::mf3<void,pion::http::server,pion::http::request_ptr &,pion::tcp::connection_ptr &,const boost::system::error_code &>,boost::_bi::list4boost::_bi::value<T,boost::arg<1>,boost::arg<2>,boost::arg<3>>>>(Functor,int)' being compiled
1> with
1> [
1> T=pion::http::server *
1> , Functor=boost::_bi::bind_t<void,boost::_mfi::mf3<void,pion::http::server,pion::http::request_ptr &,pion::tcp::connection_ptr &,const boost::system::error_code &>,boost::_bi::list4<boost::_bi::value<pion::http::server *>,boost::arg<1>,boost::arg<2>,boost::arg<3>>>
1> ]
1> Generating Code...
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

cmake find_package(Threads)

CMakeLists.txt currently uses find_package(Threads REQUIRED) to check for -lpthreads etc. However, some platforms have all the thread functions in the run-time libraries, and therefore have no extra thread library. The cmake build fails on these platforms because of the REQUIRED option. If you remove this option, then it works.

HTTP server enters busy-loop with gcc 4.7 in C++11 mode

Compile with g++ -std=c++11:

#include <iostream>

#include <pion/process.hpp>
#include <pion/http/server.hpp>

int main(int argc, char *argv[]) {
    pion::process::initialize();

    try {
        boost::asio::ip::tcp::endpoint endpoint(boost::asio::ip::tcp::v4(), 5000);
        pion::http::server server(endpoint);
        server.start();
        pion::process::wait_for_shutdown();
    } catch (std::exception& e) {
        std::cerr << pion::diagnostic_information(e) << std::endl;
        return 1;
    }

    return 0;
}

Limit number of concurrent connections

Hi,
would be possible to limit the number of concurrent connections?

I'm working on a solution to implement that feature but I didn't find yet a clean one.

My current solution:

  • add a max_concurrent_connections member variable in tcp_server with default value = 0 and passed by the user in ctor.
  • in server::listen , add a parameter bool histeresisTrigger with default value = false
  • in server::listen , add the following check at the begin
if(histeresisTrigger)
{
    if((m_max_concurrent_connections) &&
    (m_con_pool.size() != m_max_concurrent_connections -10)) {
        return;
    } else {
         if ((m_max_concurrent_connections) &&
        (m_conn_pool.size() == m_max_concurrent_connections)) {
            return;
    }
}
  • in server::finish_connection add the following code inside the else branch at the end :
if ((m_is_listening) &&
    (m_max_concurrent_connections) &&
    (m_conn_pool.size() == m_max_concurrent_connections -10)) {
        server_lock.release();
       listen(true);
    }

Do you think this feature would be useful?
Thx

Using CMAKE, make install does not copy headers

vagrant@precise32:~/cpp/pion/build$ cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr ..
EXECUTABLE_OUTPUT_PATH = /home/vagrant/cpp/pion/build/Bin/
>>> Building Pion version: 5.0.5
-- Boost version: 1.48.0
-- Found the following Boost libraries:
--   thread
--   system
--   filesystem
--   regex
--   unit_test_framework
-- Could NOT find Log4cplus (missing:  LOG4CPLUS_LIBRARIES LOG4CPLUS_INCLUDE_DIR) 
-- Could NOT find Doxygen (missing:  DOXYGEN_EXECUTABLE) 
PLUGIN_PATH = /home/vagrant/cpp/pion/build/Bin/; EXECUTABLE_OUTPUT_PATH = /home/vagrant/cpp/pion/build/Bin/
-- Configuring done
-- Generating done
-- Build files have been written to: /home/vagrant/cpp/pion/build
vagrant@precise32:~/cpp/pion/build$ sudo make install
[ 43%] Built target pion
[ 43%] Built target prepare_path
[ 76%] Built target piontests
[ 78%] Built target hasCreateAndDestroy
[ 80%] Built target hasCreateButNoDestroy
[ 82%] Built target hasNoCreate
[ 84%] Built target AllowNothingService
[ 86%] Built target CookieService
[ 89%] Built target EchoService
[ 91%] Built target FileService
[ 93%] Built target HelloService
[ 95%] Built target LogService
[ 97%] Built target helloserver
[100%] Built target piond
Install the project...
-- Install configuration: ""
-- Installing: /usr/bin/piontests
-- Removed runtime path from "/usr/bin/piontests"
-- Installing: /usr/tests/hasNoCreate.so
-- Removed runtime path from "/usr/tests/hasNoCreate.so"
-- Installing: /usr/tests/hasCreateAndDestroy.so
-- Removed runtime path from "/usr/tests/hasCreateAndDestroy.so"
-- Installing: /usr/tests/hasCreateButNoDestroy.so
-- Removed runtime path from "/usr/tests/hasCreateButNoDestroy.so"
-- Installing: /usr/lib/libpion.so
-- Installing: /usr/services/LogService.so
-- Removed runtime path from "/usr/services/LogService.so"
-- Installing: /usr/services/HelloService.so
-- Removed runtime path from "/usr/services/HelloService.so"
-- Installing: /usr/services/FileService.so
-- Removed runtime path from "/usr/services/FileService.so"
-- Installing: /usr/services/CookieService.so
-- Removed runtime path from "/usr/services/CookieService.so"
-- Installing: /usr/services/AllowNothingService.so
-- Removed runtime path from "/usr/services/AllowNothingService.so"
-- Installing: /usr/services/EchoService.so
-- Removed runtime path from "/usr/services/EchoService.so"
-- Installing: /usr/bin/piond
-- Removed runtime path from "/usr/bin/piond"
-- Installing: /usr/bin/helloserver
-- Removed runtime path from "/usr/bin/helloserver"
vagrant@precise32:~/cpp/pion/build$ cd /usr/

On top of that it install all the "Demo" binaries and things that probably are not supposed to get intalled.

Building on Windows

I'm having some issues with building on Windows.

C:\Users\xxxx\Downloads\pion-5.0.7\build>cmake .. -G "Visual Studio 12 Win6
4" -DBOOST_ROOT=C:\Users\xxxx\Downloads\boost_1_57_0 -DBOOST_LIBRARYDIR=C:\
Users\xxxx\Downloads\boost_1_57_0\stage\lib
-- The CXX compiler identification is MSVC 18.0.30723.0
-- The C compiler identification is MSVC 18.0.30723.0
-- Check for working CXX compiler using: Visual Studio 12 2013 Win64
-- Check for working CXX compiler using: Visual Studio 12 2013 Win64 -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working C compiler using: Visual Studio 12 2013 Win64
-- Check for working C compiler using: Visual Studio 12 2013 Win64 -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
EXECUTABLE_OUTPUT_PATH = C:/Users/xxxx/Downloads/pion-5.0.7/build/Bin/
>>> Building Pion version: 5.0.7
-- Looking for include file pthread.h
-- Looking for include file pthread.h - not found
-- Found Threads: TRUE
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.0/Modules/FindBoost.cm
ake:1179 (message):
  Unable to find the requested Boost libraries.

  Boost version: 1.57.0

  Boost include path: C:/Users/xxxx/Downloads/boost_1_57_0

  Could not find the following Boost libraries:

          boost_thread
          boost_system
          boost_filesystem
          boost_regex
          boost_unit_test_framework

  No Boost libraries were found.  You may need to set BOOST_LIBRARYDIR to the
  directory containing Boost libraries or BOOST_ROOT to the location of
  Boost.
Call Stack (most recent call first):
  CMakeLists.txt:92 (find_package)


CMake Error at CMakeLists.txt:98 (message):
  Boost >= 1.35 required to build Pion


-- Configuring incomplete, errors occurred!
See also "C:/Users/xxxx/Downloads/pion-5.0.7/build/CMakeFiles/CMakeOutput.l
og".
See also "C:/Users/xxxx/Downloads/pion-5.0.7/build/CMakeFiles/CMakeError.lo
g".

Generating documents fail

Hi,
Use "./configure --enable-doxygen-pdf " and "make all" to generate documents,but after that, can't find generated pdf files in doc.

System is Fedora16(x64), and doxgen has been installed.

make install error

/usr/bin/install: request_reader.hpp' and/home/llx/fun_1.0/server/fun-fogs/d_3rdParty/pion_net/pion-develop/include/pion/http/request_reader.hpp' are the same file
/usr/bin/install: request_writer.hpp' and/home/llx/fun_1.0/server/fun-fogs/d_3rdParty/pion_net/pion-develop/include/pion/http/request_writer.hpp' are the same file
/usr/bin/install: response.hpp' and/home/llx/fun_1.0/server/fun-fogs/d_3rdParty/pion_net/pion-develop/include/pion/http/response.hpp' are the same file
/usr/bin/install: response_reader.hpp' and/home/llx/fun_1.0/server/fun-fogs/d_3rdParty/pion_net/pion-develop/include/pion/http/response_reader.hpp' are the same file
/usr/bin/install: response_writer.hpp' and/home/llx/fun_1.0/server/fun-fogs/d_3rdParty/pion_net/pion-develop/include/pion/http/response_writer.hpp' are the same file
/usr/bin/install: server.hpp' and/home/llx/fun_1.0/server/fun-fogs/d_3rdParty/pion_net/pion-develop/include/pion/http/server.hpp' are the same file
/usr/bin/install: types.hpp' and/home/llx/fun_1.0/server/fun-fogs/d_3rdParty/pion_net/pion-develop/include/pion/http/types.hpp' are the same file
/usr/bin/install: writer.hpp' and/home/llx/fun_1.0/server/fun-fogs/d_3rdParty/pion_net/pion-develop/include/pion/http/writer.hpp' are the same file
make[5]: *** [install-pion_http_includeHEADERS] Error 1 <<--Here
make[5]: Leaving directory /data1/home/llx/fun_1.0/server/fun-fogs/d_3rdParty/pion_net/pion-develop/include/pion/http' make[4]: *** [install-am] Error 2 <<--Here make[4]: Leaving directory/data1/home/llx/fun_1.0/server/fun-fogs/d_3rdParty/pion_net/pion-develop/include/pion/http'
make[3]: *** [install-recursive] Error 1 <<--Here
make[3]: Leaving directory /data1/home/llx/fun_1.0/server/fun-fogs/d_3rdParty/pion_net/pion-develop/include/pion' make[2]: *** [install-recursive] Error 1 make[2]: Leaving directory/data1/home/llx/fun_1.0/server/fun-fogs/d_3rdParty/pion_net/pion-develop/include'
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory `/data1/home/llx/fun_1.0/server/fun-fogs/d_3rdParty/pion_net/pion-develop'
make: *** [install-strip] Error 2

External io_service

Is it possible to create an http server with an existing asio::io_service? If an application has an existing thread pool available could this be passed to a custom scheduler for example?

Embedded Pion server crashes on request handling

I'm embedding Pion in a small console application (MSVC-12.0). Unfortunately it crashes when handling a simple HTTP GET request.

I've built it with boost_1_57_0, openssl-1.0.2 and zlib-1.2.8 and no logging.

Here's a small example program reproducing the issue,

#include <pion/http/server.hpp>
#include <pion/http/response_writer.hpp>

using namespace pion;
using namespace pion::http;

struct test_server {
    void start() {
        m_server = pion::http::server_ptr(new pion::http::server(4500));
        m_server->add_resource("/", boost::bind(&test_server::handle_request, this, _1, _2));
        m_server->start();
    }

    void handle_request(http::request_ptr& req, tcp::connection_ptr& conn) {
        http::response_writer_ptr writer(
            http::response_writer::create(
            conn,
            *req,
            boost::bind(&tcp::connection::finish, conn))); // Crashes in this callback

        writer->write("hello world");
        writer->send();
    }

    pion::http::server_ptr m_server;
};

int main() {
    test_server svr;
    svr.start();

    while (1) {
        Sleep(0);
    }
}

It crashes in the &tcp::connection::finish callback with the following stack trace,

pion_test.exe!boost::function1<void,boost::shared_ptr<pion::tcp::connection> >::operator()(boost::shared_ptr<pion::tcp::connection> a0) Line 767    C++
pion_test.exe!pion::tcp::connection::finish() Line 596  C++
pion_test.exe!boost::_mfi::mf0<void,pion::tcp::connection>::call<boost::shared_ptr<pion::tcp::connection> >(boost::shared_ptr<pion::tcp::connection> & u, const void * __formal) Line 40    C++
pion_test.exe!boost::_mfi::mf0<void,pion::tcp::connection>::operator()<boost::shared_ptr<pion::tcp::connection> >(boost::shared_ptr<pion::tcp::connection> & u) Line 56 C++
pion_test.exe!boost::_bi::list1<boost::_bi::value<boost::shared_ptr<pion::tcp::connection> > >::operator()<boost::_mfi::mf0<void,pion::tcp::connection>,boost::_bi::list1<boost::system::error_code const &> >(boost::_bi::type<void> __formal, boost::_mfi::mf0<void,pion::tcp::connection> & f, boost::_bi::list1<boost::system::error_code const &> & a, int __formal) Line 254  C++
pion_test.exe!boost::_bi::bind_t<void,boost::_mfi::mf0<void,pion::tcp::connection>,boost::_bi::list1<boost::_bi::value<boost::shared_ptr<pion::tcp::connection> > > >::operator()<boost::system::error_code>(const boost::system::error_code & a1) Line 48  C++
pion_test.exe!boost::detail::function::void_function_obj_invoker1<boost::_bi::bind_t<void,boost::_mfi::mf0<void,pion::tcp::connection>,boost::_bi::list1<boost::_bi::value<boost::shared_ptr<pion::tcp::connection> > > >,void,boost::system::error_code const &>::invoke(boost::detail::function::function_buffer & function_obj_ptr, const boost::system::error_code & a0) Line 154   C++
pion.dll!boost::function1<void,boost::system::error_code const &>::operator()(const boost::system::error_code & a0) Line 767    C++
pion.dll!pion::http::writer::finished_writing(const boost::system::error_code & ec) Line 82 C++
pion.dll!pion::http::response_writer::handle_write(const boost::system::error_code & write_error, unsigned int bytes_written) Line 161  C++
pion.dll!boost::_mfi::mf2<void,pion::http::response_writer,boost::system::error_code const &,unsigned int>::call<boost::shared_ptr<pion::http::response_writer>,boost::system::error_code const ,unsigned int>(boost::shared_ptr<pion::http::response_writer> & u, const void * __formal, const boost::system::error_code & b1, unsigned int & b2) Line 271 C++
pion.dll!boost::_mfi::mf2<void,pion::http::response_writer,boost::system::error_code const &,unsigned int>::operator()<boost::shared_ptr<pion::http::response_writer> >(boost::shared_ptr<pion::http::response_writer> & u, const boost::system::error_code & a1, unsigned int a2) Line 287 C++
pion.dll!boost::_bi::list3<boost::_bi::value<boost::shared_ptr<pion::http::response_writer> >,boost::arg<1>,boost::arg<2> >::operator()<boost::_mfi::mf2<void,pion::http::response_writer,boost::system::error_code const &,unsigned int>,boost::_bi::list2<boost::system::error_code const &,unsigned int &> >(boost::_bi::type<void> __formal, boost::_mfi::mf2<void,pion::http::response_writer,boost::system::error_code const &,unsigned int> & f, boost::_bi::list2<boost::system::error_code const &,unsigned int &> & a, int __formal) Line 393 C++
pion.dll!boost::_bi::bind_t<void,boost::_mfi::mf2<void,pion::http::response_writer,boost::system::error_code const &,unsigned int>,boost::_bi::list3<boost::_bi::value<boost::shared_ptr<pion::http::response_writer> >,boost::arg<1>,boost::arg<2> > >::operator()<boost::system::error_code,unsigned int>(const boost::system::error_code & a1, unsigned int & a2) Line 77    C++
pion.dll!boost::detail::function::void_function_obj_invoker2<boost::_bi::bind_t<void,boost::_mfi::mf2<void,pion::http::response_writer,boost::system::error_code const &,unsigned int>,boost::_bi::list3<boost::_bi::value<boost::shared_ptr<pion::http::response_writer> >,boost::arg<1>,boost::arg<2> > >,void,boost::system::error_code const &,unsigned int>::invoke(boost::detail::function::function_buffer & function_obj_ptr, const boost::system::error_code & a0, unsigned int a1) Line 154   C++
pion.dll!boost::function2<void,boost::system::error_code const &,unsigned int>::operator()(const boost::system::error_code & a0, unsigned int a1) Line 767  C++
pion.dll!boost::asio::detail::write_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp,boost::asio::stream_socket_service<boost::asio::ip::tcp> >,std::vector<boost::asio::const_buffer,std::allocator<boost::asio::const_buffer> >,boost::asio::detail::transfer_all_t,boost::function2<void,boost::system::error_code const &,unsigned int> >::operator()(const boost::system::error_code & ec, unsigned int bytes_transferred, int start) Line 194 C++
pion.dll!boost::asio::detail::binder2<boost::asio::detail::write_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp,boost::asio::stream_socket_service<boost::asio::ip::tcp> >,std::vector<boost::asio::const_buffer,std::allocator<boost::asio::const_buffer> >,boost::asio::detail::transfer_all_t,boost::function2<void,boost::system::error_code const &,unsigned int> >,boost::system::error_code,unsigned int>::operator()() Line 129   C++
pion.dll!boost::asio::asio_handler_invoke<boost::asio::detail::binder2<boost::asio::detail::write_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp,boost::asio::stream_socket_service<boost::asio::ip::tcp> >,std::vector<boost::asio::const_buffer,std::allocator<boost::asio::const_buffer> >,boost::asio::detail::transfer_all_t,boost::function2<void,boost::system::error_code const &,unsigned int> >,boost::system::error_code,unsigned int> >(boost::asio::detail::binder2<boost::asio::detail::write_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp,boost::asio::stream_socket_service<boost::asio::ip::tcp> >,std::vector<boost::asio::const_buffer,std::allocator<boost::asio::const_buffer> >,boost::asio::detail::transfer_all_t,boost::function2<void,boost::system::error_code const &,unsigned int> >,boost::system::error_code,unsigned int> & function, ...) Line 70    C++
pion.dll!boost_asio_handler_invoke_helpers::invoke<boost::asio::detail::binder2<boost::asio::detail::write_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp,boost::asio::stream_socket_service<boost::asio::ip::tcp> >,std::vector<boost::asio::const_buffer,std::allocator<boost::asio::const_buffer> >,boost::asio::detail::transfer_all_t,boost::function2<void,boost::system::error_code const &,unsigned int> >,boost::system::error_code,unsigned int>,boost::function2<void,boost::system::error_code const &,unsigned int> >(boost::asio::detail::binder2<boost::asio::detail::write_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp,boost::asio::stream_socket_service<boost::asio::ip::tcp> >,std::vector<boost::asio::const_buffer,std::allocator<boost::asio::const_buffer> >,boost::asio::detail::transfer_all_t,boost::function2<void,boost::system::error_code const &,unsigned int> >,boost::system::error_code,unsigned int> & function, boost::function2<void,boost::system::error_code const &,unsigned int> & context) Line 37 C++
pion.dll!boost::asio::detail::asio_handler_invoke<boost::asio::detail::binder2<boost::asio::detail::write_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp,boost::asio::stream_socket_service<boost::asio::ip::tcp> >,std::vector<boost::asio::const_buffer,std::allocator<boost::asio::const_buffer> >,boost::asio::detail::transfer_all_t,boost::function2<void,boost::system::error_code const &,unsigned int> >,boost::system::error_code,unsigned int>,boost::asio::basic_stream_socket<boost::asio::ip::tcp,boost::asio::stream_socket_service<boost::asio::ip::tcp> >,std::vector<boost::asio::const_buffer,std::allocator<boost::asio::const_buffer> >,boost::asio::detail::transfer_all_t,boost::function2<void,boost::system::error_code const &,unsigned int> >(boost::asio::detail::binder2<boost::asio::detail::write_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp,boost::asio::stream_socket_service<boost::asio::ip::tcp> >,std::vector<boost::asio::const_buffer,std::allocator<boost::asio::const_buffer> >,boost::asio::detail::transfer_all_t,boost::function2<void,boost::system::error_code const &,unsigned int> >,boost::system::error_code,unsigned int> & function, boost::asio::detail::write_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp,boost::asio::stream_socket_service<boost::asio::ip::tcp> >,std::vector<boost::asio::const_buffer,std::allocator<boost::asio::const_buffer> >,boost::asio::detail::transfer_all_t,boost::function2<void,boost::system::error_code const &,unsigned int> > * this_handler) Line 566  C++
pion.dll!boost_asio_handler_invoke_helpers::invoke<boost::asio::detail::binder2<boost::asio::detail::write_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp,boost::asio::stream_socket_service<boost::asio::ip::tcp> >,std::vector<boost::asio::const_buffer,std::allocator<boost::asio::const_buffer> >,boost::asio::detail::transfer_all_t,boost::function2<void,boost::system::error_code const &,unsigned int> >,boost::system::error_code,unsigned int>,boost::asio::detail::write_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp,boost::asio::stream_socket_service<boost::asio::ip::tcp> >,std::vector<boost::asio::const_buffer,std::allocator<boost::asio::const_buffer> >,boost::asio::detail::transfer_all_t,boost::function2<void,boost::system::error_code const &,unsigned int> > >(boost::asio::detail::binder2<boost::asio::detail::write_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp,boost::asio::stream_socket_service<boost::asio::ip::tcp> >,std::vector<boost::asio::const_buffer,std::allocator<boost::asio::const_buffer> >,boost::asio::detail::transfer_all_t,boost::function2<void,boost::system::error_code const &,unsigned int> >,boost::system::error_code,unsigned int> & function, boost::asio::detail::write_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp,boost::asio::stream_socket_service<boost::asio::ip::tcp> >,std::vector<boost::asio::const_buffer,std::allocator<boost::asio::const_buffer> >,boost::asio::detail::transfer_all_t,boost::function2<void,boost::system::error_code const &,unsigned int> > & context) Line 37   C++
pion.dll!boost::asio::detail::win_iocp_socket_send_op<boost::asio::detail::consuming_buffers<boost::asio::const_buffer,std::vector<boost::asio::const_buffer,std::allocator<boost::asio::const_buffer> > >,boost::asio::detail::write_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp,boost::asio::stream_socket_service<boost::asio::ip::tcp> >,std::vector<boost::asio::const_buffer,std::allocator<boost::asio::const_buffer> >,boost::asio::detail::transfer_all_t,boost::function2<void,boost::system::error_code const &,unsigned int> > >::do_complete(boost::asio::detail::win_iocp_io_service * owner, boost::asio::detail::win_iocp_operation * base, const boost::system::error_code & result_ec, unsigned int bytes_transferred) Line 92   C++
pion.dll!boost::asio::detail::win_iocp_operation::complete(boost::asio::detail::win_iocp_io_service & owner, const boost::system::error_code & ec, unsigned int bytes_transferred) Line 46  C++
pion.dll!boost::asio::detail::win_iocp_io_service::do_one(bool block, boost::system::error_code & ec) Line 406  C++
pion.dll!boost::asio::detail::win_iocp_io_service::run(boost::system::error_code & ec) Line 164 C++
pion.dll!boost::asio::io_service::run() Line 59 C++
pion.dll!pion::scheduler::process_service_work(boost::asio::io_service & service) Line 111  C++
pion.dll!boost::_mfi::mf1<void,pion::scheduler,boost::asio::io_service &>::call<pion::single_service_scheduler *,boost::asio::io_service>(pion::single_service_scheduler * & u, const void * __formal, boost::asio::io_service & b1) Line 156   C++
pion.dll!boost::_mfi::mf1<void,pion::scheduler,boost::asio::io_service &>::operator()<pion::single_service_scheduler *>(pion::single_service_scheduler * & u, boost::asio::io_service & a1) Line 172    C++
pion.dll!boost::_bi::list2<boost::_bi::value<pion::single_service_scheduler *>,boost::reference_wrapper<boost::asio::io_service> >::operator()<boost::_mfi::mf1<void,pion::scheduler,boost::asio::io_service &>,boost::_bi::list0>(boost::_bi::type<void> __formal, boost::_mfi::mf1<void,pion::scheduler,boost::asio::io_service &> & f, boost::_bi::list0 & a, int __formal) Line 314 C++
pion.dll!boost::_bi::bind_t<void,boost::_mfi::mf1<void,pion::scheduler,boost::asio::io_service &>,boost::_bi::list2<boost::_bi::value<pion::single_service_scheduler *>,boost::reference_wrapper<boost::asio::io_service> > >::operator()() Line 21 C++
pion.dll!boost::detail::thread_data<boost::_bi::bind_t<void,boost::_mfi::mf1<void,pion::scheduler,boost::asio::io_service &>,boost::_bi::list2<boost::_bi::value<pion::single_service_scheduler *>,boost::reference_wrapper<boost::asio::io_service> > > >::run() Line 117  C++
boost_thread-vc120-mt-gd-1_57.dll!boost::`anonymous namespace'::thread_start_function(void * param) Line 305    C++

How to start pion web server?

Hi,

After installing pion in ubuntu, i couldn't start pion server using "sudo ./start_pion.sh -D" command.
Infact start_pion.sh is missing in setup files.

Also in windows, "PionWebServer" file is excluded.

pls guide for the same.
Thanks

Pion fails to build on linux: BOOST_NOEXCEPT does not name a type

Trying to build pion on ElementaryOS Luna fails with following error:

Making all in src
make[1]: Entering directory `/home/jsokolow/Test/pion-develop/src'
CXX spdy_parser.lo
In file included from spdy_parser.cpp:15:0:
../include/pion/spdy/parser.hpp:55:28: error: expected ';' at end of member declaration
../include/pion/spdy/parser.hpp:55:34: error: 'BOOST_NOEXCEPT' does not name a type
make[1]: *** [spdy_parser.lo] Error 1

Boost version i have installed is 1.48
autogen and config gave no errors. I don't have cmake 2.8.10 installed to test whether cmake would get it working.

cmake and bzlib

If you have bzip2 installed, but not libbz-dev, then cmake will pass just fine, but a subsequent configure will fail to find the header files.

Ubuntu 12.04 build error

Building 5.0.7 on ubuntu:

./autogen.sh
./configure
make

Gives the following output:

.
.
.
Making all in src
make[1]: Entering directory `/home/pdgendt/pion-5.0.7/src'
  CXX    admin_rights.lo
In file included from ../include/pion/admin_rights.hpp:14:0,
                 from admin_rights.cpp:10:
../include/pion/logger.hpp:199:25: error: variable 'pion::PION_API pion::logger' has initializer but incomplete type
../include/pion/logger.hpp:199:25: warning: extended initializer lists only available with -std=c++0x or -std=gnu++0x [enabled by default]
../include/pion/logger.hpp:200:20: error: expected primary-expression before 'int'
../include/pion/logger.hpp:200:36: error: expected '}' before '{' token
../include/pion/logger.hpp:200:36: error: expected ',' or ';' before '{' token
../include/pion/logger.hpp:201:29: error: non-member function 'pion::operator bool()' cannot have cv-qualifier
../include/pion/logger.hpp:201:29: error: 'pion::operator bool()' must be a nonstatic member function
../include/pion/logger.hpp:206:5: error: expected declaration before '}' token
../include/pion/logger.hpp:202:25: warning: 'void pion::shutdown()' defined but not used [-Wunused-function]
make[1]: *** [admin_rights.lo] Error 1
make[1]: Leaving directory `/home/pdgendt/pion-5.0.7/src'
make: *** [all-recursive] Error 1

Does the pion server support compression via the 'Accept-Encoding: gzip' directive?

I built the pion 5.0.6 library with zlib support and wrote a sample HTTP server. The server is a dummy server that always returns a JSON payload.

When I issue a HTTP get request to the server with "Accept-Encoding: gzip" set in the header, I was hoping to get gzipped JSON in the response but server always returns plain JSON.

Am I missing something here? Do I need to set a parameter on the pion::http::server that will turn on the gzip support?

FileService bug for directory option with trailing slash

Using the FileService with pion v5.0.7 and boost filesystem V3:

m_server.load_service("/resource", "FileService");
m_server.set_service_option("/resource", "directory", "/some/trailing/slash/path/");

Results in an unusable FileService. Because the FileService stores this path normalized which would be /some/trailing/slash/path/.

If some request is handled by the FileService the file path is constructed (see

file_path = m_directory / relative_path;
)

For example file index.html reconstructs to /some/trailing/slash/path/./index.html which later is normalized to /some/trailing/slash/path/index.html. The function then checks if the file is in the directory (with string::find) but fails because of the normalized resource directory (mind the extra dot there).

Also mind that boost::filesystem::path::normalize() is set to deprecated.

parse_multipart_form_data corrupts binary file

Hi,

//const char *next_ptr = strstr(ptr, boundary.c_str());
const char *next_ptr = std::search(ptr, end_ptr, boundary.begin(), boundary.end());

strstr will stop at the null character, hence it will fail to find the boundary marker, and the latter will be appended to the file

Hope it helps,
alex

behavioral change with parse_uri?

Hi,

I've been using parse_uri to decide if there is a uri and if not do something different.
Previously
std::string potentialUri="ethanol.xml"
would reject and let me know it wasn't a uri

        if(!pion::http::parser::parse_uri(uri, proto, host, port, path, query))
        {
            return false;
        }

but not it satisfies but there is no host or port;
Maybe I should now decide on the results instead of the return boolean?

Good documentation / tutorials

Any links to good documentation or tutorial for starting with pion? Also I would like to know if we can do async long io with this library?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.