| 683 | } |
| 684 | |
| 685 | bool 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 | |
| 712 | void TClientRequest::ReleaseConnection() { |
| 713 | if (Conn_ && HttpConn_ && HttpServ()->Options().KeepAliveEnabled && HttpConn_->CanBeKeepAlive() && (!HttpServ()->Options().RejectExcessConnections || !HttpServ()->MaxRequestsReached())) { |