indigophox commented on code in PR #34817: URL: https://github.com/apache/arrow/pull/34817#discussion_r1380689308
########## cpp/src/arrow/flight/sql/server_session_middleware.cc: ########## @@ -0,0 +1,179 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#include <shared_mutex> +#include "arrow/flight/sql/server_session_middleware.h" +#include <boost/lexical_cast.hpp> +#include <boost/uuid/uuid.hpp> +#include <boost/uuid/uuid_generators.hpp> +#include <boost/uuid/uuid_io.hpp> + +namespace arrow { +namespace flight { +namespace sql { + +/// \brief A factory for ServerSessionMiddleware, itself storing session data. +class ServerSessionMiddlewareFactory : public ServerMiddlewareFactory { + protected: + std::map<std::string, std::shared_ptr<FlightSqlSession>> session_store_; + std::shared_mutex session_store_lock_; + boost::uuids::random_generator uuid_generator_; + + std::vector<std::pair<std::string, std::string>> ParseCookieString( Review Comment: So Cookie::Parse and Cookie::ParseCookieAttribute are both stateful in terms of the string parsing (ok) but also heavily intertwined with the logic for managing the set-cookie semantics. Really all we're reusing is "split on '; '" and "split on '='" which unfortunately C++ doesn't have canned, but IMO not worth chainsawwing existing cookie_internal code and creating a dependency on it to reuse a conceptually very simple string splitting routine and no further specialized cookie logic. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
