1
0
mirror of https://github.com/stefanocasazza/ULib.git synced 2025-10-05 19:18:01 +08:00
This commit is contained in:
stefanocasazza 2017-06-23 14:43:08 +02:00
parent 6555d29cd2
commit dd7188d3b3
3 changed files with 86 additions and 60 deletions

View File

@ -61,9 +61,13 @@ static void usp_end_fortune()
#endif
-->
<!doctype html><html><head><title>Fortunes</title></head><body><table><tr><th>id</th><th>message</th></tr><!--#code
uint32_t sz;
Fortune* item;
char* s = UClientImage_Base::wbuffer->data();
char* ptr = UClientImage_Base::wbuffer->pend();
U_NEW(Fortune, item, Fortune(*pfortune2add));
pvfortune->push_back(item);
pstmt_fortune->execute();
@ -83,13 +87,26 @@ for (uint32_t i = 0, n = pvfortune->size(); i < n; ++i)
UXMLEscape::encode(elem->message, *pencoded);
USP_PRINTF_ADD(
"<tr>"
"<td>%u</td>"
"<td>%v</td>"
"</tr>",
elem->id, pencoded->rep);
sz = pencoded->size();
u_put_unalignedp64(ptr, U_MULTICHAR_CONSTANT64('<','t','r','>','<','t','d','>'));
ptr = u_num2str32(elem->id, ptr+8);
u_put_unalignedp64(ptr, U_MULTICHAR_CONSTANT64('<','/','t','d','>','<','t','d'));
ptr += 8;
*ptr++ = '>';
(void) memcpy(ptr, pencoded->data(), sz);
ptr += sz;
u_put_unalignedp64(ptr, U_MULTICHAR_CONSTANT64('<','/','t','d','>','<','/','t'));
u_put_unalignedp16(ptr+8, U_MULTICHAR_CONSTANT16('r','>'));
ptr += 10;
}
UClientImage_Base::wbuffer->size_adjust(ptr - s);
pvfortune->clear();
--></table></body></html>

View File

@ -1445,16 +1445,8 @@ bool UServer_Base::checkHitUriStats()
if (bwhitelist == false)
{
uint32_t sz = U_http_info.uri_len;
const char* ptr = U_http_info.uri;
# ifdef U_ALIAS
if (*UClientImage_Base::request_uri) // The interpreted pathname of the original requested document (relative to the document root)
{
sz = UClientImage_Base::request_uri->size();
ptr = UClientImage_Base::request_uri->data();
}
# endif
uint32_t sz;
const char* ptr = UClientImage_Base::getRequestUri(sz);
UString key(UServer_Base::client_address_len + sz);

View File

@ -61,9 +61,13 @@ static void usp_end_fortune()
#endif
-->
<!doctype html><html><head><title>Fortunes</title></head><body><table><tr><th>id</th><th>message</th></tr><!--#code
uint32_t sz;
Fortune* item;
char* s = UClientImage_Base::wbuffer->data();
char* ptr = UClientImage_Base::wbuffer->pend();
U_NEW(Fortune, item, Fortune(*pfortune2add));
pvfortune->push_back(item);
pstmt_fortune->execute();
@ -83,13 +87,26 @@ for (uint32_t i = 0, n = pvfortune->size(); i < n; ++i)
UXMLEscape::encode(elem->message, *pencoded);
USP_PRINTF_ADD(
"<tr>"
"<td>%u</td>"
"<td>%v</td>"
"</tr>",
elem->id, pencoded->rep);
sz = pencoded->size();
u_put_unalignedp64(ptr, U_MULTICHAR_CONSTANT64('<','t','r','>','<','t','d','>'));
ptr = u_num2str32(elem->id, ptr+8);
u_put_unalignedp64(ptr, U_MULTICHAR_CONSTANT64('<','/','t','d','>','<','t','d'));
ptr += 8;
*ptr++ = '>';
(void) memcpy(ptr, pencoded->data(), sz);
ptr += sz;
u_put_unalignedp64(ptr, U_MULTICHAR_CONSTANT64('<','/','t','d','>','<','/','t'));
u_put_unalignedp16(ptr+8, U_MULTICHAR_CONSTANT16('r','>'));
ptr += 10;
}
UClientImage_Base::wbuffer->size_adjust(ptr - s);
pvfortune->clear();
--></table></body></html>