Browse Source

Fix "clrf" typo

CR LF stands for "carriage return" and "line feed"
openbsd
link2xt 8 months ago
parent
commit
1d733d03b1
1 changed files with 7 additions and 7 deletions
  1. 7
    7
      src/gemini/client.rs

+ 7
- 7
src/gemini/client.rs View File

@@ -48,13 +48,13 @@ pub fn get_data<T: Protocol>(url: T) -> Result<(Option<Vec<u8>>, Vec<u8>), Strin
48 48
                                 let mut res = vec![];
49 49
                                 stream.read_to_end(&mut res).unwrap();
50 50
 
51
-                                let clrf_idx = find_clrf(&res);
51
+                                let crlf_idx = find_crlf(&res);
52 52
 
53
-                                if clrf_idx.is_none() {
54
-                                    return Err("Failed to read response (missing clrf)".to_string());
53
+                                if crlf_idx.is_none() {
54
+                                    return Err("Failed to read response (missing crlf)".to_string());
55 55
                                 }
56 56
 
57
-                                let content = res.split_off(clrf_idx.unwrap() + 2);
57
+                                let content = res.split_off(crlf_idx.unwrap() + 2);
58 58
 
59 59
                                 Ok((Some(res), content))
60 60
                             })
@@ -72,7 +72,7 @@ pub fn get_data<T: Protocol>(url: T) -> Result<(Option<Vec<u8>>, Vec<u8>), Strin
72 72
     }
73 73
 }
74 74
 
75
-fn find_clrf(data: &[u8]) -> Option<usize> {
76
-    let clrf = b"\r\n";
77
-    data.windows(clrf.len()).position(|window| window == clrf)
75
+fn find_crlf(data: &[u8]) -> Option<usize> {
76
+    let crlf = b"\r\n";
77
+    data.windows(crlf.len()).position(|window| window == crlf)
78 78
 }

Loading…
Cancel
Save