10 #ifndef __WVHTTPPOOL_H
11 #define __WVHTTPPOOL_H
15 #include "wvistreamlist.h"
16 #include "wvstreamclone.h"
18 #include "wvhashtable.h"
19 #include "wvbufstream.h"
28 static const WvString DEFAULT_ANON_PW(
"weasels@");
35 : name(_name), value(_value)
59 WvStream *content_source,
bool _create_dirs,
bool _pipeline_test);
74 : linkname(_linkname), url(_url)
90 WvHTTPHeaderDict headers;
98 const char *wstype()
const {
return "WvBufUrlStream"; }
114 : remaddr(_remaddr), username(_username) {}
118 bool operator== (
const Target &n2)
const
119 {
return (username == n2.username && remaddr == n2.remaddr); }
122 static int max_requests;
126 WvUrlRequestList urls, waiting_urls;
129 virtual void doneurl() = 0;
130 virtual void request_next() = 0;
136 log(logname,
WvLog::Debug)
148 virtual size_t remaining()
154 const char *wstype()
const {
return "WvUrlStream"; }
165 static bool global_enable_pipelining;
166 bool enable_pipelining;
169 int pipeline_test_count;
171 bool sent_url_request;
172 WvIPPortAddrTable &pipeline_incompatible;
173 WvString http_response, pipeline_test_response;
176 enum { Unknown, Chunked, ContentLength, Infinity,
177 PostHeadInfinity, PostHeadChunked, PostHeadStream,
178 ChuckInfinity, ChuckChunked, ChuckStream } encoding;
179 size_t bytes_remaining;
180 bool in_chunk_trailer, last_was_pipeline_test, in_doneurl;
182 virtual void doneurl();
183 virtual void request_next();
184 void start_pipeline_test(
WvUrl *url);
187 void pipelining_is_broken(
int why);
191 bool ssl, WvIPPortAddrTable &_pipeline_incompatible);
194 virtual void close();
198 virtual size_t remaining()
199 {
return bytes_remaining; }
202 const char *wstype()
const {
return "WvHttpStream"; }
208 bool logged_in, pasv_acked;
211 time_t last_request_time;
214 virtual void doneurl();
215 virtual void request_next();
219 char *get_important_line();
226 WvString parse_for_links(
char *line);
229 void* real_execute(
void*);
237 virtual void close();
241 const char *wstype()
const {
return "WvFtpStream"; }
250 WvUrlStreamDict conns;
251 WvUrlRequestList urls;
252 int num_streams_created;
255 WvIPPortAddrTable pipeline_incompatible;
268 bool create_dirs =
false);
279 {
return !urls.count(); }
282 const char *wstype()
const {
return "WvHttpPool"; }
WvBufStream stores data written by write(), and returns it later on in read().
WvCont provides "continuations", which are apparently also known as semi-coroutines.
A WvFastString acts exactly like a WvString, but can take (const char *) strings without needing to a...
virtual void close()
Close this stream.
virtual void execute()
The callback() function calls execute(), and then calls the user- specified callback if one is define...
virtual void pre_select(SelectInfo &si)
pre_select() sets up for eventually calling ::select().
virtual bool post_select(SelectInfo &si)
post_select() is called after ::select(), and returns true if this object is now ready.
virtual void execute()
The callback() function calls execute(), and then calls the user- specified callback if one is define...
virtual void pre_select(SelectInfo &si)
pre_select() sets up for eventually calling ::select().
virtual bool post_select(SelectInfo &si)
post_select() is called after ::select(), and returns true if this object is now ready.
virtual void pre_select(SelectInfo &si)
pre_select() sets up for eventually calling ::select().
virtual bool post_select(SelectInfo &si)
post_select() is called after ::select(), and returns true if this object is now ready.
virtual void close()
Close this stream.
virtual void execute()
The callback() function calls execute(), and then calls the user- specified callback if one is define...
An IP+Port address also includes a port number, with the resulting form www.xxx.yyy....
WvStreamList holds a list of WvStream objects – and its select() and callback() functions know how to...
A WvLog stream accepts log messages from applications and forwards them to all registered WvLogRcv's.
ASynchronous DNS resolver functions, so that we can do non-blocking lookups.
WvStreamClone simply forwards all requests to the "cloned" stream.
Unified support for streams, that is, sequences of bytes that may or may not be ready for read/write ...
WvString is an implementation of a simple and efficient printable-string class.
WvTCPConn tries to make all outgoing connections asynchronously (in the background).
virtual void close()=0
Close this stream.
virtual void execute()=0
The callback() function calls execute(), and then calls the user- specified callback if one is define...
the data structure used by pre_select()/post_select() and internally by select().