 				if result
 					callback req.auth.username
 				else
-					res.setHeader 'WWW-Authenticate', 'Basic realm="Please provide proper username and password to access this package"'
-					res.send 401, 'Please provide proper username and password to access this package'
-					return
+					askForCredentials req, res
 		else
-			res.setHeader 'WWW-Authenticate', 'Basic realm="Please provide proper username and password to access this package"'
-			res.send 401, 'Please provide proper username and password to access this package'
-			return
+			askForCredentials req, res
 	else
 		callback ''
 

				else if result
					callback req.auth.username
				else
					res.setHeader 'WWW-Authenticate', 'Basic realm="Invalid password or username"'
					res.send 401, 'Invalid password or username'
		else
			res.setHeader 'WWW-Authenticate', 'Basic realm="Invalid password or username"'
			res.send 401, 'Invalid password or username'
	else
		callback ''


					res.sendfile "#{config.packageFolder}/#{req.params[0]}/#{req.params[1].toLowerCase()}.tar", (err) -> res.send 404, '404 Not Found' if err?
				else
					logger.log "notice", "#{username} tried to download #{req.params[0]}/#{req.params[1].toLowerCase()}"
					askForCredentials req, res
			else
				res.send 404, '404 Not Found'
		
