-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdata_cgi.c
More file actions
49 lines (31 loc) · 996 Bytes
/
data_cgi.c
File metadata and controls
49 lines (31 loc) · 996 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include "fcgi_config.h"
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/wait.h>
#include "fcgi_stdio.h"
#include "util_cgi.h"
#define LOG_CGI_MODULE "cgi"
#define LOG_DATA_PROC "data"
#define JSON_STR ""
int main ()
{
while (FCGI_Accept() >= 0) {
printf("Content-type: text/html\r\n"
"\r\n");
char buf[4096] = {0};
//1 获取 前段的参数
LOG(LOG_CGI_MODULE, LOG_DATA_PROC, "url: %s", getenv("QUERY_STRING"));
// cmd=newFile&fromId=0&count=8&user=
//进程lrange 查询FILE_ID_LIST 得到fileid
//全部文件已经租床称了一个json字符串
//test
FILE *fp = NULL;
fp = fopen("json_test_data.json", "r");
fread(buf, 4096, 1, fp);
//LOG(LOG_CGI_MODULE, LOG_DATA_PROC, "%s\n", buf);
fclose(fp);
printf("%s\n", buf);
} /* while */
return 0;
}