Changeset 14980 in project


Ignore:
Timestamp:
06/11/09 22:54:38 (10 years ago)
Author:
sjamaan
Message:

Describe safe? and idempotent?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/4/intarweb

    r14857 r14980  
    562562<procedure>(keep-alive? request-or-response)</procedure>
    563563
    564 Returns {{#t}} when the given request or response object belongs
    565 to a connection that should be kept alive or not.  Remember that
    566 both parties must agree on whether the connection is to be kept
    567 alive or not; HTTP/1.1 defaults to keep alive unless a
    568 {{Connection: close}} header is sent, HTTP/1.0 defaults to closing
    569 the connection, unless a {{Connection: Keep-Alive}} header is sent.
    570 
     564Returns {{#t}} when the given request or response object belongs to a
     565connection that should be kept alive, {{#f}} if not.  Remember that
     566both parties must agree on whether the connection is to be kept alive
     567or not; HTTP/1.1 defaults to keep alive unless a {{Connection: close}}
     568header is sent, HTTP/1.0 defaults to closing the connection, unless a
     569{{Connection: Keep-Alive}} header is sent.
     570
     571<procedure>(safe? request-or-method)</procedure>
     572
     573Returns {{#t}} when the given request object or symbol (method) is a
     574''safe'' method.  A method is defined to be safe when a request of
     575this method will have no side-effects on the server.  In practice this
     576means that you can send this request from anywhere at any time and
     577cause no damage.
     578
     579'''Important''': Quite a lot of software does not abide by these
     580rules!  This is not necessarily a reason to treat all methods as
     581unsafe, however.  In the words of the standard "the user did not
     582request the side-effects, so therefore cannot be held accountable for
     583them".  If a safe method produces side-effects, that's the server-side
     584script developer's fault and he should fix his code.
     585
     586<parameter>(safe-methods [symbols])</parameter>
     587
     588A list of methods which are to be considered safe.  Defaults to
     589{{'(GET HEAD OPTIONS TRACE)}}.
     590
     591<procedure>(idempotent? request-or-method)</procedure>
     592
     593Returns {{#t}} when the given request object or symbol (method) is a
     594''idempotent'' method.  A method is defined to be idempotent when a
     595series of identical requests of this method in succession causes the
     596exact same side-effect as just one such request.  In practice this
     597means that you can safely retry such a request when an error occurs,
     598for example.
     599
     600'''Important''': Just as with the ''safe'' methods, there is no
     601guarantee that methods that ''should be'' idempotent really are
     602idempotent in any given web application.  Furthermore, a sequence of
     603requests which each are individually idempotent is not necessarily
     604idempotent as a whole.  This means that you cannot replay requests
     605starting anywhere in the chain.  To be on the safe side, only retry
     606the last request in the chain.
     607
     608<parameter>(idempotent-methods [symbols])</parameter>
     609
     610A list of methods which are to be considered idempotent.  Defaults to
     611{{'(GET HEAD PUT DELETE OPTIONS TRACE)}}.
    571612
    572613=== Changelog
Note: See TracChangeset for help on using the changeset viewer.