Commit 63a4620 1 parent ccdee23 commit 63a4620 Copy full SHA for 63a4620
File tree 2 files changed +13
-19
lines changed
2 files changed +13
-19
lines changed Original file line number Diff line number Diff line change @@ -682,7 +682,7 @@ impl<'x> HeaderValue<'x> {
682
682
pub fn as_text_ref ( & self ) -> Option < & str > {
683
683
match * self {
684
684
HeaderValue :: Text ( ref s) => Some ( s) ,
685
- HeaderValue :: TextList ( ref l) => l. get ( 0 ) ?. as_ref ( ) . into ( ) ,
685
+ HeaderValue :: TextList ( ref l) => l. last ( ) ?. as_ref ( ) . into ( ) ,
686
686
_ => None ,
687
687
}
688
688
}
Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ pub fn parse_headers<'x>(
45
45
46
46
match result {
47
47
HeaderParserResult :: Rfc ( name) => {
48
- let ( is_many , parser) = HDR_PARSER [ name as usize ] ;
48
+ let ( _ , parser) = HDR_PARSER [ name as usize ] ;
49
49
50
50
let from_offset = stream. pos ;
51
51
let value = parser ( stream) ;
@@ -58,25 +58,19 @@ pub fn parse_headers<'x>(
58
58
} ) ;
59
59
60
60
if !value. is_empty ( ) {
61
- if is_many {
62
- match headers_rfc. entry ( name) {
63
- Entry :: Occupied ( mut e) => {
64
- if let HeaderValue :: Collection ( col) = e. get_mut ( ) {
65
- col. push ( value) ;
66
- } else {
67
- let old_value = e. remove ( ) ;
68
- headers_rfc. insert (
69
- name,
70
- HeaderValue :: Collection ( vec ! [ old_value, value] ) ,
71
- ) ;
72
- }
73
- }
74
- Entry :: Vacant ( e) => {
75
- e. insert ( value) ;
61
+ match headers_rfc. entry ( name) {
62
+ Entry :: Occupied ( mut e) => {
63
+ if let HeaderValue :: Collection ( col) = e. get_mut ( ) {
64
+ col. push ( value) ;
65
+ } else {
66
+ let old_value = e. remove ( ) ;
67
+ headers_rfc
68
+ . insert ( name, HeaderValue :: Collection ( vec ! [ old_value, value] ) ) ;
76
69
}
77
70
}
78
- } else {
79
- headers_rfc. insert ( name, value) ;
71
+ Entry :: Vacant ( e) => {
72
+ e. insert ( value) ;
73
+ }
80
74
}
81
75
}
82
76
}
You can’t perform that action at this time.
0 commit comments