Skip to main content

split_line

Function split_line 

Source
pub fn split_line(line: &str) -> Option<(String, String)>
Expand description

Split a line into a header name and a value.

The rules, from SPEC.md 4.3 and src/tcp_server.cpp:604-616:

  1. A line with no colon is ignored.
  2. A semicolon starts a comment. The parser removes it and the rest.
  3. The parser lowercases the whole line, so names are case-insensitive.
  4. The parser trims the name and the value.

liblsl finds the colon before it removes the comment, and it then uses the old position. A semicolon before the colon therefore reads past the end of the shortened line. This function returns None for that input, which is the safe reading of a path that no upstream test covers. SPEC.md 4.3 records the behavior as observed.