| 778 | } |
| 779 | |
| 780 | void TClientRequest::ProcessFailRequest(int failstate) { |
| 781 | Output() << "HTTP/1.1 503 Service Unavailable\r\n" |
| 782 | "Content-Type: text/plain\r\n" |
| 783 | "Content-Length: 21\r\n" |
| 784 | "\r\n" |
| 785 | "Service Unavailable\r\n"; |
| 786 | |
| 787 | TString url; |
| 788 | |
| 789 | if (!strnicmp(RequestString.data(), "GET ", 4)) { |
| 790 | // Trying to extract url... |
| 791 | const char* str = RequestString.data(); |
| 792 | |
| 793 | // Skipping spaces before url... |
| 794 | size_t start = 3; |
| 795 | while (str[start] == ' ') { |
| 796 | ++start; |
| 797 | } |
| 798 | |
| 799 | if (str[start]) { |
| 800 | // Traversing url... |
| 801 | size_t idx = start; |
| 802 | |
| 803 | while (str[idx] != ' ' && str[idx]) { |
| 804 | ++idx; |
| 805 | } |
| 806 | |
| 807 | url = RequestString.substr(start, idx - start); |
| 808 | } |
| 809 | } |
| 810 | |
| 811 | const THttpServer::ICallBack::TFailLogData d = { |
| 812 | failstate, |
| 813 | url, |
| 814 | }; |
| 815 | |
| 816 | // Handling failure... |
| 817 | Conn_->HttpServ_->Cb_->OnFailRequestEx(d); |
| 818 | Output().Flush(); |
| 819 | } |
| 820 | |
| 821 | THttpServer* TClientRequest::HttpServ() const noexcept { |
| 822 | return Conn_->HttpServ_->Parent_; |
nothing calls this directly
no test coverage detected