Merge pull request #234 from rclone/pr-debuglist
Debug directory listings
This commit is contained in:
		
						commit
						6a13e1e753
					
				
							
								
								
									
										16
									
								
								debug.go
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								debug.go
									
									
									
									
									
								
							@ -19,3 +19,19 @@ func newDebugWrapper(conn io.ReadWriteCloser, w io.Writer) io.ReadWriteCloser {
 | 
				
			|||||||
func (w *debugWrapper) Close() error {
 | 
					func (w *debugWrapper) Close() error {
 | 
				
			||||||
	return w.conn.Close()
 | 
						return w.conn.Close()
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					type streamDebugWrapper struct {
 | 
				
			||||||
 | 
						io.Reader
 | 
				
			||||||
 | 
						closer io.ReadCloser
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func newStreamDebugWrapper(rd io.ReadCloser, w io.Writer) io.ReadCloser {
 | 
				
			||||||
 | 
						return &streamDebugWrapper{
 | 
				
			||||||
 | 
							Reader: io.TeeReader(rd, w),
 | 
				
			||||||
 | 
							closer: rd,
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (w *streamDebugWrapper) Close() error {
 | 
				
			||||||
 | 
						return w.closer.Close()
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										12
									
								
								ftp.go
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								ftp.go
									
									
									
									
									
								
							@ -251,6 +251,14 @@ func (o *dialOptions) wrapConn(netConn net.Conn) io.ReadWriteCloser {
 | 
				
			|||||||
	return newDebugWrapper(netConn, o.debugOutput)
 | 
						return newDebugWrapper(netConn, o.debugOutput)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (o *dialOptions) wrapStream(rd io.ReadCloser) io.ReadCloser {
 | 
				
			||||||
 | 
						if o.debugOutput == nil {
 | 
				
			||||||
 | 
							return rd
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return newStreamDebugWrapper(rd, o.debugOutput)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Connect is an alias to Dial, for backward compatibility
 | 
					// Connect is an alias to Dial, for backward compatibility
 | 
				
			||||||
func Connect(addr string) (*ServerConn, error) {
 | 
					func Connect(addr string) (*ServerConn, error) {
 | 
				
			||||||
	return Dial(addr)
 | 
						return Dial(addr)
 | 
				
			||||||
@ -561,7 +569,7 @@ func (c *ServerConn) NameList(path string) (entries []string, err error) {
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
	}()
 | 
						}()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	scanner := bufio.NewScanner(r)
 | 
						scanner := bufio.NewScanner(c.options.wrapStream(r))
 | 
				
			||||||
	for scanner.Scan() {
 | 
						for scanner.Scan() {
 | 
				
			||||||
		entries = append(entries, scanner.Text())
 | 
							entries = append(entries, scanner.Text())
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@ -600,7 +608,7 @@ func (c *ServerConn) List(path string) (entries []*Entry, err error) {
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
	}()
 | 
						}()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	scanner := bufio.NewScanner(r)
 | 
						scanner := bufio.NewScanner(c.options.wrapStream(r))
 | 
				
			||||||
	now := time.Now()
 | 
						now := time.Now()
 | 
				
			||||||
	for scanner.Scan() {
 | 
						for scanner.Scan() {
 | 
				
			||||||
		entry, errParse := parser(scanner.Text(), now, c.options.location)
 | 
							entry, errParse := parser(scanner.Text(), now, c.options.location)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user