You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
888 B

  1. #if !NET20
  2. using System.Text;
  3. namespace Apewer.WebSocket
  4. {
  5. internal class FlashSocketPolicyRequestHandler
  6. {
  7. public static string PolicyResponse =
  8. "<?xml version=\"1.0\"?>\n" +
  9. "<cross-domain-policy>\n" +
  10. " <allow-access-from domain=\"*\" to-ports=\"*\"/>\n" +
  11. " <site-control permitted-cross-domain-policies=\"all\"/>\n" +
  12. "</cross-domain-policy>\n" +
  13. "\0";
  14. public static ComposableHandler Create(HttpRequest request)
  15. {
  16. return new ComposableHandler
  17. {
  18. Handshake = sub => FlashSocketPolicyRequestHandler.Handshake(request, sub),
  19. };
  20. }
  21. public static byte[] Handshake(HttpRequest request, string subProtocol)
  22. {
  23. WebSocketLog.Debug("Building Flash Socket Policy Response");
  24. return Encoding.UTF8.GetBytes(PolicyResponse);
  25. }
  26. }
  27. }
  28. #endif