forked from NadiaSama/FG.video
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathngx_http_f4v_module.c
74 lines (59 loc) · 1.63 KB
/
ngx_http_f4v_module.c
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*
* Copyright (C) NadiaF0rever
* Copyright (C) Beijing Datafrog Technology Co., Ltd.
*/
#include <ngx_config.h>
#include <ngx_core.h>
#include <ngx_http.h>
#include "ngx_http_flv_handler.h"
#include "fgvideo_iqiyi_handler.h"
static char *ngx_http_f4v(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
static ngx_command_t ngx_http_f4v_commands[] = {
{
ngx_string("f4v"),
NGX_HTTP_LOC_CONF | NGX_CONF_NOARGS,
ngx_http_f4v,
0,
0,
NULL
},
ngx_null_command
};
static ngx_http_module_t ngx_http_f4v_module_ctx = {
NULL, /* preconfiguration */
NULL, /* postconfiguration */
NULL, /* create main configuration */
NULL, /* init main configuration */
NULL, /* create server configuration */
NULL, /* merge server configuration */
NULL, /* create location configuration */
NULL /* merge location configuration */
};
ngx_module_t ngx_http_f4v_module = {
NGX_MODULE_V1,
&ngx_http_f4v_module_ctx,
ngx_http_f4v_commands,
NGX_HTTP_MODULE,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NGX_MODULE_V1_PADDING
};
static ngx_int_t
ngx_http_f4v_handler(ngx_http_request_t *r){
if(iqiyi_request(r)){
return fgvideo_iqiyi_handler(r);
}
return ngx_http_flv_pos_handler(r);
}
static char *
ngx_http_f4v(ngx_conf_t *cf, ngx_command_t *cmd, void *arg){
ngx_http_core_loc_conf_t *clcf;
clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module);
clcf->handler = ngx_http_f4v_handler;
return NGX_CONF_OK;
}