TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
httppost.cpp File Reference
#include "httppost.h"
+ Include dependency graph for httppost.cpp:

Functions

static int http_post_init (struct soap *soap, struct http_post_data *data, struct http_post_handlers *handlers)
 
static void http_post_delete (struct soap *soap, struct soap_plugin *p)
 
static int http_post_parse_header (struct soap *soap, const char *, const char *)
 
static http_handler_t http_lookup_handler (struct soap *soap, const char *type, struct http_post_data *data)
 
static int http_fput (struct soap *soap)
 
static int http_fdel (struct soap *soap)
 
int http_post (struct soap *soap, struct soap_plugin *p, void *arg)
 
int soap_post_connect (struct soap *soap, const char *endpoint, const char *action, const char *type)
 
int soap_put_connect (struct soap *soap, const char *endpoint, const char *action, const char *type)
 
int soap_delete_connect (struct soap *soap, const char *endpoint, const char *action, const char *type)
 
int soap_http_body (struct soap *soap, char **buf, size_t *len)
 

Variables

const char http_post_id [14] = HTTP_POST_ID
 

Function Documentation

static int http_fdel ( struct soap soap)
static
226 { struct http_post_data *data = (struct http_post_data*)soap_lookup_plugin(soap, http_post_id);
227  if (!data)
228  return SOAP_PLUGIN_ERROR;
229  soap->fform = http_lookup_handler(soap, "DELETE", data);
230  if (soap->fform)
231  return SOAP_STOP;
232  return 405;
233 }
Definition: httppost.h:72
int(* fform)(struct soap *)
Definition: stdsoap2.h:1988
const char http_post_id[14]
Definition: httppost.cpp:146
SOAP_FMAC1 void *SOAP_FMAC2 soap_lookup_plugin(struct soap *soap, const char *id)
Definition: stdsoap2.cpp:16947
#define SOAP_PLUGIN_ERROR
Definition: stdsoap2.h:1285
#define SOAP_STOP
Definition: stdsoap2.h:1308
static http_handler_t http_lookup_handler(struct soap *soap, const char *type, struct http_post_data *data)
Definition: httppost.cpp:204

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int http_fput ( struct soap soap)
static
216 { struct http_post_data *data = (struct http_post_data*)soap_lookup_plugin(soap, http_post_id);
217  if (!data)
218  return SOAP_PLUGIN_ERROR;
219  soap->fform = http_lookup_handler(soap, "PUT", data);
220  if (soap->fform)
221  return SOAP_FORM;
222  return 405;
223 }
Definition: httppost.h:72
int(* fform)(struct soap *)
Definition: stdsoap2.h:1988
const char http_post_id[14]
Definition: httppost.cpp:146
SOAP_FMAC1 void *SOAP_FMAC2 soap_lookup_plugin(struct soap *soap, const char *id)
Definition: stdsoap2.cpp:16947
#define SOAP_PLUGIN_ERROR
Definition: stdsoap2.h:1285
static http_handler_t http_lookup_handler(struct soap *soap, const char *type, struct http_post_data *data)
Definition: httppost.cpp:204
#define SOAP_FORM
Definition: stdsoap2.h:1309

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static http_handler_t http_lookup_handler ( struct soap soap,
const char *  type,
struct http_post_data data 
)
static
205 { struct http_post_handlers *p;
206  for (p = data->handlers; p && p->type; p++)
207  { if (!soap_tag_cmp(type, p->type))
208  { DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Found HTTP POST plugin handler for '%s'\n", type));
209  return p->handler;
210  }
211  }
212  return NULL;
213 }
#define DBGLOG(DBGFILE, CMD)
Definition: stdsoap2.h:1600
arena_t NULL
Definition: jemalloc_internal.h:624
SOAP_FMAC1 int SOAP_FMAC2 soap_tag_cmp(const char *s, const char *t)
Definition: stdsoap2.cpp:2918
struct http_post_handlers * handlers
Definition: httppost.h:76
Definition: httppost.h:66
const char * type
Definition: httppost.h:67
http_handler_t handler
Definition: httppost.h:68

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int http_post ( struct soap soap,
struct soap_plugin p,
void *  arg 
)
157 { p->id = http_post_id;
158  p->data = (void*)malloc(sizeof(struct http_post_data));
160  if (p->data)
161  if (http_post_init(soap, (struct http_post_data*)p->data, (struct http_post_handlers *)arg))
162  { free(p->data); /* error: could not init */
163  return SOAP_EOM; /* return error */
164  }
165  return SOAP_OK;
166 }
Definition: httppost.h:72
const char * id
Definition: stdsoap2.h:2252
const char http_post_id[14]
Definition: httppost.cpp:146
static void http_post_delete(struct soap *soap, struct soap_plugin *p)
Definition: httppost.cpp:179
static int http_post_init(struct soap *soap, struct http_post_data *data, struct http_post_handlers *handlers)
Definition: httppost.cpp:168
internal::NamedArg< char > arg(StringRef name, const T &arg)
Definition: format.h:3248
#define SOAP_OK
Definition: stdsoap2.h:1245
void * data
Definition: stdsoap2.h:2253
Definition: httppost.h:66
void(* fdelete)(struct soap *soap, struct soap_plugin *p)
Definition: stdsoap2.h:2255
#define SOAP_EOM
Definition: stdsoap2.h:1265

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void http_post_delete ( struct soap soap,
struct soap_plugin p 
)
static
180 { soap->fparsehdr = ((struct http_post_data*)p->data)->fparsehdr;
181  soap->fput = ((struct http_post_data*)p->data)->fput;
182  soap->fdel = ((struct http_post_data*)p->data)->fdel;
183  free(p->data); /* free allocated plugin data (this function is not called for shared plugin data, but only when the final soap_done() is invoked on the original soap struct) */
184 }
Definition: httppost.h:72
int(* fdel)(struct soap *)
Definition: stdsoap2.h:1985
int(* fput)(struct soap *)
Definition: stdsoap2.h:1984
int(* fparsehdr)(struct soap *, const char *, const char *)
Definition: stdsoap2.h:1992
void * data
Definition: stdsoap2.h:2253

+ Here is the caller graph for this function:

static int http_post_init ( struct soap soap,
struct http_post_data data,
struct http_post_handlers handlers 
)
static
169 { data->fparsehdr = soap->fparsehdr; /* save old HTTP header parser callback */
170  soap->fparsehdr = http_post_parse_header; /* replace HTTP header parser callback with ours */
171  data->fput = soap->fput;
172  soap->fput = http_fput;
173  data->fdel = soap->fdel;
174  soap->fdel = http_fdel;
175  data->handlers = handlers;
176  return SOAP_OK;
177 }
int(* fdel)(struct soap *)
Definition: httppost.h:75
int(* fparsehdr)(struct soap *, const char *, const char *)
Definition: httppost.h:73
static int http_post_parse_header(struct soap *soap, const char *, const char *)
Definition: httppost.cpp:186
static int http_fdel(struct soap *soap)
Definition: httppost.cpp:225
struct http_post_handlers * handlers
Definition: httppost.h:76
int(* fdel)(struct soap *)
Definition: stdsoap2.h:1985
int(* fput)(struct soap *)
Definition: stdsoap2.h:1984
int(* fparsehdr)(struct soap *, const char *, const char *)
Definition: stdsoap2.h:1992
#define SOAP_OK
Definition: stdsoap2.h:1245
static int http_fput(struct soap *soap)
Definition: httppost.cpp:215
int(* fput)(struct soap *)
Definition: httppost.h:74

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int http_post_parse_header ( struct soap soap,
const char *  key,
const char *  val 
)
static
187 { struct http_post_data *data = (struct http_post_data*)soap_lookup_plugin(soap, http_post_id);
188  if (!data)
189  return SOAP_PLUGIN_ERROR;
190  soap->error = data->fparsehdr(soap, key, val); /* parse HTTP header */
191  if (soap->error == SOAP_OK)
192  { if (!soap_tag_cmp(key, "Content-Type"))
193  { /* check content type */
194  soap->fform = http_lookup_handler(soap, val, data);
195  if (!soap->fform)
196  soap->fform = http_lookup_handler(soap, "POST", data);
197  if (soap->fform)
198  return SOAP_FORM; /* calls soap->fform after processing the HTTP header */
199  }
200  }
201  return soap->error;
202 }
int(* fparsehdr)(struct soap *, const char *, const char *)
Definition: httppost.h:73
int error
Definition: stdsoap2.h:2112
Definition: httppost.h:72
SOAP_FMAC1 int SOAP_FMAC2 soap_tag_cmp(const char *s, const char *t)
Definition: stdsoap2.cpp:2918
int(* fform)(struct soap *)
Definition: stdsoap2.h:1988
const char http_post_id[14]
Definition: httppost.cpp:146
SOAP_FMAC1 void *SOAP_FMAC2 soap_lookup_plugin(struct soap *soap, const char *id)
Definition: stdsoap2.cpp:16947
#define SOAP_PLUGIN_ERROR
Definition: stdsoap2.h:1285
static http_handler_t http_lookup_handler(struct soap *soap, const char *type, struct http_post_data *data)
Definition: httppost.cpp:204
#define SOAP_FORM
Definition: stdsoap2.h:1309
#define SOAP_OK
Definition: stdsoap2.h:1245

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int soap_delete_connect ( struct soap soap,
const char *  endpoint,
const char *  action,
const char *  type 
)
252 { if (soap_connect_command(soap, SOAP_DEL, endpoint, action)
253  || soap_end_send(soap))
254  return soap_closesock(soap);
255  return soap_closesock(soap);
256 }
SOAP_FMAC1 int SOAP_FMAC2 soap_end_send(struct soap *soap)
Definition: stdsoap2.cpp:8242
SOAP_FMAC1 int SOAP_FMAC2 soap_connect_command(struct soap *soap, int http_command, const char *endpoints, const char *action)
Definition: stdsoap2.cpp:15698
#define SOAP_DEL
Definition: stdsoap2.h:1319
SOAP_FMAC1 int SOAP_FMAC2 soap_closesock(struct soap *soap)
Definition: stdsoap2.cpp:5113

+ Here is the call graph for this function:

int soap_http_body ( struct soap soap,
char **  buf,
size_t *  len 
)
259 { char *s = *buf = NULL;
260  *len = 0;
261  /* It is unlikely chunked and/or compressed POST messages are sent by browsers, but we need to handle them */
262  if ((soap->mode & SOAP_IO) == SOAP_IO_CHUNK
263 #ifdef WITH_ZLIB
264  || soap->zlib_in != SOAP_ZLIB_NONE
265 #endif
266  )
267  { register size_t k;
268  soap_wchar c = EOF;
269  soap->labidx = 0;
270  do
271  { if (soap_append_lab(soap, NULL, 0))
272  return soap->error;
273  s = soap->labbuf + soap->labidx;
274  k = soap->lablen - soap->labidx;
275  soap->labidx = soap->lablen;
276  while (k--)
277  { if ((c = soap_getchar(soap)) == (int)EOF)
278  break;
279  *s++ = c;
280  }
281  } while (c != (int)EOF);
282  *len = soap->lablen - k - 1;
283  *buf = (char*)soap_malloc(soap, *len + 1);
284  memcpy(*buf, soap->labbuf, *len + 1);
285  }
286  else
287  { if (soap->length)
288  { s = (char*)soap_malloc(soap, soap->length + 1);
289  if (s)
290  { char *t = s;
291  size_t i;
292  for (i = soap->length; i; i--)
293  { soap_wchar c;
294  if ((c = soap_getchar(soap)) == (int)EOF)
295  return soap->error = SOAP_EOF;
296  *t++ = c;
297  }
298  *t = '\0';
299  }
300  }
301  *buf = s;
302  *len = soap->length;
303  }
304  return soap_end_recv(soap);
305 }
size_t lablen
Definition: stdsoap2.h:2064
int error
Definition: stdsoap2.h:2112
soap_mode mode
Definition: stdsoap2.h:1936
soap_int32 soap_wchar
Definition: stdsoap2.h:1610
#define SOAP_IO
Definition: stdsoap2.h:1342
#define SOAP_ZLIB_NONE
Definition: stdsoap2.h:1333
arena_t NULL
Definition: jemalloc_internal.h:624
#define SOAP_IO_CHUNK
Definition: stdsoap2.h:1346
SOAP_FMAC1 int SOAP_FMAC2 soap_append_lab(struct soap *soap, const char *s, size_t n)
Definition: stdsoap2.cpp:10592
size_t labidx
Definition: stdsoap2.h:2065
char * labbuf
Definition: stdsoap2.h:2063
short zlib_in
Definition: stdsoap2.h:2201
size_t length
Definition: stdsoap2.h:2062
#define SOAP_EOF
Definition: stdsoap2.h:1243
SOAP_FMAC1 int SOAP_FMAC2 soap_end_recv(struct soap *soap)
Definition: stdsoap2.cpp:8387
SOAP_FMAC1 soap_wchar SOAP_FMAC2 soap_getchar(struct soap *soap)
Definition: stdsoap2.cpp:1337
SOAP_FMAC1 void *SOAP_FMAC2 soap_malloc(struct soap *soap, size_t n)
Definition: stdsoap2.cpp:7638

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int soap_post_connect ( struct soap soap,
const char *  endpoint,
const char *  action,
const char *  type 
)
238 { if ((soap->omode & SOAP_IO) != SOAP_IO_CHUNK) /* not chunking: store in buf */
239  soap->omode = (soap->omode & ~SOAP_IO) | SOAP_IO_STORE;
240  soap->http_content = type;
241  return soap_connect_command(soap, SOAP_POST_FILE, endpoint, action);
242 }
#define SOAP_IO
Definition: stdsoap2.h:1342
#define SOAP_IO_CHUNK
Definition: stdsoap2.h:1346
const char * http_content
Definition: stdsoap2.h:1943
SOAP_FMAC1 int SOAP_FMAC2 soap_connect_command(struct soap *soap, int http_command, const char *endpoints, const char *action)
Definition: stdsoap2.cpp:15698
soap_mode omode
Definition: stdsoap2.h:1938
#define SOAP_IO_STORE
Definition: stdsoap2.h:1345
#define SOAP_POST_FILE
Definition: stdsoap2.h:1316

+ Here is the call graph for this function:

int soap_put_connect ( struct soap soap,
const char *  endpoint,
const char *  action,
const char *  type 
)
245 { if ((soap->omode & SOAP_IO) != SOAP_IO_CHUNK) /* not chunking: store in buf */
246  soap->omode = (soap->omode & ~SOAP_IO) | SOAP_IO_STORE;
247  soap->http_content = type;
248  return soap_connect_command(soap, SOAP_PUT, endpoint, action);
249 }
#define SOAP_IO
Definition: stdsoap2.h:1342
#define SOAP_IO_CHUNK
Definition: stdsoap2.h:1346
const char * http_content
Definition: stdsoap2.h:1943
SOAP_FMAC1 int SOAP_FMAC2 soap_connect_command(struct soap *soap, int http_command, const char *endpoints, const char *action)
Definition: stdsoap2.cpp:15698
soap_mode omode
Definition: stdsoap2.h:1938
#define SOAP_PUT
Definition: stdsoap2.h:1318
#define SOAP_IO_STORE
Definition: stdsoap2.h:1345

+ Here is the call graph for this function:

Variable Documentation

const char http_post_id[14] = HTTP_POST_ID