Package: approx
Version: 5.5-2
Severity: normal

The dl.google.com server (which serves Debian packages of Google Chrome)
supports HTTP/2 and replies to the initial HTTP request with a status of
"HTTP/2.0 200", which omits the traditional reason phrase "OK". This
trips a regular expression in approx and results in the following error:

 Mar 18 22:19:58 iota approx[7811]: Unrecognized response: HTTP/2.0 200
 Mar 18 22:19:58 iota approx[7811]: Unexpected status code: 0

The reason phrase is captured in a group (to reuse 'with_pair', I
assume) but never actually used so it can be made optional, which is
what the following trivial patch does:

--- a/approx.ml
+++ b/approx.ml
@@ -269,7 +269,7 @@
   | [| a; b |] -> proc (a, b)
   | _ -> assert false
 
-let status_re = Pcre.regexp "^HTTP/\\d+\\.\\d+\\s+(\\d{3})\\s+(.*?)\\s*$"
+let status_re = Pcre.regexp "^HTTP/\\d+\\.\\d+\\s+(\\d{3})(?:\\s+(.*?)\\s*)?$"
 let header_re = Pcre.regexp "^(.*?):\\s*(.*?)\\s*$"
 
 let process_header resp str =

Thanks,
-- 
Romain Francoise <rfranco...@debian.org>
http://people.debian.org/~rfrancoise/

Reply via email to