Quellcode durchsuchen

Lua error handler should show the status code

bel vor 11 Jahren
Ursprung
Commit
266bb6f8a9
1 geänderte Dateien mit 5 neuen und 0 gelöschten Zeilen
  1. 5 0
      src/mod_lua.inl

+ 5 - 0
src/mod_lua.inl

@@ -784,6 +784,11 @@ static void prepare_lua_environment(struct mg_connection *conn, lua_State *L, co
     reg_boolean(L, "https", conn->ssl != NULL);
     reg_boolean(L, "https", conn->ssl != NULL);
     reg_string(L, "script_name", script_name);
     reg_string(L, "script_name", script_name);
 
 
+    if (conn->status_code > 0) {
+        /* Lua error handler should show the status code */
+        reg_int(L, "status", conn->status_code);
+    }
+
     lua_rawset(L, -3);
     lua_rawset(L, -3);
     lua_setglobal(L, "mg");
     lua_setglobal(L, "mg");