@@ -610,7 +610,7 @@ pub const Request = struct {
610
610
req .response .headers .deinit ();
611
611
612
612
if (req .connection ) | connection | {
613
- if (! req .response .parser .done ) {
613
+ if (req .response .parser .state != .complete ) {
614
614
// If the response wasn't fully read, then we need to close the connection.
615
615
connection .closing = true ;
616
616
}
@@ -624,7 +624,7 @@ pub const Request = struct {
624
624
// This function must deallocate all resources associated with the request, or keep those which will be used
625
625
// This needs to be kept in sync with deinit and request
626
626
fn redirect (req : * Request , uri : Uri ) ! void {
627
- assert (req .response .parser .done );
627
+ assert (req .response .parser .state == .complete );
628
628
629
629
switch (req .response .compression ) {
630
630
.none = > {},
@@ -794,12 +794,12 @@ pub const Request = struct {
794
794
}
795
795
796
796
fn transferRead (req : * Request , buf : []u8 ) TransferReadError ! usize {
797
- if (req .response .parser .done ) return 0 ;
797
+ if (req .response .parser .state == .complete ) return 0 ;
798
798
799
799
var index : usize = 0 ;
800
800
while (index == 0 ) {
801
801
const amt = try req .response .parser .read (req .connection .? , buf [index .. ], req .response .skip );
802
- if (amt == 0 and req .response .parser .done ) break ;
802
+ if (amt == 0 and req .response .parser .state == .complete ) break ;
803
803
index += amt ;
804
804
}
805
805
@@ -840,7 +840,7 @@ pub const Request = struct {
840
840
try req .response .parse (req .response .parser .get (), false );
841
841
842
842
if (req .response .status == .@"continue" ) {
843
- req .response .parser .done = true ; // we're done parsing the continue response, reset to prepare for the real response
843
+ req .response .parser .state = .complete ; // we're done parsing the continue response, reset to prepare for the real response
844
844
req .response .parser .reset ();
845
845
846
846
if (req .handle_continue )
@@ -852,7 +852,7 @@ pub const Request = struct {
852
852
// we're switching protocols, so this connection is no longer doing http
853
853
if (req .method == .CONNECT and req .response .status .class () == .success ) {
854
854
req .connection .? .closing = false ;
855
- req .response .parser .done = true ;
855
+ req .response .parser .state = .complete ;
856
856
857
857
return ; // the connection is not HTTP past this point, return to the caller
858
858
}
@@ -872,8 +872,10 @@ pub const Request = struct {
872
872
// Any response to a HEAD request and any response with a 1xx (Informational), 204 (No Content), or 304 (Not Modified)
873
873
// status code is always terminated by the first empty line after the header fields, regardless of the header fields
874
874
// present in the message
875
- if (req .method == .HEAD or req .response .status .class () == .informational or req .response .status == .no_content or req .response .status == .not_modified ) {
876
- req .response .parser .done = true ;
875
+ if (req .method == .HEAD or req .response .status .class () == .informational or
876
+ req .response .status == .no_content or req .response .status == .not_modified )
877
+ {
878
+ req .response .parser .state = .complete ;
877
879
878
880
return ; // the response is empty, no further setup or redirection is necessary
879
881
}
@@ -889,7 +891,7 @@ pub const Request = struct {
889
891
} else if (req .response .content_length ) | cl | {
890
892
req .response .parser .next_chunk_length = cl ;
891
893
892
- if (cl == 0 ) req .response .parser .done = true ;
894
+ if (cl == 0 ) req .response .parser .state = .complete ;
893
895
} else {
894
896
// read until the connection is closed
895
897
req .response .parser .next_chunk_length = std .math .maxInt (u64 );
@@ -947,7 +949,7 @@ pub const Request = struct {
947
949
try req .send (.{});
948
950
} else {
949
951
req .response .skip = false ;
950
- if (! req .response .parser .done ) {
952
+ if (req .response .parser .state != .complete ) {
951
953
switch (req .response .transfer_compression ) {
952
954
.identity = > req .response .compression = .none ,
953
955
.compress , .@"x-compress" = > return error .CompressionNotSupported ,
0 commit comments