1- namespace Unosquare . Labs . EmbedIO
1+ using System . Globalization ;
2+
3+ namespace Unosquare . Labs . EmbedIO
24{
35 using System ;
46 using System . Collections . Generic ;
@@ -240,7 +242,7 @@ public void UnregisterModule(Type moduleType)
240242 /// </summary>
241243 /// <param name="context">The context.</param>
242244 /// <param name="app"></param>
243- private void HandleClientRequest ( HttpListenerContext context , Middleware app )
245+ private async void HandleClientRequest ( HttpListenerContext context , Middleware app )
244246 {
245247 // start with an empty request ID
246248 var requestId = "(not set)" ;
@@ -251,15 +253,15 @@ private void HandleClientRequest(HttpListenerContext context, Middleware app)
251253 if ( app != null )
252254 {
253255 var middlewareContext = new MiddlewareContext ( context , this ) ;
254- app . Invoke ( middlewareContext ) ;
256+ await app . Invoke ( middlewareContext ) ;
255257
256258 if ( middlewareContext . Handled ) return ;
257259 }
258260
259261 // Create a request endpoint string
260262 var requestEndpoint = string . Join ( ":" ,
261263 context . Request . RemoteEndPoint . Address . ToString ( ) ,
262- context . Request . RemoteEndPoint . Port . ToString ( ) ) ;
264+ context . Request . RemoteEndPoint . Port . ToString ( CultureInfo . InvariantCulture ) ) ;
263265
264266 // Generate a random request ID. It's currently not important butit could be useful in the future.
265267 requestId = string . Concat ( DateTime . Now . Ticks . ToString ( ) , requestEndpoint ) . GetHashCode ( ) . ToString ( "x2" ) ;
0 commit comments