File tree 1 file changed +17
-3
lines changed
1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -186,15 +186,29 @@ class hybi00 : public processor<config> {
186
186
187
187
// / Extracts requested subprotocols from a handshake request
188
188
/* *
189
- * hybi00 doesn't support subprotocols so there never will be any requested
189
+ * hybi00 does support subprotocols
190
+ * https://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-00#section-1.9
190
191
*
191
192
* @param [in] req The request to extract from
192
193
* @param [out] subprotocol_list A reference to a vector of strings to store
193
194
* the results in.
194
195
*/
195
- lib::error_code extract_subprotocols (request_type const &,
196
- std::vector<std::string> &)
196
+ lib::error_code extract_subprotocols (request_type const & req,
197
+ std::vector<std::string> & subprotocol_list )
197
198
{
199
+ if (!req.get_header (" Sec-WebSocket-Protocol" ).empty ()) {
200
+ http::parameter_list p;
201
+
202
+ if (!req.get_header_as_plist (" Sec-WebSocket-Protocol" ,p)) {
203
+ http::parameter_list::const_iterator it;
204
+
205
+ for (it = p.begin (); it != p.end (); ++it) {
206
+ subprotocol_list.push_back (it->first );
207
+ }
208
+ } else {
209
+ return error::make_error_code (error::subprotocol_parse_error);
210
+ }
211
+ }
198
212
return lib::error_code ();
199
213
}
200
214
You can’t perform that action at this time.
0 commit comments