CSTest/网页请求/HttpAnalysis.cpp

33 lines
539 B
C++

#include "HttpAnalysis.h"
#include <iostream>
HttpAnalysis::HttpAnalysis(char** envp)
{
CString Key,Value;
int pos;
while (*envp)
{
Value = Key = *envp++;
pos = Value.Find(_T("="));
Value.Delete(0, pos + 1);
Key = Key.Left(pos);
HttpValue[Key] = Value;
}
int len = _ttoi(HttpValue[_T("CONTENT_LENGTH")]);
if (len != 0)
{
data = new char[len + 1];
ZeroMemory(data, len + 1);
for (int i = 0; i < len; i++)
{
data[i] = fgetc(stdin);
}
}
}
HttpAnalysis::~HttpAnalysis()
{
if (data != NULL)
delete[]data;
}