summaryrefslogtreecommitdiff
path: root/cgi/4or6.c
diff options
context:
space:
mode:
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;
+}