mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-07-18 06:47:11 +02:00
bin
module
vendor
CPR
ConcurrentQueue
Fmt
MaxmindDB
POCO
ApacheConnector
doc
include
ApacheApplication.h
ApacheChannel.h
ApacheConnector.h
ApacheRequestHandlerFactory.h
ApacheServerRequest.h
ApacheServerResponse.h
ApacheStream.h
samples
src
ApacheConnector.progen
ApacheConnector_vs140.sln
ApacheConnector_vs140.vcxproj
ApacheConnector_vs140.vcxproj.filters
ApacheConnector_vs150.sln
ApacheConnector_vs150.vcxproj
ApacheConnector_vs150.vcxproj.filters
ApacheConnector_vs160.sln
ApacheConnector_vs160.vcxproj
ApacheConnector_vs160.vcxproj.filters
ApacheConnector_vs90.sln
ApacheConnector_vs90.vcproj
CMakeLists.txt
Makefile
dependencies
CppParser
CppUnit
Crypto
Data
Encodings
Foundation
JSON
JWT
MongoDB
Net
NetSSL_OpenSSL
NetSSL_Win
PDF
PageCompiler
PocoDoc
ProGen
Redis
SevenZip
Util
XML
Zip
appveyor
build
cmake
contrib
doc
packaging
patches
release
travis
.gitattributes
.gitignore
.gitmodules
.travis.yml
CHANGELOG
CMakeLists.txt
CODE_OF_CONDUCT.md
CONTRIBUTING.md
CONTRIBUTORS
LICENSE
Makefile
NEWS
README
README.md
VERSION
appveyor.yml
build_cmake.cmd
build_cmake.sh
build_vs140.cmd
build_vs150.cmd
build_vs160.cmd
buildwin.cmd
buildwin.ps1
components
configure
cppignore.lnx
cppignore.win
env.bat
env.sh
libversion
SimpleIni
Squirrel
TinyDir
CMakeLists.txt
.gitignore
.gitmodules
CMakeLists.txt
LICENSE
README.md
Switched to POCO library for unified platform/library interface. Deprecated the external module API. It was creating more problems than solving. Removed most built-in libraries in favor of system libraries for easier maintenance. Cleaned and secured code with help from static analyzers.
104 lines
2.4 KiB
C++
104 lines
2.4 KiB
C++
//
|
|
// ApacheStream.h
|
|
//
|
|
// Copyright (c) 2006-2011, Applied Informatics Software Engineering GmbH.
|
|
// and Contributors.
|
|
//
|
|
// SPDX-License-Identifier: BSL-1.0
|
|
//
|
|
|
|
|
|
#ifndef ApacheConnector_ApacheStream_INCLUDED
|
|
#define ApacheConnector_ApacheStream_INCLUDED
|
|
|
|
|
|
#include "ApacheConnector.h"
|
|
#include "Poco/BufferedStreamBuf.h"
|
|
#include <istream>
|
|
#include <ostream>
|
|
|
|
|
|
class ApacheStreamBuf: public Poco::BufferedStreamBuf
|
|
/// This is the streambuf class used for reading from and writing to a socket.
|
|
{
|
|
public:
|
|
ApacheStreamBuf(ApacheRequestRec* pApacheRequest, bool haveData = false);
|
|
/// Creates a ApacheStreamBuf with the given socket.
|
|
|
|
~ApacheStreamBuf();
|
|
/// Destroys the SocketStreamBuf.
|
|
|
|
protected:
|
|
int readFromDevice(char* buffer, std::streamsize length);
|
|
int writeToDevice(const char* buffer, std::streamsize length);
|
|
|
|
private:
|
|
enum
|
|
{
|
|
STREAM_BUFFER_SIZE = 1024
|
|
};
|
|
|
|
ApacheRequestRec* _pApacheRequest;
|
|
bool _haveData;
|
|
};
|
|
|
|
|
|
class ApacheIOS: public virtual std::ios
|
|
/// The base class for ApacheStream, ApacheInputStream and
|
|
/// ApacheOutputStream.
|
|
///
|
|
/// This class is needed to ensure the correct initialization
|
|
/// order of the stream buffer and base classes.
|
|
{
|
|
public:
|
|
ApacheIOS(ApacheRequestRec* pApacheRequest, bool haveData = false);
|
|
/// Creates the ApacheIOS with the given socket.
|
|
|
|
~ApacheIOS();
|
|
/// Destroys the ApacheIOS.
|
|
///
|
|
/// Flushes the buffer, but does not close the socket.
|
|
|
|
ApacheStreamBuf* rdbuf();
|
|
/// Returns a pointer to the internal ApacheStreamBuf.
|
|
|
|
void close();
|
|
/// Flushes the stream.
|
|
|
|
protected:
|
|
ApacheStreamBuf _buf;
|
|
};
|
|
|
|
|
|
class ApacheOutputStream: public ApacheIOS, public std::ostream
|
|
/// An output stream for writing to an Apache response.
|
|
{
|
|
public:
|
|
ApacheOutputStream(ApacheRequestRec* pApacheRequest);
|
|
/// Creates the ApacheOutputStream with the given socket.
|
|
|
|
~ApacheOutputStream();
|
|
/// Destroys the ApacheOutputStream.
|
|
///
|
|
/// Flushes the buffer.
|
|
};
|
|
|
|
|
|
class ApacheInputStream: public ApacheIOS, public std::istream
|
|
/// An input stream for reading from an Apache request.
|
|
///
|
|
/// Using formatted input from a ApacheInputStream
|
|
/// is not recommended, due to the read-ahead behavior of
|
|
/// istream with formatted reads.
|
|
{
|
|
public:
|
|
ApacheInputStream(ApacheRequestRec* pApacheRequest);
|
|
/// Creates the ApacheInputStream with the given socket.
|
|
|
|
~ApacheInputStream();
|
|
/// Destroys the ApacheInputStream.
|
|
};
|
|
|
|
|
|
#endif // ApacheConnector_ApacheStream_INCLUDED
|