/*
- * DEBUG: section 93 eCAP Interface
+ * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
+ *
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
*/
+
+/* DEBUG: section 93 eCAP Interface */
+
#include "squid.h"
#include <libecap/adapter/service.h>
#include <libecap/common/names.h>
#include "base/TextException.h"
#include "HttpReply.h"
#include "HttpRequest.h"
+#include "MasterXaction.h"
const libecap::Name Adaptation::Ecap::protocolInternal("internal", libecap::Name::NextId());
const libecap::Name Adaptation::Ecap::protocolCacheObj("cache_object", libecap::Name::NextId());
// assign our host-specific IDs to well-known names
// this code can run only once
- libecap::headerTransferEncoding.assignHostId(HDR_TRANSFER_ENCODING);
- libecap::headerReferer.assignHostId(HDR_REFERER);
- libecap::headerContentLength.assignHostId(HDR_CONTENT_LENGTH);
- libecap::headerVia.assignHostId(HDR_VIA);
- // TODO: libecap::headerXClientIp.assignHostId(HDR_X_CLIENT_IP);
- // TODO: libecap::headerXServerIp.assignHostId(HDR_X_SERVER_IP);
+ libecap::headerTransferEncoding.assignHostId(Http::HdrType::TRANSFER_ENCODING);
+ libecap::headerReferer.assignHostId(Http::HdrType::REFERER);
+ libecap::headerContentLength.assignHostId(Http::HdrType::CONTENT_LENGTH);
+ libecap::headerVia.assignHostId(Http::HdrType::VIA);
+ // TODO: libecap::headerXClientIp.assignHostId(Http::HdrType::X_CLIENT_IP);
+ // TODO: libecap::headerXServerIp.assignHostId(Http::HdrType::X_SERVER_IP);
libecap::protocolHttp.assignHostId(AnyP::PROTO_HTTP);
libecap::protocolHttps.assignHostId(AnyP::PROTO_HTTPS);
return DBG_DATA; // is it a good idea to ignore other flags?
if (lv.application())
- return DBG_IMPORTANT; // is it a good idea to ignore other flags?
+ return lv.normal() ? DBG_IMPORTANT : 2;
return 2 + 2*lv.debugging() + 3*lv.operation() + 2*lv.xaction();
}
{
const int squidLevel = SquidLogLevel(lv);
const int squidSection = 93; // XXX: this should be a global constant
- // XXX: Debug.h should provide this to us
- if ((Debug::level = squidLevel) <= Debug::Levels[squidSection])
- return &Debug::getDebugOut();
- else
- return NULL;
+ return Debug::Enabled(squidSection, squidLevel) ?
+ &Debug::Start(squidSection, squidLevel) :
+ nullptr;
}
void
Adaptation::Ecap::Host::closeDebug(std::ostream *debug)
{
if (debug)
- Debug::finishDebug();
+ Debug::Finish();
}
Adaptation::Ecap::Host::MessagePtr
Adaptation::Ecap::Host::newRequest() const
{
- return MessagePtr(new Adaptation::Ecap::MessageRep(new HttpRequest));
+ static const MasterXaction::Pointer mx = new MasterXaction(XactionInitiator::initAdaptationOrphan_);
+ return MessagePtr(new Adaptation::Ecap::MessageRep(new HttpRequest(mx)));
}
Adaptation::Ecap::Host::MessagePtr
libecap::RegisterHost(TheHost);
}
}
+