You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by "D, Dinoj" <Di...@Honeywell.com> on 2011/05/10 06:51:46 UTC

SVN files content Type

Hi,

 

All the "content Types" are set for our apache server.  This is working
well for local apache paths . But if we point this to subversion , it
wouldn't work. Could you please let me know how to set content type for
subversions as well

 

Thanks & Regards,

Dinoj D

Desk: +91 80 26588360 Extn: 48547

Cell: +91 9916668051


Re: SVN files content Type

Posted by Jeyanthan <je...@collab.net>.
>> All the “content Types” are set for our apache server.  This is working well for local apache paths . But if we point this to subversion , it wouldn’t work. Could you please let me know how to set content type for subversions as well
>
> For each individual file in the repository, you must set the svn:mime-type property. Subversion does not use your Apache content types.

Hope the below links helps.

http://svnbook.red-bean.com/en/1.5/svn.advanced.props.html

http://svnbook.red-bean.com/en/1.5/svn.advanced.props.file-portability.html#svn.advanced.props.special.mime-type

-- 
Regards,
Jeyanthan


Re: SVN files content Type

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Ryan Schmidt wrote on Tue, May 10, 2011 at 01:21:42 -0500:
> 
> On May 9, 2011, at 23:51, D, Dinoj wrote:
> 
> > All the “content Types” are set for our apache server.  This is working well for local apache paths . But if we point this to subversion , it wouldn’t work. Could you please let me know how to set content type for subversions as well
> 
> For each individual file in the repository, you must set the svn:mime-type property. Subversion does not use your Apache content types.
> 

There is this bit of the configuration file where we accept an
httpd-like mime.types file:

        "### Set mime-types-file to a MIME type registry file, used to"      NL
        "### provide hints to Subversion's MIME type auto-detection"         NL
        "### algorithm."                                                     NL
        "# mime-types-file = /path/to/mime.types"                            NL

Though, reading the OP's question, he's probably looking for
a mod_dav_svn configuration directive rather than a client-side
setting.

Re: SVN files content Type

Posted by Henning Hucke <h_...@aeon.icebear.org>.
On Tue, 10 May 2011, D, Dinoj wrote:

> Hi Ryan

Hello Dinoj,

Hint: http://www.netmeister.org/news/learn2quote.html

> Can we make it possible to contact apache content type using any
> modules..Setting the svn:mime-type to all individual files is not a good
> solution

why not!? You quite often need them anyway. And you can use any mime.types 
file - even the apache one - to initially set the mime-types in your SVN 
working copy (Use "find" and some magic, maybe "file" as well).

Regards
     Henning Hucke
-- 
The Almighty in His infinite wisdom did not see
fit to create Frenchmen in the image of Englishmen.
 		-- Winston Churchill, 1942

Re: SVN files content Type

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Aug 4, 2011, at 04:11, D, Dinoj wrote:
> 
> I have got some information that we can overwrite the header information
> if required. How can we set this for SVN?

Somebody did just post a message about that:

http://svn.haxx.se/users/archive-2011-08/0107.shtml

I had not been aware of this option before so I don't have any further information.




RE: SVN files content Type

Posted by "D, Dinoj" <Di...@Honeywell.com>.
Hi,

I have got some information that we can overwrite the header information
if required. How can we set this for SVN?

Thanks & Regards,
Dinoj D
Desk: +91 80 26588360 Extn: 48547
Cell: +91 9916668051
-----Original Message-----
From: Ryan Schmidt [mailto:subversion-2011a@ryandesign.com] 
Sent: Monday, May 16, 2011 12:14 PM
To: D, Dinoj
Cc: Daniel Shahaf; users@subversion.apache.org
Subject: Re: SVN files content Type


On May 16, 2011, at 00:42, D, Dinoj wrote:

> Hi Daniel/Ryan
> 
> Thanks. I understood that the mime content-types are not sending to
the
> client from the server's mime.types file , intead it takes from the
> files which have subversion mime-type property set. I am unable to
> configure this to bypass to apache mime.types file.

That's correct.

> Here my requirement
> is that whoever accessing the repository through web browser must get
> the mime content-type from the apache file conf/mime.types and not
from
> the svn:property. Please help on this.

There's no way to configure Subversion to do that.

As I already suggested, consider having a server-side post-commit hook
that updates a server-side working copy of a relevant part of your
repository, and point your apache at that working copy. Then, when users
want to access this site, instruct users to use that other URL, not the
repository URL.

As a concrete example:

Consider you have an HTML page in a project in a repository accessible
here:

http://www.example.com/svn/project1/trunk/folder/index.html

You haven't been using svn:mime-type, so users who view this URL in a
web browser will see the source of the document, instead of the page
rendered as HTML which is what you want.

Imagine your repository is on the server at /var/svn, and that you have
a document root at /var/www used for everything at
http://www.example.com/ other than the /svn directory, like this:

<VirtualHost *:80>
	ServerName www.example.com
	DocumentRoot /var/www
	<Location /svn>
		DAV svn
		SVNPath /var/svn
	</Location>
</VirtualHost

So, check out a working copy of this project's trunk somewhere inside
the document root:

mkdir -p /var/www/test
cd /var/www/test
svn co http://www.example.com/svn/project1/trunk project1

Now you can access that same HTML file from above at:

http://www.example.com/test/project1/folder/index.html

And now it will use the MIME types from the Apache configuration.

Now, you install a post-commit hook script in the repository which
basically does:

svn up /var/www/test/*

This way, every time anyone commits anything to the repository, the test
directories will be updated as well.

Updating "*" will be slow, so you can optimize this further if you like
to just update the thing that was just committed.




Re: SVN files content Type

Posted by Ryan Schmidt <su...@ryandesign.com>.
On May 16, 2011, at 00:42, D, Dinoj wrote:

> Hi Daniel/Ryan
> 
> Thanks. I understood that the mime content-types are not sending to the
> client from the server's mime.types file , intead it takes from the
> files which have subversion mime-type property set. I am unable to
> configure this to bypass to apache mime.types file.

That's correct.

> Here my requirement
> is that whoever accessing the repository through web browser must get
> the mime content-type from the apache file conf/mime.types and not from
> the svn:property. Please help on this.

There's no way to configure Subversion to do that.

As I already suggested, consider having a server-side post-commit hook that updates a server-side working copy of a relevant part of your repository, and point your apache at that working copy. Then, when users want to access this site, instruct users to use that other URL, not the repository URL.

As a concrete example:

Consider you have an HTML page in a project in a repository accessible here:

http://www.example.com/svn/project1/trunk/folder/index.html

You haven't been using svn:mime-type, so users who view this URL in a web browser will see the source of the document, instead of the page rendered as HTML which is what you want.

Imagine your repository is on the server at /var/svn, and that you have a document root at /var/www used for everything at http://www.example.com/ other than the /svn directory, like this:

<VirtualHost *:80>
	ServerName www.example.com
	DocumentRoot /var/www
	<Location /svn>
		DAV svn
		SVNPath /var/svn
	</Location>
</VirtualHost

So, check out a working copy of this project's trunk somewhere inside the document root:

mkdir -p /var/www/test
cd /var/www/test
svn co http://www.example.com/svn/project1/trunk project1

Now you can access that same HTML file from above at:

http://www.example.com/test/project1/folder/index.html

And now it will use the MIME types from the Apache configuration.

Now, you install a post-commit hook script in the repository which basically does:

svn up /var/www/test/*

This way, every time anyone commits anything to the repository, the test directories will be updated as well.

Updating "*" will be slow, so you can optimize this further if you like to just update the thing that was just committed.




RE: SVN files content Type

Posted by "D, Dinoj" <Di...@Honeywell.com>.
Hi Daniel/Ryan

Thanks. I understood that the mime content-types are not sending to the
client from the server's mime.types file , intead it takes from the
files which have subversion mime-type property set. I am unable to
configure this to bypass to apache mime.types file. Here my requirement
is that whoever accessing the repository through web browser must get
the mime content-type from the apache file conf/mime.types and not from
the svn:property. Please help on this.

Thanks & Regards,
Dinoj D
Desk: +91 80 26588360 Extn: 48547
Cell: +91 9916668051
-----Original Message-----
From: Daniel Shahaf [mailto:d.s@daniel.shahaf.name] 
Sent: Tuesday, May 10, 2011 3:17 PM
To: Ryan Schmidt
Cc: D, Dinoj; users@subversion.apache.org
Subject: Re: SVN files content Type

Ryan Schmidt wrote on Tue, May 10, 2011 at 02:41:25 -0500:
> 
> On May 10, 2011, at 02:24, D, Dinoj wrote:
> 
> > Thanks for your prompt response. The content type should be worked
only
> > while accessing the files through web browser.The problem here we
are
> > facing is that while accessing the files through web browser the
> > extensions .docx, .pptx, .xlsx are opening as zip files.  The
> > configuration for SVN in apache is 
> > 
> > <Location /repo/test>
> > DAV svn
> > SVNPath /repo/Test
> > 
> > </Location>
> > 
> > 
> > In which can we point the content to conf/mime.types file using 
> > 
> > TypesConfig conf/mime.types
> > 
> > Or is there any methods like
> > 
> > ModMimeUsePathInfo on
> > 
> > Or
> > AddType image/gif .gif or if any? 
> 
> No. Set the svn:mime-type property to the correct value on these
files.
> 

If nothing else, it ought to be technically possible to throw an HTTP
proxy that detects file extensions on GET requests to the mod_dav_svn
-controlled location and rewrites the Content-Type for those.

So, I'd expect there to be a way to configure httpd to bypass
mod_dav_svn's reported MIME types.

> 
> 

Re: SVN files content Type

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Ryan Schmidt wrote on Tue, May 10, 2011 at 02:41:25 -0500:
> 
> On May 10, 2011, at 02:24, D, Dinoj wrote:
> 
> > Thanks for your prompt response. The content type should be worked only
> > while accessing the files through web browser.The problem here we are
> > facing is that while accessing the files through web browser the
> > extensions .docx, .pptx, .xlsx are opening as zip files.  The
> > configuration for SVN in apache is 
> > 
> > <Location /repo/test>
> > DAV svn
> > SVNPath /repo/Test
> > 
> > </Location>
> > 
> > 
> > In which can we point the content to conf/mime.types file using 
> > 
> > TypesConfig conf/mime.types
> > 
> > Or is there any methods like
> > 
> > ModMimeUsePathInfo on
> > 
> > Or
> > AddType image/gif .gif or if any? 
> 
> No. Set the svn:mime-type property to the correct value on these files.
> 

If nothing else, it ought to be technically possible to throw an HTTP
proxy that detects file extensions on GET requests to the mod_dav_svn
-controlled location and rewrites the Content-Type for those.

So, I'd expect there to be a way to configure httpd to bypass
mod_dav_svn's reported MIME types.

> 
> 

RE: SVN files content Type

Posted by "D, Dinoj" <Di...@Honeywell.com>.
Ok, any plan of enhance this feature?

Thanks & Regards,
Dinoj D
Desk: +91 80 26588360 Extn: 48547
Cell: +91 9916668051

-----Original Message-----
From: Ryan Schmidt [mailto:subversion-2011a@ryandesign.com] 
Sent: Tuesday, May 10, 2011 1:11 PM
To: D, Dinoj
Cc: users@subversion.apache.org
Subject: Re: SVN files content Type


On May 10, 2011, at 02:24, D, Dinoj wrote:

> Thanks for your prompt response. The content type should be worked
only
> while accessing the files through web browser.The problem here we are
> facing is that while accessing the files through web browser the
> extensions .docx, .pptx, .xlsx are opening as zip files.  The
> configuration for SVN in apache is 
> 
> <Location /repo/test>
> DAV svn
> SVNPath /repo/Test
> 
> </Location>
> 
> 
> In which can we point the content to conf/mime.types file using 
> 
> TypesConfig conf/mime.types
> 
> Or is there any methods like
> 
> ModMimeUsePathInfo on
> 
> Or
> AddType image/gif .gif or if any? 

No. Set the svn:mime-type property to the correct value on these files.




Re: SVN files content Type

Posted by Ryan Schmidt <su...@ryandesign.com>.
On May 10, 2011, at 02:24, D, Dinoj wrote:

> Thanks for your prompt response. The content type should be worked only
> while accessing the files through web browser.The problem here we are
> facing is that while accessing the files through web browser the
> extensions .docx, .pptx, .xlsx are opening as zip files.  The
> configuration for SVN in apache is 
> 
> <Location /repo/test>
> DAV svn
> SVNPath /repo/Test
> 
> </Location>
> 
> 
> In which can we point the content to conf/mime.types file using 
> 
> TypesConfig conf/mime.types
> 
> Or is there any methods like
> 
> ModMimeUsePathInfo on
> 
> Or
> AddType image/gif .gif or if any? 

No. Set the svn:mime-type property to the correct value on these files.




RE: SVN files content Type

Posted by "D, Dinoj" <Di...@Honeywell.com>.
Hi Ryan

Thanks for your prompt response. The content type should be worked only
while accessing the files through web browser.The problem here we are
facing is that while accessing the files through web browser the
extensions .docx, .pptx, .xlsx are opening as zip files.  The
configuration for SVN in apache is 

<Location /repo/test>
DAV svn
SVNPath /repo/Test

</Location>


In which can we point the content to conf/mime.types file using 

TypesConfig conf/mime.types

Or is there any methods like

ModMimeUsePathInfo on

Or
AddType image/gif .gif or if any? 



Thanks & Regards,
Dinoj D
Desk: +91 80 26588360 Extn: 48547
Cell: +91 9916668051

-----Original Message-----
From: Ryan Schmidt [mailto:subversion-2011a@ryandesign.com] 
Sent: Tuesday, May 10, 2011 12:06 PM
To: D, Dinoj
Cc: users@subversion.apache.org
Subject: Re: SVN files content Type


On May 10, 2011, at 01:31, D, Dinoj wrote:

> Can we make it possible to contact apache content type using any
> modules..Setting the svn:mime-type to all individual files is not a
good
> solution

If you want to serve the files directly out of the repository, then you
must set the svn:mime-type property on each individual file.

You can use auto-props in your config file on each client to make it
easy to automatically add properties when adding files. There is a
script you can run to retroactively apply those properties to your
existing files in the repository too. And you can write a pre-commit
hook script to prevent future files from being added without their
required properties.

But, consider not serving the files directly out of the repository.
Instead, consider having a working copy of the appropriate subsection of
the repository checked out on your web server and automatically updated
at every commit. This will then use your normal Apache settings for mime
type etc., and will additionally let you use server-side scripting
languages like PHP if you want to.

http://subversion.apache.org/faq.html#website-auto-update



Re: SVN files content Type

Posted by Ryan Schmidt <su...@ryandesign.com>.
On May 10, 2011, at 01:31, D, Dinoj wrote:

> Can we make it possible to contact apache content type using any
> modules..Setting the svn:mime-type to all individual files is not a good
> solution

If you want to serve the files directly out of the repository, then you must set the svn:mime-type property on each individual file.

You can use auto-props in your config file on each client to make it easy to automatically add properties when adding files. There is a script you can run to retroactively apply those properties to your existing files in the repository too. And you can write a pre-commit hook script to prevent future files from being added without their required properties.

But, consider not serving the files directly out of the repository. Instead, consider having a working copy of the appropriate subsection of the repository checked out on your web server and automatically updated at every commit. This will then use your normal Apache settings for mime type etc., and will additionally let you use server-side scripting languages like PHP if you want to.

http://subversion.apache.org/faq.html#website-auto-update



RE: SVN files content Type

Posted by "D, Dinoj" <Di...@Honeywell.com>.
Hi Ryan

Can we make it possible to contact apache content type using any
modules..Setting the svn:mime-type to all individual files is not a good
solution

Thanks & Regards,
Dinoj D
Desk: +91 80 26588360 Extn: 48547
Cell: +91 9916668051
-----Original Message-----
From: Ryan Schmidt [mailto:subversion-2011a@ryandesign.com] 
Sent: Tuesday, May 10, 2011 11:52 AM
To: D, Dinoj
Cc: users@subversion.apache.org
Subject: Re: SVN files content Type


On May 9, 2011, at 23:51, D, Dinoj wrote:

> All the "content Types" are set for our apache server.  This is
working well for local apache paths . But if we point this to subversion
, it wouldn't work. Could you please let me know how to set content type
for subversions as well

For each individual file in the repository, you must set the
svn:mime-type property. Subversion does not use your Apache content
types.




Re: SVN files content Type

Posted by Ryan Schmidt <su...@ryandesign.com>.
On May 9, 2011, at 23:51, D, Dinoj wrote:

> All the “content Types” are set for our apache server.  This is working well for local apache paths . But if we point this to subversion , it wouldn’t work. Could you please let me know how to set content type for subversions as well

For each individual file in the repository, you must set the svn:mime-type property. Subversion does not use your Apache content types.