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

Method Reply

library/cpp/http/io/stream_ut.cpp:26–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24 }
25
26 bool Reply(void* /*tsr*/) override {
27 if (!ProcessHeaders()) {
28 return true;
29 }
30
31 // Check that function will not hang on
32 Input().ReadAll();
33
34 // "lo" is for "local"
35 if (RD.ServerName() == "yandex.lo") {
36 // do redirect
37 Output() << "HTTP/1.1 301 Moved permanently\r\n"
38 "Location: http://www.yandex.lo\r\n"
39 "\r\n";
40 } else if (RD.ServerName() == "www.yandex.lo") {
41 Output() << "HTTP/1.1 200 Ok\r\n"
42 "\r\n";
43 } else {
44 Output() << "HTTP/1.1 200 Ok\r\n\r\n";
45 if (Buf.Size()) {
46 Output().Write(Buf.AsCharPtr(), Buf.Size());
47 } else {
48 Output() << Parent_->Res_;
49 }
50 }
51 Output().Finish();
52
53 Parent_->LastRequestSentSize_ = Output().SentSize();
54
55 return true;
56 }
57
58 private:
59 TTestHttpServer* Parent_ = nullptr;

Callers

nothing calls this directly

Calls 6

ReadAllMethod · 0.80
AsCharPtrMethod · 0.80
SizeMethod · 0.45
WriteMethod · 0.45
FinishMethod · 0.45
SentSizeMethod · 0.45

Tested by

no test coverage detected