templates_httpd_commands.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * Copyright (C) 2000,2001 Florian Sander
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation; either version 2
  7. * of the License, or (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  17. */
  18. static void template_send_requested_url(int idx, struct template_content *tpc)
  19. {
  20. dprintf(idx, "%s", http_connection(idx)->path);
  21. }
  22. static void template_send_server_version(int idx, struct template_content *tpc)
  23. {
  24. dprintf(idx, "EggdropMiniHTTPd/%s", HTTPD_VERSION);
  25. }
  26. static void template_send_server_port(int idx, struct template_content *tpc)
  27. {
  28. int i;
  29. for (i = 0; i < dcc_total; i++) {
  30. if (dcc[i].type == &MHTTPD_CON_HTTPD) {
  31. dprintf(idx, "%d", dcc[i].port);
  32. return;
  33. }
  34. }
  35. }
  36. struct template_commands template_httpd_commands[] =
  37. {
  38. {"requested_url", template_send_requested_url, NULL},
  39. {"server_version", template_send_server_version, NULL},
  40. {"server_port", template_send_server_port, NULL},
  41. {0, 0, 0},
  42. };