@@ -28,7 +28,7 @@ namespace httpserver
2828// REQUEST
2929void http_request::set_method (const std::string& method)
3030{
31- this -> method = string_utilities::to_upper_copy (method);
31+ string_utilities::to_upper_copy (method, this -> method );
3232}
3333
3434bool http_request::check_digest_auth (const std::string& realm, const std::string& password, int nonce_timeout, bool & reload_nonce) const
@@ -60,6 +60,26 @@ const std::vector<std::pair<std::string, std::string> > http_request::get_header
6060#endif
6161 return to_ret;
6262}
63+ size_t http_request::get_headers (std::vector<std::pair<std::string, std::string> >& result) const
64+ {
65+ std::map<std::string, std::string, header_comparator>::const_iterator it;
66+ for (it = headers.begin (); it != headers.end (); it++)
67+ #ifdef USE_CPP_ZEROX
68+ result.push_back (std::make_pair ((*it).first ,(*it).second ));
69+ #else
70+ result.push_back (std::make_pair<std::string, std::string>((*it).first ,(*it).second ));
71+ #endif
72+ return result.size ();
73+ }
74+
75+ #ifndef SWIG
76+ size_t http_request::get_headers (std::map<std::string, std::string, header_comparator>& result) const
77+ {
78+ result = this ->headers ;
79+ return result.size ();
80+ }
81+ #endif
82+
6383const std::vector<std::pair<std::string, std::string> > http_request::get_footers () const
6484{
6585 std::vector<std::pair<std::string, std::string> > to_ret;
@@ -72,6 +92,26 @@ const std::vector<std::pair<std::string, std::string> > http_request::get_footer
7292#endif
7393 return to_ret;
7494}
95+ size_t http_request::get_footers (std::vector<std::pair<std::string, std::string> >& result) const
96+ {
97+ std::map<std::string, std::string, header_comparator>::const_iterator it;
98+ for (it = footers.begin (); it != footers.end (); it++)
99+ #ifdef USE_CPP_ZEROX
100+ result.push_back (std::make_pair ((*it).first ,(*it).second ));
101+ #else
102+ result.push_back (std::make_pair<std::string, std::string>((*it).first ,(*it).second ));
103+ #endif
104+ return result.size ();
105+ }
106+
107+ #ifndef SWIG
108+ size_t http_request::get_footers (std::map<std::string, std::string, header_comparator>& result) const
109+ {
110+ result = this ->footers ;
111+ return result.size ();
112+ }
113+ #endif
114+
75115const std::vector<std::pair<std::string, std::string> > http_request::get_cookies () const
76116{
77117 std::vector<std::pair<std::string, std::string> > to_ret;
@@ -84,6 +124,27 @@ const std::vector<std::pair<std::string, std::string> > http_request::get_cookie
84124#endif
85125 return to_ret;
86126}
127+
128+ size_t http_request::get_cookies (std::vector<std::pair<std::string, std::string> >& result) const
129+ {
130+ std::map<std::string, std::string, header_comparator>::const_iterator it;
131+ for (it = cookies.begin (); it != cookies.end (); it++)
132+ #ifdef USE_CPP_ZEROX
133+ result.push_back (std::make_pair ((*it).first ,(*it).second ));
134+ #else
135+ result.push_back (std::make_pair<std::string, std::string>((*it).first ,(*it).second ));
136+ #endif
137+ return result.size ();
138+ }
139+
140+ #ifndef SWIG
141+ size_t http_request::get_cookies (std::map<std::string, std::string, header_comparator>& result) const
142+ {
143+ result = this ->cookies ;
144+ return result.size ();
145+ }
146+ #endif
147+
87148const std::vector<std::pair<std::string, std::string> > http_request::get_args () const
88149{
89150 std::vector<std::pair<std::string, std::string> > to_ret;
@@ -97,4 +158,26 @@ const std::vector<std::pair<std::string, std::string> > http_request::get_args()
97158 return to_ret;
98159}
99160
161+ size_t http_request::get_args (std::vector<std::pair<std::string, std::string> >& result) const
162+ {
163+ std::map<std::string, std::string, header_comparator>::const_iterator it;
164+ for (it = args.begin (); it != args.end (); it++)
165+ #ifdef USE_CPP_ZEROX
166+ result.push_back (std::make_pair ((*it).first ,(*it).second ));
167+ #else
168+ result.push_back (std::make_pair<std::string, std::string>((*it).first ,(*it).second ));
169+ #endif
170+ return result.size ();
171+ }
172+
173+ #ifndef SWIG
174+ size_t http_request::get_args (std::map<std::string, std::string, arg_comparator>& result) const
175+ {
176+ result = this ->args ;
177+ return result.size ();
178+ }
179+ #endif
180+
181+
182+
100183};
0 commit comments