[racket-dev] [plt] Push #26024: master branch updated

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Mon Jan 7 11:56:46 EST 2013

How about just saying that the input is either the string "get" "put"
"post" or a match pattern and if it is one of the former, then do
case-folding before checking?

Robby


On Mon, Jan 7, 2013 at 9:24 AM, Jay McCarthy <jay at racket-lang.org> wrote:

> I like the idea of the match patterns... but I'm worried about the details.
>
> The names are very common: get, post, head, etc. And I think exporting
> them as http-method-get or GET, etc would be hideous.
>
> Also, there is no exhaustive list of valid HTTP methods... anything
> can be used. And even the lisf of commonly used ones is long:
>
> http://annevankesteren.nl/2007/10/http-methods  (as of 2007)
>
> Do you have any ideas for a solution to this?
>
> Jay
>
>
> On Fri, Jan 4, 2013 at 9:27 AM, Sam Tobin-Hochstadt <samth at ccs.neu.edu>
> wrote:
> > Ah, that makes sense.  You could think about providing match patterns
> > for each of the HTTP methods, in that case -- people might be less
> > confused by that than strings.
> >
> > On Fri, Jan 4, 2013 at 10:30 AM, Jay McCarthy <jay at racket-lang.org>
> wrote:
> >> The programmer's input is not a string. It is a match pattern, so you
> can
> >> use 'or', '_', etc.
> >>
> >>
> >> On Fri, Jan 4, 2013 at 6:30 AM, Sam Tobin-Hochstadt <samth at ccs.neu.edu>
> >> wrote:
> >>>
> >>> Why not normalize this at the other end (ie, normalize the provided
> >>> string as well as the actual method) so that "GET" as well as "get"
> >>> will work?
> >>>
> >>> Sam
> >>>
> >>> On Fri, Jan 4, 2013 at 7:45 AM,  <jay at racket-lang.org> wrote:
> >>> > jay has updated `master' from aa5f2e7875 to c07ff948ee.
> >>> >   http://git.racket-lang.org/plt/aa5f2e7875..c07ff948ee
> >>> >
> >>> > =====[ One Commit
> ]=====================================================
> >>> > Directory summary:
> >>> >  100.0% collects/web-server/scribblings/
> >>> >
> >>> > ~~~~~~~~~~
> >>> >
> >>> > c07ff94 Jay McCarthy <jay at racket-lang.org> 2013-01-04 05:44
> >>> > :
> >>> > | Fixes PR13406
> >>> > :
> >>> >   M collects/web-server/scribblings/dispatch.scrbl | 11 +++++++++--
> >>> >
> >>> > =====[ Overall Diff
> ]===================================================
> >>> >
> >>> > collects/web-server/scribblings/dispatch.scrbl
> >>> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >>> > --- OLD/collects/web-server/scribblings/dispatch.scrbl
> >>> > +++ NEW/collects/web-server/scribblings/dispatch.scrbl
> >>> > @@ -118,6 +118,7 @@ or else the filesystem server will never see the
> >>> > requests.
> >>> >   [maybe-method
> >>> >    code:blank
> >>> >    (code:line #:method method)]
> >>> > + [method pat]
> >>> >   [maybe-else-clause
> >>> >    code:blank
> >>> >    [else else-fun]])
> >>> > @@ -137,9 +138,15 @@ the @racket[dispatch-fun] given as its first
> >>> > argument.
> >>> >  @racket[(next-dispatcher)] to signal to the Web Server that this
> >>> >  dispatcher does not apply.
> >>> >
> >>> > - If any @racket[_method] is left out, it assumed to apply to
> requests
> >>> > -without methods and GET methods.
> >>> > + The @racket[_method] syntax is used in a @racket[match] expression
> to
> >>> > +match the @racket[request-method] part of the incoming request
> >>> > +object. However, since HTTP allows methods to use any case, the byte
> >>> > +string from @racket[request-method] is normalized to a lower-case
> >>> > +string. Thus, valid patterns are things like: @racket["get"],
> >>> > + at racket["post"], @racket["head"], @racket[(or "get" "post")], etc.
> >>> >
> >>> > + If @racket[_method] is left out, it assumed to apply to requests
> >>> > +without methods and GET methods.
> >>> >  }
> >>> >
> >>> >  @defform[
> >>
> >>
> _________________________
>   Racket Developers list:
>   http://lists.racket-lang.org/dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/dev/archive/attachments/20130107/47077b15/attachment-0001.html>

Posted on the dev mailing list.