#endif
// Why is this a sub-class and not a set of real "private:" fields?
- // It looks like its duplicating HTTPRequestMethod anyway!
- // TODO: shuffle this to the relevant protocol section OR replace with request->method
+ // TODO: shuffle this to the relevant ICP/HTCP protocol section
class Private
{
void
FwdState::dispatch()
{
- debugs(17, 3, HERE << clientConn << ": Fetching '" << RequestMethodStr(request->method) << " " << entry->url() << "'");
+ debugs(17, 3, clientConn << ": Fetching " << request->method << ' ' << entry->url());
/*
* Assert that server_fd is set. This is to guarantee that fwdState
* is attached to something and will be deallocated when server_fd
{
assert(p);
/* pack request-line */
- packerPrintf(p, "%s " SQUIDSTRINGPH " HTTP/%d.%d\r\n",
- RequestMethodStr(method), SQUIDSTRINGPRINT(urlpath),
+ packerPrintf(p, SQUIDSBUFPH " " SQUIDSTRINGPH " HTTP/%d.%d\r\n",
+ SQUIDSBUFPRINT(method.image()), SQUIDSTRINGPRINT(urlpath),
http_ver.major, http_ver.minor);
/* headers */
header.packInto(p);
int
HttpRequest::prefixLen()
{
- return strlen(RequestMethodStr(method)) + 1 +
+ return method.image().length() + 1 +
urlpath.size() + 1 +
4 + 1 + 3 + 2 +
header.len + 2;
void HttpRequest::packFirstLineInto(Packer * p, bool full_uri) const
{
// form HTTP request-line
- packerPrintf(p, "%s %s HTTP/%d.%d\r\n",
- RequestMethodStr(method),
+ packerPrintf(p, SQUIDSBUFPH " %s HTTP/%d.%d\r\n",
+ SQUIDSBUFPRINT(method.image()),
packableURI(full_uri),
http_ver.major, http_ver.minor);
}
* or from a range of chars, * such as "GET" from "GETFOOBARBAZ"
* (pass in pointer to G and pointer to F.)
*/
-HttpRequestMethod::HttpRequestMethod(char const *begin, char const *end) : theMethod (Http::METHOD_NONE)
+HttpRequestMethod::HttpRequestMethod(char const *begin, char const *end) : theMethod(Http::METHOD_NONE)
{
if (begin == NULL)
return;
- /*
- * This check for '%' makes sure that we don't
- * match one of the extension method placeholders,
- * which have the form %EXT[0-9][0-9]
- */
-
- if (*begin == '%')
- return;
-
/*
* if e is NULL, b must be NULL terminated and we
* make e point to the first whitespace character
if (NULL == end)
end = begin + strcspn(begin, w_space);
- if (end == begin) {
- theMethod = Http::METHOD_NONE;
+ if (end == begin)
return;
- }
+ // TODO: Optimize this linear search.
for (++theMethod; theMethod < Http::METHOD_ENUM_END; ++theMethod) {
// RFC 2616 section 5.1.1 - Method names are case-sensitive
// NP: this is not a HTTP_VIOLATIONS case since there is no MUST/SHOULD involved.
- if (0 == strncasecmp(begin, Http::MethodType_str[theMethod], end-begin)) {
+ if (0 == image().caseCmp(begin, end-begin)) {
// relaxed parser allows mixed-case and corrects them on output
if (Config.onoff.relaxed_header_parser)
return;
- if (0 == strncmp(begin, Http::MethodType_str[theMethod], end-begin))
+ if (0 == image().cmp(begin, end-begin))
return;
}
}
// if method not found and method string is not null then it is other method
theMethod = Http::METHOD_OTHER;
- theImage.limitInit(begin,end-begin);
+ theImage.assign(begin, end-begin);
}
-char const*
+const SBuf &
HttpRequestMethod::image() const
{
+ static const SBuf methodOther("METHOD_OTHER");
if (Http::METHOD_OTHER != theMethod) {
- return Http::MethodType_str[theMethod];
+ return Http::MethodType_sb[theMethod];
} else {
- if (theImage.size()>0) {
- return theImage.termedBuf();
+ if (!theImage.isEmpty()) {
+ return theImage;
} else {
- return "METHOD_OTHER";
+ return methodOther;
}
}
}
#define SQUID_HTTPREQUESTMETHOD_H
#include "http/MethodType.h"
-#include "SquidString.h"
-#include "SquidString.h"
+#include "SBuf.h"
class SquidConfig;
HttpRequestMethod & operator = (Http::MethodType const aMethod) {
theMethod = aMethod;
- theImage.clean();
+ theImage.clear();
return *this;
}
*/
Http::MethodType id() const { return theMethod; }
- /** Get a char string representation of the method. */
- char const * image() const;
+ /** Get a string representation of the method. */
+ const SBuf &image() const;
/// Whether this method is defined as a "safe" in HTTP/1.1
/// see RFC 2616 section 9.1.1
bool purgesOthers() const;
private:
- static const char *RequestMethodStr[];
-
Http::MethodType theMethod; ///< Method type
- String theImage; ///< Used for storing the Http::METHOD_OTHER only. A copy of the parsed method text.
+ SBuf theImage; ///< Used for storing the Http::METHOD_OTHER only. A copy of the parsed method text.
};
inline std::ostream &
return os;
}
-inline const char*
-RequestMethodStr(const Http::MethodType m)
-{
- return HttpRequestMethod(m).image();
-}
-
-inline const char*
-RequestMethodStr(const HttpRequestMethod& m)
-{
- return m.image();
-}
-
#endif /* SQUID_HTTPREQUESTMETHOD_H */
fatal.h \
tests/stub_fatal.cc \
tests/stub_MemBuf.cc \
+ $(SBUF_SOURCE) \
+ SBufDetailedStats.h \
+ tests/stub_SBufDetailedStats.cc \
StatHist.cc \
StatHist.h \
String.cc \
repl_modules.h \
tests/stub_store.cc \
tests/stub_store_stats.cc \
+ time.cc \
tools.h \
tests/stub_tools.cc \
tests/testMain.cc \
void
MemObject::stat(MemBuf * mb) const
{
- mb->Printf("\t%s %s\n",
- RequestMethodStr(method), logUri());
+ mb->Printf("\t" SQUIDSBUFPH " %s\n", SQUIDSBUFPRINT(method.image()), logUri());
if (vary_headers)
mb->Printf("\tvary_headers: %s\n", vary_headers);
mb->Printf("\tinmem_lo: %" PRId64 "\n", inmem_lo);
// XXX: should we use originalRequest() here?
const char *reqUrl = urlCanonical(request);
- debugs(88, 5, "maybe purging due to " << RequestMethodStr(request->method) << ' ' << reqUrl);
+ debugs(88, 5, "maybe purging due to " << request->method << ' ' << reqUrl);
purgeEntriesByUrl(request, reqUrl);
purgeEntriesByHeader(request, reqUrl, theFinalReply, HDR_LOCATION);
purgeEntriesByHeader(request, reqUrl, theFinalReply, HDR_CONTENT_LOCATION);
CbDataList<HttpRequestMethod> *data = values;
while (data != NULL) {
- sl.push_back(SBuf(RequestMethodStr(data->element)));
+ sl.push_back(data->element.image());
data = data->next;
}
authenticateDigestNonceNonceb64(digest_request->nonce),
digest_request->cnonce,
digest_user->HA1, SESSIONKEY);
+ SBuf sTmp = request->method.image();
DigestCalcResponse(SESSIONKEY, authenticateDigestNonceNonceb64(digest_request->nonce),
digest_request->nc, digest_request->cnonce, digest_request->qop,
- RequestMethodStr(request->method), digest_request->uri, HA2, Response);
+ sTmp.c_str(), digest_request->uri, HA2, Response);
debugs(29, 9, "\nResponse = '" << digest_request->response << "'\nsquid is = '" << Response << "'");
* widespread and such broken browsers no longer are commonly
* used.
*/
+ sTmp = HttpRequestMethod(Http::METHOD_GET).image();
DigestCalcResponse(SESSIONKEY, authenticateDigestNonceNonceb64(digest_request->nonce),
digest_request->nc, digest_request->cnonce, digest_request->qop,
- RequestMethodStr(Http::METHOD_GET), digest_request->uri, HA2, Response);
+ sTmp.c_str(), digest_request->uri, HA2, Response);
if (strcasecmp(digest_request->response, Response)) {
auth_user->credentials(Auth::Failed);
unsigned char key_arr[SQUID_MD5_DIGEST_LENGTH];
} CacheEntry;
-/* copied from url.c */
-const char *RequestMethodStr[] = {
- "NONE",
- "GET",
- "POST",
- "PUT",
- "HEAD",
- "CONNECT",
- "TRACE",
- "PURGE"
-};
-
static int cacheIndexScan(CacheIndex * idx, const char *fname, FILE * file);
static CacheEntry *
{
HttpRequest *request = http->request;
- debugs(33, 3, "clientSetKeepaliveFlag: http_ver = " <<
- request->http_ver.major << "." << request->http_ver.minor);
- debugs(33, 3, "clientSetKeepaliveFlag: method = " <<
- RequestMethodStr(request->method));
+ debugs(33, 3, "http_ver = " << request->http_ver);
+ debugs(33, 3, "method = " << request->method);
// TODO: move to HttpRequest::hdrCacheInit, just like HttpReply.
request->flags.proxyKeepalive = request->persistent();
char *url = http->uri;
HttpRequest *r = http->request;
ErrorState *err = NULL;
- debugs(88, 4, "clientProcessMiss: '" << RequestMethodStr(r->method) << " " << url << "'");
+ debugs(88, 4, r->method << ' ' << url);
/**
* We might have a left-over StoreEntry from a failed cache hit
void
clientReplyContext::processOnlyIfCachedMiss()
{
- debugs(88, 4, "clientProcessOnlyIfCachedMiss: '" <<
- RequestMethodStr(http->request->method) << " " << http->uri << "'");
+ debugs(88, 4, http->request->method << ' ' << http->uri);
http->al->http.code = Http::scGatewayTimeout;
ErrorState *err = clientBuildError(ERR_ONLY_IF_CACHED_MISS, Http::scGatewayTimeout, NULL,
http->getConn()->clientConnection->remote, http->request);
for (HttpRequestMethod m(Http::METHOD_NONE); m != Http::METHOD_ENUM_END; ++m) {
if (m.respMaybeCacheable()) {
if (StoreEntry *entry = storeGetPublic(url, m)) {
- debugs(88, 5, "purging " << *entry << ' ' << RequestMethodStr(m) << ' ' << url);
+ debugs(88, 5, "purging " << *entry << ' ' << m << ' ' << url);
#if USE_HTCP
neighborsHtcpClear(entry, url, req, m, HTCP_CLR_INVALIDATION);
if (m == Http::METHOD_GET || m == Http::METHOD_HEAD) {
void
clientReplyContext::processReplyAccessResult(const allow_t &accessAllowed)
{
- debugs(88, 2, "The reply for " << RequestMethodStr(http->request->method)
- << " " << http->uri << " is " << accessAllowed << ", because it matched '"
- << (AclMatchedName ? AclMatchedName : "NO ACL's") << "'" );
+ debugs(88, 2, "The reply for " << http->request->method
+ << ' ' << http->uri << " is " << accessAllowed << ", because it matched "
+ << (AclMatchedName ? AclMatchedName : "NO ACL's"));
if (accessAllowed != ACCESS_ALLOWED) {
ErrorState *err;
acl_checklist = NULL;
err_type page_id;
Http::StatusCode status;
- debugs(85, 2, "The request " <<
- RequestMethodStr(http->request->method) << " " <<
+ debugs(85, 2, "The request " << http->request->method << ' ' <<
http->uri << " is " << answer <<
"; last ACL checked: " << (AclMatchedName ? AclMatchedName : "[none]"));
void
ClientHttpRequest::processRequest()
{
- debugs(85, 4, "clientProcessRequest: " << RequestMethodStr(request->method) << " '" << uri << "'");
+ debugs(85, 4, request->method << ' ' << uri);
if (request->method == Http::METHOD_CONNECT && !redirect.status) {
#if USE_OPENSSL
else
urlpath_or_slash = "/";
- str.Printf("%s " SQUIDSTRINGPH " %s/%d.%d\n",
- RequestMethodStr(request->method),
+ str.Printf(SQUIDSBUFPH " " SQUIDSTRINGPH " %s/%d.%d\n",
+ SQUIDSBUFPRINT(request->method.image()),
SQUIDSTRINGPRINT(urlpath_or_slash),
AnyP::ProtocolType_str[request->http_ver.protocol],
request->http_ver.major, request->http_ver.minor);
break;
case 'M':
- if (request)
- p = RequestMethodStr(request->method);
- else if (!building_deny_info_url)
- p= "[unknown method]";
+ if (request) {
+ const SBuf &m = request->method.image();
+ mb.append(m.rawContent(), m.length());
+ } else if (!building_deny_info_url)
+ p = "[unknown method]";
break;
case 'o':
else
urlpath_or_slash = "/";
- mb.Printf("%s " SQUIDSTRINGPH " %s/%d.%d\n",
- RequestMethodStr(request->method),
+ mb.Printf(SQUIDSBUFPH " " SQUIDSTRINGPH " %s/%d.%d\n",
+ SQUIDSBUFPRINT(request->method.image()),
SQUIDSTRINGPRINT(urlpath_or_slash),
AnyP::ProtocolType_str[request->http_ver.protocol],
request->http_ver.major, request->http_ver.minor);
break;
case _external_acl_format::EXT_ACL_METHOD:
- str = RequestMethodStr(request->method);
+ {
+ const SBuf &s = request->method.image();
+ sb.append(s.rawContent(), s.length());
+ }
+ str = sb.termedBuf();
break;
case _external_acl_format::EXT_ACL_HEADER_REQUEST:
case LFT_CLIENT_REQ_METHOD:
if (al->request) {
- out = al->request->method.image();
+ const SBuf &s = al->request->method.image();
+ sb.append(s.rawContent(), s.length());
+ out = sb.termedBuf();
quote = 1;
}
break;
break;
case LFT_REQUEST_METHOD:
- out = al->_private.method_str;
+ if (al->_private.method_str) // ICP, HTCP method code
+ out = al->_private.method_str;
+ else {
+ const SBuf &s = al->http.method.image();
+ sb.append(s.rawContent(), s.length());
+ out = sb.termedBuf();
+ quote = 1;
+ }
break;
case LFT_REQUEST_URI:
case LFT_SERVER_REQ_METHOD:
if (al->adapted_request) {
- out = al->adapted_request->method.image();
+ const SBuf &s = al->adapted_request->method.image();
+ sb.append(s.rawContent(), s.length());
+ out = sb.termedBuf();
quote = 1;
}
break;
void setFrom(Ip::Address &from);
void setDataHeader(htcpDataHeader *);
- char *method;
+ const char *method;
char *uri;
char *version;
char *req_hdrs;
stuff.f1 = 1;
stuff.response = 0;
stuff.msg_id = ++msg_id_counter;
- stuff.S.method = (char *) RequestMethodStr(req->method);
+ SBuf sb = req->method.image();
+ stuff.S.method = sb.c_str();
stuff.S.uri = (char *) e->url();
stuff.S.version = vbuf;
HttpStateData::httpBuildRequestHeader(req, e, NULL, &hdr, flags);
stuff.reason = 0;
break;
}
- stuff.S.method = (char *) RequestMethodStr(req->method);
+ SBuf sb = req->method.image();
+ stuff.S.method = sb.c_str();
if (e == NULL || e->mem_obj == NULL) {
if (uri == NULL) {
return;
* connection.
*/
if (!flags.request_sent) {
- debugs(11, 2, "statusIfComplete: Request not yet fully sent \"" << RequestMethodStr(request->method) << " " << entry->url() << "\"" );
+ debugs(11, 2, "Request not yet fully sent " << request->method << ' ' << entry->url());
return COMPLETE_NONPERSISTENT_MSG;
}
url = urlCanonical(request);
else
url = request->urlpath.termedBuf();
- mb->Printf("%s %s %s/%d.%d\r\n",
- RequestMethodStr(request->method),
+ mb->Printf(SQUIDSBUFPH " %s %s/%d.%d\r\n",
+ SQUIDSBUFPRINT(request->method.image()),
url && *url ? url : "/",
AnyP::ProtocolType_str[httpver.protocol],
httpver.major,httpver.minor);
void
httpStart(FwdState *fwd)
{
- debugs(11, 3, "httpStart: \"" << RequestMethodStr(fwd->request->method) << " " << fwd->entry->url() << "\"" );
+ debugs(11, 3, fwd->request->method << ' ' << fwd->entry->url());
AsyncJob::Start(new HttpStateData(fwd));
}
StatusLine.h
MethodType.cc: MethodType.h $(top_srcdir)/src/mk-string-arrays.awk
- ($(AWK) -f $(top_srcdir)/src/mk-string-arrays.awk < $(srcdir)/MethodType.h | \
+ ($(AWK) -f $(top_srcdir)/src/mk-string-arrays.awk sbuf=1 < $(srcdir)/MethodType.h | \
sed -e 's%METHOD_%%' -e 's%_C%-C%' >$@) || ($(RM) -f $@ && exit 1)
CLEANFILES += MethodType.cc
#ifndef SQUID_SRC_HTTP_METHODTYPE_H
#define SQUID_SRC_HTTP_METHODTYPE_H
+#include "SBuf.h"
+
namespace Http
{
typedef enum _method_t {
METHOD_NONE = 0,
-#if NO_SPECIAL_HANDLING
- // RFC 2068
- METHOD_LINK,
- METHOD_UNLINK,
-#endif
-
// RFC 2616 (HTTP)
METHOD_GET,
METHOD_POST,
METHOD_OPTIONS,
METHOD_DELETE,
+#if NO_SPECIAL_HANDLING
+ // RFC 2068
+ METHOD_LINK,
+ METHOD_UNLINK,
+#endif
+
// RFC 3253
METHOD_CHECKOUT,
METHOD_CHECKIN,
METHOD_ENUM_END // MUST be last, (yuck) this is used as an array-initialization index constant!
} MethodType;
-extern const char *MethodType_str[];
+extern const SBuf MethodType_sb[];
-inline const char*
+inline const SBuf &
MethodStr(const MethodType m)
{
- return MethodType_str[m];
+ return MethodType_sb[m];
}
}; // namespace Http
char clientip[MAX_IPSTRLEN];
al->getLogClientIp(clientip, MAX_IPSTRLEN);
- logfilePrintf(logfile, "%s %s %s [%s] \"%s %s %s/%d.%d\" %d %" PRId64 " \"%s\" \"%s\" %s%s:%s%s",
+ static SBuf method;
+ if (al->_private.method_str)
+ method.assign(al->_private.method_str);
+ else
+ method = al->http.method.image();
+
+ logfilePrintf(logfile, "%s %s %s [%s] \"" SQUIDSBUFPH " %s %s/%d.%d\" %d %" PRId64 " \"%s\" \"%s\" %s%s:%s%s",
clientip,
user_ident ? user_ident : dash_str,
user_auth ? user_auth : dash_str,
Time::FormatHttpd(squid_curtime),
- al->_private.method_str,
+ SQUIDSBUFPRINT(method),
al->url,
AnyP::ProtocolType_str[al->http.version.protocol],
al->http.version.major, al->http.version.minor,
char clientip[MAX_IPSTRLEN];
al->getLogClientIp(clientip, MAX_IPSTRLEN);
- logfilePrintf(logfile, "%s %s %s [%s] \"%s %s %s/%d.%d\" %d %" PRId64 " %s%s:%s%s",
+ static SBuf method;
+ if (al->_private.method_str)
+ method.assign(al->_private.method_str);
+ else
+ method = al->http.method.image();
+
+ logfilePrintf(logfile, "%s %s %s [%s] \"" SQUIDSBUFPH " %s %s/%d.%d\" %d %" PRId64 " %s%s:%s%s",
clientip,
user_ident ? user_ident : dash_str,
user_auth ? user_auth : dash_str,
Time::FormatHttpd(squid_curtime),
- al->_private.method_str,
+ SQUIDSBUFPRINT(method),
al->url,
AnyP::ProtocolType_str[al->http.version.protocol],
al->http.version.major, al->http.version.minor,
char clientip[MAX_IPSTRLEN];
al->getLogClientIp(clientip, MAX_IPSTRLEN);
- logfilePrintf(logfile, "%9ld.%03d %6d %s %s%s/%03d %" PRId64 " %s %s %s %s%s/%s %s%s",
+ static SBuf method;
+ if (al->_private.method_str)
+ method.assign(al->_private.method_str);
+ else
+ method = al->http.method.image();
+
+ logfilePrintf(logfile, "%9ld.%03d %6d %s %s%s/%03d %" PRId64 " " SQUIDSBUFPH " %s %s %s%s/%s %s%s",
(long int) current_time.tv_sec,
(int) current_time.tv_usec / 1000,
al->cache.msec,
al->http.statusSfx(),
al->http.code,
al->http.clientReplySz.messageTotal(),
- al->_private.method_str,
+ SQUIDSBUFPRINT(method),
al->url,
user ? user : dash_str,
al->hier.ping.timedout ? "TIMEOUT_" : "",
else if (al->htcp.opcode)
al->_private.method_str = al->htcp.opcode;
else
- al->_private.method_str = RequestMethodStr(al->http.method);
+ al->_private.method_str = NULL;
if (al->hier.host[0] == '\0')
xstrncpy(al->hier.host, dash_str, SQUIDHOSTNAMELEN);
Mgr::ActionParams::pack(Ipc::TypedMsgHdr &msg) const
{
msg.putString(httpUri);
- String foo(httpMethod.image());
+ String foo(httpMethod.image().toString());
msg.putString(foo);
msg.putPod(httpFlags);
msg.putString(httpOrigin);
}
# when namespace is encountered store it
-/^namespace [a-zA-Z]+/ {
+/^namespace *[a-zA-Z]+/ {
nspath = tolower($2) "/" # nested folder
namespace = $2 # code namespace reconstruct
next
/^[ \t]*[A-Z]/ {
split($1, t, ",") # remove ,
- Element[++e] = t[1]
+ if (sbuf) Element[++e] = "SBuf(\"" t[1] "\")"
+ else Element[++e] = "\"" t[1] "\""
next
}
type = t[1]
codeSkip = 1
+ if (sbuf) print "#include \"SBuf.h\""
print "#include \"" nspath type ".h\""
# if namesapce is not empty ??
if (namespace) print "namespace " namespace
if (namespace) print "{"
- print "\nconst char *" type "_str[] = {"
+ if (sbuf) print "\nconst SBuf " type "_sb[] = {"
+ else print "\nconst char * " type "_str[] = {"
for ( i = 1; i < e; ++i)
if (Wrapper[i]) print Wrapper[i]
- else print "\t\"" Element[i] "\","
+ else print "\t" Element[i] ","
- print "\t\"" Element[i] "\""
+ print "\t" Element[i]
print "};"
if (namespace) print "}; // namespace " namespace
next
ps_state *psstate;
if (entry)
- debugs(44, 3, "peerSelect: " << entry->url() );
+ debugs(44, 3, *entry << ' ' << entry->url());
else
- debugs(44, 3, "peerSelect: " << RequestMethodStr(request->method));
+ debugs(44, 3, request->method);
psstate = new ps_state;
StoreEntry *entry = ps->entry;
HttpRequest *request = ps->request;
- debugs(44, 3, "peerSelectFoo: '" << RequestMethodStr(request->method) << " " << request->GetHost() << "'");
+ debugs(44, 3, request->method << ' ' << request->GetHost());
/** If we don't know whether DIRECT is permitted ... */
if (ps->direct == DIRECT_UNKNOWN) {
CachePeer *p;
HttpRequest *request = ps->request;
hier_code code = HIER_NONE;
- debugs(44, 3, "peerGetSomeParent: " << RequestMethodStr(request->method) << " " << request->GetHost());
+ debugs(44, 3, request->method << ' ' << request->GetHost());
if (ps->direct == DIRECT_YES)
return;
String ctype=(reply->content_type.size() ? reply->content_type.termedBuf() : str_unknown);
logfileLineStart(storelog);
- logfilePrintf(storelog, "%9d.%03d %-7s %02d %08X %s %4d %9d %9d %9d " SQUIDSTRINGPH " %" PRId64 "/%" PRId64 " %s %s\n",
+ logfilePrintf(storelog, "%9d.%03d %-7s %02d %08X %s %4d %9d %9d %9d " SQUIDSTRINGPH " %" PRId64 "/%" PRId64 " " SQUIDSBUFPH " %s\n",
(int) current_time.tv_sec,
(int) current_time.tv_usec / 1000,
storeLogTags[tag],
SQUIDSTRINGPRINT(ctype),
reply->content_length,
e->contentLen(),
- RequestMethodStr(mem->method),
+ SQUIDSBUFPRINT(mem->method.image()),
mem->logUri());
logfileLineEnd(storelog);
} else {
/* globals */
static time_t cur_time = -1; /* timestamp of the current log entry */
-/* copied from url.c */
-const char *RequestMethodStr[] = {
- "NONE",
- "GET",
- "POST",
- "PUT",
- "HEAD",
- "CONNECT",
- "TRACE",
- "PURGE"
-};
-
/* copied from url.c */
static HttpRequestMethod
methodStrToId(const char *s)
{
// relaxed RFC-compliance parse HTTP methods are upgraded to correct case
Config.onoff.relaxed_header_parser = 1;
- CPPUNIT_ASSERT_EQUAL(String("POST"), String(HttpRequestMethod("POST",NULL).image()));
- CPPUNIT_ASSERT_EQUAL(String("POST"), String(HttpRequestMethod("pOsT",NULL).image()));
- CPPUNIT_ASSERT_EQUAL(String("POST"), String(HttpRequestMethod("post",NULL).image()));
+ CPPUNIT_ASSERT_EQUAL(SBuf("POST"), HttpRequestMethod("POST",NULL).image());
+ CPPUNIT_ASSERT_EQUAL(SBuf("POST"), HttpRequestMethod("pOsT",NULL).image());
+ CPPUNIT_ASSERT_EQUAL(SBuf("POST"), HttpRequestMethod("post",NULL).image());
// strict RFC-compliance parse HTTP methods are case sensitive
Config.onoff.relaxed_header_parser = 0;
- CPPUNIT_ASSERT_EQUAL(String("POST"), String(HttpRequestMethod("POST",NULL).image()));
- CPPUNIT_ASSERT_EQUAL(String("pOsT"), String(HttpRequestMethod("pOsT",NULL).image()));
- CPPUNIT_ASSERT_EQUAL(String("post"), String(HttpRequestMethod("post",NULL).image()));
+ CPPUNIT_ASSERT_EQUAL(SBuf("POST"), HttpRequestMethod("POST",NULL).image());
+ CPPUNIT_ASSERT_EQUAL(SBuf("pOsT"), HttpRequestMethod("pOsT",NULL).image());
+ CPPUNIT_ASSERT_EQUAL(SBuf("post"), HttpRequestMethod("post",NULL).image());
}
/*
}
}
- debugs(26, 3, HERE << "'" << RequestMethodStr(request->method) << " " << url << " " << request->http_ver << "'");
+ debugs(26, 3, request->method << ' ' << url << ' ' << request->http_ver);
++statCounter.server.all.requests;
++statCounter.server.other.requests;