From 224776df6aec3cdf14f6843e691b1aec0846992b Mon Sep 17 00:00:00 2001 From: Percy Wegmann Date: Thu, 12 Jun 2025 14:31:09 -0500 Subject: [PATCH] More verbose Taildrive logging, DO NOT MERGE TO main Signed-off-by: Percy Wegmann --- ipn/ipnlocal/peerapi.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ipn/ipnlocal/peerapi.go b/ipn/ipnlocal/peerapi.go index 60dd41024..620f9ca6a 100644 --- a/ipn/ipnlocal/peerapi.go +++ b/ipn/ipnlocal/peerapi.go @@ -1015,12 +1015,14 @@ func (rbw *requestBodyWrapper) Read(b []byte) (int, error) { } func (h *peerAPIHandler) handleServeDrive(w http.ResponseWriter, r *http.Request) { + h.logf("taildrive: handleServeDrive: received peerapi request %s: %q", r.Method, r.URL.Path) if !h.ps.b.DriveSharingEnabled() { h.logf("taildrive: not enabled") http.Error(w, "taildrive not enabled", http.StatusNotFound) return } + h.logf("taildrive: handleServeDrive: checking peer caps") capsMap := h.PeerCaps() driveCaps, ok := capsMap[tailcfg.PeerCapabilityTaildrive] if !ok { @@ -1034,6 +1036,7 @@ func (h *peerAPIHandler) handleServeDrive(w http.ResponseWriter, r *http.Request rawPerms = append(rawPerms, []byte(cap)) } + h.logf("taildrive: handleServeDrive: parsing permissions") p, err := drive.ParsePermissions(rawPerms) if err != nil { h.logf("taildrive: error parsing permissions: %v", err) @@ -1041,6 +1044,7 @@ func (h *peerAPIHandler) handleServeDrive(w http.ResponseWriter, r *http.Request return } + h.logf("taildrive: handleServeDrive: getting DriveForRemote") fs, ok := h.ps.b.sys.DriveForRemote.GetOK() if !ok { h.logf("taildrive: not supported on platform") @@ -1055,6 +1059,10 @@ func (h *peerAPIHandler) handleServeDrive(w http.ResponseWriter, r *http.Request } r.Body = bw + defer func() { + h.logf("taildrive: after ServeHTTPWithPerms to %q, status was %d", r.URL.Path, wr.statusCode) + }() + if r.Method == httpm.PUT || r.Method == httpm.GET { defer func() { switch wr.statusCode { @@ -1072,6 +1080,7 @@ func (h *peerAPIHandler) handleServeDrive(w http.ResponseWriter, r *http.Request } r.URL.Path = strings.TrimPrefix(r.URL.Path, taildrivePrefix) + h.logf("taildrive: handleServeDrive: calling ServeHTTPWithPerms at: %s", r.URL.Path) fs.ServeHTTPWithPerms(p, wr, r) }