Fix duplicate HTTP headers
When the same header is passed in, Apache/PHP will comma delimit all header values for the returned values in apache_request_headers and $_SERVER['HTTP_*'].
Esse commit está contido em:
@@ -29,6 +29,7 @@
|
||||
#include "hphp/runtime/base/server/replay_transport.h"
|
||||
#include "hphp/runtime/base/server/virtual_host.h"
|
||||
#include "hphp/runtime/base/util/http_client.h"
|
||||
#include "folly/String.h"
|
||||
|
||||
#define DEFAULT_POST_CONTENT_TYPE "application/x-www-form-urlencoded"
|
||||
|
||||
@@ -281,10 +282,10 @@ void HttpProtocol::PrepareSystemVariables(Transport *transport,
|
||||
}
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < values.size(); i++) {
|
||||
{
|
||||
String key = "HTTP_";
|
||||
key += StringUtil::ToUpper(iter->first).replace("-", "_");
|
||||
server.set(key, String(values[i]));
|
||||
server.set(key, String(folly::join(", ", values)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "hphp/runtime/base/runtime_option.h"
|
||||
#include "hphp/runtime/base/server/server_note.h"
|
||||
#include "hphp/runtime/base/server/transport.h"
|
||||
#include "folly/String.h"
|
||||
|
||||
namespace HPHP {
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@@ -45,7 +46,7 @@ Array f_apache_request_headers() {
|
||||
for (HeaderMap::const_iterator iter = headers.begin();
|
||||
iter != headers.end(); ++iter) {
|
||||
const vector<string> &values = iter->second;
|
||||
ret.set(String(iter->first), String(values.back()));
|
||||
ret.set(String(iter->first), String(folly::join(", ", values)));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário