File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -42,6 +42,25 @@ namespace uWS {
4242 return state & STATE_SIZE_MASK ;
4343 }
4444
45+ bool is_token_char (char c) {
46+ // 1. Check for alphanumeric (0-9, a-z, A-Z)
47+ if ((c >= ' 0' && c <= ' 9' ) ||
48+ (c >= ' a' && c <= ' z' ) ||
49+ (c >= ' A' && c <= ' Z' )) {
50+ return true ;
51+ }
52+
53+ // 2. Check for the 15 allowed special tchar symbols: ! # $ % & ' * + - . ^ _ ` | ~
54+ switch (c) {
55+ case ' !' : case ' #' : case ' $' : case ' %' : case ' &' :
56+ case ' \' ' : case ' *' : case ' +' : case ' -' : case ' .' :
57+ case ' ^' : case ' _' : case ' `' : case ' |' : case ' ~' :
58+ return true ;
59+ default :
60+ return false ;
61+ }
62+ }
63+
4564 /* Reads hex number until CR or out of data to consume. Updates state. Returns bytes consumed. */
4665 inline void consumeHexNumber (std::string_view &data, uint64_t &state) {
4766 /* Consume everything hex */
@@ -78,6 +97,10 @@ namespace uWS {
7897 state = STATE_IS_ERROR ;
7998 return ;
8099 }
100+
101+ /* While we stand on semicolon, parse an extension */
102+
103+
81104 /* Consume everything not /n */
82105 while (data.length () && data.data ()[0 ] != ' \n ' ) {
83106 data.remove_prefix (1 );
You can’t perform that action at this time.
0 commit comments