I just pushed a fix for these issues. Thank you!

Jay

On Fri, Oct 16, 2015 at 12:17 PM, Greg Hendershott
<greghendersh...@gmail.com> wrote:
> The URL needs to get split into parts, and the HTTP request will go
> "on the wire" as something like:
>
>     HEAD <path> HTTP/1.0
>     Host: www.racket-lang.org
>     <more headers>
>
> When you have the trailing / it will be:
>
>     HEAD / HTTP/1.0
>
> Which makes sense.
>
> When the trailing slash is missing, i.e. "no path", I'm guessing that
> http-conn-send! is sending
>
>     HEAD HTTP/1.0
>
> The server thinks the path is "HTTP/1.0" and the HTTP/<ver> part is...
> missing. The server doesn't think blank is a valid version of HTTP. It
> may have a point. :)
>
> TL;DR1: It's probably good form to use the trailing slash in your
> URLs, anyway. (What you can type in a browser address bar is a lot
> looser than what you can/should use in code.)  This will work even
> with the currently shipping Racket.
>
> TL;DR2: Jay, http-conn-send! might want to supply "/" when the path is
> missing?  Or at least something like (error 'http-conn-send! "URL is
> missing a path") so it fails more understandably?
>
>
>
> On Fri, Oct 16, 2015 at 6:18 AM, Jon Stenerson <jonstener...@comcast.net> 
> wrote:
>> This works:
>>
>>> (define p (head-impure-port (string->url "http://www.racket-lang.org/";)))
>>> (read-line p)
>> "HTTP/1.1 200 OK\r"
>>
>> But, leaving off trailing /, I usually see
>>
>>> (define p (head-impure-port (string->url "http://www.racket-lang.org";)))
>>
>> string-trim: contract violation
>>   expected: string?
>>   given: #<eof>
>>
>> Sometimes I get a port with status line "HTTP/1.1 505 HTTP Version not
>> supported\r".
>>
>> Can anyone explain? Thanks.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Racket Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to racket-users+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.



-- 
Jay McCarthy
Associate Professor
PLT @ CS @ UMass Lowell
http://jeapostrophe.github.io

           "Wherefore, be not weary in well-doing,
      for ye are laying the foundation of a great work.
And out of small things proceedeth that which is great."
                          - D&C 64:33

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to