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

Method DoRun

library/cpp/neh/https.cpp:1237–1289  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1235 }
1236
1237 void DoRun(TCont* c) override {
1238 THolder<THttpsRequest> This(this);
1239
1240 if (c->Cancelled()) {
1241 Hndl_->NotifyError(new TError("canceled", TError::TType::Cancelled));
1242 return;
1243 }
1244
1245 TErrorRef error;
1246 TConnCache::TConnectionRef connection(ConnectionCache()->Connect(c, Msg_.Addr, *Addr_, &error));
1247 if (!connection) {
1248 Hndl_->NotifyError(error);
1249 return;
1250 }
1251
1252 TSslClientIOStream io(TSslCtxClient::Instance(), Loc_, (*connection)->Fd(), Hndl_->CanceledPtr());
1253 TContBIOWatcher w(io, c);
1254 TString received;
1255 THttpHeaders headers;
1256 TString firstLine;
1257
1258 try {
1259 if ((*connection)->HasSsl()) {
1260 io.SetSsl((*connection)->MoveSsl());
1261 } else {
1262 io.Handshake();
1263 }
1264 RequestData().SendTo(io);
1265 Req_.Destroy();
1266 error = ProcessRecv(io, &received, &headers, &firstLine);
1267 (*connection)->SetSsl(io.MoveSsl());
1268 (*connection)->ResetBIO();
1269 } catch (const TSystemError& e) {
1270 if (c->Cancelled() || e.Status() == ECANCELED) {
1271 error = new TError("canceled", TError::TType::Cancelled);
1272 } else {
1273 error = new TError(CurrentExceptionMessage());
1274 }
1275 } catch (...) {
1276 if (c->Cancelled()) {
1277 error = new TError("canceled", TError::TType::Cancelled);
1278 } else {
1279 error = new TError(CurrentExceptionMessage());
1280 }
1281 }
1282
1283 if (error) {
1284 Hndl_->NotifyError(error, received, firstLine, headers);
1285 } else {
1286 ConnectionCache()->Release(connection);
1287 Hndl_->NotifyResponse(received, firstLine, headers);
1288 }
1289 }
1290
1291 TErrorRef ProcessRecv(TSslClientIOStream& io, TString* data, THttpHeaders* headers, TString* firstLine) {
1292 io.WaitUntilWritten();

Callers

nothing calls this directly

Calls 15

ConnectionCacheFunction · 0.85
InstanceFunction · 0.85
CurrentExceptionMessageFunction · 0.85
CancelledMethod · 0.80
CanceledPtrMethod · 0.80
HasSslMethod · 0.80
ResetBIOMethod · 0.80
NotifyErrorMethod · 0.45
ConnectMethod · 0.45
FdMethod · 0.45
SetSslMethod · 0.45
HandshakeMethod · 0.45

Tested by

no test coverage detected