better regexp use

svn: r6057
This commit is contained in:
Eli Barzilay 2007-04-27 04:22:21 +00:00
parent 48138e97f2
commit 3098287803
2 changed files with 3 additions and 3 deletions

View File

@ -204,13 +204,13 @@ PROCEDURES -----------------------------------------------------------
The "head.ss" library provides procedures, such as `extract-field, The "head.ss" library provides procedures, such as `extract-field,
for manipulating the header. for manipulating the header.
Since web server sometimes return mis-formatted replies, Since web servers sometimes return mis-formatted replies,
`purify-port' is liberal in what it accepts as a header. as a `purify-port' is liberal in what it accepts as a header. as a
result, the result string may be ill formed, but it will either be result, the result string may be ill formed, but it will either be
the empty string, or it will be a string matching the following the empty string, or it will be a string matching the following
regexp: regexp:
#rx"^HTTP/.*?((\r\n\r\n)|(\n\n)|(\r\r))" #rx"^HTTP/.*?(\r\n\r\n|\n\n|\r\r)"
> (call/input-url url url->port-proc port->X-proc [list-of-strings]) -> X > (call/input-url url url->port-proc port->X-proc [list-of-strings]) -> X

View File

@ -312,7 +312,7 @@
;; purify-port : in-port -> header-string ;; purify-port : in-port -> header-string
(define (purify-port port) (define (purify-port port)
(let ([m (regexp-match-peek-positions (let ([m (regexp-match-peek-positions
#rx"^HTTP/.*?((\r\n\r\n)|(\n\n)|(\r\r))" port)]) #rx"^HTTP/.*?(?:\r\n\r\n|\n\n|\r\r)" port)])
(if m (read-string (cdar m) port) ""))) (if m (read-string (cdar m) port) "")))
(define character-set-size 256) (define character-set-size 256)