~julienxx/castor

Fix "clrf" typo v1 APPLIED

link2xt: 1
 Fix "clrf" typo

 1 files changed, 7 insertions(+), 7 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~julienxx/castor/patches/13030/mbox | git am -3
Learn more about email & git

[PATCH] Fix "clrf" typo Export this patch

CR LF stands for "carriage return" and "line feed"
---
 src/gemini/client.rs | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/gemini/client.rs b/src/gemini/client.rs
index 68663e2..bf28cf7 100644
--- a/src/gemini/client.rs
+++ b/src/gemini/client.rs
@@ -48,13 +48,13 @@ pub fn get_data<T: Protocol>(url: T) -> Result<(Option<Vec<u8>>, Vec<u8>), Strin
                                let mut res = vec![];
                                stream.read_to_end(&mut res).unwrap();

                                let clrf_idx = find_clrf(&res);
                                let crlf_idx = find_crlf(&res);

                                if clrf_idx.is_none() {
                                    return Err("Failed to read response (missing clrf)".to_string());
                                if crlf_idx.is_none() {
                                    return Err("Failed to read response (missing crlf)".to_string());
                                }

                                let content = res.split_off(clrf_idx.unwrap() + 2);
                                let content = res.split_off(crlf_idx.unwrap() + 2);

                                Ok((Some(res), content))
                            })
@@ -72,7 +72,7 @@ pub fn get_data<T: Protocol>(url: T) -> Result<(Option<Vec<u8>>, Vec<u8>), Strin
    }
}

fn find_clrf(data: &[u8]) -> Option<usize> {
    let clrf = b"\r\n";
    data.windows(clrf.len()).position(|window| window == clrf)
fn find_crlf(data: &[u8]) -> Option<usize> {
    let crlf = b"\r\n";
    data.windows(crlf.len()).position(|window| window == crlf)
}
-- 
2.28.0
I keep making this mistake, thanks!