1
0
Эх сурвалжийг харах

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

grunfink 2 долоо хоног өмнө
parent
commit
e24609e1f6
1 өөрчлөгдсөн 3 нэмэгдсэн , 1 устгасан
  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;
 
             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, "remote-addr", xs_or(
+                xs_dict_get(req, "remote-addr"),
+                xs_dict_get(req, "x-forwarded-for")));
 
             app_add(cid, app);