~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to doc/en/user-guide/http_smart_server.txt

  • Committer: Agustin Henze - TiN
  • Date: 2010-02-26 18:47:48 UTC
  • mto: This revision was merged to the branch mainline in revision 5077.
  • Revision ID: tin@sluc.org.ar-20100226184748-gm2vvvfpec2rbusd
Added suggestions for Andrew Bennetts and revised the entire document

Show diffs side-by-side

added added

removed removed

Lines of Context:
120
120
mod_wsgi
121
121
~~~~~~~~
122
122
 
123
 
The next configuration permit read and write the repository with apache
124
 
authentication.
125
123
First, configure mod_wsgi, e.g. enabling the mod with a2enmod wsgi.
126
 
 
127
 
In our example, we're already serving `/srv/example.com/www/code` at
128
 
`http://example.com/code`, if you want apache authentication you need add
129
 
the next lines::
130
 
 
131
 
    # This has the same structure as svn in apache
132
 
    <Location /code>
133
 
        AuthType Basic
134
 
        AuthName "example"
135
 
        AuthUserFile /srv/example.com/conf/auth.passwd
136
 
        <LimitExcept GET>
137
 
            Require valid-user
138
 
        </LimitExcept>
139
 
    </Location>
140
 
 
141
124
We need to change it to handle all requests for URLs ending in `.bzr/smart`.  It
142
125
will look like::
143
126
 
153
136
    </Directory>
154
137
 
155
138
This instructs Apache to hand requests for any URL ending with `/.bzr/smart`
156
 
inside `/code` to a Bazaar smart server via WSGI.
 
139
inside `/code` to a Bazaar smart server via WSGI, and any other URL inside
 
140
`/code` to be served directly by Apache.
157
141
 
158
142
Refer to the mod_wsgi_ documentation for further information.
159
143
 
234
218
        app = wsgi.make_app(
235
219
            root="/srv/example.com/www/code/",
236
220
            prefix="/code",
237
 
            readonly=False,
 
221
            readonly=True,
238
222
            enable_logging=False)
239
223
        return app(environ, start_response)
240
224
 
276
260
.. _WSGI standard: http://www.python.org/dev/peps/pep-0333/
277
261
 
278
262
 
279
 
Pushing over ``bzr+http://``
280
 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
263
Pushing over the http smart server
 
264
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
281
265
 
282
266
It is possible to allow pushing data over the http smart server. The
283
267
easiest way to do this, is to just supply ``readonly=False`` to the
284
268
``wsgi.make_app()`` call. But be careful, because the smart protocol does
285
269
not contain any Authentication. So if you enable write support, you will
286
270
want to restrict access to ``.bzr/smart`` URLs to restrict who can
287
 
actually write data on your system.  At this time, it is not possible to
288
 
allow some people to have read-only access and others to have read-write
289
 
access to the same urls. Because at the HTTP layer (which is doing the
290
 
Authenticating), everything is just a POST request.  However, it would
291
 
certainly be possible to have HTTPS require authentication and use a
292
 
writable server, and plain HTTP allow read-only access.
293
 
 
294
 
If you trying to push with the protocol bzr+https and receive the next
295
 
message::
296
 
 
297
 
    bzr: ERROR: Connection error: curl connection error (server certificate verification failed.
298
 
    CAfile:/etc/ssl/certs/ca-certificates.crt CRLfile: none)
299
 
 
300
 
You can probably uninstall pycurl or check the `bug 82086`_ or use
301
 
https+urllib if you put the RewriteRule directive in your Virtual Host.
 
271
actually write data on your system, e.g. in apache it looks like::
 
272
 
 
273
    <Location /code>
 
274
        AuthType Basic
 
275
        AuthName "example"
 
276
        AuthUserFile /srv/example.com/conf/auth.passwd
 
277
        <LimitExcept GET>
 
278
            Require valid-user
 
279
        </LimitExcept>
 
280
    </Location>
 
281
 
 
282
At this time, it is not possible to allow some people to have read-only
 
283
access and others to have read-write access to the same urls. Because at
 
284
the HTTP layer (which is doing the Authenticating), everything is just a
 
285
POST request.  However, it would certainly be possible to have HTTPS
 
286
require authentication and use a writable server, and plain HTTP allow
 
287
read-only access.
 
288
 
 
289
If bzr gives an error like this when accessing your HTTPS site::
 
290
 
 
291
  bzr: ERROR: Connection error: curl connection error (server certificate verification failed.
 
292
  CAfile:/etc/ssl/certs/ca-certificates.crt CRLfile: none)
 
293
 
 
294
You can workaround it by using ``https+urllib`` rather than ``http`` in your
 
295
URL, or by uninstalling pycurl.  See `bug 82086`_ for more details.
302
296
 
303
297
.. _bug 82086: https://bugs.launchpad.net/bzr/+bug/82086
304
298