Merge pull request #4 from SunRunAway/feature/connect
use ReadResponse in Connect
This commit is contained in:
		
						commit
						100a5ab846
					
				@ -103,3 +103,20 @@ func TestConn(t *testing.T) {
 | 
				
			|||||||
		t.Error("Expected error")
 | 
							t.Error("Expected error")
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func TestConn2(t *testing.T) {
 | 
				
			||||||
 | 
						c, err := Connect("ftp.mozilla.org:21")
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							t.Fatal(err)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						err = c.Login("anonymous", "anonymous")
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							t.Fatal(err)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						_, err = c.List(".")
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							t.Error(err)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										2
									
								
								ftp.go
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								ftp.go
									
									
									
									
									
								
							@ -58,7 +58,7 @@ func Connect(addr string) (*ServerConn, error) {
 | 
				
			|||||||
		features: make(map[string]string),
 | 
							features: make(map[string]string),
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	_, _, err = c.conn.ReadCodeLine(StatusReady)
 | 
						_, _, err = c.conn.ReadResponse(StatusReady)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		c.Quit()
 | 
							c.Quit()
 | 
				
			||||||
		return nil, err
 | 
							return nil, err
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user