thttp_machine_ws.rl 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * Copyright (C) 2010-2015 Mamadou Diop.
  3. *
  4. * This file is part of Open Source Doubango Framework.
  5. *
  6. * DOUBANGO is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * DOUBANGO is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with DOUBANGO.
  18. *
  19. */
  20. */
  21. %%{
  22. machine thttp_machine_ws;
  23. extension_param = token ( "=" ( token | quoted_string ) )?;
  24. NZDIGIT = "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9";
  25. version = DIGIT | ( NZDIGIT DIGIT ) | ( "1" DIGIT DIGIT ) | ( "2" DIGIT DIGIT );
  26. base64_character = ALPHA | DIGIT | "+" | "/";
  27. base64_data = base64_character{4};
  28. base64_padding = ( base64_character{2} "==" ) | ( base64_character{3} "=" );
  29. base64_value_non_empty = ( base64_data+ base64_padding? ) | base64_padding;
  30. Sec_WebSocket_Key = base64_value_non_empty;
  31. registered_token = token;
  32. extension_token = registered_token;
  33. extension = extension_token ( ";" extension_param )*;
  34. extension_list = extension ( COMMA extension )*;
  35. Sec_WebSocket_Extensions = extension_list;
  36. Sec_WebSocket_Protocol_Client = token ( COMMA token )*;
  37. Sec_WebSocket_Version_Client = version;
  38. Sec_WebSocket_Accept = base64_value_non_empty;
  39. Sec_WebSocket_Protocol_Server = token;
  40. Sec_WebSocket_Version_Server = version ( COMMA version )*;
  41. Sec_WebSocket_Version = version ( COMMA version )*;
  42. Sec_WebSocket_Protocol = token ( COMMA token )*;
  43. }%%