Bazaar

Bazaar

 




Wiki Tools

  • Find Page
  • Recent Changes
  • Page History
  • Attachments

IIS Server Guide

Dumb Service

  • Configure the permissions for absolutely minimal access
    • No execute permissions required
  • To get IIS to serve files for which the extension is not recognised
    • Associate the mime-type * to application/octet-stream

This should be sufficient to provide a dumb, read-only, service.

Of course, IIS has an FTP server, if you trust it, so you could get dumb RW service from that. Some people might not recommend using the IIS FTP server on security grounds though.

Smart Service

Smart service on IIS could be provided via CGI, or ISAPI. The following links are probably a good starting point for those who wish to try this.

  • MS KB article on using Python with IIS as a CGI engine (and an ASP scripter).

  • PyISAPIe, a Python ISAPI module

PyISAPIe

Smart service using IIS 7 and PyISAPIe can be configured as follows.

  1. Configure a dumb service as above
    • In this case our dumb service is a root level virtual directory
    • Name is bzr

    • Resolves to f:\my\repo\folder

  2. Download and install PyISAPIe

    • Unpack it to a folder
    • Copy the Source/Python/Http folder from the unpacked archive into the folder with the DLL

  3. Change the text in Http/Isapi.py to the "Simple Bazaar Request Handler" below (with path changes as appropriate)

  4. Add a handler mapping to IIS instructions for IIS 7

    • Go to the Handler Mappings page for your virtual dir or a directory node above it
    • Add a "Module Mapping"
    • Request path */.bzr/smart

    • Module IsapiModule

    • Executable should point to PyISAPIe.dll

    • Name as desired (e.g. Python ISAPI Handler)

   1 """Simple Bazaar Request Handler
   2 
   3 Only serves a single folder, you could get far more creative.
   4 For example, to serve multiple roots, maintain a dict of wsgi app instances.
   5 
   6 """
   7 from Http import *
   8 from Http.WSGI import RunWSGI
   9 
  10 from bzrlib.transport.http import wsgi
  11 
  12 smart_server_app = wsgi.make_app(
  13          root=r'F:\my\repo\folder'
  14         # prefix must match the URI prefix that resolves to the folder or virtual folder the repo is in
  15         # e.g.  http://myserver/bzr/branch   
  16         # in this example "bzr" is an IIS virtual directory in the root of the site, pointing to f:\my\repo\folder
  17         ,prefix='/bzr'
  18         ,path_var='PATH_INFO'  # not "REQUEST_URI" as in user guide
  19         ,readonly=True)
  20 
  21 def Request():
  22     RunWSGI(smart_server_app)

Supporting IIS 6

IIS 6 is awkward.

However, you can configure EITHER smart OR dumb service easily. For dumb service, configure as for IIS 7 (the config dialogs may be a little different). For smart service, configure the PyISAPIe extension as a wildcard handler (make sure you turn OFF the "verify file is present" option).

Because by default, using the http:// scheme makes Bazaar pass a mixture of dumb and smart requests, and the described config can only serve one type, to use smart service on IIS 6 you must use the bzr+http:// URI scheme, which at present makes Bazaar use ONLY smart requests.

Problems :

  1. You cannot configure a pattern-matching URL handler on IIS6
    • You are only permitted a list of 0-n handlers that ALL requests are fielded by
  2. Bazaar makes dumb requests alongside smart ones when using http://

The IIS API does allow for a handler to "pass" on a request and get handled by the next in the chain, but PyISAPIe does not at present support calls to this API.

Solutions :

  1. Patch PyISAPIe to support calls to ServerSupportFunction from it's Python API

    • Or even just to have a "Pass" function which does this for you
  2. Patch bzr+http:// to remove non WSGI requests