1 |
/* |
2 |
* ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd) |
3 |
* |
4 |
* Copyright (c) 2001-2015 ircd-hybrid development team |
5 |
* |
6 |
* This program 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 2 of the License, or |
9 |
* (at your option) any later version. |
10 |
* |
11 |
* This program 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 this program; if not, write to the Free Software |
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 |
19 |
* USA |
20 |
*/ |
21 |
|
22 |
/*! \file m_post.c |
23 |
* \brief Includes required functions for processing the POST/GET/PUT command. |
24 |
* \version $Id$ |
25 |
*/ |
26 |
|
27 |
#include "stdinc.h" |
28 |
#include "client.h" |
29 |
#include "ircd.h" |
30 |
#include "send.h" |
31 |
#include "parse.h" |
32 |
#include "modules.h" |
33 |
|
34 |
|
35 |
/*! \brief GET/POST/PUT command handler |
36 |
* |
37 |
* \param source_p Pointer to allocated Client struct from which the message |
38 |
* originally comes from. This can be a local or remote client. |
39 |
* \param parc Integer holding the number of supplied arguments. |
40 |
* \param parv Argument vector where parv[0] .. parv[parc-1] are non-NULL |
41 |
* pointers. |
42 |
* \note Valid arguments for this command are: |
43 |
* - parv[0] = command |
44 |
*/ |
45 |
static int |
46 |
mr_dumb_proxy(struct Client *source_p, int parc, char *parv[]) |
47 |
{ |
48 |
sendto_realops_flags(UMODE_REJ, L_ALL, SEND_NOTICE, |
49 |
"HTTP Proxy disconnected: [%s@%s]", |
50 |
source_p->username, source_p->host); |
51 |
exit_client(source_p, "Client Exit"); |
52 |
return 0; |
53 |
} |
54 |
|
55 |
static struct Message post_msgtab = |
56 |
{ |
57 |
.cmd = "POST", |
58 |
.args_max = MAXPARA, |
59 |
.handlers[UNREGISTERED_HANDLER] = mr_dumb_proxy, |
60 |
.handlers[CLIENT_HANDLER] = m_ignore, |
61 |
.handlers[SERVER_HANDLER] = m_ignore, |
62 |
.handlers[ENCAP_HANDLER] = m_ignore, |
63 |
.handlers[OPER_HANDLER] = m_ignore |
64 |
}; |
65 |
|
66 |
static struct Message get_msgtab = |
67 |
{ |
68 |
.cmd = "GET", |
69 |
.args_max = MAXPARA, |
70 |
.handlers[UNREGISTERED_HANDLER] = mr_dumb_proxy, |
71 |
.handlers[CLIENT_HANDLER] = m_ignore, |
72 |
.handlers[SERVER_HANDLER] = m_ignore, |
73 |
.handlers[ENCAP_HANDLER] = m_ignore, |
74 |
.handlers[OPER_HANDLER] = m_ignore |
75 |
}; |
76 |
|
77 |
static struct Message put_msgtab = |
78 |
{ |
79 |
.cmd = "PUT", |
80 |
.args_max = MAXPARA, |
81 |
.handlers[UNREGISTERED_HANDLER] = mr_dumb_proxy, |
82 |
.handlers[CLIENT_HANDLER] = m_ignore, |
83 |
.handlers[SERVER_HANDLER] = m_ignore, |
84 |
.handlers[ENCAP_HANDLER] = m_ignore, |
85 |
.handlers[OPER_HANDLER] = m_ignore |
86 |
}; |
87 |
|
88 |
static void |
89 |
module_init(void) |
90 |
{ |
91 |
mod_add_cmd(&post_msgtab); |
92 |
mod_add_cmd(&get_msgtab); |
93 |
mod_add_cmd(&put_msgtab); |
94 |
} |
95 |
|
96 |
static void |
97 |
module_exit(void) |
98 |
{ |
99 |
mod_del_cmd(&post_msgtab); |
100 |
mod_del_cmd(&get_msgtab); |
101 |
mod_del_cmd(&put_msgtab); |
102 |
} |
103 |
|
104 |
struct module module_entry = |
105 |
{ |
106 |
.version = "$Revision$", |
107 |
.modinit = module_init, |
108 |
.modexit = module_exit, |
109 |
}; |