IHttpServer.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Threading.Tasks;
  4. using Jellyfin.Data.Events;
  5. using Microsoft.AspNetCore.Http;
  6. namespace MediaBrowser.Controller.Net
  7. {
  8. /// <summary>
  9. /// Interface IHttpServer.
  10. /// </summary>
  11. public interface IHttpServer
  12. {
  13. /// <summary>
  14. /// Gets the URL prefix.
  15. /// </summary>
  16. /// <value>The URL prefix.</value>
  17. string[] UrlPrefixes { get; }
  18. /// <summary>
  19. /// Occurs when [web socket connected].
  20. /// </summary>
  21. event EventHandler<GenericEventArgs<IWebSocketConnection>> WebSocketConnected;
  22. /// <summary>
  23. /// Inits this instance.
  24. /// </summary>
  25. void Init(IEnumerable<IWebSocketListener> listener, IEnumerable<string> urlPrefixes);
  26. /// <summary>
  27. /// If set, all requests will respond with this message.
  28. /// </summary>
  29. string GlobalResponse { get; set; }
  30. /// <summary>
  31. /// The HTTP request handler.
  32. /// </summary>
  33. /// <param name="context"></param>
  34. /// <returns></returns>
  35. Task RequestHandler(HttpContext context);
  36. /// <summary>
  37. /// Get the default CORS headers.
  38. /// </summary>
  39. /// <param name="httpContext">The HTTP context of the current request.</param>
  40. /// <returns>The default CORS headers for the context.</returns>
  41. IDictionary<string, string> GetDefaultCorsHeaders(HttpContext httpContext);
  42. }
  43. }