Browse Source

fix query string parsing issue

LukePulverenti 12 years ago
parent
commit
815240f920
2 changed files with 47 additions and 43 deletions
  1. 4 4
      MediaBrowser.Api/Images/ImageRequest.cs
  2. 43 39
      MediaBrowser.Common/Net/HttpServer.cs

+ 4 - 4
MediaBrowser.Api/Images/ImageRequest.cs

@@ -10,19 +10,19 @@ namespace MediaBrowser.Api.Images
         /// <summary>
         /// The max width
         /// </summary>
-        public int? MaxWidth;
+        public int? MaxWidth { get; set; }
         /// <summary>
         /// The max height
         /// </summary>
-        public int? MaxHeight;
+        public int? MaxHeight { get; set; }
         /// <summary>
         /// The width
         /// </summary>
-        public int? Width;
+        public int? Width { get; set; }
         /// <summary>
         /// The height
         /// </summary>
-        public int? Height;
+        public int? Height { get; set; }
         /// <summary>
         /// Gets or sets the quality.
         /// </summary>

+ 43 - 39
MediaBrowser.Common/Net/HttpServer.cs

@@ -207,54 +207,58 @@ namespace MediaBrowser.Common.Net
                 return;
             }
 
-            RaiseReceiveWebRequest(context);
 
-            try
-            {
-                ProcessRequest(context);
-            }
-            catch (InvalidOperationException ex)
+            Task.Run(() =>
             {
-                HandleException(context.Response, ex, 422);
+                RaiseReceiveWebRequest(context);
 
-                throw;
-            }
-            catch (ResourceNotFoundException ex)
-            {
-                HandleException(context.Response, ex, 404);
+                try
+                {
+                    ProcessRequest(context);
+                }
+                catch (InvalidOperationException ex)
+                {
+                    HandleException(context.Response, ex, 422);
 
-                throw;
-            }
-            catch (FileNotFoundException ex)
-            {
-                HandleException(context.Response, ex, 404);
+                    throw;
+                }
+                catch (ResourceNotFoundException ex)
+                {
+                    HandleException(context.Response, ex, 404);
 
-                throw;
-            }
-            catch (DirectoryNotFoundException ex)
-            {
-                HandleException(context.Response, ex, 404);
+                    throw;
+                }
+                catch (FileNotFoundException ex)
+                {
+                    HandleException(context.Response, ex, 404);
 
-                throw;
-            }
-            catch (UnauthorizedAccessException ex)
-            {
-                HandleException(context.Response, ex, 401);
+                    throw;
+                }
+                catch (DirectoryNotFoundException ex)
+                {
+                    HandleException(context.Response, ex, 404);
 
-                throw;
-            }
-            catch (ArgumentException ex)
-            {
-                HandleException(context.Response, ex, 400);
+                    throw;
+                }
+                catch (UnauthorizedAccessException ex)
+                {
+                    HandleException(context.Response, ex, 401);
 
-                throw;
-            }
-            catch (Exception ex)
-            {
-                HandleException(context.Response, ex, 500);
+                    throw;
+                }
+                catch (ArgumentException ex)
+                {
+                    HandleException(context.Response, ex, 400);
 
-                throw;
-            }
+                    throw;
+                }
+                catch (Exception ex)
+                {
+                    HandleException(context.Response, ex, 500);
+
+                    throw;
+                }
+            });
         }
 
         /// <summary>