Merge pull request #344 from RangelReale/htmlformcontentlength

HTMLForm Content-Length calculation
This commit is contained in:
Aleksandar Fabijanic
2014-05-21 22:27:12 -05:00
12 changed files with 164 additions and 5 deletions

View File

@@ -16,6 +16,7 @@
#include "Poco/Net/FilePartSource.h"
#include "Poco/Path.h"
#include "Poco/File.h"
#include "Poco/Exception.h"
@@ -28,7 +29,7 @@ namespace Net {
FilePartSource::FilePartSource(const std::string& path):
_istr(path)
_path(path), _istr(path)
{
Path p(path);
_filename = p.getFileName();
@@ -39,6 +40,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);
@@ -50,6 +52,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)
{
@@ -76,4 +79,11 @@ const std::string& FilePartSource::filename() const
}
std::streamsize FilePartSource::getContentLength() const
{
Poco::File p(_path);
return p.getSize();
}
} } // namespace Poco::Net