Skip to content

Commit

Permalink
Remove BufferingHTTPServer, reuse the header parser of BaseHTTPServer
Browse files Browse the repository at this point in the history
  • Loading branch information
cedk committed Feb 27, 2012
1 parent 1b0d971 commit 8c0cd01
Show file tree
Hide file tree
Showing 9 changed files with 254 additions and 511 deletions.
4 changes: 2 additions & 2 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ OPTIONAL
--------

- MySQLdb (http://sourceforge.net/projects/mysql-python)
- Mysql server 4.0+ for Mysql authentication with
with read/write access to one database
- Mysql server 4.0+ for Mysql authentication with
with read/write access to one database


NOTES
Expand Down
69 changes: 10 additions & 59 deletions doc/ARCHITECTURE
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,18 @@ OVERVIEW

Here is a little overview of the package:

A. In the DAV/ package:
A. In the pywebdav/lib/ package:

1. BufferingHTTPServer

This is the same as the normal BasicHTTPServer but instead of
directly sending each string over the network this implementation
caches it and sends it at once after finishing one request.

This has the advantage that clients like cadaver don't break as
they want to peek at the next lines when encountering e.g. a header.

2. AuthHTTPServer

1. AuthHTTPServer
This works on top of either the BasicHTTPServer or the
BufferingHTTPServer and implements basic authentication.

3. WebDAVServer
2. WebDAVServer
This server uses AuthHTTPServer for the base functionality. It also uses
a dav interface class for interfacing with the actual data storage (e.g.
a filesystem or a database).

B. In the PyDAVServer directory:
B. In the pywebdav/server/ directory:

1. server.py
Main file for server. Serves as a start point for the WebDAV server
Expand All @@ -47,59 +37,21 @@ B. In the PyDAVServer directory:
PyWebDav configuration file.


Class Tree
----------

PyWebDAVServer.fileauth.DAVAuthHandler
<Very simple handler for authentication. Must have its data
injected (look at server.py). Overwrites get_userinfo from AuthRequestHandler>

|
|
|

DAV.WebDAVServer.DAVRequestHandler
<Provides methods for DAV commands. These methods are triggered
by AuthRequestHandler.handle().>

|
|
|

DAV.AuthServer.BufferedAuthRequestHandler
<Calls the right methods to buffer request data>

| |
| |
| |

DAV.BufferingHTTPServer DAV.AuthServer.AuthRequestHandler
<Saves the complete result <Overwrites handle() method in order
in one file and returns to provide authentication and to pass
only if request is control to the do_ methods handling
complete> DAV commands>


Information
----------

This document describes the architecture of the python davserver.

The main programm is stored in DAV/WebDAVServer.py. It exports a class WebDAVServer
which is subclassed from AuthServer which again is subclassed from
BufferingHTTPServer.

The BufferingHTTPServer class extends the BaseHTTPServer class by
storing all output in a buffer and sending it at once when the request
is finished. Otherwise clients like cadaver might break.
The main programm is stored in pywebdav/lib/WebDAVServer.py. It exports a class
WebDAVServer which is subclassed from AuthServer.

The AuthServer class implements Basic Authentication in order to make
connections somewhat more secure.

For processing requests the WebDAVServer class needs some connection to
the actual data on server. In contrast to a normal web server this
data must not simply be stored on a filesystem but can also live in
databases and the like.
databases and the like.

Thus the WebDAVServer class needs an interface
to this data which is implemented via an interface class (in our
Expand All @@ -124,10 +76,9 @@ following:
You might use the existing class as skeleton and explanation of which
methods are needed.

That should be basically all you need to do. Have a look at PyDAVServer/fileauth.py in order
to get an example how to subclass WebDAVServer.
That should be basically all you need to do. Have a look at
pywebdav/server/fileauth.py in order to get an example how to subclass
WebDAVServer.

===
* describe the methods which need to be implemented.


7 changes: 5 additions & 2 deletions doc/Changes
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@

0.9.8 (Feb 2011)
----------------
0.9.8
-----

Restructured. Moved DAV package to pywebdav.lib. All integrators must simply replace
''from DAV'' imports to ''from pywebdav.lib''.
[Simon Pamies]

Remove BufferingHTTPServer, reuse the header parser of BaseHTTPServer.
[Cédric Krier]

Fix issue 44: Incomplete PROPFIND response
[Sascha Silbe]

Expand Down
8 changes: 4 additions & 4 deletions doc/TODO
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ GENERAL
-------

- web page needs to get done:
- Download
- News
- TODO list
- Changes
- Download
- News
- TODO list
- Changes
- Name

- use a better solution than DAV/INI_Parse.py [Stephane Klein]
Expand Down
16 changes: 8 additions & 8 deletions doc/interface_class
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ and change it. You actually have implement the following methods:



get_childs(self,uri)
get_childs(self, uri, filter=None)

This method should return a list of all childs for the
object specified by the given uri.
Expand All @@ -29,10 +29,10 @@ get_props(self,uri,values=None,all=None,proplist=[])
about properties for the object specified with the given uri.
The parameters are as follows:

values -- ?? cannot remember ;-)
all -- if set to 1 return all properties
proplist -- alternatively you can give get a list of
properties to return
values -- ?? cannot remember ;-)
all -- if set to 1 return all properties
proplist -- alternatively you can give get a list of
properties to return

The result of this method should be a dictionary of the form

Expand All @@ -50,15 +50,15 @@ get_data(self,uri)


get_dav(self,uri,propname)

This method will be called when the server needs access to a DAV
property. In the example implementation it will simply delegate it
to the corresponding _get_dav_<propname> method. You maybe should
handle it the same way.


_get_dav_<propname>(uri)

These methods will be called by get_dav() when the value of a DAV
property is needed. The defined properties are:

Expand Down Expand Up @@ -100,7 +100,7 @@ rmcol(self,uri)


rm(self,uri)

This is the same for single objects, the same as above applies.


Expand Down
16 changes: 8 additions & 8 deletions doc/walker
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Walker methods

In the COPY, DELETE and MOVE methods we need to walk over
a tree of resources and collections in order to copy, delete
or move them.
or move them.

The difference between all these walks is only that we perform
a different action on the resources we visit. Thus it might be
Expand All @@ -28,17 +28,17 @@ perform on it.


Here the iterative approach (in order to save memory):
dc=dataclass
queue=list=[start_uri]
dc = dataclass
queue = list = [start_uri]
while len(queue):
element=queue[-1]
childs=dc.get_childs(element)
element = queue[-1]
childs = dc.get_childs(element)
if childs:
list=list+childs
list = list + childs
# update queue
del queue[-1]
del queue[-1]
if childs:
queue=queue+childs
queue = queue + childs


(first try..)
Expand Down
Loading

0 comments on commit 8c0cd01

Please sign in to comment.