Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

XQuery/Publishing to Subversion

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

Motivation To have a single button on a content management system that will copy a file to a remote subversion repository. Method Configuration of the subversion repository on a standard Apache server that is configured with an SSL certificate. This will encrypt all communication between the intranet system and the remote subversion server. We will also set the authentication to be Basic Authentication. Apache Configuration File <Location "/testsvn/"> DAV svn AuthName "svntest" SVNParentPath /Library/Subversion/RepositoryTest SVNAutoversioning on <Limit GET HEAD OPTIONS CONNECT POST PROPFIND PUT DELETE PROPPATCH MKCOL COPY MOVE LOCK UNLOCK> Require user testuser1 testuser2 testuser3 </Limit> AuthType Basic </Location> HTTP Put Function for Basic Authentication HTTP Basic authentication requires the user to concatenate the user and password with a colon separating the strings and then do a base64-encoding on that string. This is then sent in the HTTP header with the key of "Authorization". The HTTP header must look like the following: Authorization = Basic BASE64-ENCODED-USER-PASSWORD The following XQuery function performs this process. declare function http:put-basic-auth($url, $content, $username, $password, $in-header) as node(){ let $credentials := concat($username, ':', $password) let $encode := util:base64-encode($credentials) let $value := concat('Basic ', $encode) let $new-headers := <headers> {$in-header/header} <header name="Authorization" value="{$value}"/> </headers> let $response := httpclient:put($url, $content, false(), $new-headers) return $response }; To put the file, put the URL in the correct content area, and the content to be inserted, the user name and password and Monitoring HTTP Client Libraries Debugging authentication protocols is very difficult if you do not have the correct tools. A useful tool is to enable logging for the httpclient module. <category name="org.apache.commons.httpclient" additivity="false"> <priority value="debug"/> <appender-ref ref="console"/> </category> References Wikipedia entry on Basic access authentication