better embedded use with outside proxy

This commit is contained in:
Adam D. Ruppe 2017-11-18 10:56:57 -05:00
parent 14eacbf28b
commit bbe1a19b68
1 changed files with 6 additions and 2 deletions

8
cgi.d
View File

@ -1312,7 +1312,7 @@ class Cgi {
/** /**
Initializes it from raw HTTP request data. GenericMain uses this when you compile with -version=embedded_httpd. Initializes it from raw HTTP request data. GenericMain uses this when you compile with -version=embedded_httpd.
NOTE: If you are behind a reverse proxy, the values here might not be what you expect.... FIXME somehow. NOTE: If you are behind a reverse proxy, the values here might not be what you expect.... it will use X-Forwarded-For for remote IP and X-Forwarded-Host for host
Params: Params:
inputData = the incoming data, including headers and other raw http data. inputData = the incoming data, including headers and other raw http data.
@ -1478,6 +1478,10 @@ class Cgi {
case "content-length": case "content-length":
contentLength = to!size_t(value); contentLength = to!size_t(value);
break; break;
case "x-forwarded-for":
remoteAddress = value;
break;
case "x-forwarded-host":
case "host": case "host":
host = value; host = value;
break; break;
@ -3225,7 +3229,7 @@ class BufferedInputRange {
if(ret == Socket.ERROR) { if(ret == Socket.ERROR) {
version(Posix) { version(Posix) {
import core.stdc.errno; import core.stdc.errno;
if(errno == EINTR) { if(errno == EINTR || errno == EAGAIN) {
goto try_again; goto try_again;
} }
} }