File tree Expand file tree Collapse file tree 8 files changed +30
-14
lines changed Expand file tree Collapse file tree 8 files changed +30
-14
lines changed Original file line number Diff line number Diff line change @@ -45,7 +45,10 @@ package AWS.HTTP2.Frame.Continuation is
4545 Stream_Id : HTTP2.Stream_Id;
4646 List : Headers.List;
4747 End_Headers : Boolean := True) return Object
48- with Post => (if End_Headers then Create'Result.Flags = End_Headers_Flag);
48+ with Pre => Stream_Id /= 0 ,
49+ Post => (if End_Headers then Create'Result.Flags = End_Headers_Flag)
50+ and then Create'Result.Kind = K_Continuation;
51+ -- Create a CONTINUATION frame with given content
4952
5053 overriding procedure Send_Payload
5154 (Self : Object; Sock : Net.Socket_Type'Class);
@@ -56,11 +59,13 @@ package AWS.HTTP2.Frame.Continuation is
5659 -- Iterator interface
5760
5861 function Content_Length
59- (Self : Object) return Stream_Element_Count;
62+ (Self : Object) return Stream_Element_Count
63+ with Pre => Self.Is_Defined;
6064
6165 function Get
6266 (Self : Object;
63- Index : Stream_Element_Offset) return Stream_Element;
67+ Index : Stream_Element_Offset) return Stream_Element
68+ with Pre => Self.Is_Defined;
6469
6570private
6671
Original file line number Diff line number Diff line change @@ -50,14 +50,16 @@ package AWS.HTTP2.Frame.Data is
5050 function Create
5151 (Stream_Id : HTTP2.Stream_Id;
5252 Content : String) return Object
53- with Pre => Stream_Id > 0 and then Content'Length > 0 ;
53+ with Pre => Stream_Id > 0 and then Content'Length > 0 ,
54+ Post => Create'Result.Kind = K_Data;
5455 -- Create a DATA frame with given content and stream id
5556
5657 function Create
5758 (Stream_Id : HTTP2.Stream_Id;
5859 Content : Utils.Stream_Element_Array_Access;
5960 End_Stream : Boolean) return Object
60- with Pre => Stream_Id > 0 and then Content'Length > 0 ;
61+ with Pre => Stream_Id > 0 and then Content'Length > 0 ,
62+ Post => Create'Result.Kind = K_Data;
6163 -- Create a DATA frame with given content and stream id
6264
6365 overriding procedure Send_Payload
Original file line number Diff line number Diff line change @@ -45,7 +45,8 @@ package AWS.HTTP2.Frame.GoAway is
4545
4646 function Create
4747 (Stream_Id : Stream.Id;
48- Error : Error_Codes) return Object;
48+ Error : Error_Codes) return Object
49+ with Post => Create'Result.Kind = K_GoAway;
4950 -- Create a GOAWAY frame with given content and stream id
5051
5152 function Error (Self : Object) return Error_Codes
Original file line number Diff line number Diff line change @@ -48,7 +48,8 @@ package AWS.HTTP2.Frame.Priority is
4848 (Stream_Id : HTTP2.Stream_Id;
4949 Stream_Dependency : HTTP2.Stream_Id;
5050 Weight : Byte_1) return Object
51- with Pre => Stream_Id /= Stream_Dependency;
51+ with Pre => Stream_Id /= Stream_Dependency,
52+ Post => Create'Result.Kind = K_Priority;
5253 -- Create a PRIORITY frame (stream id is always 0)
5354
5455 function Read
Original file line number Diff line number Diff line change @@ -58,14 +58,16 @@ package AWS.HTTP2.Frame.Push_Promise is
5858 Promise_Stream_Id : HTTP2.Stream_Id;
5959 List : AWS.Headers.List;
6060 End_Headers : Boolean := True) return Object
61- with Post => (if End_Headers then Create'Result.Flags = End_Headers_Flag);
61+ with Post => (if End_Headers then Create'Result.Flags = End_Headers_Flag)
62+ and then Create'Result.Kind = K_Push_Promise;
6263 -- Create an HEADERS frame with given content and stream id
6364
6465 function Get
6566 (Self : Object;
6667 Table : not null access HTTP2.HPACK.Table.Object;
6768 Settings : not null access HTTP2.Connection.Object)
68- return AWS.Headers.List;
69+ return AWS.Headers.List
70+ with Pre => Self.Is_Defined;
6971 -- Get the header list out of the HEADERS frame. This reads the content of
7072 -- the payload and decode using HPACK.
7173
Original file line number Diff line number Diff line change @@ -47,8 +47,10 @@ package AWS.HTTP2.Frame.RST_Stream is
4747
4848 function Create
4949 (Error : Error_Codes;
50- Stream_Id : Stream.Id) return Object;
51- -- Create an RST_Stream frame (stream id is 0)
50+ Stream_Id : Stream.Id) return Object
51+ with Pre => Stream_Id /= 0 ,
52+ Post => Create'Result.Kind = K_RST_Stream;
53+ -- Create an RST_Stream frame
5254
5355 overriding procedure Send_Payload
5456 (Self : Object; Sock : Net.Socket_Type'Class)
Original file line number Diff line number Diff line change @@ -124,7 +124,8 @@ package AWS.HTTP2.Frame is
124124 (Self : Object'Class;
125125 Settings : Connection.Object;
126126 Error : out Error_Codes) return Boolean
127- with Pre => Self.Is_Defined;
127+ with Pre => Self.Is_Defined,
128+ Post => Is_Valid'Result = (Error = C_No_Error);
128129 -- Set Error to appropriate value with Validate routine and return True if
129130 -- Error became C_No_Error, returns False otherwise.
130131
Original file line number Diff line number Diff line change @@ -62,11 +62,13 @@ package AWS.HTTP2 is
6262 -- "PRI * HTTP/2.0" & CRLF & CRLF & "SM" & CRLF & CRLF
6363
6464 function Exception_Message
65- (Error : Error_Codes; Message : String) return String;
65+ (Error : Error_Codes; Message : String) return String
66+ with Pre => Message /= " " ;
6667 -- Build an exception message with the error code endoded at the start of
6768 -- the message and surrounded with square brackets.
6869
69- function Exception_Code (Exception_Message : String) return Error_Codes;
70+ function Exception_Code (Exception_Message : String) return Error_Codes
71+ with Pre => Exception_Message'Length > 2 ;
7072 -- Extract the execption code from an exception message built with the
7173 -- Exception_Message routine above.
7274
You can’t perform that action at this time.
0 commit comments