void MemObject::trimSwappable() STUB
void MemObject::trimUnSwappable() STUB
int64_t MemObject::policyLowestOffsetToKeep(bool swap) const STUB_RETVAL(-1)
-MemObject::MemObject(char const *, char const *) {} // NOP due to Store
+MemObject::MemObject(char const *, char const *) :
+ url(NULL),
+ inmem_lo(0),
+ nclients(0),
+ request(NULL),
+ ping_reply_callback(NULL),
+ ircb_data(NULL),
+ log_url(NULL),
+ id(0),
+ object_sz(-1),
+ swap_hdr_sz(0),
+ vary_headers(NULL),
+ _reply(NULL)
+{
+ memset(&clients, 0, sizeof(clients));
+ memset(&start_ping, 0, sizeof(start_ping));
+ memset(&abort, 0, sizeof(abort));
+} // NOP instead of elided due to Store
+
HttpReply const * MemObject::getReply() const
{
// XXX: required by testStore
fprintf(stderr, "Invalid config line: %s\n", s);
return false;
}
+
// Keep the initial value on cfgparam. The ConfigParser methods will write on cfgline
- strcpy(cfgparam, tmp+1);
+ strncpy(cfgparam, tmp+1, sizeof(cfgparam)-1);
+ cfgparam[sizeof(cfgparam)-1] = '\0';
// Initialize parser to point to the start of quoted string
strtok(cfgline, w_space);
CPPUNIT_ASSERT_EQUAL(String("/bar"), aRequest->urlpath);
CPPUNIT_ASSERT_EQUAL(AnyP::PROTO_HTTP, aRequest->protocol);
CPPUNIT_ASSERT_EQUAL(String("http://foo/bar"), String(url));
+ xfree(url);
/* a connect url with non-CONNECT data */
url = xstrdup(":foo/bar");
}
int
-main (int argc, char **argv)
+main(int argc, char **argv)
{
- Mem::Init();
- /* enable for debugging to console */
- // _db_init (NULL, NULL);
- // Debug::Levels[64] = 9;
- testRangeParser ("bytes=0-3");
- testRangeParser ("bytes=-3");
- testRangeParser ("bytes=1-");
- testRangeParser ("bytes=0-3, 1-, -2");
- testRangeIter ();
- testRangeCanonization();
+ try{
+ Mem::Init();
+ /* enable for debugging to console */
+ // _db_init (NULL, NULL);
+ // Debug::Levels[64] = 9;
+ testRangeParser("bytes=0-3");
+ testRangeParser("bytes=-3");
+ testRangeParser("bytes=1-");
+ testRangeParser("bytes=0-3, 1-, -2");
+ testRangeIter();
+ testRangeCanonization();
+ } catch (const std::exception &e) {
+ printf("Error: dying from an unhandled exception: %s\n", e.what());
+ return 1;
+ } catch (...) {
+ printf("Error: dying from an unhandled exception.\n");
+ return 1;
+ }
return 0;
}