lib/smblib/Makefile \
scripts/Makefile \
src/Makefile \
+ src/anyp/Makefile \
src/base/Makefile \
src/acl/Makefile \
src/fs/Makefile \
ACL::Prototype ACLPeerName::RegistryProtoype(&ACLPeerName::RegistryEntry_, "peername");
ACLStrategised<const char *> ACLPeerName::RegistryEntry_(new ACLStringData, ACLPeerNameStrategy::Instance(), "peername");
ACL::Prototype ACLProtocol::RegistryProtoype(&ACLProtocol::RegistryEntry_, "proto");
-ACLStrategised<protocol_t> ACLProtocol::RegistryEntry_(new ACLProtocolData, ACLProtocolStrategy::Instance(), "proto");
+ACLStrategised<AnyP::ProtocolType> ACLProtocol::RegistryEntry_(new ACLProtocolData, ACLProtocolStrategy::Instance(), "proto");
ACL::Prototype ACLRandom::RegistryProtoype(&ACLRandom::RegistryEntry_, "random");
ACLRandom ACLRandom::RegistryEntry_("random");
ACL::Prototype ACLReferer::RegistryProtoype(&ACLReferer::RegistryEntry_, "referer_regex");
#include "MemBuf.h"
HttpMsg::HttpMsg(http_hdr_owner_type owner): header(owner),
- cache_control(NULL), hdr_sz(0), content_length(0), protocol(PROTO_NONE),
+ cache_control(NULL), hdr_sz(0), content_length(0), protocol(AnyP::PROTO_NONE),
pstate(psReadyToParseStartLine), lock_count(0)
{}
int64_t content_length;
- protocol_t protocol;
+ AnyP::ProtocolType protocol;
HttpMsgParseState pstate; /* the current parsing state */
init();
}
-HttpRequest::HttpRequest(const HttpRequestMethod& aMethod, protocol_t aProtocol, const char *aUrlpath) : HttpMsg(hoRequest)
+HttpRequest::HttpRequest(const HttpRequestMethod& aMethod, AnyP::ProtocolType aProtocol, const char *aUrlpath) : HttpMsg(hoRequest)
{
static unsigned int id = 1;
debugs(93,7, HERE << "constructed, this=" << this << " id=" << ++id);
}
void
-HttpRequest::initHTTP(const HttpRequestMethod& aMethod, protocol_t aProtocol, const char *aUrlpath)
+HttpRequest::initHTTP(const HttpRequestMethod& aMethod, AnyP::ProtocolType aProtocol, const char *aUrlpath)
{
method = aMethod;
protocol = aProtocol;
HttpRequest::init()
{
method = METHOD_NONE;
- protocol = PROTO_NONE;
+ protocol = AnyP::PROTO_NONE;
urlpath = NULL;
login[0] = '\0';
host[0] = '\0';
bool
HttpRequest::cacheable() const
{
- if (protocol == PROTO_HTTP)
+ if (protocol == AnyP::PROTO_HTTP)
return httpCachable(method);
/*
* XXX POST may be cached sometimes.. ignored
* for now
*/
- if (protocol == PROTO_GOPHER)
+ if (protocol == AnyP::PROTO_GOPHER)
return gopherCachable(this);
- if (protocol == PROTO_CACHEOBJ)
+ if (protocol == AnyP::PROTO_CACHEOBJ)
return false;
return true;
MEMPROXY_CLASS(HttpRequest);
HttpRequest();
- HttpRequest(const HttpRequestMethod& aMethod, protocol_t aProtocol, const char *aUrlpath);
+ HttpRequest(const HttpRequestMethod& aMethod, AnyP::ProtocolType aProtocol, const char *aUrlpath);
~HttpRequest();
virtual void reset();
return static_cast<HttpRequest*>(HttpMsg::_lock());
};
- void initHTTP(const HttpRequestMethod& aMethod, protocol_t aProtocol, const char *aUrlpath);
+ void initHTTP(const HttpRequestMethod& aMethod, AnyP::ProtocolType aProtocol, const char *aUrlpath);
virtual HttpRequest *clone() const;
httpStatusLineSet(HttpStatusLine * sline, HttpVersion version, http_status status, const char *reason)
{
assert(sline);
- sline->protocol = PROTO_HTTP;
+ sline->protocol = AnyP::PROTO_HTTP;
sline->version = version;
sline->status = status;
/* Note: no xstrdup for 'reason', assumes constant 'reasons' */
assert(sline && p);
/* handle ICY protocol status line specially. Pass on the bad format. */
- if (sline->protocol == PROTO_ICY) {
+ if (sline->protocol == AnyP::PROTO_ICY) {
debugs(57, 9, "packing sline " << sline << " using " << p << ":");
debugs(57, 9, "FORMAT=" << IcyStatusLineFormat );
debugs(57, 9, "ICY " << sline->status << " " << (sline->reason ? sline->reason : httpStatusString(sline->status)) );
if (protoPrefix.cmp("ICY", 3) == 0) {
debugs(57, 3, "httpStatusLineParse: Invalid HTTP identifier. Detected ICY protocol istead.");
- sline->protocol = PROTO_ICY;
+ sline->protocol = AnyP::PROTO_ICY;
start += protoPrefix.size();
} else if (protoPrefix.caseCmp(start, protoPrefix.size()) == 0) {
class Packer;
class String;
-/* for http_status and protocol_t */
-#include "enums.h"
-
+#include "HttpStatusCode.h"
#include "HttpVersion.h"
+#include "anyp/ProtocolType.h"
#include "SquidString.h"
/**
/**
* By rights protocol name should be a constant "HTTP", with no need for this field to exist.
- * However there are protocols which violate HTTP by sending their wn custom formats
- * back with other protocol names (ICY streaming format being the current major problem)
+ * However there are protocols which violate HTTP by sending their own custom formats
+ * back with other protocol names (ICY streaming format being the current major problem).
*/
- protocol_t protocol;
+ AnyP::ProtocolType protocol;
HttpVersion version; ///< breakdown of protocol version labels: 0.9 1.0 1.1
http_status status; ///< status code. ie 200 404
LoadableModules.h \
LoadableModules.cc
-SUBDIRS = base comm eui acl fs repl
-DIST_SUBDIRS = base comm eui acl fs repl
+SUBDIRS = base anyp comm eui acl fs repl
+DIST_SUBDIRS = base anyp comm eui acl fs repl
if ENABLE_AUTH
SUBDIRS += auth
squid_LDADD = \
$(COMMON_LIBS) \
+ anyp/libanyp.la \
comm/libcomm.la \
eui/libeui.la \
icmp/libicmp.la icmp/libicmp-core.la \
tests_testAuth_LDADD= \
$(COMMON_LIBS) \
+ anyp/libanyp.la \
$(top_builddir)/lib/libmisccontainers.la \
$(top_builddir)/lib/libmiscencoding.la \
$(top_builddir)/lib/libmiscutil.la \
$(ADAPTATION_LIBS) \
$(ESI_LIBS) \
$(SSL_LIBS) \
+ anyp/libanyp.la \
$(top_builddir)/lib/libmisccontainers.la \
$(top_builddir)/lib/libmiscencoding.la \
$(top_builddir)/lib/libmiscutil.la \
SquidMath.h \
swap_log_op.cc
tests_testDiskIO_LDADD = \
+ anyp/libanyp.la \
SquidConfig.o \
CommCalls.o \
DnsLookupDetails.o \
$(BUILT_SOURCES)
tests_testEvent_LDADD = \
$(COMMON_LIBS) \
+ anyp/libanyp.la \
$(SNMP_LIBS) \
icmp/libicmp.la icmp/libicmp-core.la \
comm/libcomm.la \
$(BUILT_SOURCES)
tests_testEventLoop_LDADD = \
$(COMMON_LIBS) \
+ anyp/libanyp.la \
$(SNMP_LIBS) \
icmp/libicmp.la icmp/libicmp-core.la \
comm/libcomm.la \
$(BUILT_SOURCES)
tests_test_http_range_LDADD = \
$(COMMON_LIBS) \
+ anyp/libanyp.la \
$(SNMP_LIBS) \
icmp/libicmp.la icmp/libicmp-core.la \
comm/libcomm.la \
$(BUILT_SOURCES)
tests_testHttpRequest_LDADD = \
$(COMMON_LIBS) \
+ anyp/libanyp.la \
$(SNMP_LIBS) \
icmp/libicmp.la icmp/libicmp-core.la \
comm/libcomm.la \
tests_testStore_LDADD= \
$(COMMON_LIBS) \
+ anyp/libanyp.la \
$(top_builddir)/lib/libmisccontainers.la \
$(top_builddir)/lib/libmiscencoding.la \
$(top_builddir)/lib/libmiscutil.la \
SquidMath.h \
swap_log_op.cc
tests_testUfs_LDADD = \
+ anyp/libanyp.la \
CommCalls.o \
DnsLookupDetails.o \
$(COMMON_LIBS) \
nodist_tests_testURL_SOURCES = \
$(BUILT_SOURCES)
tests_testURL_LDADD = \
+ anyp/libanyp.la \
$(COMMON_LIBS) \
$(SNMP_LIBS) \
icmp/libicmp.la icmp/libicmp-core.la \
*
*/
-#include "squid.h"
+#include "config.h"
#include "URLScheme.h"
#include "wordlist.h"
-const char *ProtocolStr[] = {
- "NONE",
- "http",
- "ftp",
- "gopher",
- "wais",
- "cache_object",
- "icp",
-#if USE_HTCP
- "htcp",
-#endif
- "urn",
- "whois",
- "internal",
- "https",
- "icy",
- "TOTAL"
-};
+char const *
+URLScheme::const_str() const
+{
+ if (theScheme_ == AnyP::PROTO_UNKNOWN)
+ return "(unknown)";
+
+ static char out[BUFSIZ];
+ int p = 0;
+
+ if (theScheme_ > AnyP::PROTO_NONE && theScheme_ < AnyP::PROTO_MAX) {
+ const char *in = AnyP::ProtocolType_str[theScheme_];
+ for (; p < (BUFSIZ-1) && in[p] != '\0'; ++p)
+ out[p] = xtolower(in[p]);
+ }
+ out[p] = '\0';
+ return out;
+}
#ifndef SQUID_URLSCHEME_H
#define SQUID_URLSCHEME_H
-/* For the definition of NULL and protocol_t */
-#include "squid.h"
-
+#include "anyp/ProtocolType.h"
+#if HAVE_IOSFWD
#include <iosfwd>
+#endif
-extern const char *ProtocolStr[];
-
-/* This class represents a URL Scheme such as HTTPS, HTTP, WAIS etc.
+/** This class represents a URL Scheme such as HTTPS, HTTP, WAIS etc.
* It does not represent the PROTOCOL that such schemes refer to.
*/
-
class URLScheme
{
public:
- URLScheme() : theScheme(PROTO_NONE) {}
+ URLScheme() : theScheme_(AnyP::PROTO_NONE) {}
+ URLScheme(AnyP::ProtocolType const aScheme) : theScheme_(aScheme) {}
+ ~URLScheme() {}
- URLScheme(protocol_t const aScheme) : theScheme(aScheme) {}
+ operator AnyP::ProtocolType() const { return theScheme_; }
- operator protocol_t() const { return theScheme; }
+ bool operator != (AnyP::ProtocolType const & aProtocol) const { return theScheme_ != aProtocol; }
- bool operator != (protocol_t const & aProtocol) const { return theScheme != aProtocol;}
-
- /* Get a char string representation of the scheme. */
- char const *const_str() const { return ProtocolStr[theScheme]; }
+ /** Get a char string representation of the scheme.
+ * An upper bound length of BUFSIZ bytes converted. Remainder will be truncated.
+ * The result of this call will remain usable only until any subsequest call
+ * and must be copied if persistence is needed.
+ */
+ char const *const_str() const;
private:
- /* This is a typecode for now - TODO make the varying methods virtual
- * Doing that without doubling the storage size will require having
- * something like a flyweight. perhaps the strategy pattern is appropiate:
- * one strategy per scheme, and an object that is nothing but a pointer
- * into the registry of schemes.
- */
- protocol_t theScheme;
+ /// This is a typecode pointer into the enum/registry of protocols handled.
+ AnyP::ProtocolType theScheme_;
};
inline std::ostream &
/* explicit template instantiation required for some systems */
-template class ACLStrategised<protocol_t>;
+template class ACLStrategised<AnyP::ProtocolType>;
#ifndef SQUID_ACLPROTOCOL_H
#define SQUID_ACLPROTOCOL_H
+
#include "acl/Strategy.h"
#include "acl/Strategised.h"
+#include "anyp/ProtocolType.h"
-class ACLProtocolStrategy : public ACLStrategy<protocol_t>
+class ACLProtocolStrategy : public ACLStrategy<AnyP::ProtocolType>
{
public:
private:
static ACL::Prototype RegistryProtoype;
- static ACLStrategised<protocol_t> RegistryEntry_;
+ static ACLStrategised<AnyP::ProtocolType> RegistryEntry_;
};
#endif /* SQUID_ACLPROTOCOL_H */
}
bool
-ACLProtocolData::match(protocol_t toFind)
+ACLProtocolData::match(AnyP::ProtocolType toFind)
{
return values->findAndTune (toFind);
}
/* explicit instantiation required for some systems */
/// \cond AUTODOCS-IGNORE
-template cbdata_type CbDataList<protocol_t>::CBDATA_CbDataList;
+template cbdata_type CbDataList<AnyP::ProtocolType>::CBDATA_CbDataList;
/// \endcond
wordlist *
ACLProtocolData::dump()
{
wordlist *W = NULL;
- CbDataList<protocol_t> *data = values;
+ CbDataList<AnyP::ProtocolType> *data = values;
while (data != NULL) {
- wordlistAdd(&W, ProtocolStr[data->element]);
+ wordlistAdd(&W, AnyP::ProtocolType_str[data->element]);
data = data->next;
}
void
ACLProtocolData::parse()
{
- CbDataList<protocol_t> **Tail;
+ CbDataList<AnyP::ProtocolType> **Tail;
char *t = NULL;
for (Tail = &values; *Tail; Tail = &((*Tail)->next));
while ((t = strtokFile())) {
- CbDataList<protocol_t> *q = new CbDataList<protocol_t> (urlParseProtocol(t));
- *(Tail) = q;
- Tail = &q->next;
+ for (int p = AnyP::PROTO_NONE; p < AnyP::PROTO_UNKNOWN; ++p) {
+ if (strcasecmp(t, AnyP::ProtocolType_str[p]) != 0) {
+ CbDataList<AnyP::ProtocolType> *q = new CbDataList<AnyP::ProtocolType>(static_cast<AnyP::ProtocolType>(p));
+ *(Tail) = q;
+ Tail = &q->next;
+ break;
+ } else {
+ debugs(28, DBG_IMPORTANT, "WARNING: Ignoring unknown protocol '" << t << "' in the ACL named '" << AclMatchedName << "'");
+ }
+ }
}
}
return values == NULL;
}
-ACLData<protocol_t> *
+ACLData<AnyP::ProtocolType> *
ACLProtocolData::clone() const
{
/* Splay trees don't clone yet. */
#ifndef SQUID_ACLPROTOCOLDATA_H
#define SQUID_ACLPROTOCOLDATA_H
+
#include "acl/Acl.h"
#include "acl/Data.h"
+#include "anyp/ProtocolType.h"
#include "CbDataList.h"
-class ACLProtocolData : public ACLData<protocol_t>
+class ACLProtocolData : public ACLData<AnyP::ProtocolType>
{
public:
ACLProtocolData(ACLProtocolData const &);
ACLProtocolData &operator= (ACLProtocolData const &);
virtual ~ACLProtocolData();
- bool match(protocol_t);
+ bool match(AnyP::ProtocolType);
wordlist *dump();
void parse();
bool empty() const;
- virtual ACLData<protocol_t> *clone() const;
+ virtual ACLData<AnyP::ProtocolType> *clone() const;
- CbDataList<protocol_t> *values;
+ CbDataList<AnyP::ProtocolType> *values;
};
MEMPROXY_CLASS_INLINE(ACLProtocolData);
--- /dev/null
+include $(top_srcdir)/src/Common.am
+include $(top_srcdir)/src/TestHeaders.am
+
+noinst_LTLIBRARIES = libanyp.la
+
+libanyp_la_SOURCES = \
+ ProtocolType.cc \
+ ProtocolType.h
+
+ProtocolType.cc: ProtocolType.h $(top_srcdir)/src/mk-string-arrays.awk
+ ($(AWK) -f $(top_srcdir)/src/mk-string-arrays.awk <$(srcdir)/ProtocolType.h | sed -e 's%PROTO_%%' >$@) || ($(RM) -f $@ && exit 1)
+
+CLEANFILES += ProtocolType.cc
--- /dev/null
+#ifndef _SQUID_SRC_ANYP_PROTOCOLTYPE_H
+#define _SQUID_SRC_ANYP_PROTOCOLTYPE_H
+
+#if HAVE_OSTREAM
+#include <ostream>
+#endif
+
+namespace AnyP {
+
+/**
+ * List of all protocols known and supported.
+ * This is a combined list. It is used as type-codes where needed and
+ * the AnyP::ProtocolType_Str array of strings may be used for display
+ */
+typedef enum {
+ PROTO_NONE = 0,
+ PROTO_HTTP,
+ PROTO_FTP,
+ PROTO_HTTPS,
+ PROTO_GOPHER,
+ PROTO_WAIS,
+ PROTO_CACHEOBJ,
+ PROTO_ICP,
+#if USE_HTCP
+ PROTO_HTCP,
+#endif
+ PROTO_URN,
+ PROTO_WHOIS,
+ PROTO_INTERNAL,
+ PROTO_ICY,
+ PROTO_UNKNOWN,
+ PROTO_MAX
+} ProtocolType;
+
+extern const char *ProtocolType_str[];
+
+/** Display the registered Protocol Type (in upper case).
+ * If the protocol is not a registered AnyP::ProtocolType nothing will be displayed.
+ * The caller is responsible for any alternative text.
+ */
+inline std::ostream &
+operator <<(std::ostream &os, ProtocolType const &p)
+{
+ if (PROTO_NONE <= p && p < PROTO_MAX)
+ os << ProtocolType_str[p];
+ else
+ os << static_cast<int>(p);
+ return os;
+}
+
+} // namespace AnyP
+
+#endif /* _SQUID_SRC_ANYP_PROTOCOLTYPE_H */
}
#endif
void
-clientdbUpdate(const Ip::Address &addr, log_type ltype, protocol_t p, size_t size)
+clientdbUpdate(const Ip::Address &addr, log_type ltype, AnyP::ProtocolType p, size_t size)
{
char key[MAX_IPSTRLEN];
ClientInfo *c;
if (c == NULL)
debug_trap("clientdbUpdate: Failed to add entry");
- if (p == PROTO_HTTP) {
+ if (p == AnyP::PROTO_HTTP) {
c->Http.n_requests++;
c->Http.result_hist[ltype]++;
kb_incr(&c->Http.kbytes_out, size);
if (logTypeIsATcpHit(ltype))
kb_incr(&c->Http.hit_kbytes_out, size);
- } else if (p == PROTO_ICP) {
+ } else if (p == AnyP::PROTO_ICP) {
c->Icp.n_requests++;
c->Icp.result_hist[ltype]++;
kb_incr(&c->Icp.kbytes_out, size);
updateCounters();
if (getConn() != NULL)
- clientdbUpdate(getConn()->peer, logType, PROTO_HTTP, out.size);
+ clientdbUpdate(getConn()->peer, logType, AnyP::PROTO_HTTP, out.size);
}
delete checklist;
}
if (http->flags.internal) {
- request->protocol = PROTO_HTTP;
+ request->protocol = AnyP::PROTO_HTTP;
request->login[0] = '\0';
}
*/
http->logType = LOG_TCP_CLIENT_REFRESH_MISS;
processMiss();
- } else if (r->protocol == PROTO_HTTP) {
+ } else if (r->protocol == AnyP::PROTO_HTTP) {
/*
* Object needs to be revalidated
* XXX This could apply to FTP as well, if Last-Modified is known.
/** Check for internal requests. Update Protocol info if so. */
if (http->flags.internal)
- r->protocol = PROTO_INTERNAL;
+ r->protocol = AnyP::PROTO_INTERNAL;
r->clientConnection = http->getConn();
reply = HTTPMSGLOCK(rep);
- if (reply->sline.protocol == PROTO_HTTP) {
+ if (reply->sline.protocol == AnyP::PROTO_HTTP) {
/* RFC 2616 requires us to advertise our 1.1 version (but only on real HTTP traffic) */
reply->sline.version = HttpVersion(1,1);
}
*/
if (http->request == NULL)
- http->request = HTTPMSGLOCK(new HttpRequest(m, PROTO_NONE, null_string));
+ http->request = HTTPMSGLOCK(new HttpRequest(m, AnyP::PROTO_NONE, null_string));
StoreEntry *e = storeCreateEntry(http->uri, http->log_uri, reqFlags, m);
if (request->flags.loopdetect)
return 0;
- if (request->protocol == PROTO_HTTP)
+ if (request->protocol == AnyP::PROTO_HTTP)
return httpCachable(method);
- if (request->protocol == PROTO_GOPHER)
+ if (request->protocol == AnyP::PROTO_GOPHER)
return gopherCachable(request);
- if (request->protocol == PROTO_CACHEOBJ)
+ if (request->protocol == AnyP::PROTO_CACHEOBJ)
return 0;
return 1;
}
-
static void
clientCheckPinning(ClientHttpRequest * http)
{
STORE_DISK_CLIENT
} store_client_t;
-typedef enum {
- PROTO_NONE,
- PROTO_HTTP,
- PROTO_FTP,
- PROTO_GOPHER,
- PROTO_WAIS,
- PROTO_CACHEOBJ,
- PROTO_ICP,
-#if USE_HTCP
- PROTO_HTCP,
-#endif
- PROTO_URN,
- PROTO_WHOIS,
- PROTO_INTERNAL,
- PROTO_HTTPS,
- PROTO_ICY,
- PROTO_MAX
-} protocol_t;
-
/*
* These are for StoreEntry->flag, which is defined as a SHORT
*
case 'P':
if (request) {
- p = ProtocolStr[request->protocol];
+ p = AnyP::ProtocolType_str[request->protocol];
} else if (!building_deny_info_url) {
p = "[unknown protocol]";
}
break;
case _external_acl_format::EXT_ACL_PROTO:
- str = ProtocolStr[request->protocol];
+ str = AnyP::ProtocolType_str[request->protocol];
break;
case _external_acl_format::EXT_ACL_PORT:
*/
if ( Config.accessList.miss && !request->client_addr.IsNoAddr() &&
- request->protocol != PROTO_INTERNAL && request->protocol != PROTO_CACHEOBJ) {
+ request->protocol != AnyP::PROTO_INTERNAL && request->protocol != AnyP::PROTO_CACHEOBJ) {
/**
* Check if this host is allowed to fetch MISSES from us (miss_access)
*/
switch (request->protocol) {
- case PROTO_INTERNAL:
+ case AnyP::PROTO_INTERNAL:
internalStart(request, entry);
return;
- case PROTO_CACHEOBJ:
+ case AnyP::PROTO_CACHEOBJ:
CacheManager::GetInstance()->Start(client_fd, request, entry);
return;
- case PROTO_URN:
+ case AnyP::PROTO_URN:
urnStart(request, entry);
return;
#if USE_SSL
if ((fs->_peer && fs->_peer->use_ssl) ||
- (!fs->_peer && request->protocol == PROTO_HTTPS)) {
+ (!fs->_peer && request->protocol == AnyP::PROTO_HTTPS)) {
initiateSSL();
return;
}
switch (request->protocol) {
#if USE_SSL
- case PROTO_HTTPS:
+ case AnyP::PROTO_HTTPS:
httpStart(this);
break;
#endif
- case PROTO_HTTP:
+ case AnyP::PROTO_HTTP:
httpStart(this);
break;
- case PROTO_GOPHER:
+ case AnyP::PROTO_GOPHER:
gopherStart(this);
break;
- case PROTO_FTP:
+ case AnyP::PROTO_FTP:
ftpStart(this);
break;
- case PROTO_CACHEOBJ:
+ case AnyP::PROTO_CACHEOBJ:
- case PROTO_INTERNAL:
+ case AnyP::PROTO_INTERNAL:
- case PROTO_URN:
+ case AnyP::PROTO_URN:
fatal_dump("Should never get here");
break;
- case PROTO_WHOIS:
+ case AnyP::PROTO_WHOIS:
whoisStart(this);
break;
- case PROTO_WAIS: /* Not implemented */
+ case AnyP::PROTO_WAIS: /* Not implemented */
default:
debugs(17, 1, "fwdDispatch: Cannot retrieve '" << entry->url() << "'" );
title_url.append(request->GetHost());
- if (request->port != urlDefaultPort(PROTO_FTP)) {
+ if (request->port != urlDefaultPort(AnyP::PROTO_FTP)) {
title_url.append(":");
title_url.append(xitoa(request->port));
}
base_href.append(request->GetHost());
- if (request->port != urlDefaultPort(PROTO_FTP)) {
+ if (request->port != urlDefaultPort(AnyP::PROTO_FTP)) {
base_href.append(":");
base_href.append(xitoa(request->port));
}
{
String newbuf = "%2f";
- if (request->protocol != PROTO_FTP)
+ if (request->protocol != AnyP::PROTO_FTP)
return NULL;
if ( request->urlpath[0]=='/' ) {
newrep->removeStaleWarnings();
- if (newrep->sline.protocol == PROTO_HTTP && newrep->sline.status >= 100 && newrep->sline.status < 200) {
+ if (newrep->sline.protocol == AnyP::PROTO_HTTP && newrep->sline.status >= 100 && newrep->sline.status < 200) {
handle1xx(newrep);
ctx_exit(ctx);
return;
}
flags.chunked = 0;
- if (newrep->sline.protocol == PROTO_HTTP && newrep->header.chunked()) {
+ if (newrep->sline.protocol == AnyP::PROTO_HTTP && newrep->header.chunked()) {
flags.chunked = 1;
httpChunkDecoder = new ChunkedCodingParser;
}
/* append Front-End-Https */
if (flags.front_end_https) {
- if (flags.front_end_https == 1 || request->protocol == PROTO_HTTPS)
+ if (flags.front_end_https == 1 || request->protocol == AnyP::PROTO_HTTPS)
hdr_out->putStr(HDR_FRONT_END_HTTPS, "On");
}
if (LOG_ICP_QUERY == logcode)
return;
- clientdbUpdate(caddr, logcode, PROTO_ICP, len);
+ clientdbUpdate(caddr, logcode, AnyP::PROTO_ICP, len);
if (!Config.onoff.log_udp)
return;
* count this DENIED query in the clientdb, even though
* we're not sending an ICP reply...
*/
- clientdbUpdate(from, LOG_UDP_DENIED, PROTO_ICP, 0);
+ clientdbUpdate(from, LOG_UDP_DENIED, AnyP::PROTO_ICP, 0);
} else {
icpCreateAndSend(ICP_DENIED, 0, url, reqnum, 0, fd, from);
}
mb.Printf("http://%s", lc_host);
/* append port if not default */
- if (port && port != urlDefaultPort(PROTO_HTTP))
+ if (port && port != urlDefaultPort(AnyP::PROTO_HTTP))
mb.Printf(":%d", port);
if (dir)
if (p == NULL) {
neighborIgnoreNonPeer(from, opcode);
} else {
- mem->ping_reply_callback(p, ntype, PROTO_ICP, header, mem->ircb_data);
+ mem->ping_reply_callback(p, ntype, AnyP::PROTO_ICP, header, mem->ircb_data);
}
} else if (opcode == ICP_HIT) {
if (p == NULL) {
neighborIgnoreNonPeer(from, opcode);
} else {
header->opcode = ICP_HIT;
- mem->ping_reply_callback(p, ntype, PROTO_ICP, header, mem->ircb_data);
+ mem->ping_reply_callback(p, ntype, AnyP::PROTO_ICP, header, mem->ircb_data);
}
} else if (opcode == ICP_DECHO) {
if (p == NULL) {
debug_trap("neighborsUdpAck: Found non-ICP cache as SIBLING\n");
debug_trap("neighborsUdpAck: non-ICP neighbors must be a PARENT\n");
} else {
- mem->ping_reply_callback(p, ntype, PROTO_ICP, header, mem->ircb_data);
+ mem->ping_reply_callback(p, ntype, AnyP::PROTO_ICP, header, mem->ircb_data);
}
} else if (opcode == ICP_SECHO) {
if (p) {
}
}
} else if (opcode == ICP_MISS_NOFETCH) {
- mem->ping_reply_callback(p, ntype, PROTO_ICP, header, mem->ircb_data);
+ mem->ping_reply_callback(p, ntype, AnyP::PROTO_ICP, header, mem->ircb_data);
} else {
debugs(15, 0, "neighborsUdpAck: Unexpected ICP reply: " << opcode_d);
}
}
static void
-peerCountHandleIcpReply(peer * p, peer_t type, protocol_t proto, void *hdrnotused, void *data)
+peerCountHandleIcpReply(peer * p, peer_t type, AnyP::ProtocolType proto, void *hdrnotused, void *data)
{
int rtt_av_factor;
StoreEntry *fake = psstate->entry;
MemObject *mem = fake->mem_obj;
int rtt = tvSubMsec(mem->start_ping, current_time);
- assert(proto == PROTO_ICP);
+ assert(proto == AnyP::PROTO_ICP);
assert(fake);
assert(mem);
psstate->ping.n_recv++;
}
debugs(15, 3, "neighborsHtcpReply: e = " << e);
- mem->ping_reply_callback(p, ntype, PROTO_HTCP, htcp, mem->ircb_data);
+ mem->ping_reply_callback(p, ntype, AnyP::PROTO_HTCP, htcp, mem->ircb_data);
}
/*
return;
/* WAIS is not implemented natively */
- if (ps->request->protocol == PROTO_WAIS)
+ if (ps->request->protocol == AnyP::PROTO_WAIS)
return;
peerAddFwdServer(&ps->servers, NULL, HIER_DIRECT);
#endif
static void
-peerHandlePingReply(peer * p, peer_t type, protocol_t proto, void *pingdata, void *data)
+peerHandlePingReply(peer * p, peer_t type, AnyP::ProtocolType proto, void *pingdata, void *data)
{
- if (proto == PROTO_ICP)
+ if (proto == AnyP::PROTO_ICP)
peerHandleIcpReply(p, type, (icp_common_t *)pingdata, data);
#if USE_HTCP
- else if (proto == PROTO_HTCP)
+ else if (proto == AnyP::PROTO_HTCP)
peerHandleHtcpReply(p, type, (htcpReplyData *)pingdata, data);
#endif
else
- debugs(44, 1, "peerHandlePingReply: unknown protocol_t " << proto);
+ debugs(44, 1, "peerHandlePingReply: unknown protocol " << proto);
}
static void
SQUIDCEXTERN void clientdbInit(void);
-SQUIDCEXTERN void clientdbUpdate(const Ip::Address &, log_type, protocol_t, size_t);
+#include "anyp/ProtocolType.h"
+SQUIDCEXTERN void clientdbUpdate(const Ip::Address &, log_type, AnyP::ProtocolType, size_t);
SQUIDCEXTERN int clientdbCutoffDenied(const Ip::Address &);
void clientdbDump(StoreEntry *);
SQUIDCEXTERN void unlinkdUnlink(const char *);
#endif
-SQUIDCEXTERN protocol_t urlParseProtocol(const char *, const char *e = NULL);
+SQUIDCEXTERN AnyP::ProtocolType urlParseProtocol(const char *, const char *e = NULL);
SQUIDCEXTERN void urlInitialize(void);
SQUIDCEXTERN HttpRequest *urlParse(const HttpRequestMethod&, char *, HttpRequest *request = NULL);
SQUIDCEXTERN const char *urlCanonical(HttpRequest *);
SQUIDCEXTERN char *urlInternal(const char *dir, const char *name);
SQUIDCEXTERN int matchDomainName(const char *host, const char *domain);
SQUIDCEXTERN int urlCheckRequest(const HttpRequest *);
-SQUIDCEXTERN int urlDefaultPort(protocol_t p);
+SQUIDCEXTERN int urlDefaultPort(AnyP::ProtocolType p);
SQUIDCEXTERN char *urlHostname(const char *url);
SQUIDCEXTERN void urlExtMethodConfigure(void);
fatal("Not implemented");
}
-HttpRequest::HttpRequest(const HttpRequestMethod& method, protocol_t protocol, const char *aUrlpath) : HttpMsg(hoRequest)
+HttpRequest::HttpRequest(const HttpRequestMethod& method, AnyP::ProtocolType protocol, const char *aUrlpath) : HttpMsg(hoRequest)
{
fatal("Not implemented");
}
}
void
-HttpRequest::initHTTP(const HttpRequestMethod& aMethod, protocol_t aProtocol, const char *aUrlpath)
+HttpRequest::initHTTP(const HttpRequestMethod& aMethod, AnyP::ProtocolType aProtocol, const char *aUrlpath)
{
fatal("Not implemented");
}
CPPUNIT_ASSERT(aRequest->method == METHOD_GET);
CPPUNIT_ASSERT_EQUAL(String("foo"), String(aRequest->GetHost()));
CPPUNIT_ASSERT_EQUAL(String("/bar"), aRequest->urlpath);
- CPPUNIT_ASSERT_EQUAL(PROTO_HTTP, aRequest->protocol);
+ CPPUNIT_ASSERT_EQUAL(AnyP::PROTO_HTTP, aRequest->protocol);
CPPUNIT_ASSERT_EQUAL(String("http://foo:90/bar"), String(url));
xfree(url);
CPPUNIT_ASSERT(aRequest->method == METHOD_PUT);
CPPUNIT_ASSERT_EQUAL(String("foo"), String(aRequest->GetHost()));
CPPUNIT_ASSERT_EQUAL(String("/bar"), aRequest->urlpath);
- CPPUNIT_ASSERT_EQUAL(PROTO_HTTP, aRequest->protocol);
+ CPPUNIT_ASSERT_EQUAL(AnyP::PROTO_HTTP, aRequest->protocol);
CPPUNIT_ASSERT_EQUAL(String("http://foo/bar"), String(url));
/* a connect url with non-CONNECT data */
CPPUNIT_ASSERT(aRequest->method == METHOD_CONNECT);
CPPUNIT_ASSERT_EQUAL(String("foo"), String(aRequest->GetHost()));
CPPUNIT_ASSERT_EQUAL(String(""), aRequest->urlpath);
- CPPUNIT_ASSERT_EQUAL(PROTO_NONE, aRequest->protocol);
+ CPPUNIT_ASSERT_EQUAL(AnyP::PROTO_NONE, aRequest->protocol);
CPPUNIT_ASSERT_EQUAL(String("foo:45"), String(url));
xfree(url);
}
CPPUNIT_ASSERT(aRequest->method == METHOD_GET);
CPPUNIT_ASSERT_EQUAL(String("foo"), String(aRequest->GetHost()));
CPPUNIT_ASSERT_EQUAL(String("/bar"), aRequest->urlpath);
- CPPUNIT_ASSERT_EQUAL(PROTO_HTTP, aRequest->protocol);
+ CPPUNIT_ASSERT_EQUAL(AnyP::PROTO_HTTP, aRequest->protocol);
CPPUNIT_ASSERT_EQUAL(String("http://foo:90/bar"), String(url));
xfree(url);
}
CPPUNIT_ASSERT(aRequest->method == METHOD_GET);
CPPUNIT_ASSERT_EQUAL(String("[2000:800::45]"), String(aRequest->GetHost()));
CPPUNIT_ASSERT_EQUAL(String("/foo"), aRequest->urlpath);
- CPPUNIT_ASSERT_EQUAL(PROTO_HTTP, aRequest->protocol);
+ CPPUNIT_ASSERT_EQUAL(AnyP::PROTO_HTTP, aRequest->protocol);
CPPUNIT_ASSERT_EQUAL(String("http://[2000:800::45]/foo"), String(url));
xfree(url);
CPPUNIT_ASSERT(aRequest->method == METHOD_GET);
CPPUNIT_ASSERT_EQUAL(String("[2000:800::45]"), String(aRequest->GetHost()));
CPPUNIT_ASSERT_EQUAL(String("/foo"), aRequest->urlpath);
- CPPUNIT_ASSERT_EQUAL(PROTO_HTTP, aRequest->protocol);
+ CPPUNIT_ASSERT_EQUAL(AnyP::PROTO_HTTP, aRequest->protocol);
CPPUNIT_ASSERT_EQUAL(String("http://[2000:800::45]:90/foo"), String(url));
xfree(url);
CPPUNIT_ASSERT(aRequest->method == METHOD_GET);
CPPUNIT_ASSERT_EQUAL(String("[2000:800::45]"), String(aRequest->GetHost()));
CPPUNIT_ASSERT_EQUAL(String("/foo"), aRequest->urlpath);
- CPPUNIT_ASSERT_EQUAL(PROTO_HTTP, aRequest->protocol);
+ CPPUNIT_ASSERT_EQUAL(AnyP::PROTO_HTTP, aRequest->protocol);
CPPUNIT_ASSERT_EQUAL(String("http://2000:800::45/foo"), String(url));
xfree(url);
}
testURL::testConstructScheme()
{
URLScheme empty_scheme;
- URL protoless_url(PROTO_NONE);
+ URL protoless_url(AnyP::PROTO_NONE);
CPPUNIT_ASSERT_EQUAL(empty_scheme, protoless_url.getScheme());
- URLScheme ftp_scheme(PROTO_FTP);
- URL ftp_url(PROTO_FTP);
+ URLScheme ftp_scheme(AnyP::PROTO_FTP);
+ URL ftp_url(AnyP::PROTO_FTP);
CPPUNIT_ASSERT_EQUAL(ftp_scheme, ftp_url.getScheme());
}
{
URLScheme empty_scheme;
URLScheme scheme;
- scheme = PROTO_NONE;
+ scheme = AnyP::PROTO_NONE;
CPPUNIT_ASSERT_EQUAL(empty_scheme, scheme);
- URLScheme https_scheme(PROTO_HTTPS);
- scheme = PROTO_HTTPS;
+ URLScheme https_scheme(AnyP::PROTO_HTTPS);
+ scheme = AnyP::PROTO_HTTPS;
CPPUNIT_ASSERT_EQUAL(https_scheme, scheme);
}
testURLScheme::testCastToprotocol_t()
{
/* explicit cast */
- protocol_t protocol = (protocol_t) URLScheme();
- CPPUNIT_ASSERT_EQUAL(PROTO_NONE, protocol);
+ AnyP::ProtocolType protocol = static_cast<AnyP::ProtocolType>(URLScheme());
+ CPPUNIT_ASSERT_EQUAL(AnyP::PROTO_NONE, protocol);
/* and implicit */
- protocol = URLScheme(PROTO_HTTP);
- CPPUNIT_ASSERT_EQUAL(PROTO_HTTP, protocol);
+ protocol = URLScheme(AnyP::PROTO_HTTP);
+ CPPUNIT_ASSERT_EQUAL(AnyP::PROTO_HTTP, protocol);
}
/*
- * a default constructed URLScheme is == PROTO_NONE
+ * a default constructed URLScheme is == AnyP::PROTO_NONE
*/
void
testURLScheme::testDefaultConstructor()
{
URLScheme lhs;
- URLScheme rhs(PROTO_NONE);
+ URLScheme rhs(AnyP::PROTO_NONE);
CPPUNIT_ASSERT_EQUAL(lhs, rhs);
}
void
testURLScheme::testConstructprotocol_t()
{
- URLScheme lhs_none(PROTO_NONE), rhs_none(PROTO_NONE);
+ URLScheme lhs_none(AnyP::PROTO_NONE), rhs_none(AnyP::PROTO_NONE);
CPPUNIT_ASSERT_EQUAL(lhs_none, rhs_none);
- URLScheme lhs_cacheobj(PROTO_CACHEOBJ), rhs_cacheobj(PROTO_CACHEOBJ);
+ URLScheme lhs_cacheobj(AnyP::PROTO_CACHEOBJ), rhs_cacheobj(AnyP::PROTO_CACHEOBJ);
CPPUNIT_ASSERT_EQUAL(lhs_cacheobj, rhs_cacheobj);
CPPUNIT_ASSERT(lhs_none != rhs_cacheobj);
}
testURLScheme::testConst_str()
{
String lhs("wais");
- URLScheme wais(PROTO_WAIS);
+ URLScheme wais(AnyP::PROTO_WAIS);
String rhs(wais.const_str());
CPPUNIT_ASSERT_EQUAL(lhs, rhs);
}
void
testURLScheme::testEqualprotocol_t()
{
- CPPUNIT_ASSERT(URLScheme() == PROTO_NONE);
- CPPUNIT_ASSERT(not (URLScheme(PROTO_WAIS) == PROTO_HTTP));
- CPPUNIT_ASSERT(PROTO_HTTP == URLScheme(PROTO_HTTP));
- CPPUNIT_ASSERT(not (PROTO_CACHEOBJ == URLScheme(PROTO_HTTP)));
+ CPPUNIT_ASSERT(URLScheme() == AnyP::PROTO_NONE);
+ CPPUNIT_ASSERT(not (URLScheme(AnyP::PROTO_WAIS) == AnyP::PROTO_HTTP));
+ CPPUNIT_ASSERT(AnyP::PROTO_HTTP == URLScheme(AnyP::PROTO_HTTP));
+ CPPUNIT_ASSERT(not (AnyP::PROTO_CACHEOBJ == URLScheme(AnyP::PROTO_HTTP)));
}
/*
void
testURLScheme::testNotEqualprotocol_t()
{
- CPPUNIT_ASSERT(URLScheme(PROTO_NONE) != PROTO_HTTP);
- CPPUNIT_ASSERT(not (URLScheme(PROTO_HTTP) != PROTO_HTTP));
- CPPUNIT_ASSERT(PROTO_NONE != URLScheme(PROTO_HTTP));
- CPPUNIT_ASSERT(not (PROTO_WAIS != URLScheme(PROTO_WAIS)));
+ CPPUNIT_ASSERT(URLScheme(AnyP::PROTO_NONE) != AnyP::PROTO_HTTP);
+ CPPUNIT_ASSERT(not (URLScheme(AnyP::PROTO_HTTP) != AnyP::PROTO_HTTP));
+ CPPUNIT_ASSERT(AnyP::PROTO_NONE != URLScheme(AnyP::PROTO_HTTP));
+ CPPUNIT_ASSERT(not (AnyP::PROTO_WAIS != URLScheme(AnyP::PROTO_WAIS)));
}
/*
testURLScheme::testStream()
{
std::ostringstream buffer;
- buffer << URLScheme(PROTO_HTTP);
+ buffer << URLScheme(AnyP::PROTO_HTTP);
String http_str("http");
String from_buf(buffer.str().c_str());
CPPUNIT_ASSERT_EQUAL(http_str, from_buf);
typedef void FQDNH(const char *, const DnsLookupDetails &details, void *);
typedef void IDCB(const char *ident, void *data);
typedef void IPH(const ipcache_addrs *, const DnsLookupDetails &details, void *);
-typedef void IRCB(struct peer *, peer_t, protocol_t, void *, void *data);
+
+#include "anyp/ProtocolType.h"
+typedef void IRCB(struct peer *, peer_t, AnyP::ProtocolType, void *, void *data);
class FwdServer;
typedef void PSC(FwdServer *, void *);
#include "rfc1738.h"
static HttpRequest *urlParseFinish(const HttpRequestMethod& method,
- const protocol_t protocol,
+ const AnyP::ProtocolType protocol,
const char *const urlpath,
const char *const host,
const char *const login,
{
debugs(23, 5, "urlInitialize: Initializing...");
/* this ensures that the number of protocol strings is the same as
- * the enum slots allocated because the last enum is always 'TOTAL'.
+ * the enum slots allocated because the last enum is always 'MAX'.
*/
- assert(strcmp(ProtocolStr[PROTO_MAX], "TOTAL") == 0);
+ assert(strcmp(AnyP::ProtocolType_str[AnyP::PROTO_MAX], "MAX") == 0);
/*
* These test that our matchDomainName() function works the
* way we expect it to.
* backwards compatibility, e defaults to NULL, in which case we
* assume b is NULL-terminated.
*/
-protocol_t
+AnyP::ProtocolType
urlParseProtocol(const char *b, const char *e)
{
/*
/* test common stuff first */
if (strncasecmp(b, "http", len) == 0)
- return PROTO_HTTP;
+ return AnyP::PROTO_HTTP;
if (strncasecmp(b, "ftp", len) == 0)
- return PROTO_FTP;
+ return AnyP::PROTO_FTP;
if (strncasecmp(b, "https", len) == 0)
- return PROTO_HTTPS;
+ return AnyP::PROTO_HTTPS;
if (strncasecmp(b, "file", len) == 0)
- return PROTO_FTP;
+ return AnyP::PROTO_FTP;
if (strncasecmp(b, "gopher", len) == 0)
- return PROTO_GOPHER;
+ return AnyP::PROTO_GOPHER;
if (strncasecmp(b, "wais", len) == 0)
- return PROTO_WAIS;
+ return AnyP::PROTO_WAIS;
if (strncasecmp(b, "cache_object", len) == 0)
- return PROTO_CACHEOBJ;
+ return AnyP::PROTO_CACHEOBJ;
if (strncasecmp(b, "urn", len) == 0)
- return PROTO_URN;
+ return AnyP::PROTO_URN;
if (strncasecmp(b, "whois", len) == 0)
- return PROTO_WHOIS;
+ return AnyP::PROTO_WHOIS;
if (strncasecmp(b, "internal", len) == 0)
- return PROTO_INTERNAL;
+ return AnyP::PROTO_INTERNAL;
- return PROTO_NONE;
+ return AnyP::PROTO_NONE;
}
int
-urlDefaultPort(protocol_t p)
+urlDefaultPort(AnyP::ProtocolType p)
{
switch (p) {
- case PROTO_HTTP:
+ case AnyP::PROTO_HTTP:
return 80;
- case PROTO_HTTPS:
+ case AnyP::PROTO_HTTPS:
return 443;
- case PROTO_FTP:
+ case AnyP::PROTO_FTP:
return 21;
- case PROTO_GOPHER:
+ case AnyP::PROTO_GOPHER:
return 70;
- case PROTO_WAIS:
+ case AnyP::PROTO_WAIS:
return 210;
- case PROTO_CACHEOBJ:
+ case AnyP::PROTO_CACHEOBJ:
- case PROTO_INTERNAL:
+ case AnyP::PROTO_INTERNAL:
return CACHE_HTTP_PORT;
- case PROTO_WHOIS:
+ case AnyP::PROTO_WHOIS:
return 43;
default:
char *t = NULL;
char *q = NULL;
int port;
- protocol_t protocol = PROTO_NONE;
+ AnyP::ProtocolType protocol = AnyP::PROTO_NONE;
int l;
int i;
const char *src;
} else if ((method == METHOD_OPTIONS || method == METHOD_TRACE) &&
strcmp(url, "*") == 0) {
- protocol = PROTO_HTTP;
+ protocol = AnyP::PROTO_HTTP;
port = urlDefaultPort(protocol);
return urlParseFinish(method, protocol, url, host, login, port, request);
} else if (!strncmp(url, "urn:", 4)) {
*/
static HttpRequest *
urlParseFinish(const HttpRequestMethod& method,
- const protocol_t protocol,
+ const AnyP::ProtocolType protocol,
const char *const urlpath,
const char *const host,
const char *const login,
urnParse(const HttpRequestMethod& method, char *urn)
{
debugs(50, 5, "urnParse: " << urn);
- return new HttpRequest(method, PROTO_URN, urn + 4);
+ return new HttpRequest(method, AnyP::PROTO_URN, urn + 4);
}
const char *
if (request->canonical)
return request->canonical;
- if (request->protocol == PROTO_URN) {
+ if (request->protocol == AnyP::PROTO_URN) {
snprintf(urlbuf, MAX_URL, "urn:" SQUIDSTRINGPH,
SQUIDSTRINGPRINT(request->urlpath));
} else {
if (request->port != urlDefaultPort(request->protocol))
snprintf(portbuf, 32, ":%d", request->port);
+ const URLScheme sch = request->protocol; // temporary, until bug 1961 URL handling is fixed.
snprintf(urlbuf, MAX_URL, "%s://%s%s%s%s" SQUIDSTRINGPH,
- ProtocolStr[request->protocol],
+ sch.const_str(),
request->login,
*request->login ? "@" : null_string,
request->GetHost(),
LOCAL_ARRAY(char, loginbuf, MAX_LOGIN_SZ + 1);
char *t;
- if (request->protocol == PROTO_URN) {
+ if (request->protocol == AnyP::PROTO_URN) {
snprintf(buf, MAX_URL, "urn:" SQUIDSTRINGPH,
SQUIDSTRINGPRINT(request->urlpath));
} else {
strcat(loginbuf, "@");
}
+ const URLScheme sch = request->protocol; // temporary, until bug 1961 URL handling is fixed.
snprintf(buf, MAX_URL, "%s://%s%s%s" SQUIDSTRINGPH,
- ProtocolStr[request->protocol],
+ sch.const_str(),
loginbuf,
request->GetHost(),
portbuf,
char *urlbuf = (char *)xmalloc(MAX_URL * sizeof(char));
- if (req->protocol == PROTO_URN) {
+ if (req->protocol == AnyP::PROTO_URN) {
snprintf(urlbuf, MAX_URL, "urn:" SQUIDSTRINGPH,
SQUIDSTRINGPRINT(req->urlpath));
return (urlbuf);
size_t urllen;
+ const URLScheme sch = req->protocol; // temporary, until bug 1961 URL handling is fixed.
if (req->port != urlDefaultPort(req->protocol)) {
urllen = snprintf(urlbuf, MAX_URL, "%s://%s%s%s:%d",
- ProtocolStr[req->protocol],
+ sch.const_str(),
req->login,
*req->login ? "@" : null_string,
req->GetHost(),
);
} else {
urllen = snprintf(urlbuf, MAX_URL, "%s://%s%s%s",
- ProtocolStr[req->protocol],
+ sch.const_str(),
req->login,
*req->login ? "@" : null_string,
req->GetHost()
/* does method match the protocol? */
switch (r->protocol) {
- case PROTO_URN:
+ case AnyP::PROTO_URN:
- case PROTO_HTTP:
+ case AnyP::PROTO_HTTP:
- case PROTO_CACHEOBJ:
+ case AnyP::PROTO_CACHEOBJ:
rc = 1;
break;
- case PROTO_FTP:
+ case AnyP::PROTO_FTP:
if (r->method == METHOD_PUT)
rc = 1;
- case PROTO_GOPHER:
+ case AnyP::PROTO_GOPHER:
- case PROTO_WAIS:
+ case AnyP::PROTO_WAIS:
- case PROTO_WHOIS:
+ case AnyP::PROTO_WHOIS:
if (r->method == METHOD_GET)
rc = 1;
else if (r->method == METHOD_HEAD)
break;
- case PROTO_HTTPS:
+ case AnyP::PROTO_HTTPS:
#if USE_SSL
rc = 1;