/library/server/fcgi/implementation/linux/fcgi_c_api.e

http://github.com/jocelyn/EiffelWebReloaded · Specman e · 97 lines · 74 code · 12 blank · 11 comment · 2 complexity · 4e09ddc1d00db8a6530cb24e936dd0ae MD5 · raw file

  1. note
  2. description: "Wrappers around FastCGI C API."
  3. legal: "See notice at end of class."
  4. status: "See notice at end of class."
  5. date: "$Date$"
  6. revision: "$Revision$"
  7. class
  8. FCGI_C_API
  9. feature -- Connection
  10. accept: INTEGER
  11. -- Accept a Fast CGI connection.
  12. -- Return 0 for successful calls, -1 otherwise.
  13. external
  14. "C inline use %"fcgi_stdio.h%""
  15. alias
  16. "return FCGI_Accept();"
  17. end
  18. environ: POINTER
  19. -- Get the (char**) environ variable from the DLL.
  20. external
  21. "C inline use %"fcgi_stdio.h%""
  22. alias
  23. "return (char**) environ;"
  24. end
  25. finish
  26. -- Finished current request from HTTP server started from
  27. -- the most recent call to `fcgi_accept'.
  28. external
  29. "C inline use %"fcgi_stdio.h%""
  30. alias
  31. "FCGI_Finish();"
  32. end
  33. set_exit_status (v: INTEGER)
  34. -- Set the exit status for the most recent request
  35. external
  36. "C inline use %"fcgi_stdio.h%""
  37. alias
  38. "FCGI_SetExitStatus($v);"
  39. end
  40. feature -- Input
  41. read_content_into (a_buffer: POINTER; a_length: INTEGER): INTEGER
  42. -- Read content stream into `a_buffer' but no more than `a_length' character.
  43. external
  44. "C inline use %"fcgi_stdio.h%""
  45. alias
  46. "[
  47. {
  48. size_t n;
  49. if (! FCGI_feof(FCGI_stdin)) {
  50. n = FCGI_fread($a_buffer, 1, $a_length, FCGI_stdin);
  51. } else {
  52. n = 0;
  53. }
  54. return n;
  55. }
  56. ]"
  57. end
  58. gets (s: POINTER): POINTER
  59. -- gets() reads a line from stdin into the buffer pointed to
  60. -- by s until either a terminating newline or EOF, which it
  61. -- replaces with '\0'
  62. -- No check for buffer overrun is performed
  63. external
  64. "C inline use %"fcgi_stdio.h%""
  65. alias
  66. "return FCGI_gets($s);"
  67. end
  68. feature -- Output
  69. put_string (v: POINTER; n: INTEGER)
  70. external
  71. "C inline use %"fcgi_stdio.h%""
  72. alias
  73. "FCGI_fwrite($v, 1, $n, FCGI_stdout);"
  74. end
  75. note
  76. copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
  77. license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
  78. source: "[
  79. Eiffel Software
  80. 5949 Hollister Ave., Goleta, CA 93117 USA
  81. Telephone 805-685-1006, Fax 805-685-6869
  82. Website http://www.eiffel.com
  83. Customer support http://support.eiffel.com
  84. ]"
  85. end