Skip to content

Sabre Dav HTTP PATCH(partial PUT) Method support for go webdav server

Notifications You must be signed in to change notification settings

Jipok/webdavWithPATCH

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

webdavWithPATCH

Adds the ability to the standard go WebDav server to update files partially.

Made through implementation of SaberDAV HTTP PATCH

Useful for use in clients that mount webdav as a file system (for example webdavfs).

Example usage:

package main

import (
	"flag"
	"log"
	"net/http"

	"github.com/Jipok/webdavWithPATCH"
	"golang.org/x/net/webdav"
)

var (
	Addr      string
	TargetDir string
)

func main() {
	flag.StringVar(&Addr, "l", "127.0.0.1:8080", "interface:port for WebDav server to listen")
	flag.StringVar(&TargetDir, "t", "./", "target dir")
	flag.Parse()

	fs := webdav.Dir(TargetDir)
	handler := &webdavWithPATCH.Handler{
		Handler: webdav.Handler{
			FileSystem: fs,
			LockSystem: webdav.NewMemLS(),
		},
	}

	server := &http.Server{
		Addr:    Addr,
		Handler: handler,
	}

	log.Printf("Starting WebDAV server on http://%s \n", Addr)

	err := server.ListenAndServe()
	if err != nil {
		log.Fatal("Error starting server: ", err)
	}
}

About

Sabre Dav HTTP PATCH(partial PUT) Method support for go webdav server

Topics

Resources

Stars

Watchers

Forks

Languages