From ba36a38a6c4be38fe4e09cc95a40b58a48daed79 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Fri, 8 Apr 2022 22:48:00 +0900 Subject: Allow empty dist name in bencode which is needed for hybrid torrent --- src/XmlRpcRequestParserController.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/XmlRpcRequestParserController.h') diff --git a/src/XmlRpcRequestParserController.h b/src/XmlRpcRequestParserController.h index 7892147b..b84a7de1 100644 --- a/src/XmlRpcRequestParserController.h +++ b/src/XmlRpcRequestParserController.h @@ -52,7 +52,10 @@ private: std::unique_ptr value_; std::string name_; - bool validMember() const { return value_ && !name_.empty(); } + bool validMember(bool allowEmptyMemberName) const + { + return value_ && (allowEmptyMemberName || !name_.empty()); + } void reset() { @@ -67,7 +70,11 @@ private: std::string methodName_; + bool allowEmptyMemberName_; + public: + XmlRpcRequestParserController() : allowEmptyMemberName_(false) {} + void pushFrame(); // Pops StateFrame p from frameStack_ and set p[currentFrame_.name_] @@ -90,6 +97,8 @@ public: const std::string& getMethodName() const { return methodName_; } + void setAllowEmptyMemberName(bool b); + void reset(); }; -- cgit