File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -200,6 +200,11 @@ class THttpMonLegacyActorRequest : public TActorBootstrapped<THttpMonLegacyActor
200200 if (Event->Get ()->Request ->Method == " OPTIONS" ) {
201201 return ReplyOptionsAndPassAway ();
202202 }
203+ try {
204+ Container.GetHeaders ();
205+ } catch (const yexception& exception) {
206+ return ReplyBadRequestAndPassAway (exception.what ());
207+ }
203208 Become (&THttpMonLegacyActorRequest::StateFunc);
204209 if (ActorMonPage->Authorizer ) {
205210 NActors::IEventHandle* handle = ActorMonPage->Authorizer (SelfId (), Container);
@@ -247,6 +252,18 @@ class THttpMonLegacyActorRequest : public TActorBootstrapped<THttpMonLegacyActor
247252 PassAway ();
248253 }
249254
255+ void ReplyBadRequestAndPassAway (const TString& message) {
256+ NHttp::THttpIncomingRequestPtr request = Event->Get ()->Request ;
257+ TStringBuilder response;
258+ response << " HTTP/1.1 400 Bad Request\r\n "
259+ << " Content-Type: text/plain\r\n "
260+ << " Connection: close\r\n "
261+ << " \r\n "
262+ << message << " \r\n " ;
263+ ReplyWith (request->CreateResponseString (response));
264+ PassAway ();
265+ }
266+
250267 void ReplyUnathorizedAndPassAway (const TString& error = {}) {
251268 NHttp::THttpIncomingRequestPtr request = Event->Get ()->Request ;
252269 NHttp::THeaders headers (request->Headers );
You can’t perform that action at this time.
0 commit comments