/* */ #ifndef _D_HTTP_HEADER_PROCESSOR_H_ #define _D_HTTP_HEADER_PROCESSOR_H_ #include "common.h" #include "SharedHandle.h" #include #include namespace aria2 { class HttpHeader; class HttpHeaderProcessor { private: std::string buf_; size_t limit_; void checkHeaderLimit(size_t incomingLength); public: HttpHeaderProcessor(); ~HttpHeaderProcessor(); void update(const unsigned char* data, size_t length); void update(const std::string& data); /** * Returns true if end of header is reached. */ bool eoh() const; /** * Retruns the number of bytes beyond the end of header. */ size_t getPutBackDataLength() const; /** * Processes the received header as a http response header and returns * HttpHeader object. */ SharedHandle getHttpResponseHeader(); SharedHandle getHttpRequestHeader(); std::string getHeaderString() const; void clear(); void setHeaderLimit(size_t limit) { limit_ = limit; } }; typedef SharedHandle HttpHeaderProcessorHandle; } // namespace aria2 #endif // _D_HTTP_HEADER_PROCESSOR_H_