本文整理汇总了C++中HTMLForm::setFieldLimit方法的典型用法代码示例。如果您正苦于以下问题:C++ HTMLForm::setFieldLimit方法的具体用法?C++ HTMLForm::setFieldLimit怎么用?C++ HTMLForm::setFieldLimit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTMLForm
的用法示例。
在下文中一共展示了HTMLForm::setFieldLimit方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testFieldLimitUrl
void HTMLFormTest::testFieldLimitUrl()
{
HTTPRequest req("GET", "/form.cgi?field1=value1&field2=value%202&field3=value%3D3&field4=value%264");
HTMLForm form;
form.setFieldLimit(3);
try
{
form.load(req);
fail("field limit violated - must throw");
}
catch (Poco::Net::HTMLFormException&)
{
}
}
示例2: testFieldLimitMultipart
void HTMLFormTest::testFieldLimitMultipart()
{
std::istringstream istr(
"\r\n"
"--MIME_boundary_0123456789\r\n"
"Content-Disposition: form-data; name=\"field1\"\r\n"
"\r\n"
"value1\r\n"
"--MIME_boundary_0123456789\r\n"
"Content-Disposition: form-data; name=\"field2\"\r\n"
"\r\n"
"value 2\r\n"
"--MIME_boundary_0123456789\r\n"
"Content-Disposition: form-data; name=\"field3\"\r\n"
"\r\n"
"value=3\r\n"
"--MIME_boundary_0123456789\r\n"
"Content-Disposition: form-data; name=\"field4\"\r\n"
"\r\n"
"value&4\r\n"
"--MIME_boundary_0123456789\r\n"
"Content-Disposition: file; name=\"attachment1\"; filename=\"att1.txt\"\r\n"
"Content-Type: text/plain\r\n"
"\r\n"
"This is an attachment\r\n"
"--MIME_boundary_0123456789--\r\n"
);
HTTPRequest req("POST", "/form.cgi");
req.setContentType(HTMLForm::ENCODING_MULTIPART + "; boundary=\"MIME_boundary_0123456789\"");
StringPartHandler sah;
HTMLForm form;
form.setFieldLimit(3);
try
{
form.load(req, istr, sah);
fail("field limit violated - must throw");
}
catch (Poco::Net::HTMLFormException&)
{
}
}