Leaked source code of windows server 2003
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.

85 lines
2.2 KiB

  1. /*++
  2. Copyright (c) 1994 Microsoft Corporation
  3. Module Name:
  4. w3min.c
  5. Abstract:
  6. This module demonstrates a minimal HTTP Server Extension gateway
  7. Author:
  8. John Ludeman (johnl) 13-Oct-1994
  9. Revision History:
  10. --*/
  11. #include <windows.h>
  12. #include <httpext.h>
  13. #define END_OF_DOC "End of document"
  14. DWORD
  15. HttpExtensionProc(
  16. EXTENSION_CONTROL_BLOCK * pecb
  17. )
  18. {
  19. char buff[2048];
  20. int cb = sizeof(END_OF_DOC) - 1;
  21. //
  22. // Note the HTTP header block is terminated by a blank '\r\n' pair,
  23. // followed by the document body
  24. //
  25. wsprintf( buff,
  26. "Content-Type: text/html\r\n"
  27. "\r\n"
  28. "<head><title>Minimal Server Extension Example</title></head>\n"
  29. "<body><h1>Minimal Server Extension Example (BGI)</h1>\n"
  30. "<p>Method = %s\n"
  31. "<p>Query String = %s\n"
  32. "<p>Path Info = %s\n"
  33. "<p>Translated Path Info = %s\n"
  34. "<p>"
  35. "<p>"
  36. "<form METHOD=\"POST\" ACTION=\"/scripts/w3min.dll/PathInfo/foo\">"
  37. "Enter your name: <input text name=\"Name\" size=36><br>"
  38. "<input type=\"submit\" value=\"Do Query\">"
  39. "</body>",
  40. pecb->lpszMethod,
  41. pecb->lpszQueryString,
  42. pecb->lpszPathInfo,
  43. pecb->lpszPathTranslated );
  44. if ( !pecb->ServerSupportFunction( pecb->ConnID,
  45. HSE_REQ_SEND_RESPONSE_HEADER,
  46. "200 OK",
  47. NULL,
  48. (LPDWORD) buff ) ||
  49. !pecb->WriteClient( pecb->ConnID,
  50. END_OF_DOC,
  51. &cb,
  52. 0 ))
  53. {
  54. return HSE_STATUS_ERROR;
  55. }
  56. return HSE_STATUS_SUCCESS;
  57. }
  58. BOOL
  59. GetExtensionVersion(
  60. HSE_VERSION_INFO * pver
  61. )
  62. {
  63. pver->dwExtensionVersion = MAKELONG( 1, 0 );
  64. strcpy( pver->lpszExtensionDesc,
  65. "Minimal Extension example" );
  66. return TRUE;
  67. }
  68.