| 
														
															@@ -1,6 +1,6 @@ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 Smalltalk current createPackage: 'FileServer'! 
														 | 
														
														 | 
														
															 Smalltalk current createPackage: 'FileServer'! 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 Object subclass: #FileServer 
														 | 
														
														 | 
														
															 Object subclass: #FileServer 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-	instanceVariableNames: 'path http fs url port basePath util username password' 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+	instanceVariableNames: 'path http fs url port basePath util username password fallbackPage' 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	package: 'FileServer'! 
														 | 
														
														 | 
														
															 	package: 'FileServer'! 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 !FileServer methodsFor: 'accessing'! 
														 | 
														
														 | 
														
															 !FileServer methodsFor: 'accessing'! 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -13,6 +13,14 @@ basePath: aString 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	basePath := aString 
														 | 
														
														 | 
														
															 	basePath := aString 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 ! 
														 | 
														
														 | 
														
															 ! 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+fallbackPage 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+	^fallbackPage 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+! 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+fallbackPage: aString 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+	fallbackPage := aString 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+! 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 password: aPassword 
														 | 
														
														 | 
														
															 password: aPassword 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	password := aPassword. 
														 | 
														
														 | 
														
															 	password := aPassword. 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 ! 
														 | 
														
														 | 
														
															 ! 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -55,6 +63,7 @@ initialize 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	port := self class defaultPort. 
														 | 
														
														 | 
														
															 	port := self class defaultPort. 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	username := nil. 
														 | 
														
														 | 
														
															 	username := nil. 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	password := nil. 
														 | 
														
														 | 
														
															 	password := nil. 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+	fallbackPage := nil. 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 ! ! 
														 | 
														
														 | 
														
															 ! ! 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 !FileServer methodsFor: 'private'! 
														 | 
														
														 | 
														
															 !FileServer methodsFor: 'private'! 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -202,6 +211,7 @@ respondNotCreatedTo: aResponse 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 ! 
														 | 
														
														 | 
														
															 ! 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 respondNotFoundTo: aResponse 
														 | 
														
														 | 
														
															 respondNotFoundTo: aResponse 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+	self fallbackPage isNil ifFalse: [^self respondFileNamed: self fallbackPage to: aResponse]. 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	aResponse  
														 | 
														
														 | 
														
															 	aResponse  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		writeHead: 404 options: #{'Content-Type' -> 'text/plain'}; 
														 | 
														
														 | 
														
															 		writeHead: 404 options: #{'Content-Type' -> 'text/plain'}; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		write: '404 Not found'; 
														 | 
														
														 | 
														
															 		write: '404 Not found'; 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -237,7 +247,8 @@ commandLineActions 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	^#{ 
														 | 
														
														 | 
														
															 	^#{ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		'-p' -> [:fileServer :value | fileServer port: value]. 
														 | 
														
														 | 
														
															 		'-p' -> [:fileServer :value | fileServer port: value]. 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		'--username' -> [:fileServer :value | fileServer username: value]. 
														 | 
														
														 | 
														
															 		'--username' -> [:fileServer :value | fileServer username: value]. 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-		'--password' -> [:fileServer :value | fileServer password: value] 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		'--password' -> [:fileServer :value | fileServer password: value]. 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		'--fallback-page' -> [:fileServer :value | fileServer fallbackPage: value] 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	} 
														 | 
														
														 | 
														
															 	} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 ! 
														 | 
														
														 | 
														
															 ! 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 |