| 1177 | } |
| 1178 | |
| 1179 | ParseResult |
| 1180 | validate_hdr_request_target(int method_wk_idx, URLImpl *url) |
| 1181 | { |
| 1182 | ParseResult ret = PARSE_RESULT_DONE; |
| 1183 | int host_len; |
| 1184 | url->get_host(&host_len); |
| 1185 | int path_len; |
| 1186 | const char *path = url->get_path(&path_len); |
| 1187 | int scheme_len; |
| 1188 | url->get_scheme(&scheme_len); |
| 1189 | |
| 1190 | if (host_len == 0) { |
| 1191 | if (path_len == 1 && path[0] == '*') { // asterisk-form |
| 1192 | // Skip this check for now because URLImpl can't distinguish '*' and '/*' |
| 1193 | // if (method_wk_idx != HTTP_WKSIDX_OPTIONS) { |
| 1194 | // ret = PARSE_RESULT_ERROR; |
| 1195 | // } |
| 1196 | } else { // origin-form |
| 1197 | // Nothing to check here |
| 1198 | } |
| 1199 | } else if (scheme_len == 0 && host_len != 0) { // authority-form |
| 1200 | if (method_wk_idx != HTTP_WKSIDX_CONNECT) { |
| 1201 | ret = PARSE_RESULT_ERROR; |
| 1202 | } |
| 1203 | } else { // absolute-form |
| 1204 | // Nothing to check here |
| 1205 | } |
| 1206 | |
| 1207 | return ret; |
| 1208 | } |
| 1209 | |
| 1210 | ParseResult |
| 1211 | validate_hdr_host(HTTPHdrImpl *hh) |
no test coverage detected