CGIFormData work in progress.
This commit is contained in:
parent
4988f98223
commit
ffa3361fd2
27
CGIFormData.cpp
Normal file
27
CGIFormData.cpp
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#include "CGIFormData.h"
|
||||||
|
#include "IMFHeader.h"
|
||||||
|
#include "malloc.h"
|
||||||
|
|
||||||
|
namespace coreutils {
|
||||||
|
|
||||||
|
CGIFormData::CGIFormData(int fd, ZString contentType, int contentLength, ZString boundary)
|
||||||
|
: contentType(contentType) {
|
||||||
|
if(contentType == "application/x-www-form-urlencoded") {
|
||||||
|
setSize(contentLength);
|
||||||
|
read(fd, contentLength);
|
||||||
|
formdata = new CGIFormattedData(*this);
|
||||||
|
} else if(contentType == "multipart/form-data") {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
MString CGIFormData::operator[](ZString name) {
|
||||||
|
if(contentType == "application/x-www-form-urlencoded")
|
||||||
|
return formdata[name];
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
27
CGIFormData.h
Normal file
27
CGIFormData.h
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#ifndef __CGIFormData_h__
|
||||||
|
# define __IMFFormData_h__
|
||||||
|
|
||||||
|
#include "MString.h"
|
||||||
|
#include "ZString.h"
|
||||||
|
#include "CGIFormattedData.h"
|
||||||
|
|
||||||
|
namespace coreutils {
|
||||||
|
|
||||||
|
class CGIFormData : public MString {
|
||||||
|
|
||||||
|
public:
|
||||||
|
CGIFormData(int fd, ZString contentType, int contentLength, ZString boundary);
|
||||||
|
|
||||||
|
MString operator[](ZString name);
|
||||||
|
|
||||||
|
private:
|
||||||
|
CGIFormattedData *formdata;
|
||||||
|
MString contentType;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user