@@ -1565,7 +1565,7 @@ std::string Transaction::toJSON(int parts) {
1565
1565
size_t len;
1566
1566
yajl_gen g;
1567
1567
std::string log ;
1568
- std::string ts = utils::string::ascTime (&m_timeStamp). c_str () ;
1568
+ std::string ts = utils::string::ascTime (&m_timeStamp);
1569
1569
std::string uniqueId = UniqueId::uniqueId ();
1570
1570
1571
1571
g = yajl_gen_alloc (NULL );
@@ -1583,13 +1583,13 @@ std::string Transaction::toJSON(int parts) {
1583
1583
1584
1584
yajl_gen_map_open (g);
1585
1585
/* Part: A (header mandatory) */
1586
- LOGFY_ADD (" client_ip" , m_clientIpAddress. c_str () );
1587
- LOGFY_ADD (" time_stamp" , ts. c_str () );
1588
- LOGFY_ADD (" server_id" , uniqueId. c_str () );
1586
+ LOGFY_ADD (" client_ip" , m_clientIpAddress);
1587
+ LOGFY_ADD (" time_stamp" , ts);
1588
+ LOGFY_ADD (" server_id" , uniqueId);
1589
1589
LOGFY_ADD_NUM (" client_port" , m_clientPort);
1590
- LOGFY_ADD (" host_ip" , m_serverIpAddress. c_str () );
1590
+ LOGFY_ADD (" host_ip" , m_serverIpAddress);
1591
1591
LOGFY_ADD_NUM (" host_port" , m_serverPort);
1592
- LOGFY_ADD (" unique_id" , m_id. c_str () );
1592
+ LOGFY_ADD (" unique_id" , m_id);
1593
1593
1594
1594
/* request */
1595
1595
yajl_gen_string (g, reinterpret_cast <const unsigned char *>(" request" ),
@@ -1598,14 +1598,14 @@ std::string Transaction::toJSON(int parts) {
1598
1598
1599
1599
LOGFY_ADD (" method" ,
1600
1600
utils::string::dash_if_empty (
1601
- m_variableRequestMethod.evaluate ()). c_str () );
1601
+ m_variableRequestMethod.evaluate ()));
1602
1602
1603
- LOGFY_ADD_INT (" http_version" , m_httpVersion. c_str () );
1604
- LOGFY_ADD (" uri" , this ->m_uri . c_str () );
1603
+ LOGFY_ADD (" http_version" , m_httpVersion);
1604
+ LOGFY_ADD (" uri" , this ->m_uri );
1605
1605
1606
1606
if (parts & audit_log::AuditLog::CAuditLogPart) {
1607
1607
// FIXME: check for the binary content size.
1608
- LOGFY_ADD (" body" , this ->m_requestBody .str (). c_str () );
1608
+ LOGFY_ADD (" body" , this ->m_requestBody .str ());
1609
1609
}
1610
1610
1611
1611
/* request headers */
@@ -1617,7 +1617,7 @@ std::string Transaction::toJSON(int parts) {
1617
1617
1618
1618
m_variableRequestHeaders.resolve (&l);
1619
1619
for (auto &h : l) {
1620
- LOGFY_ADD (h->getKey ().c_str (), h->getValue (). c_str () );
1620
+ LOGFY_ADD (h->getKey ().c_str (), h->getValue ());
1621
1621
delete h;
1622
1622
}
1623
1623
@@ -1634,7 +1634,7 @@ std::string Transaction::toJSON(int parts) {
1634
1634
yajl_gen_map_open (g);
1635
1635
1636
1636
if (parts & audit_log::AuditLog::EAuditLogPart) {
1637
- LOGFY_ADD (" body" , this ->m_responseBody .str (). c_str () );
1637
+ LOGFY_ADD (" body" , this ->m_responseBody .str ());
1638
1638
}
1639
1639
LOGFY_ADD_NUM (" http_code" , m_httpCodeReturned);
1640
1640
@@ -1647,7 +1647,7 @@ std::string Transaction::toJSON(int parts) {
1647
1647
1648
1648
m_variableResponseHeaders.resolve (&l);
1649
1649
for (auto &h : l) {
1650
- LOGFY_ADD (h->getKey ().c_str (), h->getValue (). c_str () );
1650
+ LOGFY_ADD (h->getKey ().c_str (), h->getValue ());
1651
1651
delete h;
1652
1652
}
1653
1653
@@ -1664,10 +1664,10 @@ std::string Transaction::toJSON(int parts) {
1664
1664
yajl_gen_map_open (g);
1665
1665
1666
1666
/* producer > libmodsecurity */
1667
- LOGFY_ADD (" modsecurity" , m_ms->whoAmI (). c_str () );
1667
+ LOGFY_ADD (" modsecurity" , m_ms->whoAmI ());
1668
1668
1669
1669
/* producer > connector */
1670
- LOGFY_ADD (" connector" , m_ms->getConnectorInformation (). c_str () );
1670
+ LOGFY_ADD (" connector" , m_ms->getConnectorInformation ());
1671
1671
1672
1672
/* producer > engine state */
1673
1673
LOGFY_ADD (" secrules_engine" ,
@@ -1683,7 +1683,7 @@ std::string Transaction::toJSON(int parts) {
1683
1683
for (const auto &a : m_rules->m_components ) {
1684
1684
yajl_gen_string (g,
1685
1685
reinterpret_cast <const unsigned char *>
1686
- (a.c_str ()), a.length ());
1686
+ (a.data ()), a.length ());
1687
1687
}
1688
1688
yajl_gen_array_close (g);
1689
1689
@@ -1697,34 +1697,34 @@ std::string Transaction::toJSON(int parts) {
1697
1697
yajl_gen_array_open (g);
1698
1698
for (auto a : m_rulesMessages) {
1699
1699
yajl_gen_map_open (g);
1700
- LOGFY_ADD (" message" , a.m_message . c_str () );
1700
+ LOGFY_ADD (" message" , a.m_message );
1701
1701
yajl_gen_string (g,
1702
1702
reinterpret_cast <const unsigned char *>(" details" ),
1703
1703
strlen (" details" ));
1704
1704
yajl_gen_map_open (g);
1705
- LOGFY_ADD (" match" , a.m_match . c_str () );
1706
- LOGFY_ADD (" reference" , a.m_reference . c_str () );
1707
- LOGFY_ADD (" ruleId" , std::to_string (a.m_rule .m_ruleId ). c_str () );
1708
- LOGFY_ADD (" file" , a.m_rule .getFileName (). c_str () );
1709
- LOGFY_ADD (" lineNumber" , std::to_string (a.m_rule .getLineNumber ()). c_str () );
1710
- LOGFY_ADD (" data" , a.m_data . c_str () );
1711
- LOGFY_ADD (" severity" , std::to_string (a.m_severity ). c_str () );
1712
- LOGFY_ADD (" ver" , a.m_rule .m_ver . c_str () );
1713
- LOGFY_ADD (" rev" , a.m_rule .m_rev . c_str () );
1705
+ LOGFY_ADD (" match" , a.m_match );
1706
+ LOGFY_ADD (" reference" , a.m_reference );
1707
+ LOGFY_ADD (" ruleId" , std::to_string (a.m_rule .m_ruleId ));
1708
+ LOGFY_ADD (" file" , a.m_rule .getFileName ());
1709
+ LOGFY_ADD (" lineNumber" , std::to_string (a.m_rule .getLineNumber ()));
1710
+ LOGFY_ADD (" data" , a.m_data );
1711
+ LOGFY_ADD (" severity" , std::to_string (a.m_severity ));
1712
+ LOGFY_ADD (" ver" , a.m_rule .m_ver );
1713
+ LOGFY_ADD (" rev" , a.m_rule .m_rev );
1714
1714
1715
1715
yajl_gen_string (g,
1716
1716
reinterpret_cast <const unsigned char *>(" tags" ),
1717
1717
strlen (" tags" ));
1718
1718
yajl_gen_array_open (g);
1719
1719
for (auto b : a.m_tags ) {
1720
1720
yajl_gen_string (g,
1721
- reinterpret_cast <const unsigned char *>(b.c_str ()),
1722
- strlen (b. c_str () ));
1721
+ reinterpret_cast <const unsigned char *>(b.data ()),
1722
+ b. length ( ));
1723
1723
}
1724
1724
yajl_gen_array_close (g);
1725
1725
1726
- LOGFY_ADD (" maturity" , std::to_string (a.m_rule .m_maturity ). c_str () );
1727
- LOGFY_ADD (" accuracy" , std::to_string (a.m_rule .m_accuracy ). c_str () );
1726
+ LOGFY_ADD (" maturity" , std::to_string (a.m_rule .m_maturity ));
1727
+ LOGFY_ADD (" accuracy" , std::to_string (a.m_rule .m_accuracy ));
1728
1728
yajl_gen_map_close (g);
1729
1729
yajl_gen_map_close (g);
1730
1730
}
0 commit comments