Leif Hedstrom created TS-4926:
---------------------------------

             Summary: Optimize and improve mime_scanner_get() and 
mime_parser_parse()
                 Key: TS-4926
                 URL: https://issues.apache.org/jira/browse/TS-4926
             Project: Traffic Server
          Issue Type: Improvement
          Components: HTTP
            Reporter: Leif Hedstrom


It seems there's some improvements to be done in the interaction between e.g. 
mime_scanner_get() and mime_parser_parse(). For example:

1) mime_scanner_get() does not recognize the ':' as it's walking the string 
looking for cr/lf's, WS's for continuations etc. Seems like it'd make sense 
here to also mark the position of the ':', such that the caller doesn't have to 
look for that again (mime_parser_parse() will call memchr() to find it).

2) mime_scanner_get() doesn't deal with various illegal characters, either 
leaving it up to the caller(s) to deal with, or not being dealt with at all. It 
seems it'd be pretty easy to include the checks for that here, and then avoid 
any checks further up in the calling chain entirely.

3) mime_scanner_parse() does not properly deal with white spaces before the 
':', which is a protocol error (instead we just ignore 'em).
{code}
    // find_value_last
    field_value_last = line_e - 1;
    while ((field_value_last >= field_value_first) && 
ParseRules::is_wslfcr(*field_value_last)) {
      --field_value_last;
    }
{code}


It's possible 3) should be its own Jira, but seems easy to do all this as one 
fix honestly.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to