summaryrefslogtreecommitdiffstats
path: root/src/HTTPServer
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2015-07-31 16:49:10 +0200
committerMattes D <github@xoft.cz>2015-07-31 16:49:10 +0200
commit6e4122e551eeb41d3e950b363dd837d5586fe560 (patch)
treeb5ee221d8a8e63c7d3b7868da1db19bf717a6ffd /src/HTTPServer
parentMerge pull request #2400 from cuberite/OffloadBadChunks (diff)
downloadcuberite-6e4122e551eeb41d3e950b363dd837d5586fe560.tar
cuberite-6e4122e551eeb41d3e950b363dd837d5586fe560.tar.gz
cuberite-6e4122e551eeb41d3e950b363dd837d5586fe560.tar.bz2
cuberite-6e4122e551eeb41d3e950b363dd837d5586fe560.tar.lz
cuberite-6e4122e551eeb41d3e950b363dd837d5586fe560.tar.xz
cuberite-6e4122e551eeb41d3e950b363dd837d5586fe560.tar.zst
cuberite-6e4122e551eeb41d3e950b363dd837d5586fe560.zip
Diffstat (limited to 'src/HTTPServer')
-rw-r--r--src/HTTPServer/HTTPFormParser.h39
-rw-r--r--src/HTTPServer/NameValueParser.h20
2 files changed, 29 insertions, 30 deletions
diff --git a/src/HTTPServer/HTTPFormParser.h b/src/HTTPServer/HTTPFormParser.h
index d9d29d9bc..e72d4ef10 100644
--- a/src/HTTPServer/HTTPFormParser.h
+++ b/src/HTTPServer/HTTPFormParser.h
@@ -39,68 +39,67 @@ public:
// Force a virtual destructor in descendants:
virtual ~cCallbacks() {}
- /// Called when a new file part is encountered in the form data
+ /** Called when a new file part is encountered in the form data */
virtual void OnFileStart(cHTTPFormParser & a_Parser, const AString & a_FileName) = 0;
- /// Called when more file data has come for the current file in the form data
+ /** Called when more file data has come for the current file in the form data */
virtual void OnFileData(cHTTPFormParser & a_Parser, const char * a_Data, size_t a_Size) = 0;
- /// Called when the current file part has ended in the form data
+ /** Called when the current file part has ended in the form data */
virtual void OnFileEnd(cHTTPFormParser & a_Parser) = 0;
} ;
- /// Creates a parser that is tied to a request and notifies of various events using a callback mechanism
+ /** Creates a parser that is tied to a request and notifies of various events using a callback mechanism */
cHTTPFormParser(cHTTPRequest & a_Request, cCallbacks & a_Callbacks);
- /// Creates a parser with the specified content type that reads data from a string
+ /** Creates a parser with the specified content type that reads data from a string */
cHTTPFormParser(eKind a_Kind, const char * a_Data, size_t a_Size, cCallbacks & a_Callbacks);
- /// Adds more data into the parser, as the request body is received
+ /** Adds more data into the parser, as the request body is received */
void Parse(const char * a_Data, size_t a_Size);
/** Notifies that there's no more data incoming and the parser should finish its parsing.
- Returns true if parsing successful
- */
+ Returns true if parsing successful. */
bool Finish(void);
- /// Returns true if the headers suggest the request has form data parseable by this class
+ /** Returns true if the headers suggest the request has form data parseable by this class */
static bool HasFormData(const cHTTPRequest & a_Request);
protected:
- /// The callbacks to call for incoming file data
+ /** The callbacks to call for incoming file data */
cCallbacks & m_Callbacks;
- /// The kind of the parser (decided in the constructor, used in Parse()
+ /** The kind of the parser (decided in the constructor, used in Parse() */
eKind m_Kind;
- /// Buffer for the incoming data until it's parsed
+ /** Buffer for the incoming data until it's parsed */
AString m_IncomingData;
- /// True if the information received so far is a valid form; set to false on first problem. Further parsing is skipped when false.
+ /** True if the information received so far is a valid form; set to false on first problem. Further parsing is skipped when false. */
bool m_IsValid;
- /// The parser for the multipart data, if used
+ /** The parser for the multipart data, if used */
std::unique_ptr<cMultipartParser> m_MultipartParser;
- /// Name of the currently parsed part in multipart data
+ /** Name of the currently parsed part in multipart data */
AString m_CurrentPartName;
- /// True if the currently parsed part in multipart data is a file
+ /** True if the currently parsed part in multipart data is a file */
bool m_IsCurrentPartFile;
- /// Filename of the current parsed part in multipart data (for file uploads)
+ /** Filename of the current parsed part in multipart data (for file uploads) */
AString m_CurrentPartFileName;
- /// Set to true after m_Callbacks.OnFileStart() has been called, reset to false on PartEnd
+ /** Set to true after m_Callbacks.OnFileStart() has been called, reset to false on PartEnd */
bool m_FileHasBeenAnnounced;
- /// Sets up the object for parsing a fpkMultipart request
+ /** Sets up the object for parsing a fpkMultipart request */
void BeginMultipart(const cHTTPRequest & a_Request);
- /// Parses m_IncomingData as form-urlencoded data (fpkURL or fpkFormUrlEncoded kinds)
+ /** Parses m_IncomingData as form-urlencoded data (fpkURL or fpkFormUrlEncoded kinds) */
void ParseFormUrlEncoded(void);
// cMultipartParser::cCallbacks overrides:
diff --git a/src/HTTPServer/NameValueParser.h b/src/HTTPServer/NameValueParser.h
index 9794614fa..c0643b139 100644
--- a/src/HTTPServer/NameValueParser.h
+++ b/src/HTTPServer/NameValueParser.h
@@ -17,22 +17,22 @@ class cNameValueParser :
public std::map<AString, AString>
{
public:
- /// Creates an empty parser
+ /** Creates an empty parser */
cNameValueParser(bool a_AllowsKeyOnly = true);
- /// Creates an empty parser, then parses the data given. Doesn't call Finish(), so more data can be parsed later
+ /** Creates an empty parser, then parses the data given. Doesn't call Finish(), so more data can be parsed later */
cNameValueParser(const char * a_Data, size_t a_Size, bool a_AllowsKeyOnly = true);
- /// Parses the data given
+ /** Parses the data given */
void Parse(const char * a_Data, size_t a_Size);
- /// Notifies the parser that no more data will be coming. Returns true if the parser state is valid
+ /** Notifies the parser that no more data will be coming. Returns true if the parser state is valid */
bool Finish(void);
- /// Returns true if the data parsed so far was valid
+ /** Returns true if the data parsed so far was valid */
bool IsValid(void) const { return (m_State != psInvalid); }
- /// Returns true if the parser expects no more data
+ /** Returns true if the parser expects no more data */
bool IsFinished(void) const { return ((m_State == psInvalid) || (m_State == psFinished)); }
protected:
@@ -50,16 +50,16 @@ protected:
psFinished, ///< The parser has already been instructed to finish and doesn't expect any more data
} ;
- /// The current state of the parser
+ /** The current state of the parser */
eState m_State;
- /// If true, the parser will accept keys without an equal sign and the value
+ /** If true, the parser will accept keys without an equal sign and the value */
bool m_AllowsKeyOnly;
- /// Buffer for the current Key
+ /** Buffer for the current Key */
AString m_CurrentKey;
- /// Buffer for the current Value;
+ /** Buffer for the current Value; */
AString m_CurrentValue;