  be added by using ``XMLHttpRequest``, and browsers already implement a
  same-domain policy for ``XMLHttpRequest``. (Note that this is not secure if you
  don't trust content within the same domain or subdomains.)
  
  The above two functions of ``CsrfMiddleware`` are split between two
  classes: ``CsrfResponseMiddleware`` and ``CsrfViewMiddleware``
  respectively.  This allows the individual components to be used and/or
  replaced instead of using ``CsrfMiddleware``.
  
  .. versionchanged:: 1.1
      (previous versions of Django did not provide these two components
      of ``CsrfMiddleware`` as described above)
  
  .. _9.1.1 Safe Methods, HTTP 1.1, RFC 2616: http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html
  
  Limitations
  ===========
 
</s> remove You don't have to worry about doing this for most AJAX views. Any request sent
with "X-Requested-With: XMLHttpRequest" is automatically exempt. (See the next
section.)
 </s> add Like the middleware itself, the ``csrf_exempt`` decorator is composed
of two parts: a ``csrf_view_exempt`` decorator and a
``csrf_response_exempt`` decorator, found in the same module.  These
disable the view protection mechanism (``CsrfViewMiddleware``) and the
response post-processing (``CsrfResponseMiddleware``) respectively.
They can be used individually if required.

You don't have to worry about doing this for most AJAX views. Any
request sent with "X-Requested-With: XMLHttpRequest" is automatically
exempt. (See the next section.) </s> remove             # This covers a corner case in which the outgoing request
 </s> add             # This covers a corner case in which the outgoing response </s> remove    isn't, the user will get a 403 error.
 </s> add    isn't, the user will get a 403 error. (This is done by
   ``CsrfViewMiddleware``)
  be added by using ``XMLHttpRequest``, and browsers already implement a
  same-domain policy for ``XMLHttpRequest``. (Note that this is not secure if you
  don't trust content within the same domain or subdomains.)
  








  
  .. _9.1.1 Safe Methods, HTTP 1.1, RFC 2616: http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html
  
  Limitations
  ===========
keep keep keep keep replace replace replace replace replace replace replace replace keep keep keep keep keep
 Made CSRF middleware skip post-processing for 'csrf_exempt' decorated views.

This commit also decomposes the decorator into two decorators which can be
used separately, adds some tests, updates docs and fixes some code comments.



git-svn-id: http://code.djangoproject.com/svn/django/trunk@9815 bcc190cf-cafb-0310-a4f2-bffc1f526a37 
docs/ref/contrib/csrf.txt