Bug #4417 » bug_4417_2.patch
| src/http/ProxyReply.C | ||
|---|---|---|
|
void ProxyReply::assembleRequestHeaders()
|
||
|
{
|
||
|
std::ostream os(&requestBuf_);
|
||
|
os << request_.method.data << " " << request_.uri.data << " HTTP/1.1\r\n";
|
||
|
os << request_.method << " " << request_.uri << " HTTP/1.1\r\n";
|
||
|
bool establishWebSockets = false;
|
||
|
std::string forwardedFor;
|
||
|
for (Request::HeaderList::const_iterator it = request_.headers.begin();
|
||
| ... | ... | |
|
} else if (it->name.iequals("X-Forwarded-For") || it->name.iequals("Client-IP")) {
|
||
|
const Wt::Configuration& wtConfiguration = connection()->server()->controller()->configuration();
|
||
|
if (wtConfiguration.behindReverseProxy()) {
|
||
|
forwardedFor = std::string(it->value.data) + ", ";
|
||
|
forwardedFor = it->value.str() + ", ";
|
||
|
}
|
||
|
} else if (it->name.iequals("Upgrade")) {
|
||
|
if (it->value.iequals("websocket")) {
|
||
|
establishWebSockets = true;
|
||
|
}
|
||
|
} else {
|
||
|
os << it->name.data << ": " << it->value.data << "\r\n";
|
||
|
} else if (it->name.length() > 0) {
|
||
|
os << it->name << ": " << it->value << "\r\n";
|
||
|
}
|
||
|
}
|
||
|
if (establishWebSockets) {
|
||
| ... | ... | |
|
&& !wtConfiguration.reloadIsNewSession()) {
|
||
|
const Request::Header *cookieHeader = request_.getHeader("Cookie");
|
||
|
if (cookieHeader) {
|
||
|
sessionId = Wt::WebController::sessionFromCookie(cookieHeader->value.data,
|
||
|
request_.request_path,
|
||
|
wtConfiguration.sessionIdLength());
|
||
|
std::string cookie = cookieHeader->value.str();
|
||
|
sessionId = Wt::WebController::sessionFromCookie(cookie.c_str(),
|
||
|
request_.request_path,
|
||
|
wtConfiguration.sessionIdLength());
|
||
|
}
|
||
|
}
|
||
| src/http/Request.C | ||
|---|---|---|
|
#endif
|
||
|
}
|
||
|
void buffer_string::write(std::ostream &os) const
|
||
|
{
|
||
|
for (const buffer_string *s = this; s; s = s->next) {
|
||
|
os.write(s->data, s->len);
|
||
|
}
|
||
|
}
|
||
|
std::ostream& operator<< (std::ostream &os, const buffer_string &str)
|
||
|
{
|
||
|
str.write(os);
|
||
|
return os;
|
||
|
}
|
||
|
bool buffer_string::operator==(const buffer_string& other) const
|
||
|
{
|
||
|
if (next || other.next)
|
||
| src/http/Request.h | ||
|---|---|---|
|
bool contains(const char *s) const;
|
||
|
bool icontains(const char *s) const;
|
||
|
bool iequals(const char *s) const;
|
||
|
void write(std::ostream &os) const;
|
||
|
bool operator==(const buffer_string& other) const;
|
||
|
bool operator==(const std::string& other) const;
|
||
| ... | ... | |
|
bool operator!=(const char *other) const;
|
||
|
};
|
||
|
std::ostream& operator<< (std::ostream &os, const buffer_string &str);
|
||
|
/// A request received from a client.
|
||
|
/// A request with a body will have a content-length.
|
||
|
class Request
|
||
- « Previous
- 1
- 2
- Next »