request body can be decode directly or delegated to plugin

This commit is contained in:
lxsang
2018-10-08 19:32:23 +02:00
parent 6b51621f98
commit 03a0a9deea
6 changed files with 481 additions and 430 deletions

View File

@ -24,7 +24,8 @@
#define R_FLOAT(d,k) ((double)atof(dvalue(d,k)))
#define R_PTR(d,k) (dvalue(d,k))
#define __RESULT__ "{\"result\":%d,\"msg\":\"%s\"}"
#define FORM_URL_ENCODE "application/x-www-form-urlencoded"
#define FORM_MULTI_PART "multipart/form-data"
#ifdef USE_OPENSSL
int __attribute__((weak)) usessl();
@ -64,6 +65,19 @@ typedef struct {
char* sslkey;
#endif
}config_t;
typedef struct {
char *name;
char *dbpath;
char * htdocs;
char*pdir;
int sport;
int raw_body;
#ifdef USE_OPENSSL
int usessl;
#endif
} plugin_header_t;
void set_nonblock(int socket);
//void set_block(int socket);
int response(void*, const char*);

View File

@ -11,9 +11,13 @@ void __init_plugin__(const char* pl,config_t* conf){
#ifdef USE_OPENSSL
__plugin__.usessl = conf->usessl;
#endif
__plugin__.raw_body = 0;
init();
};
void use_raw_body()
{
__plugin__.raw_body = 1;
}
#ifdef USE_DB
sqldb __getdb(char *name)
{

View File

@ -7,17 +7,6 @@
#include "ws.h"
#include "scheduler.h"
typedef struct {
char *name;
char *dbpath;
char * htdocs;
char*pdir;
int sport;
#ifdef USE_OPENSSL
int usessl;
#endif
} plugin_header_t;
//typedef void(*call)();
@ -40,4 +29,5 @@ void init();
void destroy();
void* handle(void*);
plugin_header_t* meta();
void use_raw_body();
#endif