diff options
author | Julian Laubstein <julianlaubstein@yahoo.de> | 2016-02-06 11:37:34 +0100 |
---|---|---|
committer | Julian Laubstein <julianlaubstein@yahoo.de> | 2016-02-06 11:37:34 +0100 |
commit | 6fdd7194c81be7234a126bdc3b48f0291fce3567 (patch) | |
tree | 7d5ac74b7385ce4ebf77588d80549c884c2b993c /src/HTTPServer/HTTPFormParser.h | |
parent | Merge pull request #2958 from LogicParrot/fence (diff) | |
parent | Bulk clearing of whitespace (diff) | |
download | cuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.tar cuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.tar.gz cuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.tar.bz2 cuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.tar.lz cuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.tar.xz cuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.tar.zst cuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.zip |
Diffstat (limited to '')
-rw-r--r-- | src/HTTPServer/HTTPFormParser.h | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/src/HTTPServer/HTTPFormParser.h b/src/HTTPServer/HTTPFormParser.h index e72d4ef10..f6cbe047f 100644 --- a/src/HTTPServer/HTTPFormParser.h +++ b/src/HTTPServer/HTTPFormParser.h @@ -38,36 +38,36 @@ public: public: // Force a virtual destructor in descendants: virtual ~cCallbacks() {} - + /** 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 */ 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 */ 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 */ cHTTPFormParser(cHTTPRequest & a_Request, cCallbacks & a_Callbacks); - + /** 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 */ 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. */ bool Finish(void); - + /** 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 */ cCallbacks & m_Callbacks; @@ -76,32 +76,32 @@ protected: /** 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. */ bool m_IsValid; - + /** The parser for the multipart data, if used */ std::unique_ptr<cMultipartParser> m_MultipartParser; - + /** Name of the currently parsed part in multipart data */ AString m_CurrentPartName; - + /** 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) */ AString m_CurrentPartFileName; - + /** 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 */ void BeginMultipart(const cHTTPRequest & a_Request); - + /** Parses m_IncomingData as form-urlencoded data (fpkURL or fpkFormUrlEncoded kinds) */ void ParseFormUrlEncoded(void); - + // cMultipartParser::cCallbacks overrides: virtual void OnPartStart (void) override; virtual void OnPartHeader(const AString & a_Key, const AString & a_Value) override; |