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

Re: svn commit: r14262 - trunk/subversion/mod_dav_svn

From: <kfogel_at_collab.net>
Date: 2005-05-05 01:04:07 CEST

Branko Čibej <brane@xbc.nu> writes:
> >I would think "application/octet-stream" would be a lot safer when we
> >don't know anything about the file. Does anyone know more about this?
>
> When it sees a file that doesn't have the svn:mime-type property set,
> Subversion assumes it is a text file. It would be slighly weird if
> mod_dav_svn behaved differently.

Would it?

Subversion can make that assumption because it knows the domain of
operations (diff, merge) to which the assumption will apply.

But when we return a file in response to a generic DAV request, we
have no idea what the user is going to do with it. In fact, it seems
likely that someone using a generic DAV client to fetch a file will
often not be obtaining a "text/plain" document. It's just as likely
to be MSWord, Excel, whatever, and that some software consumers of the
file would Do The Wrong Thing if they thought were plain text.

Also, notice how the "text/plain" assumption is given lie in
mod_dav_svn/repos.c, right below the code we're talking about:

      if (value)
        mimetype = value->data;
      else if ((! resource->info->repos->is_svn_client)
               && r->content_type)
        mimetype = r->content_type;
      else
        mimetype = "text/plain";

      serr = svn_mime_type_validate(mimetype, resource->pool);
      if (serr)
        {
          /* Probably serr->apr == SVN_ERR_BAD_MIME_TYPE, but
             there's no point even checking. No matter what the
             error is, we can't derive the mime type from the
             svn:mime-type property. So we resort to the infamous
             "mime type of last resort." */
          svn_error_clear(serr);
          mimetype = "application/octet-stream";
        }

Kind of hard to square that last assignment with the final 'else'
above it!

-Karl

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu May 5 01:37:15 2005

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.