mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-28 11:31:53 +01:00
Merge pull request #344 from RangelReale/htmlformcontentlength
HTMLForm Content-Length calculation
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user