mirror of
https://github.com/fumiama/CMoe-Counter.git
synced 2025-02-13 09:02:38 +01:00
Update cmoe.c
This commit is contained in:
parent
2c537be0ad
commit
591fa9ab16
8
cmoe.c
8
cmoe.c
@ -16,9 +16,9 @@ static COUNTER counter;
|
|||||||
offset += strlen(buf + offset);
|
offset += strlen(buf + offset);
|
||||||
#define EXTNM_IS_NOT(name) (strcmp(filepath+extpos, name))
|
#define EXTNM_IS_NOT(name) (strcmp(filepath+extpos, name))
|
||||||
|
|
||||||
static void headers(u_int32_t content_len, const char* content_type, int no_cache) {
|
static void headers(uint32_t content_len, const char* content_type, int no_cache) {
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
u_int32_t offset = 0;
|
uint32_t offset = 0;
|
||||||
|
|
||||||
ADD_HERDER(HTTP200 SERVER_STRING);
|
ADD_HERDER(HTTP200 SERVER_STRING);
|
||||||
if(no_cache) ADD_HERDER(CACHE_CTRL);
|
if(no_cache) ADD_HERDER(CACHE_CTRL);
|
||||||
@ -33,7 +33,7 @@ static void http_error(char* type, char* msg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static char* get_arg(char* query) {
|
static char* get_arg(char* query) {
|
||||||
u_int32_t len = 0;
|
uint32_t len = 0;
|
||||||
while(query[len] && query[len] != '&') len++;
|
while(query[len] && query[len] != '&') len++;
|
||||||
if(len > 0) {
|
if(len > 0) {
|
||||||
char* name = malloc(len+1);
|
char* name = malloc(len+1);
|
||||||
@ -175,7 +175,7 @@ static int name_exist(char* name) {
|
|||||||
//Usage: cmoe method query_string
|
//Usage: cmoe method query_string
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
if(argc == 3) {
|
if(argc == 3) {
|
||||||
u_int32_t data_len = 0;
|
uint32_t data_len = 0;
|
||||||
char* name = strstr(QS, "name=");
|
char* name = strstr(QS, "name=");
|
||||||
items_len = align_struct(sizeof(COUNTER), 2, &counter.name, &counter.count);
|
items_len = align_struct(sizeof(COUNTER), 2, &counter.name, &counter.count);
|
||||||
if(!items_len) http_error(HTTP500, "Align Struct Error.");
|
if(!items_len) http_error(HTTP500, "Align Struct Error.");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user