MCPcopy Create free account
hub / github.com/catboost/catboost / CheckLoopback

Method CheckLoopback

library/cpp/http/server/http.cpp:685–710  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

683}
684
685bool TClientRequest::CheckLoopback() {
686 bool isLocal = false;
687
688 try {
689 isLocal = IsLocal();
690 } catch (const yexception& e) {
691 Output() << "HTTP/1.0 500 Oops\r\n\r\n"
692 << e.what() << "\r\n";
693 return false;
694 }
695
696 if (!isLocal) {
697 Output() << "HTTP/1.0 403 Permission denied\r\n"
698 "Content-Type: text/html; charset=windows-1251\r\n"
699 "Connection: close\r\n"
700 "\r\n"
701 "<html><head><title>Permission denied</title></head>"
702 "<body><h1>Permission denied</h1>"
703 "<p>This request must be sent from the localhost.</p>"
704 "</body></html>\r\n";
705
706 return false;
707 }
708
709 return true;
710}
711
712void TClientRequest::ReleaseConnection() {
713 if (Conn_ && HttpConn_ && HttpServ()->Options().KeepAliveEnabled && HttpConn_->CanBeKeepAlive() && (!HttpServ()->Options().RejectExcessConnections || !HttpServ()->MaxRequestsReached())) {

Callers

nothing calls this directly

Calls 2

IsLocalFunction · 0.50
whatMethod · 0.45

Tested by

no test coverage detected