[plt-scheme] Possible bug getting requests from non-complete urls.

From: Patrick (PatrickLozzi at gmail.com)
Date: Mon Dec 8 21:09:07 EST 2008

I'm experiencing a weird issue...

Here's a test case:
#lang scheme

(require net/url)
(require (planet ashinn/html-parser:1:0/html-parser))

(define site-url "http://www.circuitcity.com")

(define (my-ext-port)
  (lambda (site-url)
    (get-pure-port
     (string->url site-url))))

(define (get-page)
  (lambda (my-port)
    (html->sxml my-port)))

; run with:
((get-page) ((my-ext-port) site-url))

And the interpreter responds more or less with:
"Your browser sent a request that this server could not understand."

However, if I change site-url to:
(define site-url "http://www.circuitycity.com/") ;note the extra
forward slash

Then it responds normally and in this case, retrieving for me the full
sxml tree.  I contacted some nice folks in #Scheme and then were
pretty strongly of the belief that this is a bug and that I should
contact this list... they believed, paraphrasing, that the HTTP
library should not send bogus requests to the server, but either make
the request sensible or signal an error.

I brought this up because many sites are of this form, or at least,
contain links that very likely do not contain the last forward slash
and I couldn't see a way around this.  I'm open to any suggestions.

Regards,
-Patrick


Posted on the users mailing list.