@@ -641,20 +641,6 @@ pub const Transfer = struct {
641641 return buf_len ;
642642 }
643643
644- var hdr = & transfer .response_header .? ;
645-
646- if (hdr ._content_type_len == 0 ) {
647- const CONTENT_TYPE_LEN = "content-type:" .len ;
648- if (header .len > CONTENT_TYPE_LEN ) {
649- if (std .ascii .eqlIgnoreCase (header [0.. CONTENT_TYPE_LEN ], "content-type:" )) {
650- const value = std .mem .trimLeft (u8 , header [CONTENT_TYPE_LEN .. ], " " );
651- const len = @min (value .len , hdr ._content_type .len );
652- hdr ._content_type_len = len ;
653- @memcpy (hdr ._content_type [0.. len ], value [0.. len ]);
654- }
655- }
656- }
657-
658644 {
659645 const SET_COOKIE_LEN = "set-cookie:" .len ;
660646 if (header .len > SET_COOKIE_LEN ) {
@@ -668,7 +654,8 @@ pub const Transfer = struct {
668654 }
669655
670656 if (buf_len == 2 ) {
671- if (getResponseHeader (easy , "content-type" )) | value | {
657+ if (getResponseHeader (easy , "content-type" , 0 )) | value | {
658+ var hdr = & transfer .response_header .? ;
672659 const len = @min (value .len , hdr ._content_type .len );
673660 hdr ._content_type_len = len ;
674661 @memcpy (hdr ._content_type [0.. len ], value [0.. len ]);
@@ -761,9 +748,9 @@ const HeaderIterator = struct {
761748 }
762749};
763750
764- fn getResponseHeader (easy : * c.CURL , name : [:0 ]const u8 ) ? []const u8 {
751+ fn getResponseHeader (easy : * c.CURL , name : [:0 ]const u8 , index : usize ) ? []const u8 {
765752 var hdr : [* c ]c.curl_header = null ;
766- const result = c .curl_easy_header (easy , name , 0 , c .CURLH_HEADER , -1 , & hdr );
753+ const result = c .curl_easy_header (easy , name , index , c .CURLH_HEADER , -1 , & hdr );
767754 if (result == c .CURLE_OK ) {
768755 return std .mem .span (hdr .* .value );
769756 }
0 commit comments