ss << host << "-" << port;
string connectionId = ss.str();
bool havePending = !d->pendingRequests.empty();
-
+ ConnectionDict::iterator consEnd = d->connections.end();
+
// assign request to an existing Connection.
// various options exist here, examined in order
if (d->connections.size() >= d->maxConnections) {
ConnectionDict::iterator it = d->connections.find(connectionId);
- if (it == d->connections.end()) {
+ if (it == consEnd) {
// maximum number of connections active, queue this request
// when a connection goes inactive, we'll start this one
d->pendingRequests.push_back(r);
// there's pressure on the number of connections to keep alive, one
// host can't DoS every other.
int count = 0;
- for (;it->first == connectionId; ++it, ++count) {
+ for (; (it != consEnd) && (it->first == connectionId); ++it, ++count) {
if (havePending || !it->second->isActive()) {
con = it->second;
break;
{
HTTP::Client cl;
-
+ // force all requests to use the same connection for this test
+ cl.setMaxConnections(1);
+
// test URL parsing
TestRequest* tr1 = new TestRequest("http://localhost.woo.zar:2000/test1?foo=bar");
COMPARE(tr1->scheme(), "http");
cout << "testing HTTP 1.1 pipelineing" << endl;
{
+
cl.setProxy("", 80);
TestRequest* tr = new TestRequest("http://localhost:2000/test1");
HTTP::Request_ptr own(tr);
time_t now = time(0);
readProperties(_persistentCachePath.str(), cacheRoot);
- for (unsigned int i=0; i<cacheRoot->nChildren(); ++i) {
+ for (int i=0; i<cacheRoot->nChildren(); ++i) {
SGPropertyNode* entry = cacheRoot->getChild(i);
string tileName = entry->getStringValue("path");
time_t stamp = entry->getIntValue("stamp");