return TRUE;
}
+void
+rspamd_http_message_set_method (struct rspamd_http_message *msg,
+ const gchar *method)
+{
+ gint i;
+
+ /* Linear search: not very efficient method */
+ for (i = 0; i < HTTP_METHOD_MAX; i ++) {
+ if (g_ascii_strcasecmp (method, http_method_str (i)) == 0) {
+ msg->method = i;
+ }
+ }
+}
+
gboolean
rspamd_http_message_set_body_from_fd (struct rspamd_http_message *msg,
gint fd)
gboolean rspamd_http_message_set_body (struct rspamd_http_message *msg,
const gchar *data, gsize len);
+/**
+ * Set message's method by name
+ * @param msg
+ * @param method
+ */
+void rspamd_http_message_set_method (struct rspamd_http_message *msg,
+ const gchar *method);
/**
* Maps fd as message's body
* @param msg
}
lua_pop (L, 1);
+
+ lua_pushstring (L, "method");
+ lua_gettable (L, 1);
+
+ if (lua_type (L, -1) == LUA_TSTRING) {
+ rspamd_http_message_set_method (msg, lua_tostring (L, -1));
+ }
+
+ lua_pop (L, 1);
}
else {
msg_err ("http request has bad params");