Clean Up Debugging Traces
This commit is contained in:
parent
9bdca02d48
commit
c16c16980d
@ -221,7 +221,6 @@ func fetchAndReportToChan(pointers []*lfs.WrappedPointer, include, exclude []str
|
||||
q := lfs.NewDownloadQueue(len(pointers), totalSize, false)
|
||||
|
||||
for _, p := range pointers {
|
||||
|
||||
// Only add to download queue if local file is not the right size already
|
||||
// This avoids previous case of over-reporting a requirement for files we already have
|
||||
// which would only be skipped by PointerSmudgeObject later
|
||||
@ -229,7 +228,6 @@ func fetchAndReportToChan(pointers []*lfs.WrappedPointer, include, exclude []str
|
||||
if !lfs.ObjectExistsOfSize(p.Oid, p.Size) && passFilter {
|
||||
tracerx.Printf("fetch %v [%v]", p.Name, p.Oid)
|
||||
q.Add(lfs.NewDownloadable(p))
|
||||
tracerx.Printf("command_fetch-willhi: Adding file %s", p.Name)
|
||||
} else {
|
||||
if !passFilter {
|
||||
tracerx.Printf("Skipping %v [%v], include/exclude filters applied", p.Name, p.Oid)
|
||||
|
@ -16,7 +16,6 @@ var (
|
||||
|
||||
func versionCommand(cmd *cobra.Command, args []string) {
|
||||
Print(lfs.UserAgent)
|
||||
Print("Bazooka")
|
||||
|
||||
if lovesComics {
|
||||
Print("Nothing may see Gah Lak Tus and survive!")
|
||||
|
@ -467,7 +467,7 @@ func doHttpRequest(req *http.Request, creds Creds) (*http.Response, error) {
|
||||
|
||||
if Config.NTLM() {
|
||||
tracerx.Printf("client: NTLM Request")
|
||||
res, err = DoNTLMRequest(req)
|
||||
res, err = DoNTLMRequest(req, true)
|
||||
} else {
|
||||
res, err = Config.HttpClient().Do(req)
|
||||
}
|
||||
|
@ -7,7 +7,6 @@ import (
|
||||
"net/url"
|
||||
"os/exec"
|
||||
"strings"
|
||||
"github.com/github/git-lfs/vendor/_nuts/github.com/rubyist/tracerx"
|
||||
)
|
||||
|
||||
// getCreds gets the credentials for the given request's URL, and sets its
|
||||
@ -51,9 +50,6 @@ func getCredsForAPI(req *http.Request) (Creds, error) {
|
||||
func getCredURLForAPI(req *http.Request) (*url.URL, error) {
|
||||
apiUrl, err := Config.ObjectUrl("")
|
||||
if err != nil {
|
||||
|
||||
tracerx.Printf("credentials-willhi credentials execCreds err:%s", err.Error())
|
||||
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
10
lfs/http.go
10
lfs/http.go
@ -63,15 +63,7 @@ func (c *HttpClient) Do(req *http.Request) (*http.Response, error) {
|
||||
|
||||
start := time.Now()
|
||||
res, err := c.Client.Do(req)
|
||||
if err != nil {
|
||||
|
||||
tracerx.Printf("http: c.Client.Do Error:%s", err.Error())
|
||||
if res != nil{
|
||||
tracerx.Printf("http:response not nil")
|
||||
}else {
|
||||
tracerx.Printf("http: response nil")
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return res, err
|
||||
}
|
||||
|
||||
|
34
lfs/ntlm.go
34
lfs/ntlm.go
@ -37,14 +37,9 @@ func (c *Configuration) NTLMSession() ntlm.ClientSession {
|
||||
return session
|
||||
}
|
||||
|
||||
func DoNTLMRequest(request *http.Request) (*http.Response, error) {
|
||||
|
||||
tracerx.Printf("DoNTLMRequest ENTER")
|
||||
defer tracerx.Printf("DoNTLMRequest LEAVE")
|
||||
|
||||
func DoNTLMRequest(request *http.Request, retry bool) (*http.Response, error) {
|
||||
|
||||
if !Config.NTLM() {
|
||||
tracerx.Printf("DoNTLMRequest ntlm is not enabled")
|
||||
|
||||
return nil, Error(fmt.Errorf("NTLM is not enabled"))
|
||||
}
|
||||
|
||||
@ -60,6 +55,11 @@ func DoNTLMRequest(request *http.Request) (*http.Response, error) {
|
||||
challengeReq := cloneRequest(request)
|
||||
res, nil := Challenge(challengeReq, challengeMessage)
|
||||
|
||||
//If the status is 401 then we need to re-authenticate
|
||||
if res.StatusCode == 401 && retry == true {
|
||||
return DoNTLMRequest(challengeReq, false)
|
||||
}
|
||||
|
||||
return res, nil
|
||||
}
|
||||
|
||||
@ -68,14 +68,9 @@ func DoNTLMRequest(request *http.Request) (*http.Response, error) {
|
||||
|
||||
func InitHandShake(request *http.Request) (*http.Response, error){
|
||||
|
||||
tracerx.Printf("=----->A")
|
||||
|
||||
var response, err = Config.HttpClient().Do(request)
|
||||
|
||||
tracerx.Printf("=------B")
|
||||
|
||||
if err != nil {
|
||||
tracerx.Printf("=-------->Err %s", err.Error())
|
||||
return nil, Error(err)
|
||||
}
|
||||
|
||||
@ -117,31 +112,25 @@ func Challenge(request *http.Request, challengeBytes []byte) (*http.Response, er
|
||||
return nil, Error(err)
|
||||
}
|
||||
|
||||
authenticateMessage := string(Concat([]byte("NTLM "), []byte(base64.StdEncoding.EncodeToString(authenticate.Bytes()))))
|
||||
authenticateMessage := ConcatS("NTLM ", base64.StdEncoding.EncodeToString(authenticate.Bytes()))
|
||||
|
||||
request.Header.Add("Authorization", authenticateMessage)
|
||||
response, err := Config.HttpClient().Do(request)
|
||||
|
||||
//io.Copy(ioutil.Discard, response.Body)
|
||||
//response.Body.Close()
|
||||
|
||||
return response, nil
|
||||
}
|
||||
|
||||
// get the bytes for the Type2 message
|
||||
func ParseChallengeMessage(response *http.Response) []byte{
|
||||
|
||||
if headers, ok := response.Header["Www-Authenticate"]; ok{
|
||||
|
||||
//parse out the "NTLM " at the beginning of the resposne
|
||||
//parse out the "NTLM " at the beginning of the response
|
||||
challenge := headers[0][5:]
|
||||
|
||||
val, err := base64.StdEncoding.DecodeString(challenge)
|
||||
|
||||
if err != nil{
|
||||
tracerx.Printf("ntlm: ParseChallengeMessage Error %s", err.Error())
|
||||
panic(err.Error())
|
||||
}
|
||||
|
||||
return []byte(val)
|
||||
}
|
||||
|
||||
@ -154,7 +143,7 @@ func cloneRequest(request *http.Request) *http.Request {
|
||||
var clonedReq *http.Request
|
||||
|
||||
if request.Body != nil {
|
||||
//If we have a body (POST/PUT etc.
|
||||
//If we have a body (POST/PUT etc.)
|
||||
//We need to do some magic to copy the request without closing the body stream
|
||||
|
||||
buf, _ := ioutil.ReadAll(request.Body)
|
||||
@ -166,7 +155,6 @@ func cloneRequest(request *http.Request) *http.Request {
|
||||
clonedReq, _ = http.NewRequest(request.Method, request.URL.String(), nil)
|
||||
}
|
||||
|
||||
|
||||
for k, v := range request.Header {
|
||||
clonedReq.Header.Add(k,v[0])
|
||||
}
|
||||
|
@ -129,12 +129,8 @@ func (q *TransferQueue) Watch() chan string {
|
||||
// sequential nature here is only for the meta POST calls.
|
||||
func (q *TransferQueue) individualApiRoutine(apiWaiter chan interface{}) {
|
||||
for t := range q.apic {
|
||||
|
||||
tracerx.Printf("tq-willhi: Name- %s", t.Name())
|
||||
|
||||
obj, err := t.Check()
|
||||
if err != nil {
|
||||
|
||||
if err != nil {`
|
||||
tracerx.Printf("tq-willhi: t.Check() failed %s", t.Check)
|
||||
|
||||
if q.canRetry(err) {
|
||||
@ -146,8 +142,6 @@ func (q *TransferQueue) individualApiRoutine(apiWaiter chan interface{}) {
|
||||
continue
|
||||
}
|
||||
|
||||
tracerx.Printf("tq-willhi: t.Check() Passed")
|
||||
|
||||
if apiWaiter != nil { // Signal to launch more individual api workers
|
||||
q.meter.Start()
|
||||
select {
|
||||
@ -161,11 +155,6 @@ func (q *TransferQueue) individualApiRoutine(apiWaiter chan interface{}) {
|
||||
q.meter.Add(t.Name())
|
||||
q.transferc <- t
|
||||
} else {
|
||||
tracerx.Printf("tq-willhi: SKIPPING T-----------------")
|
||||
tracerx.Printf("tq-willhi: name %s", t.Name())
|
||||
tracerx.Printf("tq-willhi: oid %s", t.Oid())
|
||||
tracerx.Printf("tq-willhi: size T%d", t.Size())
|
||||
tracerx.Printf("tq-willhi: ------------------------")
|
||||
q.meter.Skip(t.Size())
|
||||
q.wait.Done()
|
||||
}
|
||||
@ -255,12 +244,10 @@ func (q *TransferQueue) batchApiRoutine() {
|
||||
q.meter.Add(transfer.Name())
|
||||
q.transferc <- transfer
|
||||
} else {
|
||||
tracerx.Printf("tq-willhi: SKIPPING OBJECT DUE TO NOT IN QUEUE")
|
||||
q.meter.Skip(transfer.Size())
|
||||
q.wait.Done()
|
||||
}
|
||||
} else {
|
||||
tracerx.Printf("tq-willhi: SKIPPING OBJECT DUE TO BAD XFER KIND")
|
||||
q.meter.Skip(o.Size)
|
||||
q.wait.Done()
|
||||
}
|
||||
|
@ -33,7 +33,6 @@ func NewUploadable(oid, filename string) (*Uploadable, error) {
|
||||
if err != nil {
|
||||
return nil, Errorf(err, "Error uploading file %s (%s)", filename, oid)
|
||||
}
|
||||
|
||||
return &Uploadable{oid: oid, OidPath: localMediaPath, Filename: filename, size: fi.Size()}, nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user