@@ -118,8 +118,7 @@ begin
118118 AWS.Log.Write
119119 (LA.Server.Error_Log,
120120 Request,
121- Utils.CRLF_2_Spaces
122- (Ada.Exceptions.Exception_Information (E)));
121+ Utils.CRLF_2_Spaces (Exception_Information (E)));
123122 return False;
124123 end Send_Error_Answer ;
125124
@@ -282,25 +281,33 @@ begin
282281 AWS.Log.Write
283282 (LA.Server.Error_Log,
284283 Request,
285- Utils.CRLF_2_Spaces (Ada.Exceptions. Exception_Information (E)));
284+ Utils.CRLF_2_Spaces (Exception_Information (E)));
286285
287286 Will_Close := True;
288287
289288 if AWS.Status.Protocol (Request) = AWS.Status.H2
290289 or else (CNF.HTTP2_Activated (LA.Server.Properties)
291290 and then not CNF.Security (LA.Server.Properties))
292291 then
293- HTTP2.Frame.GoAway.Create
294- (Stream_Id => 0 ,
295- Error => HTTP2.C_Protocol_Error).Send (Sock_Ptr.all );
292+ -- We don't want to fail, if the socket is closed already
293+ -- we ignore the socket error.
294+
295+ begin
296+ HTTP2.Frame.GoAway.Create
297+ (Stream_Id => 0 ,
298+ Error => HTTP2.C_Protocol_Error).Send (Sock_Ptr.all );
299+ exception
300+ when Net.Socket_Error =>
301+ null ;
302+ end ;
296303
297304 exit For_Every_Request;
298305
299306 else
300307 Error_Answer := Response.Build
301308 (Status_Code => Messages.S400,
302309 Content_Type => " text/plain" ,
303- Message_Body => Ada.Exceptions. Exception_Message (E));
310+ Message_Body => Exception_Message (E));
304311
305312 LA.Server.Slots.Mark_Phase (LA.Line, Server_Response);
306313
@@ -314,16 +321,15 @@ begin
314321 AWS.Log.Write
315322 (LA.Server.Error_Log,
316323 Request,
317- Utils.CRLF_2_Spaces
318- (Ada.Exceptions.Exception_Information (E)));
324+ Utils.CRLF_2_Spaces (Exception_Information (E)));
319325
320326 Will_Close := True;
321327
322328 if First_Line then
323329 Error_Answer := Response.Build
324330 (Status_Code => Messages.S414,
325331 Content_Type => " text/plain" ,
326- Message_Body => Ada.Exceptions. Exception_Message (E));
332+ Message_Body => Exception_Message (E));
327333
328334 elsif
329335 Exception_Identity (E) =
@@ -332,13 +338,13 @@ begin
332338 Error_Answer := Response.Build
333339 (Status_Code => Messages.S403,
334340 Content_Type => " text/plain" ,
335- Message_Body => Ada.Exceptions. Exception_Message (E));
341+ Message_Body => Exception_Message (E));
336342
337343 else
338344 Error_Answer := Response.Build
339345 (Status_Code => Messages.S400,
340346 Content_Type => " text/plain" ,
341- Message_Body => Ada.Exceptions. Exception_Message (E));
347+ Message_Body => Exception_Message (E));
342348 end if ;
343349
344350 LA.Server.Slots.Mark_Phase (LA.Line, Server_Response);
0 commit comments