mirror of
https://github.com/Telecominfraproject/wlan-cloud-owprov.git
synced 2025-11-02 19:48:03 +00:00
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
This commit is contained in:
@@ -4,29 +4,26 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include "Poco/Net/PartHandler.h"
|
||||
#include "Poco/Net/MessageHeader.h"
|
||||
#include "Poco/CountingStream.h"
|
||||
#include "Poco/Net/MessageHeader.h"
|
||||
#include "Poco/Net/PartHandler.h"
|
||||
#include "Poco/NullStream.h"
|
||||
#include "Poco/StreamCopier.h"
|
||||
#include <string>
|
||||
|
||||
namespace OpenWifi {
|
||||
class RESTAPI_PartHandler: public Poco::Net::PartHandler {
|
||||
class RESTAPI_PartHandler : public Poco::Net::PartHandler {
|
||||
public:
|
||||
RESTAPI_PartHandler():
|
||||
_length(0)
|
||||
{
|
||||
}
|
||||
RESTAPI_PartHandler() : _length(0) {}
|
||||
|
||||
inline void handlePart(const Poco::Net::MessageHeader& header, std::istream& stream) override
|
||||
{
|
||||
inline void handlePart(const Poco::Net::MessageHeader &header,
|
||||
std::istream &stream) override {
|
||||
_type = header.get("Content-Type", "(unspecified)");
|
||||
if (header.has("Content-Disposition"))
|
||||
{
|
||||
if (header.has("Content-Disposition")) {
|
||||
std::string disp;
|
||||
Poco::Net::NameValueCollection params;
|
||||
Poco::Net::MessageHeader::splitParameters(header["Content-Disposition"], disp, params);
|
||||
Poco::Net::MessageHeader::splitParameters(header["Content-Disposition"], disp,
|
||||
params);
|
||||
_name = params.get("name", "(unnamed)");
|
||||
_fileName = params.get("filename", "(unnamed)");
|
||||
}
|
||||
@@ -37,25 +34,13 @@ namespace OpenWifi {
|
||||
_length = (int)istr.chars();
|
||||
}
|
||||
|
||||
[[nodiscard]] inline int length() const
|
||||
{
|
||||
return _length;
|
||||
}
|
||||
[[nodiscard]] inline int length() const { return _length; }
|
||||
|
||||
[[nodiscard]] inline const std::string& name() const
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
[[nodiscard]] inline const std::string &name() const { return _name; }
|
||||
|
||||
[[nodiscard]] inline const std::string& fileName() const
|
||||
{
|
||||
return _fileName;
|
||||
}
|
||||
[[nodiscard]] inline const std::string &fileName() const { return _fileName; }
|
||||
|
||||
[[nodiscard]] inline const std::string& contentType() const
|
||||
{
|
||||
return _type;
|
||||
}
|
||||
[[nodiscard]] inline const std::string &contentType() const { return _type; }
|
||||
|
||||
private:
|
||||
int _length;
|
||||
@@ -63,4 +48,4 @@ namespace OpenWifi {
|
||||
std::string _name;
|
||||
std::string _fileName;
|
||||
};
|
||||
}
|
||||
} // namespace OpenWifi
|
||||
|
||||
Reference in New Issue
Block a user