smartnut007
smartnut007

Reputation: 6423

How do I serve html thru svn ? (Can svn act as a web server?)

I have checked in javadocs(html files) into svn. But, when I access the html files thru a browser, it gets interpreted as text. How, do I fix this ?

Upvotes: 14

Views: 6294

Answers (2)

Harry Developer
Harry Developer

Reputation: 522

If you don't want to change the behaviour in general, you may be able to modify the mime type with your SVN client. E.g. for Tortoise SVN do the following:

  • go into the Repo Browser
  • right click onto the desired file and select "Show properties"
  • if there already is a "svn:mime-type" property hit "Edit ..."
  • if not, hit "New ..." and add the property "mime-type"
  • in the mime-type edit dialog you can choose between text, binary and custom. When choosing custom, you can set what ever you want. E.g. text/html, or video/mp4.
  • hit ok until all dialogs are closed.
  • you are done.

This way you can define the behaviour per file which is sometimes very usefull.

Upvotes: 0

splash
splash

Reputation: 13327

SVN is not a webserver. I guess you are talking about Subversion's Apache module!? If you want to view .html files as HTML then you should set svn:mime-type=text/html:

svn propset svn:mime-type text/html *.html

See Properties in the SVN Book.

Also, if the svn:mime-type property is set, then the Subversion Apache module will use its value to populate the Content-type: HTTP header when responding to GET requests. This gives a crucial clue about how to display a file when perusing your repository with a web browser.

Maybe you can configure your subversion client or server with the following lines in the config file:

[miscellany]
### Automatic properties are defined in the section 'auto-props'.
enable-auto-props = yes

### Section for configuring automatic properties.
[auto-props]
*.html = svn:mime-type=text/html

This will automatically set the properties for new files.

Upvotes: 14

Related Questions