You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Francois Beausoleil <fb...@users.sourceforge.net> on 2003/12/05 03:11:29 UTC

Bug in mod_dav_svn ? svn:mime-type not respected ?

Hi,

I believe I found a problem...  Here's the output of svn proplist:
C:\>svn pl -v
https://svn.hopto.org:8193/repos/references/CSS/2.0/cover.html
Properties on
'https://svn.hopto.org:8193/repos/references/CSS/2.0/cover.html':
  svn:mime-type : text/html

But, Mozilla Firebird renders the page as text/plain, and reports it as
such.

I just upgraded from 0.33.1 to 0.34.0, dumping my repos as required.

Anything wrong with 0.34.0 ?  The URL above is not publicly available.

Bye !
François
Developer of Java Gui Builder
http://jgb.sourceforge.net/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org


Re: Bug in mod_dav_svn ? svn:mime-type not respected ?

Posted by Francois Beausoleil <fb...@users.sourceforge.net>.
I cannot test such a fix.  No access to a compiler.  Can someone do it
and post back results ?

Thanks,
François

On 07 Dec 2003 10:02:02 -0600, "C. Michael Pilato" <cm...@collab.net>
said:
> Philip Martin <ph...@codematters.co.uk> writes:
> > Playing with httpd.conf shows that the DefaultType directive controls
> > the content type returned.  Stepping through dav_svn_set_headers() I
> > see
> > 
> > 1791      if ((mimetype == NULL)
> > 1792          && (resource->type == DAV_RESOURCE_TYPE_VERSION)
> > 1793          && (resource->info->repos_path != NULL))
> > 1794        {
> > 1795          svn_string_t *value;
> > (gdb) p resource->type
> > $1 = DAV_RESOURCE_TYPE_REGULAR
> > (gdb) 
> > 
> > I know very little about DAV so I cannot say whether REGULAR or
> > VERSION is correct, but lines 1792-1793 were added in r7797.
> 
> Hm.  It looks like that chunk of code should be accepting both VERSION
> and REGULAR resource types.  I've got other patches in progress, and
> no time to test a fix, but I wonder what would happen if that
> conditional became:
> 
>    if ((mimetype == NULL)
>        && ((resource->type == DAV_RESOURCE_TYPE_VERSION)
>            || (resource->type == DAV_RESOURCE_TYPE_REGULAR))
>        && (resource->info->repos_path != NULL))
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: dev-help@subversion.tigris.org
> 
Developer of Java Gui Builder
http://jgb.sourceforge.net/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org


Re: Bug in mod_dav_svn ? svn:mime-type not respected ?

Posted by Ben Collins-Sussman <su...@collab.net>.
On Sun, 2003-12-07 at 10:02, C. Michael Pilato wrote:

> Hm.  It looks like that chunk of code should be accepting both VERSION
> and REGULAR resource types.  I've got other patches in progress, and
> no time to test a fix, but I wonder what would happen if that
> conditional became:
> 
>    if ((mimetype == NULL)
>        && ((resource->type == DAV_RESOURCE_TYPE_VERSION)
>            || (resource->type == DAV_RESOURCE_TYPE_REGULAR))
>        && (resource->info->repos_path != NULL))

Oops, yup, Philip is right.  It's a bug in r7797, which was a fix for
issue #1606.  We were overzealous in our segfault protection.

I'm able to reproduce the bug with my 0.34 mod_dav_svn server, and
Mike's is correct.  It fixes the bug.  Committed in r7955.

Hmmm, how would one write a regression test for this?




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Bug in mod_dav_svn ? svn:mime-type not respected ?

Posted by "C. Michael Pilato" <cm...@collab.net>.
Philip Martin <ph...@codematters.co.uk> writes:
> Playing with httpd.conf shows that the DefaultType directive controls
> the content type returned.  Stepping through dav_svn_set_headers() I
> see
> 
> 1791      if ((mimetype == NULL)
> 1792          && (resource->type == DAV_RESOURCE_TYPE_VERSION)
> 1793          && (resource->info->repos_path != NULL))
> 1794        {
> 1795          svn_string_t *value;
> (gdb) p resource->type
> $1 = DAV_RESOURCE_TYPE_REGULAR
> (gdb) 
> 
> I know very little about DAV so I cannot say whether REGULAR or
> VERSION is correct, but lines 1792-1793 were added in r7797.

Hm.  It looks like that chunk of code should be accepting both VERSION
and REGULAR resource types.  I've got other patches in progress, and
no time to test a fix, but I wonder what would happen if that
conditional became:

   if ((mimetype == NULL)
       && ((resource->type == DAV_RESOURCE_TYPE_VERSION)
           || (resource->type == DAV_RESOURCE_TYPE_REGULAR))
       && (resource->info->repos_path != NULL))

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Bug in mod_dav_svn ? svn:mime-type not respected ?

Posted by Philip Martin <ph...@codematters.co.uk>.
"Francois Beausoleil" <fb...@users.sourceforge.net> writes:

> I believe I found a problem...  Here's the output of svn proplist:
> C:\>svn pl -v
> https://svn.hopto.org:8193/repos/references/CSS/2.0/cover.html
> Properties on
> 'https://svn.hopto.org:8193/repos/references/CSS/2.0/cover.html':
>   svn:mime-type : text/html
>
> But, Mozilla Firebird renders the page as text/plain, and reports it as
> such.

Hmmm...

$ svnadmin create repo
$ svn co http://localhost:8888/obj/repo wc
$ printf "<html>\nhello world\n</html>\n" > wc/foo
$ svn add wc/foo
$ svn ps svn:mime-type text/html wc/foo
$ svn ci wc -m ""
$ svn pl -v http://localhost:8888/obj/repo/foo
Properties on 'http://localhost:8888/obj/repo/foo':
  svn:mime-type : text/html

That looks OK so far, but the content type comes out as text/plain

$ wget -S http://localhost:8888/obj/repo/foo
--19:50:01--  http://localhost:8888/obj/repo/foo
           => `foo'
Resolving localhost... done.
Connecting to localhost[127.0.0.1]:8888... connected.
HTTP request sent, awaiting response... 
 1 HTTP/1.1 200 OK
 2 Date: Fri, 05 Dec 2003 19:50:01 GMT
 3 Server: Apache/2.0.48 (Unix) DAV/2 SVN/0.34.0+
 4 ETag: "1//foo"
 5 Accept-Ranges: bytes
 6 Connection: close
 7 Content-Type: text/plain; charset=ISO-8859-1

Playing with httpd.conf shows that the DefaultType directive controls
the content type returned.  Stepping through dav_svn_set_headers() I
see

1791      if ((mimetype == NULL)
1792          && (resource->type == DAV_RESOURCE_TYPE_VERSION)
1793          && (resource->info->repos_path != NULL))
1794        {
1795          svn_string_t *value;
(gdb) p resource->type
$1 = DAV_RESOURCE_TYPE_REGULAR
(gdb) 

I know very little about DAV so I cannot say whether REGULAR or
VERSION is correct, but lines 1792-1793 were added in r7797.

-- 
Philip Martin

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Bug in mod_dav_svn ? svn:mime-type not respected ?

Posted by Philip Martin <ph...@codematters.co.uk>.
Branko Čibej <br...@xbc.nu> writes:

> Francois Beausoleil wrote:
>
>>I believe I found a problem...  Here's the output of svn proplist:
>>C:\>svn pl -v
>>https://svn.hopto.org:8193/repos/references/CSS/2.0/cover.html
>>Properties on
>>'https://svn.hopto.org:8193/repos/references/CSS/2.0/cover.html':
>>  svn:mime-type : text/html
>>
>>But, Mozilla Firebird renders the page as text/plain, and reports it as
>>such.
>>
> I remember this being a "problem exists between keyboard and chair" type
> httpd configuration glitch, and I bet you have
>
>     DefaultType text/plain
>
> in your httpd.conf.

I would expect svn:mime-type to override DefaultType.  As far as I can
tell DefaultType does determine the Content-Type returned for a GET,
but even if DefaultType is not set the svn:mime-type doesn't get used.
This bit of code appears to be responsible

$ svn diff -r7796:7797
Index: subversion/mod_dav_svn/repos.c
===================================================================
--- subversion/mod_dav_svn/repos.c	(revision 7796)
+++ subversion/mod_dav_svn/repos.c	(revision 7797)
@@ -1777,7 +1777,9 @@
         }
     }
 
-  if (mimetype == NULL)
+  if ((mimetype == NULL)
+      && (resource->type == DAV_RESOURCE_TYPE_VERSION)
+      && (resource->info->repos_path != NULL))
     {
       svn_string_t *value;

I see resource->type is DAV_RESOURCE_TYPE_REGULAR when responding to a
GET.  If I use gdb to temporarily change resource->type from REGULAR
to VERSION then I see Content-Type set to svn:mime-type.  I don't know
whether the code should allow REGULAR as well as VERSION or whether
type should be set to VERSION.

-- 
Philip Martin

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Bug in mod_dav_svn ? svn:mime-type not respected ?

Posted by Francois Beausoleil <fb...@users.sourceforge.net>.
Hi,


On Sun, 07 Dec 2003 22:45:49 +0100, "Branko Čibej" <br...@xbc.nu> said:
> Francois Beausoleil wrote:
> 
> >Hi,
> >
> >I believe I found a problem...  Here's the output of svn proplist:
> >C:\>svn pl -v
> >https://svn.hopto.org:8193/repos/references/CSS/2.0/cover.html
> >Properties on
> >'https://svn.hopto.org:8193/repos/references/CSS/2.0/cover.html':
> >  svn:mime-type : text/html
> >
> >But, Mozilla Firebird renders the page as text/plain, and reports it as
> >such.
> >
[snip]
> >
> I remember this being a "problem exists between keyboard and chair" type
> httpd configuration glitch, and I bet you have
> 
>     DefaultType text/plain
> 
> in your httpd.conf.

You are right, I did have that.  I commented it out, and restarted
Apache, to no effect.  Mozilla Firebird still gives me text/plain.

> 
> -- 
> Brane Čibej   <br...@xbc.nu>   http://www.xbc.nu/brane/

Thanks,
François
Developer of Java Gui Builder
http://jgb.sourceforge.net/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org


Re: Bug in mod_dav_svn ? svn:mime-type not respected ?

Posted by Branko Čibej <br...@xbc.nu>.
Francois Beausoleil wrote:

>Hi,
>
>I believe I found a problem...  Here's the output of svn proplist:
>C:\>svn pl -v
>https://svn.hopto.org:8193/repos/references/CSS/2.0/cover.html
>Properties on
>'https://svn.hopto.org:8193/repos/references/CSS/2.0/cover.html':
>  svn:mime-type : text/html
>
>But, Mozilla Firebird renders the page as text/plain, and reports it as
>such.
>
>I just upgraded from 0.33.1 to 0.34.0, dumping my repos as required.
>
>Anything wrong with 0.34.0 ?  The URL above is not publicly available.
>  
>
I remember this being a "problem exists between keyboard and chair" type
httpd configuration glitch, and I bet you have

    DefaultType text/plain

in your httpd.conf.

-- 
Brane Čibej   <br...@xbc.nu>   http://www.xbc.nu/brane/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org