mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-12 18:20:26 +01:00
HTMLForm does not read URL parameters on POST or PUT
- fixed GH #175: HTMLForm does not read URL parameters on POST or PUT
This commit is contained in:
parent
b61b5ae53d
commit
460cccddf9
@ -7,7 +7,7 @@ Release 1.5.2 (2013-06-xx)
|
||||
- added VoidEvent (Arturo Castro)
|
||||
- fixed GH #80: NumberFormatter::append broken
|
||||
- fixed GH #93: ParallelSocketAcceptor virtual functions
|
||||
- small object optimization for IPAddress, SocketAddress, Any and Dynamic::Var
|
||||
- optional small object optimization for IPAddress, SocketAddress, Any and Dynamic::Var
|
||||
- SQLite events (insert, update, delete, commit, rollback) handlers
|
||||
- merged GH #91: Improve SQLite multi-threaded use (Rangel Reale)
|
||||
- merged GH #86: Invalid pointers to vector internals (Adrian Imboden)
|
||||
@ -79,6 +79,8 @@ Release 1.5.2 (2013-06-xx)
|
||||
- fixed GH #99: JSON::Query an JSON::Object
|
||||
- limited allowed types for JSON::Query to Object, Array, Object::Ptr,
|
||||
Array::Ptr and empty
|
||||
- fixed GH #175: HTMLForm does not read URL parameters on POST or PUT
|
||||
|
||||
|
||||
Release 1.5.1 (2013-01-11)
|
||||
==========================
|
||||
|
@ -129,6 +129,15 @@ void HTMLForm::addPart(const std::string& name, PartSource* pSource)
|
||||
void HTMLForm::load(const HTTPRequest& request, std::istream& requestBody, PartHandler& handler)
|
||||
{
|
||||
clear();
|
||||
|
||||
URI uri(request.getURI());
|
||||
const std::string& query = uri.getRawQuery();
|
||||
if (!query.empty())
|
||||
{
|
||||
std::istringstream istr(query);
|
||||
readUrl(istr);
|
||||
}
|
||||
|
||||
if (request.getMethod() == HTTPRequest::HTTP_POST || request.getMethod() == HTTPRequest::HTTP_PUT)
|
||||
{
|
||||
std::string mediaType;
|
||||
@ -145,12 +154,6 @@ void HTMLForm::load(const HTTPRequest& request, std::istream& requestBody, PartH
|
||||
readUrl(requestBody);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
URI uri(request.getURI());
|
||||
std::istringstream istr(uri.getRawQuery());
|
||||
readUrl(istr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -170,7 +170,7 @@ void HTMLFormTest::testWriteMultipart()
|
||||
}
|
||||
|
||||
|
||||
void HTMLFormTest::testReadUrl1()
|
||||
void HTMLFormTest::testReadUrlGET()
|
||||
{
|
||||
HTTPRequest req("GET", "/form.cgi?field1=value1&field2=value%202&field3=value%3D3&field4=value%264");
|
||||
HTMLForm form(req);
|
||||
@ -182,12 +182,27 @@ void HTMLFormTest::testReadUrl1()
|
||||
}
|
||||
|
||||
|
||||
void HTMLFormTest::testReadUrl2()
|
||||
void HTMLFormTest::testReadUrlPOST()
|
||||
{
|
||||
HTTPRequest req("POST", "/form.cgi");
|
||||
HTTPRequest req("POST", "/form.cgi?field0=value0");
|
||||
std::istringstream istr("field1=value1&field2=value%202&field3=value%3D3&field4=value%264");
|
||||
HTMLForm form(req, istr);
|
||||
assert (form.size() == 4);
|
||||
assert (form.size() == 5);
|
||||
assert (form["field0"] == "value0");
|
||||
assert (form["field1"] == "value1");
|
||||
assert (form["field2"] == "value 2");
|
||||
assert (form["field3"] == "value=3");
|
||||
assert (form["field4"] == "value&4");
|
||||
}
|
||||
|
||||
|
||||
void HTMLFormTest::testReadUrlPUT()
|
||||
{
|
||||
HTTPRequest req("PUT", "/form.cgi?field0=value0");
|
||||
std::istringstream istr("field1=value1&field2=value%202&field3=value%3D3&field4=value%264");
|
||||
HTMLForm form(req, istr);
|
||||
assert (form.size() == 5);
|
||||
assert (form["field0"] == "value0");
|
||||
assert (form["field1"] == "value1");
|
||||
assert (form["field2"] == "value 2");
|
||||
assert (form["field3"] == "value=3");
|
||||
@ -360,8 +375,9 @@ CppUnit::Test* HTMLFormTest::suite()
|
||||
|
||||
CppUnit_addTest(pSuite, HTMLFormTest, testWriteUrl);
|
||||
CppUnit_addTest(pSuite, HTMLFormTest, testWriteMultipart);
|
||||
CppUnit_addTest(pSuite, HTMLFormTest, testReadUrl1);
|
||||
CppUnit_addTest(pSuite, HTMLFormTest, testReadUrl2);
|
||||
CppUnit_addTest(pSuite, HTMLFormTest, testReadUrlGET);
|
||||
CppUnit_addTest(pSuite, HTMLFormTest, testReadUrlPOST);
|
||||
CppUnit_addTest(pSuite, HTMLFormTest, testReadUrlPUT);
|
||||
CppUnit_addTest(pSuite, HTMLFormTest, testReadMultipart);
|
||||
CppUnit_addTest(pSuite, HTMLFormTest, testSubmit1);
|
||||
CppUnit_addTest(pSuite, HTMLFormTest, testSubmit2);
|
||||
|
@ -48,8 +48,9 @@ public:
|
||||
|
||||
void testWriteUrl();
|
||||
void testWriteMultipart();
|
||||
void testReadUrl1();
|
||||
void testReadUrl2();
|
||||
void testReadUrlGET();
|
||||
void testReadUrlPOST();
|
||||
void testReadUrlPUT();
|
||||
void testReadMultipart();
|
||||
void testSubmit1();
|
||||
void testSubmit2();
|
||||
|
Loading…
Reference in New Issue
Block a user