-
Notifications
You must be signed in to change notification settings - Fork 564
/
README
258 lines (179 loc) · 7.4 KB
/
README
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
httpd Module
__________________________________________________________
Table of Contents
1. Admin Guide
1.1. Overview
1.2. Dependencies
1.2.1. OpenSIPS Modules
1.2.2. External Libraries or Applications
1.3. Exported Parameters
1.3.1. ip(string)
1.3.2. port(integer)
1.3.3. buf_size (integer)
1.3.4. post_buf_size (integer)
1.4. Exported MI Functions
1.4.1. httpd_list_root_path
1.5. Exported Functions
1.6. Known issues
2. Developer Guide
2.1. Available Functions
2.1.1. register_httpdcb (module, root_path,
httpd_acces_handler_cb, httpd_flush_data_cb,
httpd_init_proc_cb)
3. Contributors
3.1. By Commit Statistics
3.2. By Commit Activity
4. Documentation
4.1. Contributors
List of Tables
3.1. Top contributors by DevScore^(1), authored commits^(2) and
lines added/removed^(3)
3.2. Most recently active contributors^(1) to this module
List of Examples
1.1. Set ip parameter
1.2. Set port parameter
1.3. Set buf_size parameter
1.4. Set post_buf_size parameter
Chapter 1. Admin Guide
1.1. Overview
This module provides an HTTP transport layer for OpenSIPS.
Implementation of httpd module's http server is based on
libmicrohttpd library.
1.2. Dependencies
1.2.1. OpenSIPS Modules
The following modules must be loaded before this module:
* No dependencies on other OpenSIPS modules.
1.2.2. External Libraries or Applications
The following libraries or applications must be installed
before running OpenSIPS with this module loaded:
* libmicrohttpd.
1.3. Exported Parameters
1.3.1. ip(string)
The IP address used by the HTTP server to listen for incoming
requests.
The default value is an empty string. If no IP address is set,
then the http server will bind to all available IPs.
Example 1.1. Set ip parameter
...
modparam("httpd", "ip", "127.0.0.1")
...
1.3.2. port(integer)
The port number used by the HTTP server to listen for incoming
requests.
The default value is 8888. Ports lower than 1024 are not
accepted.
Example 1.2. Set port parameter
...
modparam("httpd", "port", 8000)
...
1.3.3. buf_size (integer)
It specifies the maximum length (in bytes) of the buffer used
to write in the html response.
If the size of the buffer is set to zero, it will be
automatically set to a quarter of the size of the pkg memory.
The default value is 0.
Example 1.3. Set buf_size parameter
...
modparam("httpd", "buf_size", 524288)
...
1.3.4. post_buf_size (integer)
It specifies the length (in bytes) of the POST HTTP requests
processing buffer. For large POST request, the default value
might require to be increased.
The default value is 1024. The minumal value is 256.
Example 1.4. Set post_buf_size parameter
...
modparam("httpd", "post_buf_size", 4096)
...
1.4. Exported MI Functions
1.4.1. httpd_list_root_path
Lists all the registered http root paths into the httpd module.
When a request comes in, if the root parth is in the list, the
request will be sent to the module that register it.
Name: httpd_list_root_path
Parameters: none
MI FIFO Command Format:
opensips-cli -x mi httpd_list_root_path
1.5. Exported Functions
No function exported to be used from configuration file.
1.6. Known issues
Due to the fact that OpenSIPS is a multiprocess application,
the microhttpd library is used in "external select" mode. This
ensures that the library is not running in multithread mode and
the library is entirely controled by OpenSIPS. Due to this
particular mode of operations, for now, the entire http
response is built in a pre-allocated buffer (see buf_size
parameter).
Future realeases of this module will address this issue.
Running the http daemon as non root on ports below 1024 is
forbidden by default in linux (kernel>=2.6.24). To allow the
port binding, one can use setcap to give extra privilleges to
opensips binary:
setcap 'cap_net_bind_service=+ep' /usr/local/sbin/opensips
Chapter 2. Developer Guide
2.1. Available Functions
2.1.1. register_httpdcb (module, root_path, httpd_acces_handler_cb,
httpd_flush_data_cb, httpd_init_proc_cb)
Register a new http root with it's associated callbacks into
the httpd module.
Meaning of the parameters is as follows:
* const char *mod - name of the module that register an http
root path to be handled;
* str *root_path - the registered root path;
* httpd_acces_handler_cb f1 - handler to the callback method
to be called on root path match;
* httpd_flush_data_cb f2 - handler to the callback method to
be called for sending extra data (at a later time);
* httpd_init_proc_cb f3 - handler to the callback method to
be called during httpd process init;
Chapter 3. Contributors
3.1. By Commit Statistics
Table 3.1. Top contributors by DevScore^(1), authored
commits^(2) and lines added/removed^(3)
Name DevScore Commits Lines ++ Lines --
1. Ovidiu Sas (@ovidiusas) 47 30 1667 147
2. Razvan Crainea (@razvancrainea) 19 17 60 56
3. Liviu Chircu (@liviuchircu) 12 10 27 50
4. Bogdan-Andrei Iancu (@bogdan-iancu) 10 8 37 19
5. Vlad Patrascu (@rvlad-patrascu) 10 7 52 89
6. Ionut Ionita (@ionutrazvanionita) 8 6 65 21
7. Stephane Alnet 3 1 39 3
8. Stas Kobzar 3 1 2 2
9. Dusan Klinec (@ph4r05) 3 1 1 1
10. Peter Lemenkov (@lemenkov) 3 1 1 1
(1) DevScore = author_commits + author_lines_added /
(project_lines_added / project_commits) + author_lines_deleted
/ (project_lines_deleted / project_commits)
(2) including any documentation-related commits, excluding
merge commits. Regarding imported patches/code, we do our best
to count the work on behalf of the proper owner, as per the
"fix_authors" and "mod_renames" arrays in
opensips/doc/build-contrib.sh. If you identify any
patches/commits which do not get properly attributed to you,
please submit a pull request which extends "fix_authors" and/or
"mod_renames".
(3) ignoring whitespace edits, renamed files and auto-generated
files
3.2. By Commit Activity
Table 3.2. Most recently active contributors^(1) to this module
Name Commit Activity
1. Liviu Chircu (@liviuchircu) Mar 2014 - Jan 2022
2. Razvan Crainea (@razvancrainea) Mar 2015 - Jan 2021
3. Bogdan-Andrei Iancu (@bogdan-iancu) Jan 2013 - Apr 2019
4. Vlad Patrascu (@rvlad-patrascu) May 2017 - Apr 2019
5. Ovidiu Sas (@ovidiusas) Jan 2012 - Jan 2019
6. Peter Lemenkov (@lemenkov) Jun 2018 - Jun 2018
7. Ionut Ionita (@ionutrazvanionita) Jan 2017 - Feb 2017
8. Dusan Klinec (@ph4r05) Dec 2015 - Dec 2015
9. Stas Kobzar Feb 2015 - Feb 2015
10. Stephane Alnet Nov 2013 - Nov 2013
(1) including any documentation-related commits, excluding
merge commits
Chapter 4. Documentation
4.1. Contributors
Last edited by: Razvan Crainea (@razvancrainea), Peter Lemenkov
(@lemenkov), Liviu Chircu (@liviuchircu), Vlad Patrascu
(@rvlad-patrascu), Ovidiu Sas (@ovidiusas), Bogdan-Andrei Iancu
(@bogdan-iancu).
Documentation Copyrights:
Copyright © 2012-2013 VoIP Embedded, Inc.