@@ -1694,6 +1694,29 @@ int Transaction::getRuleEngineState() {
1694
1694
}
1695
1695
1696
1696
1697
+ /* *
1698
+ * @name updateStatusCode
1699
+ * @brief Updates response status code.
1700
+ *
1701
+ * Called after processResponseHeaders to inform a new response code.
1702
+ * Not mandatory.
1703
+ *
1704
+ *
1705
+ * @param status The returned http code.
1706
+ *
1707
+ * @returns If the operation was successful or not.
1708
+ * @retval true Operation was successful.
1709
+ * @retval false Operation failed.
1710
+ *
1711
+ */
1712
+ int Transaction::updateStatusCode (int code) {
1713
+ this ->m_httpCodeReturned = code;
1714
+ m_variableResponseStatus.set (std::to_string (code), m_variableOffset);
1715
+
1716
+ return true ;
1717
+ }
1718
+
1719
+
1697
1720
/* *
1698
1721
* @name msc_new_transaction
1699
1722
* @brief Create a new transaction for a given configuration and ModSecurity core.
@@ -2126,5 +2149,25 @@ extern "C" int msc_process_logging(Transaction *transaction) {
2126
2149
return transaction->processLogging ();
2127
2150
}
2128
2151
2152
+
2153
+ /* *
2154
+ * @name msc_update_status_code
2155
+ * @brief Updates response status code.
2156
+ *
2157
+ * Called after msc_process_response_headers to inform a new response code.
2158
+ * Not mandatory.
2159
+ *
2160
+ * @param transaction ModSecurity transaction.
2161
+ *
2162
+ * @returns If the operation was successful or not.
2163
+ * @retval 1 Operation was successful.
2164
+ * @retval 0 Operation failed.
2165
+ *
2166
+ */
2167
+ extern " C" int msc_update_status_code (Transaction *transaction, int status) {
2168
+ return transaction->updateStatusCode (status);
2169
+ }
2170
+
2171
+
2129
2172
} // namespace modsecurity
2130
2173
0 commit comments