more cgi processing multiform work.
This commit is contained in:
parent
b774e50b59
commit
bd5223ca36
@ -5,8 +5,11 @@
|
||||
namespace coreutils {
|
||||
|
||||
IMFFormData::IMFFormData(int fd, ZString boundary) {
|
||||
std::cout << "030" << std::endl;
|
||||
IMFHeader header(fd);
|
||||
std::cout << "031" << std::endl;
|
||||
IMFText text(fd, boundary);
|
||||
std::cout << "032" << std::endl;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -7,12 +7,16 @@ namespace coreutils {
|
||||
|
||||
IMFHeader::IMFHeader(int fd) {
|
||||
char ch;
|
||||
std::cout << "040" << std::endl;
|
||||
int rc = ::read(fd, &ch, 1);
|
||||
while(ch != 'r') {
|
||||
while(ch != '\r') {
|
||||
std::cout << (char)ch << std::endl;
|
||||
IMFHeaderField *headerField = new IMFHeaderField(ch, fd);
|
||||
headers.push_back(headerField);
|
||||
}
|
||||
std::cout << "041: " << ch << std::endl;
|
||||
rc = ::read(fd, &ch, 1);
|
||||
std::cout << "042: " << ch << std::endl;
|
||||
}
|
||||
|
||||
}
|
@ -9,6 +9,8 @@ namespace coreutils {
|
||||
IMFHeaderField::IMFHeaderField(char &ch, int fd) {
|
||||
int rc = 0;
|
||||
|
||||
std::cout << "050" << std::endl;
|
||||
|
||||
if((ch >= 'A') && (ch <= 'Z'))
|
||||
key.write(ch);
|
||||
|
||||
@ -17,6 +19,9 @@ namespace coreutils {
|
||||
if(ch != ':')
|
||||
key.write(ch);
|
||||
}
|
||||
|
||||
std::cout << "051: " << key << std::endl;
|
||||
|
||||
rc = ::read(fd, &ch, 1);
|
||||
while(ch == ' ')
|
||||
rc = ::read(fd, &ch, 1);
|
||||
@ -25,8 +30,10 @@ namespace coreutils {
|
||||
rc = ::read(fd, &ch, 1);
|
||||
if(ch != '\r')
|
||||
value.write(ch);
|
||||
}
|
||||
rc = ::read(fd, &ch, 1);
|
||||
}
|
||||
std::cout << "052: " << value << std::endl;
|
||||
rc = ::read(fd, &ch, 1);
|
||||
std::cout << "053" << std::endl;
|
||||
}
|
||||
|
||||
}
|
@ -8,16 +8,22 @@ namespace coreutils {
|
||||
IMFMultipart::IMFMultipart(int fd, MString boundary) {
|
||||
int ch = 0;
|
||||
int rc = 0;
|
||||
std::cout << "020" << std::endl;
|
||||
while((ch != '\r') && (ch != '\n')) {
|
||||
rc = ::read(fd, &ch, 1);
|
||||
if((ch != '\r') && (ch != '\n'))
|
||||
std::cout << (char)ch;
|
||||
boundary.write(ch);
|
||||
}
|
||||
if(ch == '\r') {
|
||||
std::cout << std::endl;
|
||||
rc = ::read(fd, &ch, 1);
|
||||
}
|
||||
while(1) {
|
||||
sections.emplace_back(fd, boundary);
|
||||
std::cout << "021: " << boundary << std::endl;
|
||||
IMFFormData *formData = new IMFFormData(fd, boundary);
|
||||
std::cout << "022" << std::endl;
|
||||
|
||||
rc = ::read(fd, &ch, 1);
|
||||
if(ch == '-') {
|
||||
rc = ::read(fd, &ch, 1);
|
||||
|
21
IMFText.cpp
21
IMFText.cpp
@ -1,9 +1,28 @@
|
||||
#include "IMFText.h"
|
||||
#include <unistd.h>
|
||||
|
||||
namespace coreutils {
|
||||
|
||||
IMFText::IMFText(int fd, ZString boundary) : MString() {
|
||||
|
||||
int ch = 0;
|
||||
int rc = 0;
|
||||
char *endcursor;
|
||||
char *index = boundary.getData();
|
||||
|
||||
while(1) {
|
||||
rc = ::read(fd, &ch, 1);
|
||||
if(ch == *index) {
|
||||
++index;
|
||||
ZString check(index, index - endcursor);
|
||||
if(check == boundary) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
endcursor = index;
|
||||
}
|
||||
write(ch);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user