summaryrefslogtreecommitdiff
path: root/cgi/4or6.c
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2019-02-10 11:16:07 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2019-02-10 11:16:07 +0800
commit9d3c8c0e6e1a7ba43bf3dc19350d1dca68b657a3 (patch)
tree339de0698c13e1763d3361d70fb1266621025c91 /cgi/4or6.c
downloadweb-9d3c8c0e6e1a7ba43bf3dc19350d1dca68b657a3.tar.xz
Initial commit.
Diffstat (limited to 'cgi/4or6.c')
-rw-r--r--cgi/4or6.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/cgi/4or6.c b/cgi/4or6.c
new file mode 100644
index 0000000..1cf6780
--- /dev/null
+++ b/cgi/4or6.c
@@ -0,0 +1,14 @@
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+int main()
+{
+ printf("Content-type: text/plain\n\n");
+ if(!getenv("REMOTE_ADDR"))return 0;
+ char* s=getenv("REMOTE_ADDR");
+ if(getenv("HTTP_X_FORWARDED_FOR"))
+ s=getenv("HTTP_X_FORWARDED_FOR");
+ if(strchr(s,':')!=NULL)puts("6");
+ else puts("4");
+ return 0;
+}