summaryrefslogtreecommitdiffabout
path: root/include/kingate/util.h
authorMichael Krelin <hacker@klever.net>2005-05-09 11:00:28 (UTC)
committer Michael Krelin <hacker@klever.net>2005-05-09 11:00:28 (UTC)
commit43d47575878e4eaf3c8da84bf609fcd0bde595fb (patch) (side-by-side diff)
treef7ec4d1f0d0a01b43feb5c9b4f414e870036522c /include/kingate/util.h
parentd9578a5ae0ac4e44ff5e3c13d3f39f400f51bcf2 (diff)
downloadkingate-43d47575878e4eaf3c8da84bf609fcd0bde595fb.zip
kingate-43d47575878e4eaf3c8da84bf609fcd0bde595fb.tar.gz
kingate-43d47575878e4eaf3c8da84bf609fcd0bde595fb.tar.bz2
1. http headers container added
2. preliminary cookies support 3. absolutely useless http_quoted_string and http_quote utility functions added
Diffstat (limited to 'include/kingate/util.h') (more/less context) (ignore whitespace changes)
-rw-r--r--include/kingate/util.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/kingate/util.h b/include/kingate/util.h
index 6024ccf..3fd96f6 100644
--- a/include/kingate/util.h
+++ b/include/kingate/util.h
@@ -1,49 +1,62 @@
#ifndef __KINGATE_UTIL_H
#define __KINGATE_UTIL_H
#include <string>
#ifndef __deprecated
#if ( __GNUC__ == 3 && __GNUC_MINOR__ > 0 ) || __GNUC__ > 3
#define __deprecated __attribute__((deprecated))
#else
#define __deprecated
#endif
#endif
namespace kingate {
using namespace std;
/**
* Encode string for passing via URL.
* @param str string unencoded.
* @return the encoded string.
*/
string url_encode(const string& str);
/**
* Remove URL-encoding from the string.
* @param str the URL-encoded string.
* @return the decoded string.
*/
string url_decode(const string& str);
/**
+ * Quote string for use in HTTP header.
+ * @param str the string to quote.
+ * @return the quoted string.
+ */
+ string http_quoted_string(const string& str);
+ /**
+ * Quote string for use in HTTP header if necessary.
+ * @param str the string to quote.
+ * @return the quoted string or token left as is.
+ */
+ string http_quote(const string& str);
+
+ /**
* deprecated alias to url_encode.
* @see url_encode
*/
inline string __deprecated url_escape(const string& str) {
return url_encode(str);
}
/**
* deprecated alias to url_decode.
* @see url_decode
*/
inline string __deprecated url_unescape(const string& str) {
return url_decode(str);
}
}
#endif /* __KINGATE_UTIL_H */
/*
* vim:set ft=cpp:
*/