[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

RE: [PATCH 3/3] atomic-revprop: Signal the error as a HTTP status code

From: Jon Foster <Jon.Foster_at_cabot.co.uk>
Date: Mon, 20 Sep 2010 22:59:02 +0100

Daniel Shahaf wrote:
> Jon Foster wrote on Mon, Sep 20, 2010 at 11:01:02 +0100:
> > However, there is a simpler way! The <D:status> element contains
> > the HTTP error code, usually "500 Internal Server Error". So we
> > could pick a special HTTP status code to mean SVN_ERR_BAD_OLD_VALUE.
> > I think of old_value_p as a precondition for the operation, a bit
> > like "If-Modified-Since:", so I'd suggest "412 Precondition Failed".
> > Note that generic DAV clients won't ever see this message, because
> > they won't be sending old_value_p.
> >
>
> Fair enough. Are there currently any circumstances where
> HTTP_PRECONDITION_FAILED would be raised? (e.g., by mod_dav)
>
> As far as I can tell (by greping httpd sources), the answer is "No".

I looked and couldn't find any. The DAV spec doesn't list it as
one of the common errors that get sent in that place. (Obviously,
it would be very bad if mod_dav started sending that error code
for some other error).

> I'll commit this once I have an ra_serf version too. Would you
> like to write the ra_serf part of the patch, too?

Sure. See attached.

> > - b->description->data);
> > + *b->description->data);
> ^^^
> Unintentional change? (triggers compiler warning)

Oops, yes. Fixed in attached.

This updated patch is against the atomic-revprop branch.

[[[
Signal SVN_ERR_BAD_OLD_VALUE over DAV using a HTTP 412 status
code inside a 207 multi-status response.

* subversion/mod_dav_svn/util.c:
  (dav_svn__convert_err): Map SVN_ERR_BAD_OLD_VALUE to 412.

* subversion/libsvn_ra_neon/util.c:
   (multistatus_baton_t): New member contains_precondition_error.
   (end_207_element): Check for HTTP 412 status code and create
                      a SVN_ERR_BAD_OLD_VALUE error if found.

* subversion/libsvn_ra_serf/ra_serf.h:
   (svn_ra_serf__server_error_t): New member
contains_precondition_error.

* subversion/libsvn_ra_serf/util.c:
   (parse_dav_status): New method.
   (svn_ra_serf__handle_discard_body): Initialise new member.
   (start_207): Parse DAV:status XML element.
   (end_207): Parse DAV:status XML element. Use SVN_ERR_BAD_OLD_VALUE
              error code if applicable.
   (svn_ra_serf__handle_multistatus_only): Initialise new member.

Patch by: Jon Foster <jon.foster_at_cabot.co.uk>
]]]

Kind regards,

Jon

**********************************************************************
This email and its attachments may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Cabot Communications Ltd.

If you are not the intended recipient of this email and its attachments, you must take no action based upon them, nor must you copy or show them to anyone.

Cabot Communications Limited
Verona House, Filwood Road, Bristol BS16 3RY, UK
+44 (0) 1179584232

Co. Registered in England number 02817269

Please contact the sender if you believe you have received this email in error.

**********************************************************************

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________

Received on 2010-09-21 00:00:00 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.