21 #ifndef GV_HTTPSERVERPEER__H
22 #define GV_HTTPSERVERPEER__H
37 class HttpServerPeer ;
59 virtual void onDelete(
const std::string & )
override ;
60 virtual void onSendComplete()
override ;
61 virtual bool onReceive(
const std::string & )
override ;
62 virtual void onSecure(
const std::string & )
override ;
70 typedef std::pair<const char*,size_t> Segment ;
71 typedef std::vector<Segment> Segments ;
73 explicit Pdu(
const std::string & ) ;
77 void append(
const std::string & ) ;
78 void assignBody( shared_ptr<const Gr::ImageBuffer> ,
size_t ) ;
79 void operator=(
const std::string & ) ;
80 const Segments & segments()
const ;
81 std::string head()
const ;
86 shared_ptr<const Gr::ImageBuffer> m_body_ptr ;
87 size_t m_body_ptr_size ;
88 mutable Segments m_segments ;
89 mutable bool m_locked ;
95 void selectSource(
const std::string & path ) ;
96 void onIdleTimeout() ;
97 void onDataTimeout() ;
98 void buildPduFirst() ;
100 void buildPduSingle() ;
101 void buildPduFromFile() ;
102 void buildPduFromStatus() ;
104 std::string errorResponse(
int e ,
const std::string & s ,
const std::string & header = std::string() )
const ;
105 void doSendResponse(
int e ,
const std::string & s ,
const std::string & header = std::string() ) ;
106 bool doSend(
const std::string & ) ;
107 bool doSend(
const Pdu & ) ;
108 void doSendLogging(
const Pdu & )
const ;
109 void doInput(
Gr::Image ,
const std::string & ) ;
110 void startStreamingTimer() ;
111 static std::string toPdu( std::string & , shared_ptr<char> ,
const std::string & ,
G::Url ) ;
114 std::string fileHeader(
size_t content_length ,
const std::string & type )
const ;
115 std::string simpleHeader(
size_t content_length ,
Gr::ImageType ,
const std::string & ,
const std::string & ,
const std::string & )
const ;
116 std::string streamingHeader(
size_t content_length ,
Gr::ImageType ,
const std::string & )
const ;
117 std::string streamingSubHeader(
size_t ,
Gr::ImageType ,
const std::string & )
const ;
119 void doGatewayMessage(
const std::string & ) ;
120 std::string doGatewayMessageImp(
const std::string & ) ;
124 bool specialRequest() ;
125 static unsigned int headerValue(
const std::string & ) ;
139 size_t m_image_size ;
141 std::string m_image_type_str ;
142 unsigned int m_sending ;
143 unsigned int m_image_number ;
154 s_streaming_first_idle ,
155 s_streaming_first_busy ,
162 unsigned int m_content_length ;
A configuration structure for Gv::HttpServerPeer holding default settings from the command-line which...
HttpServerPeer(GNet::Server::PeerInfo, Sources &, const Resources &, const Config &)
Constructor.
An encapsulation of image type, including width, height and number of channels, with support for a st...
Vectors ImageBuffer
An ImageBuffer is used to hold raw image data, typically in more than one chunk.
A simple parser for URLs.
A class holding shared read-only image data (Gr::ImageBuffer) and its associated image type (Gr::Imag...
Used by a ImageInputHandler-derived object to hold a ImageInputSource pointer.
A GNet::ServerPeer class for HTTP servers that serves up image streams.
virtual ~HttpServerPeer()
Destructor.
A container for ImageInputSource pointers, used by Gv::HttpServerPeer.
A configuration structure for resources that Gv::HttpServerPeer makes available.
A timer class template in which the timeout is delivered to the specified method. ...
A ServerPeer that does line-buffering on input.
A structure used in GNet::Server::newPeer().