#1681 some fixes for builtin SSH server on Windows

This commit is contained in:
Unknwon 2015-11-23 22:32:07 -05:00
parent ec8d41765d
commit 0128036514
6 changed files with 14 additions and 8 deletions

View File

@ -5,7 +5,7 @@ Gogs - Go Git Service [![Build Status](https://travis-ci.org/gogits/gogs.svg?bra
![](public/img/gogs-large-resize.png) ![](public/img/gogs-large-resize.png)
##### Current version: 0.7.20 Beta ##### Current version: 0.7.21 Beta
<table> <table>
<tr> <tr>

View File

@ -65,7 +65,7 @@ func parseCmd(cmd string) (string, string) {
} }
var ( var (
COMMANDS = map[string]models.AccessMode{ allowedCommands = map[string]models.AccessMode{
"git-upload-pack": models.ACCESS_MODE_READ, "git-upload-pack": models.ACCESS_MODE_READ,
"git-upload-archive": models.ACCESS_MODE_READ, "git-upload-archive": models.ACCESS_MODE_READ,
"git-receive-pack": models.ACCESS_MODE_WRITE, "git-receive-pack": models.ACCESS_MODE_WRITE,
@ -163,7 +163,7 @@ func runServ(c *cli.Context) {
fail("Internal error", "Failed to get repository: %v", err) fail("Internal error", "Failed to get repository: %v", err)
} }
requestedMode, has := COMMANDS[verb] requestedMode, has := allowedCommands[verb]
if !has { if !has {
fail("Unknown git command", "Unknown git command %s", verb) fail("Unknown git command", "Unknown git command %s", verb)
} }
@ -234,6 +234,11 @@ func runServ(c *cli.Context) {
uuid := uuid.NewV4().String() uuid := uuid.NewV4().String()
os.Setenv("uuid", uuid) os.Setenv("uuid", uuid)
// Special handle for Windows.
if setting.IsWindows {
verb = strings.Replace(verb, "-", " ", 1)
}
var gitcmd *exec.Cmd var gitcmd *exec.Cmd
verbs := strings.Split(verb, " ") verbs := strings.Split(verb, " ")
if len(verbs) == 2 { if len(verbs) == 2 {

View File

@ -17,7 +17,7 @@ import (
"github.com/gogits/gogs/modules/setting" "github.com/gogits/gogs/modules/setting"
) )
const APP_VER = "0.7.20.1121 Beta" const APP_VER = "0.7.21.1123 Beta"
func init() { func init() {
runtime.GOMAXPROCS(runtime.NumCPU()) runtime.GOMAXPROCS(runtime.NumCPU())

View File

@ -222,6 +222,7 @@ func InstallPost(ctx *middleware.Context, form auth.InstallForm) {
} }
// Test repository root path. // Test repository root path.
form.RepoRootPath = strings.Replace(form.RepoRootPath, "\\", "/", -1)
if err := os.MkdirAll(form.RepoRootPath, os.ModePerm); err != nil { if err := os.MkdirAll(form.RepoRootPath, os.ModePerm); err != nil {
ctx.Data["Err_RepoRootPath"] = true ctx.Data["Err_RepoRootPath"] = true
ctx.RenderWithErr(ctx.Tr("install.invalid_repo_path", err), INSTALL, &form) ctx.RenderWithErr(ctx.Tr("install.invalid_repo_path", err), INSTALL, &form)

View File

@ -84,13 +84,13 @@ func HTTP(ctx *middleware.Context) {
// check access // check access
if askAuth { if askAuth {
baHead := ctx.Req.Header.Get("Authorization") authHead := ctx.Req.Header.Get("Authorization")
if baHead == "" { if len(authHead) == 0 {
authRequired(ctx) authRequired(ctx)
return return
} }
auths := strings.Fields(baHead) auths := strings.Fields(authHead)
// currently check basic auth // currently check basic auth
// TODO: support digit auth // TODO: support digit auth
// FIXME: middlewares/context.go did basic auth check already, // FIXME: middlewares/context.go did basic auth check already,

View File

@ -1 +1 @@
0.7.20.1121 Beta 0.7.21.1123 Beta