[racket] /inform requests in web-server

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Fri Oct 11 09:21:23 EDT 2013

On Thu, Oct 10, 2013 at 6:22 PM, Matthew Butterick
<mb.list.acct at gmail.com> wrote:
> I have a default route attached to dispatch-rules which was annoying the
> webserver by catching requests for /inform.
>
> 0) Is /inform in the docs?
>
> 1) Where are /inform requests coming from, and what are they used for?
>
> 2) Is there a way of turning them off if not needed for my application?

/inform is not a standard URI that Web servers handle that I can find
any reference to on the Web. The Racket server does not do anything
with it and it should not matter what happens with it. I'm very
curious what was going wrong for you and what response you get from
querying /inform.

> 3) I fixed my default route by just passing through /inform requests:
>
> (define request-url (request-uri req))
> (when (not (equal? (url->string request-url) "/inform"))
>     (do-my-processing)
> (next-dispatcher))
>
> Is this a legit way of handling them?

Yes, that's a fine way for a servlet to let the next dispatcher handle
everything.

> 4) Are there other silent, periodic requests like /inform that need to be
> passed through in the same way?

If you run the web-server command-line tool (which I don't recommend),
then this documents the special URLs it handles:

http://docs.racket-lang.org/web-server-internal/Web_Servers.html#%28def._%28%28lib._web-server%2Fweb-server-unit..rkt%29._web-server~40%29%29

If you use serve/servlet (which I recommend) and have #:quit? be true
(which I don't recommend for production), then this

http://docs.racket-lang.org/web-server/run.html#%28def._%28%28lib._web-server%2Fservlet-env..rkt%29._serve%2Fservlet%29%29

documents that

"If quit? is true, then the URL "/quit" ends the server."

Other than these two cases, every URL is for you with the Web server.

Jay

> Thanks.
>
> Matthew Butterick
>
>
>
>
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users
>



-- 
Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University
http://faculty.cs.byu.edu/~jay

"The glory of God is Intelligence" - D&C 93

Posted on the users mailing list.