mirror of
https://github.com/pocoproject/poco.git
synced 2025-11-25 06:36:37 +01:00
* Multipart form content length calculation
* HTMLForm test
This commit is contained in:
@@ -83,7 +83,11 @@ public:
|
||||
const std::string& filename() const;
|
||||
/// Returns the filename portion of the path.
|
||||
|
||||
std::streamsize getContentLength() const;
|
||||
/// Returns the file size.
|
||||
|
||||
private:
|
||||
std::string _path;
|
||||
std::string _filename;
|
||||
Poco::FileInputStream _istr;
|
||||
};
|
||||
|
||||
@@ -173,7 +173,14 @@ public:
|
||||
/// Otherwise, if the request's HTTP version is HTTP/1.1:
|
||||
/// - the request's persistent connection state is left unchanged
|
||||
/// - the content transfer encoding is set to chunked
|
||||
|
||||
|
||||
|
||||
std::streamsize calculateContentLength();
|
||||
/// Calculate the content length for the form.
|
||||
/// May be UNKNOWN_CONTENT_LENGTH if not possible
|
||||
/// to calculate
|
||||
|
||||
|
||||
void write(std::ostream& ostr, const std::string& boundary);
|
||||
/// Writes the form data to the given output stream,
|
||||
/// using the specified encoding.
|
||||
@@ -203,6 +210,7 @@ public:
|
||||
static const std::string ENCODING_URL; /// "application/x-www-form-urlencoded"
|
||||
static const std::string ENCODING_MULTIPART; /// "multipart/form-data"
|
||||
|
||||
static const int UNKNOWN_CONTENT_LENGTH;
|
||||
protected:
|
||||
void readUrl(std::istream& istr);
|
||||
void readMultipart(std::istream& istr, PartHandler& handler);
|
||||
|
||||
@@ -77,9 +77,15 @@ public:
|
||||
/// Returns a MessageHeader containing additional header
|
||||
/// fields for the part.
|
||||
|
||||
virtual std::streamsize getContentLength() const;
|
||||
/// Returns the content length for this part
|
||||
/// which may be UNKNOWN_CONTENT_LENGTH if
|
||||
/// not available.
|
||||
|
||||
virtual ~PartSource();
|
||||
/// Destroys the PartSource.
|
||||
|
||||
static const int UNKNOWN_CONTENT_LENGTH;
|
||||
protected:
|
||||
PartSource();
|
||||
/// Creates the PartSource, using
|
||||
|
||||
@@ -75,6 +75,9 @@ public:
|
||||
const std::string& filename() const;
|
||||
/// Returns the filename portion of the path.
|
||||
|
||||
std::streamsize getContentLength() const;
|
||||
/// Returns the string size.
|
||||
|
||||
private:
|
||||
std::istringstream _istr;
|
||||
std::string _filename;
|
||||
|
||||
Reference in New Issue
Block a user