Remove http prefix
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
#ifndef WEBCC_REQUEST_PARSER_H_
|
||||
#define WEBCC_REQUEST_PARSER_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "webcc/parser.h"
|
||||
|
||||
namespace webcc {
|
||||
|
||||
class Request;
|
||||
|
||||
class RequestParser : public Parser {
|
||||
public:
|
||||
explicit RequestParser(Request* request = nullptr);
|
||||
|
||||
~RequestParser() override = default;
|
||||
|
||||
void Init(Request* request);
|
||||
|
||||
private:
|
||||
bool ParseStartLine(const std::string& line) final;
|
||||
|
||||
// Override to handle multipart form data which is request only.
|
||||
bool ParseContent(const char* data, std::size_t length) final;
|
||||
|
||||
// Multipart specific parsing helpers.
|
||||
|
||||
bool ParseMultipartContent(const char* data, std::size_t length);
|
||||
bool ParsePartHeaders(bool* need_more_data);
|
||||
bool GetNextBoundaryLine(std::size_t* b_off, std::size_t* b_count,
|
||||
bool* ended);
|
||||
bool IsBoundary(const std::string& line) const;
|
||||
bool IsBoundaryEnd(const std::string& line) const;
|
||||
|
||||
private:
|
||||
Request* request_;
|
||||
|
||||
enum Step {
|
||||
kStart,
|
||||
kBoundaryParsed,
|
||||
kHeadersParsed,
|
||||
kEnded,
|
||||
};
|
||||
Step step_ = kStart;
|
||||
|
||||
FormPart part_;
|
||||
};
|
||||
|
||||
} // namespace webcc
|
||||
|
||||
#endif // WEBCC_REQUEST_PARSER_H_
|
||||
Reference in New Issue
Block a user