- /* there must be HTTP/1.x in the line
- * and nothing than SPACE or NUL after HTTP/1.x
- */
- if ( (!(http = strstr(pre_header, "HTTP/1."))) ||
- (!(http < end)) ||
- (!isdigit(http[lenof("HTTP/1.")])) ||
- (http[lenof("HTTP/1.1")] && (!isspace(http[lenof("HTTP/1.1")])))) {
+ /* there must be HTTP/1.x in the line */
+ if (!(http = http_locate_str(pre_header, end - pre_header, "HTTP/1.", lenof("HTTP/1.")))) {
+ return FAILURE;
+ }
+
+ /* and nothing than SPACE or NUL after HTTP/1.x */
+ if ( (!HTTP_IS_CTYPE(digit, http[lenof("HTTP/1.")])) ||
+ (http[lenof("HTTP/1.1")] && (!HTTP_IS_CTYPE(space, http[lenof("HTTP/1.1")])))) {