Procházet zdrojové kódy

mastoapi: store x-forwarded-for in app if remote-addr is not set.

grunfink před 2 týdny
rodič
revize
e24609e1f6
1 změnil soubory, kde provedl 3 přidání a 1 odebrání
  1. 3 1
      mastoapi.c

+ 3 - 1
mastoapi.c

@@ -3452,8 +3452,10 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path,
             status = HTTP_STATUS_OK;
             status = HTTP_STATUS_OK;
 
 
             app = xs_dict_append(app, "code", "");
             app = xs_dict_append(app, "code", "");
-            app = xs_dict_append(app, "remote-addr", xs_dict_get(req, "remote-addr"));
             app = xs_dict_append(app, "user-agent", xs_dict_get(req, "user-agent"));
             app = xs_dict_append(app, "user-agent", xs_dict_get(req, "user-agent"));
+            app = xs_dict_append(app, "remote-addr", xs_or(
+                xs_dict_get(req, "remote-addr"),
+                xs_dict_get(req, "x-forwarded-for")));
 
 
             app_add(cid, app);
             app_add(cid, app);