Skip to content

Instantly share code, notes, and snippets.

@ptarjan
Created January 14, 2014 02:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ptarjan/8411810 to your computer and use it in GitHub Desktop.
Save ptarjan/8411810 to your computer and use it in GitHub Desktop.
diff --git a/hphp/runtime/server/fastcgi/fastcgi-transport.cpp b/hphp/runtime/server/fastcgi/fastcgi-transport.cpp
index ae0dddf..28e719a 100644
--- a/hphp/runtime/server/fastcgi/fastcgi-transport.cpp
+++ b/hphp/runtime/server/fastcgi/fastcgi-transport.cpp
@@ -303,6 +303,7 @@ void FastCGITransport::onBodyComplete() {
const std::string FastCGITransport::k_requestURIKey = "REQUEST_URI";
const std::string FastCGITransport::k_remoteHostKey = "REMOTE_HOST";
+const std::string FastCGITransport::k_remoteAddrKey = "REMOTE_ADDR";
const std::string FastCGITransport::k_remotePortKey = "REMOTE_PORT";
const std::string FastCGITransport::k_methodKey = "REQUEST_METHOD";
const std::string FastCGITransport::k_httpVersionKey = "HTTP_VERSION";
@@ -340,6 +341,9 @@ void FastCGITransport::handleHeader(const std::string& key,
m_requestURI = value;
} else if (compareKeys(key, k_remoteHostKey)) {
m_remoteHost = value;
+ } else if (compareKeys(key, k_remoteAddrKey)) {
+ // This is an alternate name for the same headers as k_remoteHostKey
+ m_remoteHost = value;
} else if (compareKeys(key, k_remotePortKey)) {
try {
int remote_port = std::stoi(value);
diff --git a/hphp/runtime/server/fastcgi/fastcgi-transport.h b/hphp/runtime/server/fastcgi/fastcgi-transport.h
index 016a283..0d5da21 100644
--- a/hphp/runtime/server/fastcgi/fastcgi-transport.h
+++ b/hphp/runtime/server/fastcgi/fastcgi-transport.h
@@ -110,6 +110,7 @@ private:
static const std::string k_requestURIKey;
static const std::string k_remoteHostKey;
+ static const std::string k_remoteAddrKey;
static const std::string k_remotePortKey;
static const std::string k_methodKey;
static const std::string k_httpVersionKey;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment