Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: src/shared/Utils.h

Issue 4974480757620736: Issue #1356 - Improve detection of the issuer of the request (Closed)
Patch Set: Update to the repositorory tip Created Oct. 24, 2014, 9:38 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/plugin/PluginWbPassThrough.cpp ('K') | « src/plugin/PluginWbPassThrough.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/shared/Utils.h
===================================================================
--- a/src/shared/Utils.h
+++ b/src/shared/Utils.h
@@ -50,4 +50,21 @@
return trimmed;
}
+template <class T>
+T ExtractHTTPHeader(const T& allHeaders, const T& targetHeaderName, const T& delimiter)
+{
+ auto targetHeaderBeginsAt = allHeaders.find(targetHeaderName);
+ if (targetHeaderBeginsAt == T::npos)
+ {
+ return T();
+ }
+ targetHeaderBeginsAt += targetHeaderName.length();
+ auto targetHeaderEndsAt = allHeaders.find(delimiter, targetHeaderBeginsAt);
+ if (targetHeaderEndsAt == T::npos)
+ {
+ return T();
+ }
+ return allHeaders.substr(targetHeaderBeginsAt, targetHeaderEndsAt - targetHeaderBeginsAt);
+}
+
#endif // UTILS_H
« src/plugin/PluginWbPassThrough.cpp ('K') | « src/plugin/PluginWbPassThrough.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld