|  | @@ -16763,7 +16763,7 @@ smalltalk.addClass('ProtocolRemoved', smalltalk.ProtocolAnnouncement, [], 'Kerne
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  smalltalk.addPackage('FileServer');
 | 
	
		
			
				|  |  | -smalltalk.addClass('FileServer', smalltalk.Object, ['path', 'http', 'fs', 'url', 'port', 'basePath', 'util', 'username', 'password', 'fallbackPage'], 'FileServer');
 | 
	
		
			
				|  |  | +smalltalk.addClass('FileServer', smalltalk.Object, ['path', 'http', 'fs', 'url', 'host', 'port', 'basePath', 'util', 'username', 'password', 'fallbackPage'], 'FileServer');
 | 
	
		
			
				|  |  |  smalltalk.addMethod(
 | 
	
		
			
				|  |  |  smalltalk.method({
 | 
	
		
			
				|  |  |  selector: "base64Decode:",
 | 
	
	
		
			
				|  | @@ -17001,6 +17001,40 @@ referencedClasses: []
 | 
	
		
			
				|  |  |  }),
 | 
	
		
			
				|  |  |  smalltalk.FileServer);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +smalltalk.addMethod(
 | 
	
		
			
				|  |  | +smalltalk.method({
 | 
	
		
			
				|  |  | +selector: "host",
 | 
	
		
			
				|  |  | +category: 'accessing',
 | 
	
		
			
				|  |  | +fn: function (){
 | 
	
		
			
				|  |  | +var self=this;
 | 
	
		
			
				|  |  | +return smalltalk.withContext(function($ctx1) { 
 | 
	
		
			
				|  |  | +var $1;
 | 
	
		
			
				|  |  | +$1=self["@host"];
 | 
	
		
			
				|  |  | +return $1;
 | 
	
		
			
				|  |  | +}, function($ctx1) {$ctx1.fill(self,"host",{},smalltalk.FileServer)})},
 | 
	
		
			
				|  |  | +args: [],
 | 
	
		
			
				|  |  | +source: "host\x0a\x09^host",
 | 
	
		
			
				|  |  | +messageSends: [],
 | 
	
		
			
				|  |  | +referencedClasses: []
 | 
	
		
			
				|  |  | +}),
 | 
	
		
			
				|  |  | +smalltalk.FileServer);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +smalltalk.addMethod(
 | 
	
		
			
				|  |  | +smalltalk.method({
 | 
	
		
			
				|  |  | +selector: "host:",
 | 
	
		
			
				|  |  | +category: 'accessing',
 | 
	
		
			
				|  |  | +fn: function (hostname){
 | 
	
		
			
				|  |  | +var self=this;
 | 
	
		
			
				|  |  | +return smalltalk.withContext(function($ctx1) { 
 | 
	
		
			
				|  |  | +self["@host"]=hostname;
 | 
	
		
			
				|  |  | +return self}, function($ctx1) {$ctx1.fill(self,"host:",{hostname:hostname},smalltalk.FileServer)})},
 | 
	
		
			
				|  |  | +args: ["hostname"],
 | 
	
		
			
				|  |  | +source: "host: hostname\x0a\x09host := hostname",
 | 
	
		
			
				|  |  | +messageSends: [],
 | 
	
		
			
				|  |  | +referencedClasses: []
 | 
	
		
			
				|  |  | +}),
 | 
	
		
			
				|  |  | +smalltalk.FileServer);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  smalltalk.addMethod(
 | 
	
		
			
				|  |  |  smalltalk.method({
 | 
	
		
			
				|  |  |  selector: "initialize",
 | 
	
	
		
			
				|  | @@ -17014,14 +17048,15 @@ self["@http"]=_st(self)._require_("http");
 | 
	
		
			
				|  |  |  self["@fs"]=_st(self)._require_("fs");
 | 
	
		
			
				|  |  |  self["@util"]=_st(self)._require_("util");
 | 
	
		
			
				|  |  |  self["@url"]=_st(self)._require_("url");
 | 
	
		
			
				|  |  | +self["@host"]=_st(_st(self)._class())._defaultHost();
 | 
	
		
			
				|  |  |  self["@port"]=_st(_st(self)._class())._defaultPort();
 | 
	
		
			
				|  |  |  self["@username"]=nil;
 | 
	
		
			
				|  |  |  self["@password"]=nil;
 | 
	
		
			
				|  |  |  self["@fallbackPage"]=nil;
 | 
	
		
			
				|  |  |  return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.FileServer)})},
 | 
	
		
			
				|  |  |  args: [],
 | 
	
		
			
				|  |  | -source: "initialize\x0a\x09super initialize.\x0a\x09path := self require: 'path'.\x0a\x09http := self require: 'http'.\x0a\x09fs := self require: 'fs'.\x0a\x09util := self require: 'util'.\x0a\x09url := self require: 'url'.\x0a\x09port := self class defaultPort.\x0a\x09username := nil.\x0a\x09password := nil.\x0a\x09fallbackPage := nil.",
 | 
	
		
			
				|  |  | -messageSends: ["initialize", "require:", "defaultPort", "class"],
 | 
	
		
			
				|  |  | +source: "initialize\x0a\x09super initialize.\x0a\x09path := self require: 'path'.\x0a\x09http := self require: 'http'.\x0a\x09fs := self require: 'fs'.\x0a\x09util := self require: 'util'.\x0a\x09url := self require: 'url'.\x0a\x09host := self class defaultHost.\x0a\x09port := self class defaultPort.\x0a\x09username := nil.\x0a\x09password := nil.\x0a\x09fallbackPage := nil.",
 | 
	
		
			
				|  |  | +messageSends: ["initialize", "require:", "defaultHost", "class", "defaultPort"],
 | 
	
		
			
				|  |  |  referencedClasses: []
 | 
	
		
			
				|  |  |  }),
 | 
	
		
			
				|  |  |  smalltalk.FileServer);
 | 
	
	
		
			
				|  | @@ -17335,13 +17370,13 @@ return _st(console)._log_(_st("Error starting server: ").__comma(error));
 | 
	
		
			
				|  |  |  }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1)})}));
 | 
	
		
			
				|  |  |  _st($1)._on_do_("listening",(function(){
 | 
	
		
			
				|  |  |  return smalltalk.withContext(function($ctx2) {
 | 
	
		
			
				|  |  | -return _st(console)._log_(_st("Starting file server on port ").__comma(_st(_st(self)._port())._asString()));
 | 
	
		
			
				|  |  | +return _st(console)._log_(_st(_st(_st("Starting file server on ").__comma(_st(self)._host())).__comma(":")).__comma(_st(_st(self)._port())._asString()));
 | 
	
		
			
				|  |  |  }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
 | 
	
		
			
				|  |  | -$2=_st($1)._listen_(_st(self)._port());
 | 
	
		
			
				|  |  | +$2=_st($1)._listen_host_(_st(self)._port(),_st(self)._host());
 | 
	
		
			
				|  |  |  return self}, function($ctx1) {$ctx1.fill(self,"start",{},smalltalk.FileServer)})},
 | 
	
		
			
				|  |  |  args: [],
 | 
	
		
			
				|  |  | -source: "start\x0a\x09\x22Checks if required directory layout is present (issue warning if not).\x0a\x09 Afterwards start the server.\x22\x0a\x09self checkDirectoryLayout.\x0a\x09(http createServer: [:request :response |\x0a\x09      self handleRequest: request respondTo: response])\x0a\x09      on: 'error' do: [:error | console log: 'Error starting server: ', error];\x0a\x09      on: 'listening' do: [console log: 'Starting file server on port ', self port asString];\x0a\x09      listen: self port.",
 | 
	
		
			
				|  |  | -messageSends: ["checkDirectoryLayout", "on:do:", "log:", ",", "createServer:", "handleRequest:respondTo:", "asString", "port", "listen:"],
 | 
	
		
			
				|  |  | +source: "start\x0a\x09\x22Checks if required directory layout is present (issue warning if not).\x0a\x09 Afterwards start the server.\x22\x0a\x09self checkDirectoryLayout.\x0a\x09(http createServer: [:request :response |\x0a\x09      self handleRequest: request respondTo: response])\x0a\x09      on: 'error' do: [:error | console log: 'Error starting server: ', error];\x0a\x09      on: 'listening' do: [console log: 'Starting file server on ', self host, ':', self port asString];\x0a\x09      listen: self port host: self host.",
 | 
	
		
			
				|  |  | +messageSends: ["checkDirectoryLayout", "on:do:", "log:", ",", "createServer:", "handleRequest:respondTo:", "asString", "port", "host", "listen:host:"],
 | 
	
		
			
				|  |  |  referencedClasses: []
 | 
	
		
			
				|  |  |  }),
 | 
	
		
			
				|  |  |  smalltalk.FileServer);
 | 
	
	
		
			
				|  | @@ -17433,14 +17468,14 @@ return _st(each)._match_("^[^:]*:$");
 | 
	
		
			
				|  |  |  }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
 | 
	
		
			
				|  |  |  switches=_st(switches)._collect_((function(each){
 | 
	
		
			
				|  |  |  return smalltalk.withContext(function($ctx2) {
 | 
	
		
			
				|  |  | -return _st("--").__comma(_st(each)._allButLast());
 | 
	
		
			
				|  |  | +return _st(_st(_st(_st(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase())._replace_with_("^([a-z])","--$1");
 | 
	
		
			
				|  |  |  }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
 | 
	
		
			
				|  |  |  $1=switches;
 | 
	
		
			
				|  |  |  return $1;
 | 
	
		
			
				|  |  |  }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},smalltalk.FileServer.klass)})},
 | 
	
		
			
				|  |  |  args: [],
 | 
	
		
			
				|  |  | -source: "commandLineSwitches\x0a\x09\x22Collect all methodnames from the 'accessing' protocol\x0a\x09 and select the ones with only one parameter.\x0a\x09 Then remove the ':' at the end of the name\x0a\x09 and add a '--' at the beginning.\x0a\x09 Return the Array containing the commandline switches.\x22\x0a\x09| switches |\x0a\x09switches := ((self methodsInProtocol: 'accessing') collect: [ :each | each selector]).\x0a\x09switches := switches select: [ :each | each match: '^[^:]*:$'].\x0a\x09switches := switches collect: [ :each | '--', (each allButLast)].\x0a\x09^switches",
 | 
	
		
			
				|  |  | -messageSends: ["collect:", "selector", "methodsInProtocol:", "select:", "match:", ",", "allButLast"],
 | 
	
		
			
				|  |  | +source: "commandLineSwitches\x0a\x09\x22Collect all methodnames from the 'accessing' protocol\x0a\x09 and select the ones with only one parameter.\x0a\x09 Then remove the ':' at the end of the name\x0a\x09 and add a '--' at the beginning.\x0a\x09 Additionally all uppercase letters are made lowercase and preceded by a '-'.\x0a\x09 Example: fallbackPage: becomes --fallback-page.\x0a\x09 Return the Array containing the commandline switches.\x22\x0a\x09| switches |\x0a\x09switches := ((self methodsInProtocol: 'accessing') collect: [ :each | each selector]).\x0a\x09switches := switches select: [ :each | each match: '^[^:]*:$'].\x0a\x09switches :=switches collect: [ :each |\x0a\x09\x09(each allButLast replace: '([A-Z])' with: '-$1') asLowercase replace: '^([a-z])' with: '--$1' ].\x0a\x09^switches",
 | 
	
		
			
				|  |  | +messageSends: ["collect:", "selector", "methodsInProtocol:", "select:", "match:", "replace:with:", "asLowercase", "allButLast"],
 | 
	
		
			
				|  |  |  referencedClasses: []
 | 
	
		
			
				|  |  |  }),
 | 
	
		
			
				|  |  |  smalltalk.FileServer.klass);
 | 
	
	
		
			
				|  | @@ -17510,6 +17545,22 @@ referencedClasses: ["Array"]
 | 
	
		
			
				|  |  |  }),
 | 
	
		
			
				|  |  |  smalltalk.FileServer.klass);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +smalltalk.addMethod(
 | 
	
		
			
				|  |  | +smalltalk.method({
 | 
	
		
			
				|  |  | +selector: "defaultHost",
 | 
	
		
			
				|  |  | +category: 'accessing',
 | 
	
		
			
				|  |  | +fn: function (){
 | 
	
		
			
				|  |  | +var self=this;
 | 
	
		
			
				|  |  | +return smalltalk.withContext(function($ctx1) { 
 | 
	
		
			
				|  |  | +return "127.0.0.1";
 | 
	
		
			
				|  |  | +}, function($ctx1) {$ctx1.fill(self,"defaultHost",{},smalltalk.FileServer.klass)})},
 | 
	
		
			
				|  |  | +args: [],
 | 
	
		
			
				|  |  | +source: "defaultHost\x0a\x09^'127.0.0.1'",
 | 
	
		
			
				|  |  | +messageSends: [],
 | 
	
		
			
				|  |  | +referencedClasses: []
 | 
	
		
			
				|  |  | +}),
 | 
	
		
			
				|  |  | +smalltalk.FileServer.klass);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  smalltalk.addMethod(
 | 
	
		
			
				|  |  |  smalltalk.method({
 | 
	
		
			
				|  |  |  selector: "defaultMimeTypes",
 | 
	
	
		
			
				|  | @@ -17657,12 +17708,15 @@ fn: function (aSwitch){
 | 
	
		
			
				|  |  |  var self=this;
 | 
	
		
			
				|  |  |  return smalltalk.withContext(function($ctx1) { 
 | 
	
		
			
				|  |  |  var $1;
 | 
	
		
			
				|  |  | -$1=_st(_st(aSwitch)._copyFrom_to_((3),_st(aSwitch)._size())).__comma(":");
 | 
	
		
			
				|  |  | +$1=_st(_st(_st(aSwitch)._replace_with_("^--",""))._replace_with_("-[a-z]",(function(each){
 | 
	
		
			
				|  |  | +return smalltalk.withContext(function($ctx2) {
 | 
	
		
			
				|  |  | +return _st(_st(each)._second())._asUppercase();
 | 
	
		
			
				|  |  | +}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}))).__comma(":");
 | 
	
		
			
				|  |  |  return $1;
 | 
	
		
			
				|  |  |  }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch},smalltalk.FileServer.klass)})},
 | 
	
		
			
				|  |  |  args: ["aSwitch"],
 | 
	
		
			
				|  |  | -source: "selectorForCommandLineSwitch: aSwitch\x0a\x09\x22Remove the trailing '--' and at an ending ':' to aSwitch.\x22\x0a\x09^(aSwitch copyFrom: 3 to: aSwitch size), ':'.",
 | 
	
		
			
				|  |  | -messageSends: [",", "copyFrom:to:", "size"],
 | 
	
		
			
				|  |  | +source: "selectorForCommandLineSwitch: aSwitch\x0a\x09\x22Remove the trailing '--', add ':' at the end\x0a\x09 and replace all occurences of a lowercase letter preceded by a '-' with\x0a\x09 the Uppercase letter.\x0a\x09 Example: --fallback-page becomes fallbackPage:\x22\x0a\x09^((aSwitch replace: '^--' with: '')\x0a\x09\x09replace: '-[a-z]' with: [ :each | each second asUppercase ]), ':'",
 | 
	
		
			
				|  |  | +messageSends: [",", "replace:with:", "asUppercase", "second"],
 | 
	
		
			
				|  |  |  referencedClasses: []
 | 
	
		
			
				|  |  |  }),
 | 
	
		
			
				|  |  |  smalltalk.FileServer.klass);
 |