#include "squid.h"
#include "acl/FilledChecklist.h"
#include "acl/Gadgets.h"
-#include "client_side_request.h"
#include "client_side.h"
+#include "client_side_request.h"
#include "comm/Connection.h"
#include "compat/strtoll.h"
+#include "ConfigParser.h"
#include "fde.h"
+#include "globals.h"
#include "HttpHdrContRange.h"
#include "HttpHeader.h"
#include "HttpHeaderFieldInfo.h"
#include "Store.h"
#include "StrList.h"
-#if USE_SSL
+#if USE_OPENSSL
#include "ssl/support.h"
#endif
return 0;
}
/* Make sure it's defined even if empty "" */
- if (!val->defined())
+ if (!val->termedBuf())
val->limitInit("", 0);
return 1;
}
+// TODO: Optimize using SBuf
+String
+httpHeaderQuoteString(const char *raw)
+{
+ assert(raw);
+
+ // HTTPbis says Senders SHOULD NOT escape octets in quoted-strings that
+ // do not require escaping (i.e., except DQUOTE and the backslash octet).
+ bool needInnerQuote = false;
+ for (const char *s = raw; !needInnerQuote && *s; ++s)
+ needInnerQuote = *s == '"' || *s == '\\';
+
+ static String quotedStr;
+ quotedStr.clean();
+ quotedStr.append('"');
+
+ if (needInnerQuote) {
+ for (const char *s = raw; *s; ++s) {
+ if (*s == '"' || *s == '\\')
+ quotedStr.append('\\');
+ quotedStr.append(*s);
+ }
+ } else {
+ quotedStr.append(raw);
+ }
+
+ quotedStr.append('"');
+ return quotedStr;
+}
+
/**
* Checks the anonymizer (header_access) configuration.
*