The document discusses WebDAV, which extends HTTP to allow for distributed authoring and editing of resources over the web. It provides an introduction to HTTP and WebDAV, outlines some of the development challenges in working with WebDAV including ambiguities in the RFC specifications and misbehaving clients, and introduces the Zeta WebDAV component for addressing these challenges.
Connecting web Applications with Desktop, confoo 2011
1. Connecting web and desktop: WebDAV
ConFoo 2011
Tobias Schlitt <toby@qafoo.com>
March 10, 2011
2. Connecting web and desktop: WebDAV 2 / 49
Outline
Introduction
HTTP & WebDAV
Development challenges
Zeta Webdav component
3. Connecting web and desktop: WebDAV 3 / 49
About me
Degree in computer sience
More than 10 years of
professional PHP
Open source enthusiast
Apache Zeta Components
Arbit
PHPUnit
...
4. Connecting web and desktop: WebDAV 3 / 49
About me
Degree in computer sience
More than 10 years of
professional PHP
Open source enthusiast
Apache Zeta Components
Arbit
PHPUnit
...
5. Connecting web and desktop: WebDAV 3 / 49
About me
Degree in computer sience
More than 10 years of
professional PHP
Open source enthusiast
Apache Zeta Components
Arbit
PHPUnit
...
6. Connecting web and desktop: WebDAV 3 / 49
About me
Degree in computer sience
Co-Founder of
More than 10 years of Qafoo GmbH
professional PHP http://qafoo.com
Open source enthusiast
Apache Zeta Components Qafoo
passion for software quality
Arbit
PHPUnit
...
7. Connecting web and desktop: WebDAV 3 / 49
About me
Degree in computer sience
Co-Founder of
More than 10 years of Qafoo GmbH
professional PHP http://qafoo.com
Open source enthusiast
Apache Zeta Components Qafoo
passion for software quality
Arbit
We help people to produce
PHPUnit
...
high quality PHP code.
8. Connecting web and desktop: WebDAV 4 / 49
Outline
Introduction
HTTP & WebDAV
Development challenges
Zeta Webdav component
10. Connecting web and desktop: WebDAV 5 / 49
The concept
POST /some/resource
???
11. Connecting web and desktop: WebDAV 5 / 49
The concept
PUT /some/resource
???
12. Connecting web and desktop: WebDAV 5 / 49
The concept
Please file that document
under /some/resource
Done.
13. Connecting web and desktop: WebDAV 5 / 49
The concept
Please create a new col-
lection of documents
under /some/more
Done.
14. Connecting web and desktop: WebDAV 6 / 49
HTTP
Network protocol driving the web
Current version: 1.1
RFC 2616 (June 1999)
http://tools.ietf.org/html/rfc2616
Inventor: Sir Tim Berners-Lee
Client / server based
Stateless communication
Defines
Request / response
Headers / body
Formats / actions
15. Connecting web and desktop: WebDAV 6 / 49
HTTP
Network protocol driving the web
Current version: 1.1
RFC 2616 (June 1999)
http://tools.ietf.org/html/rfc2616
Inventor: Sir Tim Berners-Lee
Client / server based
Stateless communication
Defines
Request / response
Headers / body
Formats / actions
16. Connecting web and desktop: WebDAV 6 / 49
HTTP
Network protocol driving the web
Current version: 1.1
RFC 2616 (June 1999)
http://tools.ietf.org/html/rfc2616
Inventor: Sir Tim Berners-Lee
Client / server based
Stateless communication
Defines
Request / response
Headers / body
Formats / actions
17. Connecting web and desktop: WebDAV 6 / 49
HTTP
Network protocol driving the web
Current version: 1.1
RFC 2616 (June 1999)
http://tools.ietf.org/html/rfc2616
Inventor: Sir Tim Berners-Lee
Client / server based
Stateless communication
Defines
Request / response
Headers / body
Formats / actions
18. Connecting web and desktop: WebDAV 7 / 49
WebDAV
HTTP Extensions for Distributed Authoring
RFC 2518 (February 1999)
http://tools.ietf.org/html/rfc2518
HTTP Extensions for Web Distributed Authoring and
Versioning
RFC 4918 (June 2007)
http://tools.ietf.org/html/rfc4918
IETF Standard
Extension to HTTP
Allows distributed editing
19. Connecting web and desktop: WebDAV 7 / 49
WebDAV
HTTP Extensions for Distributed Authoring
RFC 2518 (February 1999)
http://tools.ietf.org/html/rfc2518
HTTP Extensions for Web Distributed Authoring and
Versioning
RFC 4918 (June 2007)
http://tools.ietf.org/html/rfc4918
IETF Standard
Extension to HTTP
Allows distributed editing
20. Connecting web and desktop: WebDAV 7 / 49
WebDAV
HTTP Extensions for Distributed Authoring
RFC 2518 (February 1999)
http://tools.ietf.org/html/rfc2518
HTTP Extensions for Web Distributed Authoring and
Versioning
RFC 4918 (June 2007)
http://tools.ietf.org/html/rfc4918
IETF Standard
Extension to HTTP
Allows distributed editing
21. Connecting web and desktop: WebDAV 7 / 49
WebDAV
HTTP Extensions for Distributed Authoring
RFC 2518 (February 1999)
http://tools.ietf.org/html/rfc2518
HTTP Extensions for Web Distributed Authoring and
Versioning
RFC 4918 (June 2007)
http://tools.ietf.org/html/rfc4918
IETF Standard
Extension to HTTP
Allows distributed editing
22. Connecting web and desktop: WebDAV 7 / 49
WebDAV
HTTP Extensions for Distributed Authoring
RFC 2518 (February 1999)
http://tools.ietf.org/html/rfc2518
HTTP Extensions for Web Distributed Authoring and
Versioning
RFC 4918 (June 2007)
http://tools.ietf.org/html/rfc4918
IETF Standard
Extension to HTTP
Allows distributed editing
WebDAV allows your users to edit web content easily.
23. Connecting web and desktop: WebDAV 8 / 49
Request methods
HTTP WebDAV
GET MKCOL
POST COPY
HEAD MOVE
PUT PROPFIND
DELETE PROPPATCH
OPTIONS LOCK
TRACE UNLOCK
CONNECT
24. Connecting web and desktop: WebDAV 8 / 49
Request methods
HTTP WebDAV
GET MKCOL
POST COPY
HEAD MOVE
PUT PROPFIND
DELETE PROPPATCH
OPTIONS LOCK
TRACE UNLOCK
CONNECT
25. Connecting web and desktop: WebDAV 8 / 49
Request methods
HTTP WebDAV
GET MKCOL
POST COPY
HEAD MOVE
PUT PROPFIND
DELETE PROPPATCH
OPTIONS LOCK
TRACE UNLOCK
CONNECT
26. Connecting web and desktop: WebDAV 8 / 49
Request methods
HTTP WebDAV
GET MKCOL
POST COPY
HEAD MOVE
PUT PROPFIND
DELETE PROPPATCH
OPTIONS LOCK
TRACE UNLOCK
CONNECT
27. Connecting web and desktop: WebDAV 8 / 49
Request methods
HTTP WebDAV
GET MKCOL
POST COPY
HEAD MOVE
PUT PROPFIND
DELETE PROPPATCH
OPTIONS LOCK
TRACE UNLOCK
CONNECT
28. Connecting web and desktop: WebDAV 8 / 49
Request methods
HTTP WebDAV
GET MKCOL
POST COPY
HEAD MOVE
PUT PROPFIND
DELETE PROPPATCH
OPTIONS LOCK
TRACE UNLOCK
CONNECT
29. Connecting web and desktop: WebDAV 8 / 49
Request methods
HTTP WebDAV
GET MKCOL
POST COPY
HEAD MOVE
PUT PROPFIND
DELETE PROPPATCH
OPTIONS LOCK
TRACE UNLOCK
CONNECT
30. Connecting web and desktop: WebDAV 8 / 49
Request methods
HTTP WebDAV
GET MKCOL
POST COPY
HEAD MOVE
PUT PROPFIND
DELETE PROPPATCH
OPTIONS LOCK
TRACE UNLOCK
CONNECT
Significant for WebDAV
31. Connecting web and desktop: WebDAV 9 / 49
Request headers
HTTP WebDAV
Accept[-*] Depth
Authorization Destination
If-[None-]Match If
If-[Un]Modified-Since Overwrite
User-Agent Timeout
...
32. Connecting web and desktop: WebDAV 9 / 49
Request headers
HTTP WebDAV
Accept[-*] Depth
Authorization Destination
If-[None-]Match If
If-[Un]Modified-Since Overwrite
User-Agent Timeout
...
33. Connecting web and desktop: WebDAV 9 / 49
Request headers
HTTP WebDAV
Accept[-*] Depth
Authorization Destination
If-[None-]Match If
If-[Un]Modified-Since Overwrite
User-Agent Timeout
...
Significant for WebDAV
34. Connecting web and desktop: WebDAV 10 / 49
Response headers
HTTP WebDAV
Accept-Ranges DAV
Content-Length Lock-Token
Content-Type Timeout
ETag
Location
Retry-After
Server
WWW-Authenticate
...
35. Connecting web and desktop: WebDAV 10 / 49
Response headers
HTTP WebDAV
Accept-Ranges DAV
Content-Length Lock-Token
Content-Type Timeout
ETag
Location
Retry-After
Server
WWW-Authenticate
...
36. Connecting web and desktop: WebDAV 10 / 49
Response headers
HTTP WebDAV
Accept-Ranges DAV
Content-Length Lock-Token
Content-Type Timeout
ETag
Location
Retry-After
Server
WWW-Authenticate
...
Significant for WebDAV
37. Connecting web and desktop: WebDAV 11 / 49
Request / response bodies
HTTP
Request body mostly not significant
Only PUT method needs body (to be stored)
Response body usually content to deliver (unspecified)
Error responses may contain arbitrary content
38. Connecting web and desktop: WebDAV 11 / 49
Request / response bodies
WebDAV
Bodies are significant
Many methods require XML bodies
Request Response
PROPFIND PROPFIND
PROPPATCH PROPPATCH
COPY (optional) LOCK
MOVE (optional) Potentially others
LOCK (multi-status)
39. Connecting web and desktop: WebDAV 11 / 49
Request / response bodies
WebDAV
Bodies are significant
Many methods require XML bodies
Request Response
PROPFIND PROPFIND
PROPPATCH PROPPATCH
COPY (optional) LOCK
MOVE (optional) Potentially others
LOCK (multi-status)
40. Connecting web and desktop: WebDAV 11 / 49
Request / response bodies
WebDAV
Bodies are significant
Many methods require XML bodies
Request Response
PROPFIND PROPFIND
PROPPATCH PROPPATCH
COPY (optional) LOCK
MOVE (optional) Potentially others
LOCK (multi-status)
41. Connecting web and desktop: WebDAV 12 / 49
Properties
Concept introduced by WebDAV
Store meta information about content
Usually not directly visible to the user
Live properties Dead properties
creationdate Arbitrary data
displayname Custom namespace
get* XML favored
lockdiscovery
...
42. Connecting web and desktop: WebDAV 12 / 49
Properties
Concept introduced by WebDAV
Store meta information about content
Usually not directly visible to the user
Live properties Dead properties
creationdate Arbitrary data
displayname Custom namespace
get* XML favored
lockdiscovery
...
43. Connecting web and desktop: WebDAV 12 / 49
Properties
Concept introduced by WebDAV
Store meta information about content
Usually not directly visible to the user
Live properties Dead properties
creationdate Arbitrary data
displayname Custom namespace
get* XML favored
lockdiscovery
...
44. Connecting web and desktop: WebDAV 13 / 49
Outline
Introduction
HTTP & WebDAV
Development challenges
Zeta Webdav component
45. Connecting web and desktop: WebDAV 14 / 49
Development challenges
Server development in general
WebDAV RFCs are a BBOM
Unstructured
Ambiguous
Design fails
Misbehaving clients
Ignore the specification
Different interpretations of RFCs
Proprietary BS
Exchangeable back ends
46. Connecting web and desktop: WebDAV 15 / 49
Outline
Development challenges
RFC problems
Client problems
Back end flexibility
47. Connecting web and desktop: WebDAV 16 / 49
COPY / MOVE methods
Errors on COPY
“[...] if an error occurs while copying an internal collection,
the server MUST NOT copy any resources identified by
members of this collection (i.e., the server must skip this
subtree) [...]” [?]
MOVE
“[...] is the logical equivalent of a copy (COPY), followed by
consistency maintenance processing, followed by a delete of
the source,[...]” [?]
MOVE errors
“[...] after detecting the error, the move operation SHOULD
try to finish as much of the original move as possible [...]” [?]
48. Connecting web and desktop: WebDAV 16 / 49
COPY / MOVE methods
Errors on COPY
“[...] if an error occurs while copying an internal collection,
the server MUST NOT copy any resources identified by
members of this collection (i.e., the server must skip this
subtree) [...]” [?]
MOVE
“[...] is the logical equivalent of a copy (COPY), followed by
consistency maintenance processing, followed by a delete of
the source,[...]” [?]
MOVE errors
“[...] after detecting the error, the move operation SHOULD
try to finish as much of the original move as possible [...]” [?]
49. Connecting web and desktop: WebDAV 16 / 49
COPY / MOVE methods
Errors on COPY
“[...] if an error occurs while copying an internal collection,
the server MUST NOT copy any resources identified by
members of this collection (i.e., the server must skip this
subtree) [...]” [?]
MOVE
“[...] is the logical equivalent of a copy (COPY), followed by
consistency maintenance processing, followed by a delete of
the source,[...]” [?]
MOVE errors
“[...] after detecting the error, the move operation SHOULD
try to finish as much of the original move as possible [...]” [?]
50. Connecting web and desktop: WebDAV 17 / 49
The If header
Makes operations conditional.
Apply operation only if
all conditions are met
no condition is met
1 No−tag − l i s t = L i s t
2 Tagged− l i s t = R e s o u r c e 1∗ L i s t
3 Resource = Coded−URL
4 List = ”(”
5 1 ∗ ( [ ” Not ” ] ( S t a t e −t o k e n | ” [ ” e n t i t y −t a g ” ] ” ) )
6 ”)”
7 S t a t e −t o k e n = Coded−URL
8 Coded−URL = ”<” a b s o l u t e U R I ”>”
51. Connecting web and desktop: WebDAV 18 / 49
The If header
Can contain
lock tokens
entity tags
1 I f : (< l o c k t o k e n : a−w r i t e −l o c k −t o k e n >
2 [ ” I am an ETag” ] ) ( [ ” I am a n o t h e r ETag” ] )
52. Connecting web and desktop: WebDAV 19 / 49
The If header
Conditions can apply to
single resources
sets of resources
all affected resources
1 <h t t p : // e x a m p l e . com/ r e s o u r c e 1 >
2 (< l o c k t o k e n : a−w r i t e −l o c k −t o k e n > [W/ ”A weak ETag” ] )
3 ( Not [ ” s t r o n g ETag” ] )
Required own parser implementation
Parser is about 150 LOC
53. Connecting web and desktop: WebDAV 20 / 49
Locking
2 different types of locks
Exclusive
Shared
Lock conditions must be validated before anything else
Timeout refresh on every lock use (successful or not)
(Fixed in RCF 4918)
Not specified how to associate principles with lock tokens
Lock-Null-Resources
(Partly fixed in RFC 4918)
Do not behave like real resources
Must vanish when the lock is released
A collection can be created on them
54. Connecting web and desktop: WebDAV 20 / 49
Locking
2 different types of locks
Exclusive
Shared
Lock conditions must be validated before anything else
Timeout refresh on every lock use (successful or not)
(Fixed in RCF 4918)
Not specified how to associate principles with lock tokens
Lock-Null-Resources
(Partly fixed in RFC 4918)
Do not behave like real resources
Must vanish when the lock is released
A collection can be created on them
55. Connecting web and desktop: WebDAV 20 / 49
Locking
2 different types of locks
Exclusive
Shared
Lock conditions must be validated before anything else
Timeout refresh on every lock use (successful or not)
(Fixed in RCF 4918)
Not specified how to associate principles with lock tokens
Lock-Null-Resources
(Partly fixed in RFC 4918)
Do not behave like real resources
Must vanish when the lock is released
A collection can be created on them
56. Connecting web and desktop: WebDAV 20 / 49
Locking
2 different types of locks
Exclusive
Shared
Lock conditions must be validated before anything else
Timeout refresh on every lock use (successful or not)
(Fixed in RCF 4918)
Not specified how to associate principles with lock tokens
Lock-Null-Resources
(Partly fixed in RFC 4918)
Do not behave like real resources
Must vanish when the lock is released
A collection can be created on them
57. Connecting web and desktop: WebDAV 20 / 49
Locking
2 different types of locks
Exclusive
Shared
Lock conditions must be validated before anything else
Timeout refresh on every lock use (successful or not)
(Fixed in RCF 4918)
Not specified how to associate principles with lock tokens
Lock-Null-Resources
(Partly fixed in RFC 4918)
Do not behave like real resources
Must vanish when the lock is released
A collection can be created on them
58. Connecting web and desktop: WebDAV 21 / 49
Outline
Development challenges
RFC problems
Client problems
Back end flexibility
59. Connecting web and desktop: WebDAV 22 / 49
Konqueror / Nautilus
Konqueror (KDE)
Does not decode URLs properly
Requires Apache like error messages for 404
Nautilus (Gnome)
Cannot cope with charset="..." info in MIME types
60. Connecting web and desktop: WebDAV 22 / 49
Konqueror / Nautilus
Konqueror (KDE)
Does not decode URLs properly
Requires Apache like error messages for 404
Nautilus (Gnome)
Cannot cope with charset="..." info in MIME types
61. Connecting web and desktop: WebDAV 23 / 49
Windows / InternetExplorer
At least 3 different WebDAV user agents in Windows
Loaded depending on how you initialize connection
Transparently switched occasionally
Requires custom header MS-Author-Via on every response
Requires custom namespaces set on live properties
Requires special namespace shortcut to be used (sic!)
Requires different shortcuts for DAV: namespace
62. Connecting web and desktop: WebDAV 23 / 49
Windows / InternetExplorer
At least 3 different WebDAV user agents in Windows
Loaded depending on how you initialize connection
Transparently switched occasionally
Requires custom header MS-Author-Via on every response
Requires custom namespaces set on live properties
Requires special namespace shortcut to be used (sic!)
Requires different shortcuts for DAV: namespace
63. Connecting web and desktop: WebDAV 23 / 49
Windows / InternetExplorer
At least 3 different WebDAV user agents in Windows
Loaded depending on how you initialize connection
Transparently switched occasionally
Requires custom header MS-Author-Via on every response
Requires custom namespaces set on live properties
Requires special namespace shortcut to be used (sic!)
Requires different shortcuts for DAV: namespace
64. Connecting web and desktop: WebDAV 24 / 49
Windows / InternetExplorer II
Cannot cope with non-significant white spaces in XML bodies
Requires newline at the end of every XML body
Occasionally sends invalid PROPFIND requests
65. Connecting web and desktop: WebDAV 24 / 49
Windows / InternetExplorer II
Cannot cope with non-significant white spaces in XML bodies
Requires newline at the end of every XML body
Occasionally sends invalid PROPFIND requests
66. Connecting web and desktop: WebDAV 24 / 49
Windows / InternetExplorer II
Cannot cope with non-significant white spaces in XML bodies
Requires newline at the end of every XML body
Occasionally sends invalid PROPFIND requests
67. Connecting web and desktop: WebDAV 25 / 49
Outline
Development challenges
RFC problems
Client problems
Back end flexibility
68. Connecting web and desktop: WebDAV 26 / 49
Back end flexibility
Exchangeable back end
File system
Memory (testing)
SQL Database?
Subversion?
Independent of client issues
Protocol enhancements back end independent
Easy implementation
69. Connecting web and desktop: WebDAV 26 / 49
Back end flexibility
Exchangeable back end
File system
Memory (testing)
SQL Database?
Subversion?
Independent of client issues
Protocol enhancements back end independent
Easy implementation
70. Connecting web and desktop: WebDAV 26 / 49
Back end flexibility
Exchangeable back end
File system
Memory (testing)
SQL Database?
Subversion?
Independent of client issues
Protocol enhancements back end independent
Easy implementation
71. Connecting web and desktop: WebDAV 26 / 49
Back end flexibility
Exchangeable back end
File system
Memory (testing)
SQL Database?
Subversion?
Independent of client issues
Protocol enhancements back end independent
Easy implementation
72. Connecting web and desktop: WebDAV 27 / 49
Outline
Introduction
HTTP & WebDAV
Development challenges
Zeta Webdav component
73. Connecting web and desktop: WebDAV 28 / 49
Outline
Zeta Webdav component
Background
Usage
Customization
End note
75. Connecting web and desktop: WebDAV 29 / 49
Apache Zeta Components
apache
Zeta
Components
76. Connecting web and desktop: WebDAV 30 / 49
History: eZ Components
Developed since 2004 by eZ Systems AS
Makers of enterprise OSS CMS eZ Publish
http://ez.no
Initial goal
Refactor and cleanup core libs of eZ Publish
Pull out standalone, general purpose library
Objectives
High quality code
Well thought out API
Backwards compatibility
Extensive documentation
77. Connecting web and desktop: WebDAV 31 / 49
History: The break
March 2010
All eZ Components developers left eZ Systems
Still, we wanted to . . .
put voluntary efforts into the project
push it further
ensure it is not broken
Discussion with eZ Systems
Spin off the project to become independent
Look for or create a foundation
Result: Propose code to Apache Software Foundation
78. Connecting web and desktop: WebDAV 32 / 49
Apache Software Foundation
http://apache.org
Well knwon OSS foundation
Home of OSS projects like
Apache HTTP server
Subversion
CouchDB
http://zeta-components.org
79. Connecting web and desktop: WebDAV 33 / 49
The Webdav component
General purpose WebDAV server
Easy integration and customization
Work around client issues
80. Connecting web and desktop: WebDAV 34 / 49
Zeta Webdav architecture
Transport layer Plugins
Microsoft Nautilus
RFC conform compatible Lock plugin
compatible
transport transport
transport
Your
custom plugin
Server layer
Your
authentication / Plugin API
authorization
Back end layer
Simple backend (base class)
File system eZ Publish Your custom
back end back end back end
81. Connecting web and desktop: WebDAV 35 / 49
Outline
Zeta Webdav component
Background
Usage
Customization
End note
82. Connecting web and desktop: WebDAV 36 / 49
Setup a simple WebDAV server
1 $ s e r v e r = ezcWebdavServer : : g e t I n s t a n c e ( ) ;
2 $ b a c k e n d = new e z c W e b d a v F i l e B a c k e n d (
3 dirname ( FILE ) . ’ / backend ’
4 );
5
6 $ s e r v e r − andle ( $backend ) ;
>h
83. Connecting web and desktop: WebDAV 36 / 49
Setup a simple WebDAV server
1 $ s e r v e r = ezcWebdavServer : : g e t I n s t a n c e ( ) ;
2 $ b a c k e n d = new e z c W e b d a v F i l e B a c k e n d (
3 dirname ( FILE ) . ’ / backend ’
4 );
5
6 $ s e r v e r − andle ( $backend ) ;
>h
84. Connecting web and desktop: WebDAV 36 / 49
Setup a simple WebDAV server
1 $ s e r v e r = ezcWebdavServer : : g e t I n s t a n c e ( ) ;
2 $ b a c k e n d = new e z c W e b d a v F i l e B a c k e n d (
3 dirname ( FILE ) . ’ / backend ’
4 );
5
6 $ s e r v e r − andle ( $backend ) ;
>h
85. Connecting web and desktop: WebDAV 36 / 49
Setup a simple WebDAV server
1 $ s e r v e r = ezcWebdavServer : : g e t I n s t a n c e ( ) ;
2 $ b a c k e n d = new e z c W e b d a v F i l e B a c k e n d (
3 dirname ( FILE ) . ’ / backend ’
4 );
5
6 $ s e r v e r − andle ( $backend ) ;
>h
86. Connecting web and desktop: WebDAV 37 / 49
WebDAV server with locking
1 require once ’ c u s t o m l o c k a u t h . php ’ ;
2
3 $ s e r v e r = ezcWebdavServer : : g e t I n s t a n c e ( ) ;
4
5 $ s e r v e r − u t h = new myCustomLockAuth (
>a
6 // Some c o n f i g u r a t i o n d i r e c t o r y h e r e
7 dirname ( FILE ) . ’ / t o k e n s . php ’
8 );
9
10 $server− luginRegistry− e g i s t e r P l u g i n (
>p >r
11 new e z c W e b d a v L o c k P l u g i n C o n f i g u r a t i o n ( )
12 );
13
14 $ b a c k e n d = new e z c W e b d a v F i l e B a c k e n d (
15 // Your WebDAV d i r e c t o r y h e r e
16 dirname ( FILE ) . ’ / backend ’
17 );
18
19 $ s e r v e r − andle ( $backend ) ;
>h
87. Connecting web and desktop: WebDAV 37 / 49
WebDAV server with locking
1 require once ’ c u s t o m l o c k a u t h . php ’ ;
2
3 $ s e r v e r = ezcWebdavServer : : g e t I n s t a n c e ( ) ;
4
5 $ s e r v e r − u t h = new myCustomLockAuth (
>a
6 // Some c o n f i g u r a t i o n d i r e c t o r y h e r e
7 dirname ( FILE ) . ’ / t o k e n s . php ’
8 );
9
10 $server− luginRegistry− e g i s t e r P l u g i n (
>p >r
11 new e z c W e b d a v L o c k P l u g i n C o n f i g u r a t i o n ( )
12 );
13
14 $ b a c k e n d = new e z c W e b d a v F i l e B a c k e n d (
15 // Your WebDAV d i r e c t o r y h e r e
16 dirname ( FILE ) . ’ / backend ’
17 );
18
19 $ s e r v e r − andle ( $backend ) ;
>h
88. Connecting web and desktop: WebDAV 37 / 49
WebDAV server with locking
1 require once ’ c u s t o m l o c k a u t h . php ’ ;
2
3 $ s e r v e r = ezcWebdavServer : : g e t I n s t a n c e ( ) ;
4
5 $ s e r v e r − u t h = new myCustomLockAuth (
>a
6 // Some c o n f i g u r a t i o n d i r e c t o r y h e r e
7 dirname ( FILE ) . ’ / t o k e n s . php ’
8 );
9
10 $server− luginRegistry− e g i s t e r P l u g i n (
>p >r
11 new e z c W e b d a v L o c k P l u g i n C o n f i g u r a t i o n ( )
12 );
13
14 $ b a c k e n d = new e z c W e b d a v F i l e B a c k e n d (
15 // Your WebDAV d i r e c t o r y h e r e
16 dirname ( FILE ) . ’ / backend ’
17 );
18
19 $ s e r v e r − andle ( $backend ) ;
>h
89. Connecting web and desktop: WebDAV 37 / 49
WebDAV server with locking
1 require once ’ c u s t o m l o c k a u t h . php ’ ;
2
3 $ s e r v e r = ezcWebdavServer : : g e t I n s t a n c e ( ) ;
4
5 $ s e r v e r − u t h = new myCustomLockAuth (
>a
6 // Some c o n f i g u r a t i o n d i r e c t o r y h e r e
7 dirname ( FILE ) . ’ / t o k e n s . php ’
8 );
9
10 $server− luginRegistry− e g i s t e r P l u g i n (
>p >r
11 new e z c W e b d a v L o c k P l u g i n C o n f i g u r a t i o n ( )
12 );
13
14 $ b a c k e n d = new e z c W e b d a v F i l e B a c k e n d (
15 // Your WebDAV d i r e c t o r y h e r e
16 dirname ( FILE ) . ’ / backend ’
17 );
18
19 $ s e r v e r − andle ( $backend ) ;
>h
90. Connecting web and desktop: WebDAV 38 / 49
Authentication
1 i n t e r f a c e ezcWebdavAnonymousAuthenticator
2 {
3 p u b l i c f u n c t i o n a u t h e n t i c a t e A n o n y m o u s ( ezcWebdavAnonymousAuth $ d a t a ) ;
4 }
1 i n t e r f a c e ezcWebdavBasicAuthenticator e x t e n d s ezcWebdavAnonymousAuthenticator
2 {
3 p u b l i c f u n c t i o n a u t h e n t i c a t e B a s i c ( ezcWebdavBasicAuth $data ) ;
4 }
1 i n t e r f a c e ezcWebdavDigestAuthenticator extends ezcWebdavBasicAuthenticator
2 {
3 p u b l i c f u n c t i o n a u t h e n t i c a t e D i g e s t ( ezcWebdavDigestAuth $data ) ;
4 }
91. Connecting web and desktop: WebDAV 38 / 49
Authentication
1 i n t e r f a c e ezcWebdavAnonymousAuthenticator
2 {
3 p u b l i c f u n c t i o n a u t h e n t i c a t e A n o n y m o u s ( ezcWebdavAnonymousAuth $ d a t a ) ;
4 }
1 i n t e r f a c e ezcWebdavBasicAuthenticator e x t e n d s ezcWebdavAnonymousAuthenticator
2 {
3 p u b l i c f u n c t i o n a u t h e n t i c a t e B a s i c ( ezcWebdavBasicAuth $data ) ;
4 }
1 i n t e r f a c e ezcWebdavDigestAuthenticator extends ezcWebdavBasicAuthenticator
2 {
3 p u b l i c f u n c t i o n a u t h e n t i c a t e D i g e s t ( ezcWebdavDigestAuth $data ) ;
4 }
92. Connecting web and desktop: WebDAV 38 / 49
Authentication
1 i n t e r f a c e ezcWebdavAnonymousAuthenticator
2 {
3 p u b l i c f u n c t i o n a u t h e n t i c a t e A n o n y m o u s ( ezcWebdavAnonymousAuth $ d a t a ) ;
4 }
1 i n t e r f a c e ezcWebdavBasicAuthenticator e x t e n d s ezcWebdavAnonymousAuthenticator
2 {
3 p u b l i c f u n c t i o n a u t h e n t i c a t e B a s i c ( ezcWebdavBasicAuth $data ) ;
4 }
1 i n t e r f a c e ezcWebdavDigestAuthenticator extends ezcWebdavBasicAuthenticator
2 {
3 p u b l i c f u n c t i o n a u t h e n t i c a t e D i g e s t ( ezcWebdavDigestAuth $data ) ;
4 }
93. Connecting web and desktop: WebDAV 38 / 49
Authentication
1 i n t e r f a c e ezcWebdavAnonymousAuthenticator
2 {
3 p u b l i c f u n c t i o n a u t h e n t i c a t e A n o n y m o u s ( ezcWebdavAnonymousAuth $ d a t a ) ;
4 }
1 i n t e r f a c e ezcWebdavBasicAuthenticator e x t e n d s ezcWebdavAnonymousAuthenticator
2 {
3 p u b l i c f u n c t i o n a u t h e n t i c a t e B a s i c ( ezcWebdavBasicAuth $data ) ;
4 }
1 i n t e r f a c e ezcWebdavDigestAuthenticator extends ezcWebdavBasicAuthenticator
2 {
3 p u b l i c f u n c t i o n a u t h e n t i c a t e D i g e s t ( ezcWebdavDigestAuth $data ) ;
4 }
94. Connecting web and desktop: WebDAV 39 / 49
Authorization
1 i n t e r f a c e ezcWebdavAuthorizer
2 {
3 c o n s t ACCESS READ = 1 ;
4 c o n s t ACCESS WRITE = 2 ;
5
6 p u b l i c f u n c t i o n a u t h o r i z e ( $ u s e r , $path , $ a c c e s s = s e l f : : ACCESS READ ) ;
7 }
1 i n t e r f a c e ezcWebdavLockAuthorizer extends ezcWebdavAuthorizer
2 {
3 p u b l i c f u n c t i o n assignLock ( $user , $lockToken ) ;
4
5 p u b l i c f u n c t i o n ownsLock ( $ u s e r , $ l o c k T o k e n ) ;
6
7 p u b l i c f u n c t i o n r e l e a s e L o c k ( $user , $lockToken ) ;
8 }
95. Connecting web and desktop: WebDAV 39 / 49
Authorization
1 i n t e r f a c e ezcWebdavAuthorizer
2 {
3 c o n s t ACCESS READ = 1 ;
4 c o n s t ACCESS WRITE = 2 ;
5
6 p u b l i c f u n c t i o n a u t h o r i z e ( $ u s e r , $path , $ a c c e s s = s e l f : : ACCESS READ ) ;
7 }
1 i n t e r f a c e ezcWebdavLockAuthorizer extends ezcWebdavAuthorizer
2 {
3 p u b l i c f u n c t i o n assignLock ( $user , $lockToken ) ;
4
5 p u b l i c f u n c t i o n ownsLock ( $ u s e r , $ l o c k T o k e n ) ;
6
7 p u b l i c f u n c t i o n r e l e a s e L o c k ( $user , $lockToken ) ;
8 }
96. Connecting web and desktop: WebDAV 39 / 49
Authorization
1 i n t e r f a c e ezcWebdavAuthorizer
2 {
3 c o n s t ACCESS READ = 1 ;
4 c o n s t ACCESS WRITE = 2 ;
5
6 p u b l i c f u n c t i o n a u t h o r i z e ( $ u s e r , $path , $ a c c e s s = s e l f : : ACCESS READ ) ;
7 }
1 i n t e r f a c e ezcWebdavLockAuthorizer extends ezcWebdavAuthorizer
2 {
3 p u b l i c f u n c t i o n assignLock ( $user , $lockToken ) ;
4
5 p u b l i c f u n c t i o n ownsLock ( $ u s e r , $ l o c k T o k e n ) ;
6
7 p u b l i c f u n c t i o n r e l e a s e L o c k ( $user , $lockToken ) ;
8 }
97. Connecting web and desktop: WebDAV 39 / 49
Authorization
1 i n t e r f a c e ezcWebdavAuthorizer
2 {
3 c o n s t ACCESS READ = 1 ;
4 c o n s t ACCESS WRITE = 2 ;
5
6 p u b l i c f u n c t i o n a u t h o r i z e ( $ u s e r , $path , $ a c c e s s = s e l f : : ACCESS READ ) ;
7 }
1 i n t e r f a c e ezcWebdavLockAuthorizer extends ezcWebdavAuthorizer
2 {
3 p u b l i c f u n c t i o n assignLock ( $user , $lockToken ) ;
4
5 p u b l i c f u n c t i o n ownsLock ( $ u s e r , $ l o c k T o k e n ) ;
6
7 p u b l i c f u n c t i o n r e l e a s e L o c k ( $user , $lockToken ) ;
8 }
98. Connecting web and desktop: WebDAV 39 / 49
Authorization
1 i n t e r f a c e ezcWebdavAuthorizer
2 {
3 c o n s t ACCESS READ = 1 ;
4 c o n s t ACCESS WRITE = 2 ;
5
6 p u b l i c f u n c t i o n a u t h o r i z e ( $ u s e r , $path , $ a c c e s s = s e l f : : ACCESS READ ) ;
7 }
1 i n t e r f a c e ezcWebdavLockAuthorizer extends ezcWebdavAuthorizer
2 {
3 p u b l i c f u n c t i o n assignLock ( $user , $lockToken ) ;
4
5 p u b l i c f u n c t i o n ownsLock ( $ u s e r , $ l o c k T o k e n ) ;
6
7 p u b l i c f u n c t i o n r e l e a s e L o c k ( $user , $lockToken ) ;
8 }
99. Connecting web and desktop: WebDAV 39 / 49
Authorization
1 i n t e r f a c e ezcWebdavAuthorizer
2 {
3 c o n s t ACCESS READ = 1 ;
4 c o n s t ACCESS WRITE = 2 ;
5
6 p u b l i c f u n c t i o n a u t h o r i z e ( $ u s e r , $path , $ a c c e s s = s e l f : : ACCESS READ ) ;
7 }
1 i n t e r f a c e ezcWebdavLockAuthorizer extends ezcWebdavAuthorizer
2 {
3 p u b l i c f u n c t i o n assignLock ( $user , $lockToken ) ;
4
5 p u b l i c f u n c t i o n ownsLock ( $ u s e r , $ l o c k T o k e n ) ;
6
7 p u b l i c f u n c t i o n r e l e a s e L o c k ( $user , $lockToken ) ;
8 }
100. Connecting web and desktop: WebDAV 40 / 49
Outline
Zeta Webdav component
Background
Usage
Customization
End note
101. Connecting web and desktop: WebDAV 41 / 49
Path handling
1 $ s e r v e r = ezcWebdavServer : : g e t I n s t a n c e ( ) ;
2
3 $ p a t h F a c t o r y = new e z c W e b d a v B a s i c P a t h F a c t o r y (
4 ’ h t t p : / / e x a m p l e . com/ webdav / i n d e x . php ’
5 );
6
7 foreach ( $server− o n f i g u r a t i o n s as $conf )
>c
8 {
9 $ c o n f− a t h F a c t o r y = $ p a t h F a c t o r y ;
>p
10 }
11
12 $ b a c k e n d = new e z c W e b d a v F i l e B a c k e n d (
13 dirname ( FILE ) . ’ / backend ’
14 );
15
16 $ s e r v e r − andle ( $backend ) ;
>h
102. Connecting web and desktop: WebDAV 41 / 49
Path handling
1 $ s e r v e r = ezcWebdavServer : : g e t I n s t a n c e ( ) ;
2
3 $ p a t h F a c t o r y = new e z c W e b d a v B a s i c P a t h F a c t o r y (
4 ’ h t t p : / / e x a m p l e . com/ webdav / i n d e x . php ’
5 );
6
7 foreach ( $server− o n f i g u r a t i o n s as $conf )
>c
8 {
9 $ c o n f− a t h F a c t o r y = $ p a t h F a c t o r y ;
>p
10 }
11
12 $ b a c k e n d = new e z c W e b d a v F i l e B a c k e n d (
13 dirname ( FILE ) . ’ / backend ’
14 );
15
16 $ s e r v e r − andle ( $backend ) ;
>h
103. Connecting web and desktop: WebDAV 41 / 49
Path handling
1 $ s e r v e r = ezcWebdavServer : : g e t I n s t a n c e ( ) ;
2
3 $ p a t h F a c t o r y = new e z c W e b d a v B a s i c P a t h F a c t o r y (
4 ’ h t t p : / / e x a m p l e . com/ webdav / i n d e x . php ’
5 );
6
7 foreach ( $server− o n f i g u r a t i o n s as $conf )
>c
8 {
9 $ c o n f− a t h F a c t o r y = $ p a t h F a c t o r y ;
>p
10 }
11
12 $ b a c k e n d = new e z c W e b d a v F i l e B a c k e n d (
13 dirname ( FILE ) . ’ / backend ’
14 );
15
16 $ s e r v e r − andle ( $backend ) ;
>h
104. Connecting web and desktop: WebDAV 42 / 49
The back end
ezcWebdavFileBackend
ezcWebdavMemoryBackend
Write your own
ezcWebdavSimpleBackend
ezcWebdavBackend
ezcWebdavBackendPut
ezcWebdavBackendChange
ezcWebdavBackendMakeCollection
ezcWebdavLockBackend
105. Connecting web and desktop: WebDAV 42 / 49
The back end
ezcWebdavFileBackend
ezcWebdavMemoryBackend
Write your own
ezcWebdavSimpleBackend
ezcWebdavBackend
ezcWebdavBackendPut
ezcWebdavBackendChange
ezcWebdavBackendMakeCollection
ezcWebdavLockBackend
106. Connecting web and desktop: WebDAV 42 / 49
The back end
ezcWebdavFileBackend
ezcWebdavMemoryBackend
Write your own
ezcWebdavSimpleBackend
ezcWebdavBackend
ezcWebdavBackendPut
ezcWebdavBackendChange
ezcWebdavBackendMakeCollection
ezcWebdavLockBackend
107. Connecting web and desktop: WebDAV 42 / 49
The back end
ezcWebdavFileBackend
ezcWebdavMemoryBackend
Write your own
ezcWebdavSimpleBackend
ezcWebdavBackend
ezcWebdavBackendPut
ezcWebdavBackendChange
ezcWebdavBackendMakeCollection
ezcWebdavLockBackend
108. Connecting web and desktop: WebDAV 43 / 49
ezcWebdavSimpleBackend
Proper method handling
Authorization
Handling of If[-*] headers
about 1600 LOC
No deeper knowledge on WebDAV required
109. Connecting web and desktop: WebDAV 44 / 49
New clients
Adjust transport layer
Needs some patience
Use Wireshark!
Extend one or more of
ezcWebdavTransport
ezcWebdavHeaderHandler
ezcWebdavPropertyHandler
110. Connecting web and desktop: WebDAV 44 / 49
New clients
Adjust transport layer
Needs some patience
Use Wireshark!
Extend one or more of
ezcWebdavTransport
ezcWebdavHeaderHandler
ezcWebdavPropertyHandler
1 $ n e w C l i e n t C o n f = new e z c W e b d a v S e r v e r C o n f i g u r a t i o n (
2 ’ (My. ∗ Webdav s+C l i e n g t ) i ’ ,
3 ’ myCustomTransportTransport ’
4 // . . .
5 );
6
7 $server− o n f i g u r a t i o n s − n s e r t B e f o r e ( $newClientConf , 0 ) ;
>c >i
111. Connecting web and desktop: WebDAV 44 / 49
New clients
Adjust transport layer
Needs some patience
Use Wireshark!
Extend one or more of
ezcWebdavTransport
ezcWebdavHeaderHandler
ezcWebdavPropertyHandler
1 $ n e w C l i e n t C o n f = new e z c W e b d a v S e r v e r C o n f i g u r a t i o n (
2 ’ (My. ∗ Webdav s+C l i e n g t ) i ’ ,
3 ’ myCustomTransportTransport ’
4 // . . .
5 );
6
7 $server− o n f i g u r a t i o n s − n s e r t B e f o r e ( $newClientConf , 0 ) ;
>c >i
112. Connecting web and desktop: WebDAV 45 / 49
Plugins
Hook into requests / responses
Handle unknown requests
Issue unknown responses
Send requests to the back end
113. Connecting web and desktop: WebDAV 46 / 49
Outline
Zeta Webdav component
Background
Usage
Customization
End note
114. Connecting web and desktop: WebDAV 47 / 49
Join the team!
Come and contribute!
Highly technical discussions
Open minded people
Apache Software Foundation
http://zeta-components.org
115. Connecting web and desktop: WebDAV 48 / 49
Q/A
Are there any questions left?
116. Connecting web and desktop: WebDAV 49 / 49
Thanks for listening
Please rate this talk at
http://joind.in/2808
and / or give me some feedback right now!
117. Connecting web and desktop: WebDAV 49 / 49
Thanks for listening
Please rate this talk at
http://joind.in/2808
and / or give me some feedback right now!
This is very important for . . .
Speakers
Organizers
You!
118. Connecting web and desktop: WebDAV 49 / 49
Thanks for listening
Please rate this talk at
http://joind.in/2808
and / or give me some feedback right now!
Stay in touch
Tobias Schlitt
toby@qafoo.com
@tobySen / @qafoo
Rent a PHP quality expert:
http://qafoo.com