* Multipart form content length calculation

* HTMLForm test
This commit is contained in:
Rangel Reale
2013-12-04 18:19:20 -02:00
parent 5edb90c48e
commit 0d2a839f79
12 changed files with 164 additions and 5 deletions

View File

@@ -36,6 +36,7 @@
#include "Poco/Net/FilePartSource.h"
#include "Poco/Path.h"
#include "Poco/File.h"
#include "Poco/Exception.h"
@@ -48,7 +49,7 @@ namespace Net {
FilePartSource::FilePartSource(const std::string& path):
_istr(path)
_path(path), _istr(path)
{
Path p(path);
_filename = p.getFileName();
@@ -59,6 +60,7 @@ FilePartSource::FilePartSource(const std::string& path):
FilePartSource::FilePartSource(const std::string& path, const std::string& mediaType):
PartSource(mediaType),
_path(path),
_istr(path)
{
Path p(path);
@@ -70,6 +72,7 @@ FilePartSource::FilePartSource(const std::string& path, const std::string& media
FilePartSource::FilePartSource(const std::string& path, const std::string& filename, const std::string& mediaType):
PartSource(mediaType),
_path(path),
_filename(filename),
_istr(path)
{
@@ -96,4 +99,11 @@ const std::string& FilePartSource::filename() const
}
std::streamsize FilePartSource::getContentLength() const
{
Poco::File p(_path);
return p.getSize();
}
} } // namespace Poco::Net