2 * Copyright 2001-2009 Internet2
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 * @file shibsp/util/CGIParser.h
20 * CGI GET/POST parameter parsing
23 #ifndef __shibsp_cgi_h__
24 #define __shibsp_cgi_h__
26 #include <shibsp/base.h>
31 namespace xmltooling {
32 class XMLTOOL_API HTTPRequest;
37 #if defined (_MSC_VER)
38 #pragma warning( push )
39 #pragma warning( disable : 4251 )
43 * CGI GET/POST parameter parsing
45 class SHIBSP_API CGIParser
47 MAKE_NONCOPYABLE(CGIParser);
52 * @param request HTTP request interface
54 CGIParser(const xmltooling::HTTPRequest& request);
58 /** Alias for multimap iterator. */
59 typedef std::multimap<std::string,char*>::const_iterator walker;
62 * Returns a pair of bounded iterators around the values of a parameter.
64 * @param name name of parameter, or NULL to return all parameters
65 * @return a pair of multimap iterators surrounding the matching value(s)
67 std::pair<walker,walker> getParameters(const char* name) const;
70 char* fmakeword(char stop, size_t *cl, const char** ppch);
71 char* makeword(char *line, char stop);
72 void plustospace(char *str);
74 std::multimap<std::string,char*> kvp_map;
77 #if defined (_MSC_VER)
78 #pragma warning( pop )
83 #endif /* __shibsp_cgi_h__ */