webroar 0.3.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +48 -1
- data/README +11 -14
- data/Rakefile +1 -1
- data/conf/mime_type.yml +172 -166
- data/conf/server_internal_config.yml +30 -8
- data/doc/user-guide.html +294 -153
- data/doc/user-guide.txt +9 -13
- data/lib/command_runner.rb +1 -0
- data/lib/dependencies.rb +18 -15
- data/lib/installer.rb +115 -50
- data/src/admin_panel/app/controllers/admin_controller.rb +1 -15
- data/src/admin_panel/app/controllers/application_controller.rb +2 -2
- data/src/admin_panel/app/controllers/application_specification_controller.rb +2 -1
- data/src/admin_panel/app/controllers/headers_controller.rb +73 -0
- data/src/admin_panel/app/controllers/mail_specification_controller.rb +10 -0
- data/src/admin_panel/app/controllers/server_specification_controller.rb +14 -0
- data/src/admin_panel/app/helpers/admin_helper.rb +0 -85
- data/src/admin_panel/app/models/app.rb +1 -1
- data/src/admin_panel/app/models/application_specification.rb +33 -25
- data/src/admin_panel/app/models/headers.rb +116 -0
- data/src/admin_panel/app/models/mail_specification.rb +20 -5
- data/src/admin_panel/app/models/server_specification.rb +2 -7
- data/src/admin_panel/app/views/admin/configuration.html.erb +10 -5
- data/src/admin_panel/app/views/exceptions/_exception_list_partial.html.erb +4 -4
- data/src/admin_panel/app/views/graph/_graph_page.html.erb +3 -0
- data/src/admin_panel/app/views/headers/_add_expires_text_box.html.erb +35 -0
- data/src/admin_panel/app/views/headers/_expires_by_type_form.html.erb +65 -0
- data/src/admin_panel/app/views/headers/_headers_table.html.erb +113 -0
- data/src/admin_panel/app/views/mail_specification/_current_spec.html.erb +168 -0
- data/src/admin_panel/app/views/{admin → server_specification}/_add_div.html.erb +1 -1
- data/src/admin_panel/config/initializers/application_constants.rb +6 -0
- data/src/admin_panel/lib/control.rb +6 -3
- data/src/admin_panel/lib/scgi.rb +74 -21
- data/src/admin_panel/lib/yaml_writer.rb +51 -17
- data/src/admin_panel/public/javascripts/application.js +20 -1
- data/src/head/wr_access_log.c +2 -2
- data/src/head/wr_application.c +294 -236
- data/src/head/wr_application.h +8 -8
- data/src/head/wr_configurator.c +451 -517
- data/src/head/wr_configurator.h +10 -115
- data/src/head/wr_connection.c +26 -25
- data/src/head/wr_connection.h +2 -3
- data/src/head/wr_controller.c +110 -93
- data/src/head/wr_controller.h +6 -6
- data/src/head/wr_main.c +31 -24
- data/src/head/wr_request.c +70 -93
- data/src/head/wr_request.h +0 -4
- data/src/head/wr_resolver.c +21 -15
- data/src/head/wr_resolver.h +2 -2
- data/src/head/wr_server.c +36 -26
- data/src/head/wr_server.h +5 -5
- data/src/head/wr_worker.c +551 -512
- data/src/head/wr_worker.h +33 -20
- data/src/helper/wr_config.c +316 -0
- data/src/helper/wr_config.h +235 -0
- data/src/helper/wr_helper.h +1 -5
- data/src/helper/wr_logger.c +4 -4
- data/src/helper/wr_scgi.c +3 -4
- data/src/helper/wr_scgi.h +2 -0
- data/src/helper/wr_string.h +2 -2
- data/src/helper/wr_util.c +3 -1
- data/src/helper/wr_util.h +0 -0
- data/src/helper/wr_yaml_parser.c +30 -0
- data/src/helper/wr_yaml_parser.h +1 -0
- data/src/ruby_lib/exception_tracker/instrumentation/action_controller.rb +2 -1
- data/src/ruby_lib/mailer/smtpmail.rb +7 -4
- data/src/ruby_lib/profiler/instrumentation/action_controller.rb +2 -1
- data/src/ruby_lib/profiler/instrumentation/active_record.rb +3 -0
- data/src/ruby_lib/rack/adapter/rails.rb +14 -7
- data/src/ruby_lib/ruby_interface/client.rb +1 -1
- data/src/ruby_lib/ruby_interface/version.rb +2 -2
- data/src/ruby_lib/webroar_app_loader.rb +4 -2
- data/src/worker/wkr_controller.c +200 -140
- data/src/worker/wkr_http.c +14 -28
- data/src/worker/wkr_http.h +4 -4
- data/src/worker/wkr_http_request.c +12 -11
- data/src/worker/wkr_http_request.h +7 -8
- data/src/worker/wkr_http_response.c +10 -14
- data/src/worker/wkr_http_response.h +0 -1
- data/src/worker/wkr_main.c +74 -140
- data/src/worker/wkr_static.c +295 -108
- data/src/worker/wkr_static.h +20 -7
- data/src/worker/worker.c +245 -70
- data/src/worker/worker.h +46 -34
- data/tasks/compile.rake +128 -175
- data/tasks/test.rake +345 -469
- data/test/spec/webroar_command_spec.rb +23 -0
- metadata +173 -43
- data/src/admin_panel/vendor/plugins/action_mailer_optional_tls/README +0 -34
- data/src/admin_panel/vendor/plugins/action_mailer_optional_tls/Rakefile +0 -13
- data/src/admin_panel/vendor/plugins/action_mailer_optional_tls/init.rb +0 -5
- data/src/admin_panel/vendor/plugins/action_mailer_optional_tls/lib/action_mailer_tls.rb +0 -16
- data/src/admin_panel/vendor/plugins/action_mailer_optional_tls/lib/smtp_tls.rb +0 -123
- data/src/admin_panel/vendor/plugins/action_mailer_optional_tls/test/tls_test.rb +0 -42
- data/src/head/wr_config.h +0 -165
- data/src/ruby_lib/mailer/action_mailer_tls.rb +0 -16
- data/src/ruby_lib/mailer/smtp_tls.rb +0 -123
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
WebROaR - Ruby Application Server - http://webroar.in/
|
|
3
|
+
Copyright (C) 2009 Goonj LLC
|
|
4
|
+
|
|
5
|
+
This file is part of WebROaR.
|
|
6
|
+
|
|
7
|
+
WebROaR is free software: you can redistribute it and/or modify
|
|
8
|
+
it under the terms of the GNU General Public License as published by
|
|
9
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+
(at your option) any later version.
|
|
11
|
+
|
|
12
|
+
WebROaR is distributed in the hope that it will be useful,
|
|
13
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
GNU General Public License for more details.
|
|
16
|
+
|
|
17
|
+
You should have received a copy of the GNU General Public License
|
|
18
|
+
along with WebROaR. If not, see <http://www.gnu.org/licenses/>.
|
|
19
|
+
-->
|
|
20
|
+
<% expires = Headers.get_expires_value() %>
|
|
21
|
+
<table width = 95% cellpadding = "4" id = 'headers_table'>
|
|
22
|
+
<tr>
|
|
23
|
+
<td class = 'table_header' colspan = 3>
|
|
24
|
+
Headers <span class = 'help_link'><%=link_to_function "Help", :onclick => "addHelp('headers')" %></span>
|
|
25
|
+
<br/>
|
|
26
|
+
<div id = 'headers' class = 'font_size_12'>
|
|
27
|
+
</div>
|
|
28
|
+
</td>
|
|
29
|
+
</tr>
|
|
30
|
+
<tr>
|
|
31
|
+
<td width = 40% class = 'BG_white'>
|
|
32
|
+
Expires <span class = 'help_link'><%=link_to_function "Help", :onclick => "addHelp('expires')" %>
|
|
33
|
+
</span>
|
|
34
|
+
<br/>
|
|
35
|
+
<div id = 'expires' class = 'font_size_12'>
|
|
36
|
+
</div>
|
|
37
|
+
</td>
|
|
38
|
+
<td width = 40% class = 'BG_white'>
|
|
39
|
+
<div id = 'expires_div'>
|
|
40
|
+
<%= h(expires) %>
|
|
41
|
+
</div>
|
|
42
|
+
</td>
|
|
43
|
+
<td width = 20% class = 'BG_white'>
|
|
44
|
+
<%= link_to_remote 'Edit', :update => 'expires_div', :url => {:controller => 'headers', :action => 'add_expires_text_box', :div_id => 'expires_div'} %>
|
|
45
|
+
</td>
|
|
46
|
+
</tr>
|
|
47
|
+
<tr>
|
|
48
|
+
<td class = 'sub_header' colspan = 3>
|
|
49
|
+
Expires By Type <span class = 'help_link'><%=link_to_function "Help", :onclick => "addHelp('expires_by_type')" %></span>
|
|
50
|
+
<br/>
|
|
51
|
+
<div id = 'expires_by_type' class = 'font_size_12'>
|
|
52
|
+
</div>
|
|
53
|
+
</td>
|
|
54
|
+
</tr>
|
|
55
|
+
<% expires_by_type_array = Headers.get_expires_by_type_array() %>
|
|
56
|
+
<% if expires_by_type_array.length > 0 %>
|
|
57
|
+
<tr>
|
|
58
|
+
<td class = 'sub_header'>
|
|
59
|
+
Extension <span class = 'help_link'><%=link_to_function "Help", :onclick => "addHelp('expires_by_type_ext')" %></span>
|
|
60
|
+
|
|
61
|
+
<br/>
|
|
62
|
+
<div id = 'expires_by_type_ext' class = 'font_size_12'>
|
|
63
|
+
</div>
|
|
64
|
+
</td>
|
|
65
|
+
<td class = 'sub_header'>
|
|
66
|
+
Expires <span class = 'help_link'><%=link_to_function "Help", :onclick => "addHelp('expires_by_type_expires_value')" %></span>
|
|
67
|
+
|
|
68
|
+
<br/>
|
|
69
|
+
<div id = 'expires_by_type_expires_value' class = 'font_size_12'>
|
|
70
|
+
</div>
|
|
71
|
+
</td>
|
|
72
|
+
<td class = 'sub_header'>
|
|
73
|
+
|
|
74
|
+
</td>
|
|
75
|
+
</tr>
|
|
76
|
+
<% index = 0 %>
|
|
77
|
+
<% expires_by_type_array.each do |item| %>
|
|
78
|
+
<tr>
|
|
79
|
+
<td class = 'BG_white'>
|
|
80
|
+
<%=h item['ext'] %>
|
|
81
|
+
</td>
|
|
82
|
+
<td class = 'BG_white'>
|
|
83
|
+
<%=h item['expires'] %>
|
|
84
|
+
</td>
|
|
85
|
+
<td class = 'BG_white'>
|
|
86
|
+
<%=link_to_remote "Delete", :update => 'headers_div', :url => {:controller => 'headers', :action => 'delete_expires_by_type', :id => index}, :confirm => "Are you sure to delete?", :oncontextmenu => 'return false;' %>
|
|
87
|
+
</td>
|
|
88
|
+
</tr>
|
|
89
|
+
<% index += 1%>
|
|
90
|
+
<% end %>
|
|
91
|
+
<% end %>
|
|
92
|
+
|
|
93
|
+
</table>
|
|
94
|
+
|
|
95
|
+
<div id = 'expires_by_type_form'>
|
|
96
|
+
</div>
|
|
97
|
+
|
|
98
|
+
<table width = 95% cellpadding = "4">
|
|
99
|
+
<% if @restart_server_message %>
|
|
100
|
+
<tr>
|
|
101
|
+
<td align = 'left'>
|
|
102
|
+
<span id='error_div'>
|
|
103
|
+
<%= @restart_server_message%>
|
|
104
|
+
</span>
|
|
105
|
+
</td>
|
|
106
|
+
</tr>
|
|
107
|
+
<% end %>
|
|
108
|
+
<tr>
|
|
109
|
+
<td align = 'right'>
|
|
110
|
+
<%=link_to_remote "Add Expires By Type", :update => 'expires_by_type_form', :url => {:controller => 'headers', :action => 'add_expires_by_type_form'} %>
|
|
111
|
+
</td>
|
|
112
|
+
</tr>
|
|
113
|
+
</table>
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
WebROaR - Ruby Application Server - http://webroar.in/
|
|
3
|
+
Copyright (C) 2009 Goonj LLC
|
|
4
|
+
|
|
5
|
+
This file is part of WebROaR.
|
|
6
|
+
|
|
7
|
+
WebROaR is free software: you can redistribute it and/or modify
|
|
8
|
+
it under the terms of the GNU General Public License as published by
|
|
9
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+
(at your option) any later version.
|
|
11
|
+
|
|
12
|
+
WebROaR is distributed in the hope that it will be useful,
|
|
13
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
GNU General Public License for more details.
|
|
16
|
+
|
|
17
|
+
You should have received a copy of the GNU General Public License
|
|
18
|
+
along with WebROaR. If not, see <http://www.gnu.org/licenses/>.
|
|
19
|
+
-->
|
|
20
|
+
|
|
21
|
+
<% if File.exist?(MAIL_FILE_PATH) and info = YAML::load_file(MAIL_FILE_PATH) %>
|
|
22
|
+
<% if info['smtp'] %>
|
|
23
|
+
<table width = 95%>
|
|
24
|
+
<tr>
|
|
25
|
+
<td class = 'table_header_link' width = 50% colspan = 2>
|
|
26
|
+
<b>Mail Settings :- SMTP</b> <span class = 'help_link'><%=link_to_function('Help', :onclick => 'addHelp("mail");') %></span>
|
|
27
|
+
<br/>
|
|
28
|
+
<div id = 'mail' class = 'font_size_12'>
|
|
29
|
+
</div>
|
|
30
|
+
</td>
|
|
31
|
+
<td class = 'table_header_link' width = 50% colspan = 2 align = 'right'>
|
|
32
|
+
<%=link_to_remote 'Sendmail', :update => 'mail_div', :url => {:controller => 'mail_specification', :action => 'sendmail_form'} %>
|
|
33
|
+
<%=link_to_remote 'Edit', :update => 'mail_div', :url => {:controller => 'mail_specification', :action => 'edit_smtp', :smtp => info['smtp']} %>
|
|
34
|
+
<% if info['email_notification'] and info['email_notification'].downcase == 'disabled' %>
|
|
35
|
+
<%=link_to_remote 'Enable', :update => 'mail_div', :url => {:controller => 'mail_specification', :action => 'enable_notification'}, :confirm => ENABLE_EMAIL_NOTIFICATION, :oncontextmenu => 'return false;' %>
|
|
36
|
+
<% elsif info['email_notification'] and info['email_notification'].downcase == 'enabled' %>
|
|
37
|
+
<%=link_to_remote 'Disable', :update => 'mail_div', :url => {:controller => 'mail_specification', :action => 'disable_notification'}, :confirm => DISABLE_EMAIL_NOTIFICATION, :oncontextmenu => 'return false;' %>
|
|
38
|
+
<% end %>
|
|
39
|
+
</td>
|
|
40
|
+
</tr>
|
|
41
|
+
<tr>
|
|
42
|
+
<td class = 'BG_dark_gray' width = 25%>
|
|
43
|
+
Server
|
|
44
|
+
</td>
|
|
45
|
+
<td class = 'BG_dark_gray' width = 25%>
|
|
46
|
+
<%=info['smtp']['address'] %>
|
|
47
|
+
</td>
|
|
48
|
+
<td class = 'BG_dark_gray' width = 25%>
|
|
49
|
+
Port
|
|
50
|
+
</td>
|
|
51
|
+
<td class = 'BG_dark_gray' width = 25%>
|
|
52
|
+
<%=info['smtp']['port'] %>
|
|
53
|
+
</td>
|
|
54
|
+
</tr>
|
|
55
|
+
<tr>
|
|
56
|
+
<td class = 'BG_white'>
|
|
57
|
+
Domain
|
|
58
|
+
</td>
|
|
59
|
+
<td class = 'BG_white'>
|
|
60
|
+
<%=info['smtp']['domain'] %>
|
|
61
|
+
</td>
|
|
62
|
+
<td class = 'BG_white'>
|
|
63
|
+
Authenitcation
|
|
64
|
+
</td>
|
|
65
|
+
<td class = 'BG_white'>
|
|
66
|
+
<%=info['smtp']['authentication'] %>
|
|
67
|
+
</td>
|
|
68
|
+
</tr>
|
|
69
|
+
<tr>
|
|
70
|
+
<td class = 'BG_dark_gray'>
|
|
71
|
+
User Name
|
|
72
|
+
</td>
|
|
73
|
+
<td class = 'BG_dark_gray'>
|
|
74
|
+
<%=info['smtp']['user_name'] %>
|
|
75
|
+
</td>
|
|
76
|
+
<td class = 'BG_dark_gray'>
|
|
77
|
+
Password
|
|
78
|
+
</td>
|
|
79
|
+
<td class = 'BG_dark_gray'>
|
|
80
|
+
**************
|
|
81
|
+
</td>
|
|
82
|
+
</tr>
|
|
83
|
+
<tr>
|
|
84
|
+
<td class = 'BG_white'>
|
|
85
|
+
Sender's Email Address
|
|
86
|
+
</td>
|
|
87
|
+
<td class = 'BG_white'>
|
|
88
|
+
<%=info['smtp']['from'] %>
|
|
89
|
+
</td>
|
|
90
|
+
<td class = 'BG_white'>
|
|
91
|
+
Recipient Email Addresses
|
|
92
|
+
</td>
|
|
93
|
+
<td class = 'BG_white'>
|
|
94
|
+
<%=info['smtp']['recipients'] %>
|
|
95
|
+
</td>
|
|
96
|
+
</tr>
|
|
97
|
+
<tr>
|
|
98
|
+
</tr>
|
|
99
|
+
</table>
|
|
100
|
+
<br/>
|
|
101
|
+
<br/>
|
|
102
|
+
<% elsif info['sendmail'] %>
|
|
103
|
+
<table width = 95%>
|
|
104
|
+
<tr>
|
|
105
|
+
<td class = 'table_header_link' width = 50%>
|
|
106
|
+
<b>Mail Settings :- Sendmail</b> <span class = 'help_link'><%=link_to_function('Help', :onclick => 'addHelp("mail");') %></span>
|
|
107
|
+
<br/>
|
|
108
|
+
<div id = 'mail' class = 'font_size_12'>
|
|
109
|
+
</div>
|
|
110
|
+
</td>
|
|
111
|
+
<td class = 'table_header_link' width = 50% colspan = 2 align = 'right'>
|
|
112
|
+
<%=link_to_remote 'SMTP', :update => 'mail_div', :url => {:controller => 'mail_specification', :action => 'smtp_form'} %>
|
|
113
|
+
<%=link_to_remote 'Edit', :update => 'mail_div', :url => {:controller => 'mail_specification', :action => 'edit_sendmail', :sendmail => info['sendmail']} %>
|
|
114
|
+
<% if info['email_notification'] and info['email_notification'].downcase == 'disabled' %>
|
|
115
|
+
<%=link_to_remote 'Enable', :update => 'mail_div', :url => {:controller => 'mail_specification', :action => 'enable_notification'}, :confirm => ENABLE_EMAIL_NOTIFICATION, :oncontextmenu => 'return false;' %>
|
|
116
|
+
<% elsif info['email_notification'] and info['email_notification'].downcase == 'enabled' %>
|
|
117
|
+
<%=link_to_remote 'Disable', :update => 'mail_div', :url => {:controller => 'mail_specification', :action => 'disable_notification'}, :confirm => DISABLE_EMAIL_NOTIFICATION, :oncontextmenu => 'return false;' %>
|
|
118
|
+
<% end %>
|
|
119
|
+
</td>
|
|
120
|
+
</tr>
|
|
121
|
+
<tr>
|
|
122
|
+
<td class = 'BG_dark_gray' width = 50%>
|
|
123
|
+
Location
|
|
124
|
+
</td>
|
|
125
|
+
<td colspan = 2 class = 'BG_dark_gray'width = 50%>
|
|
126
|
+
<%=info['sendmail']['location']%>
|
|
127
|
+
</td>
|
|
128
|
+
</tr>
|
|
129
|
+
<tr>
|
|
130
|
+
<td class = 'BG_white'>
|
|
131
|
+
Sender's Email Address
|
|
132
|
+
</td>
|
|
133
|
+
<td colspan = 2 class = 'BG_white'>
|
|
134
|
+
<%=info['sendmail']['from'] %>
|
|
135
|
+
</td>
|
|
136
|
+
</tr>
|
|
137
|
+
<tr>
|
|
138
|
+
<td class = 'BG_dark_gray'>
|
|
139
|
+
Recipient Email Addresses
|
|
140
|
+
</td>
|
|
141
|
+
<td colspan = 2 class = 'BG_dark_gray'>
|
|
142
|
+
<%=info['sendmail']['recipients'] %>
|
|
143
|
+
</td>
|
|
144
|
+
</tr>
|
|
145
|
+
</table>
|
|
146
|
+
<br/>
|
|
147
|
+
<br/>
|
|
148
|
+
<% end %>
|
|
149
|
+
<% else %>
|
|
150
|
+
<table width = 95%>
|
|
151
|
+
<tr>
|
|
152
|
+
<td class = 'table_header_link' width = 80%>
|
|
153
|
+
<b>Mail Settings</b> <span class = 'help_link'><%=link_to_function('Help', :onclick => 'addHelp("mail");') %></span>
|
|
154
|
+
<br/>
|
|
155
|
+
<div id = 'mail' class = 'font_size_12'>
|
|
156
|
+
</div>
|
|
157
|
+
</td>
|
|
158
|
+
<td class = 'table_header_link' width = 10%>
|
|
159
|
+
<%=link_to_remote 'SMTP', :update => 'mail_div', :url => {:controller => 'mail_specification', :action => 'smtp_form'} %>
|
|
160
|
+
</td>
|
|
161
|
+
<td class = 'table_header_link' width = 10%>
|
|
162
|
+
<%=link_to_remote 'Sendmail', :update => 'mail_div', :url => {:controller => 'mail_specification', :action => 'sendmail_form'} %>
|
|
163
|
+
</td>
|
|
164
|
+
</tr>
|
|
165
|
+
</table>
|
|
166
|
+
<br/>
|
|
167
|
+
<br/>
|
|
168
|
+
<% end %>
|
|
@@ -35,7 +35,7 @@ along with WebROaR. If not, see <http://www.gnu.org/licenses/>.
|
|
|
35
35
|
<%end%>
|
|
36
36
|
</span>
|
|
37
37
|
<span style = "height:20px;float:right;">
|
|
38
|
-
<%remote_form_for :cancel, :update => params[:div_id], :url => {:action => 'cancel_edit', :div_id => params[:div_id], :old_value => old_value}do%>
|
|
38
|
+
<%remote_form_for :cancel, :update => params[:div_id], :url => {:controller => 'server_specification', :action => 'cancel_edit', :div_id => params[:div_id], :old_value => old_value}do%>
|
|
39
39
|
<%=submit_tag 'Cancel'%>
|
|
40
40
|
<%end%>
|
|
41
41
|
</span>
|
|
@@ -146,3 +146,9 @@ RACK = 'rack'
|
|
|
146
146
|
CLOSED_EXCEPTION = 0
|
|
147
147
|
OPEN_EXCEPTION = 1
|
|
148
148
|
IGNORED_EXCEPTION = 2
|
|
149
|
+
|
|
150
|
+
ENABLE_EMAIL_NOTIFICATION = 'Are you sure, enable email notification for the exceptions?'
|
|
151
|
+
DISABLE_EMAIL_NOTIFICATION = 'Are you sure, disable email notificaion for the exceptions? This would still captures exceptions and stores into database.'
|
|
152
|
+
|
|
153
|
+
EXPIRES_VALIDATION = "Possible value for expires is off or no. of seconds."
|
|
154
|
+
EMPTY_STRING = "Value is empty string."
|
|
@@ -79,11 +79,14 @@ class Control
|
|
|
79
79
|
streamSock.send(@req.request, 0)
|
|
80
80
|
start_time = DateTime.parse(Time.now.strftime("%a %b %d %H:%M:%S %Y"))
|
|
81
81
|
str = streamSock.recv(2048)
|
|
82
|
-
end_time = DateTime.parse(Time.now.strftime("%a %b %d %H:%M:%S %Y"))
|
|
83
|
-
streamSock.close
|
|
84
82
|
@resp = SCGI.new
|
|
85
83
|
@resp.parse(str)
|
|
86
|
-
|
|
84
|
+
until @resp.parsing_done?
|
|
85
|
+
str = streamSock.recv(2048)
|
|
86
|
+
@resp.parse(str)
|
|
87
|
+
end
|
|
88
|
+
end_time = DateTime.parse(Time.now.strftime("%a %b %d %H:%M:%S %Y"))
|
|
89
|
+
streamSock.close
|
|
87
90
|
if @resp.header("STATUS") == "OK" or @resp.header("STATUS") == "ok"
|
|
88
91
|
return nil, nil
|
|
89
92
|
else
|
data/src/admin_panel/lib/scgi.rb
CHANGED
|
@@ -18,17 +18,28 @@
|
|
|
18
18
|
# along with WebROaR. If not, see <http://www.gnu.org/licenses/>.
|
|
19
19
|
#++
|
|
20
20
|
|
|
21
|
+
require 'jcode' if RUBY_VERSION.gsub(/\D/,'').to_i < 187
|
|
21
22
|
#This class contructs and parse the SCGI request.
|
|
22
23
|
class SCGI
|
|
23
|
-
@hash #Instance variable to store SCGI headers.
|
|
24
|
-
@request #Instance variable to store SCGI request in single string value.
|
|
25
|
-
@body #Instance variable to store SCGI request body.
|
|
26
|
-
|
|
24
|
+
# @hash #Instance variable to store SCGI headers.
|
|
25
|
+
# @request #Instance variable to store SCGI request in single string value.
|
|
26
|
+
# @body #Instance variable to store SCGI request body.
|
|
27
|
+
|
|
27
28
|
#This is the constructor function for SCGI class.
|
|
28
29
|
def initialize
|
|
29
30
|
@hash = Hash.new
|
|
31
|
+
@body = ''
|
|
32
|
+
@tmp_headers_length = ''
|
|
33
|
+
@headers_length = 0
|
|
34
|
+
@curr_state = :SCGI_NONE
|
|
35
|
+
@curr_key = ''
|
|
36
|
+
@curr_value = ''
|
|
37
|
+
@done = false
|
|
30
38
|
end
|
|
31
39
|
|
|
40
|
+
def parsing_done?
|
|
41
|
+
@done
|
|
42
|
+
end
|
|
32
43
|
#Getter setter for request in SCGI class.
|
|
33
44
|
def request
|
|
34
45
|
@request
|
|
@@ -46,7 +57,7 @@ class SCGI
|
|
|
46
57
|
|
|
47
58
|
#Adds SCGI request body.
|
|
48
59
|
def body_add(body)
|
|
49
|
-
@body
|
|
60
|
+
@body += body
|
|
50
61
|
end
|
|
51
62
|
|
|
52
63
|
#Getter method for receiving SCGI headers.
|
|
@@ -56,7 +67,7 @@ class SCGI
|
|
|
56
67
|
|
|
57
68
|
#Construct SCGI request.
|
|
58
69
|
def build
|
|
59
|
-
if(@body ==
|
|
70
|
+
if(@body == '')
|
|
60
71
|
@request = "CONTENT_LENGTH\0"+"0"+"\0"
|
|
61
72
|
else
|
|
62
73
|
@request = "CONTENT_LENGTH\0#{body.length}\0"
|
|
@@ -79,19 +90,61 @@ class SCGI
|
|
|
79
90
|
end
|
|
80
91
|
|
|
81
92
|
#Parse the string and build SCGI request.
|
|
82
|
-
def parse(req)
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
93
|
+
def parse(req)
|
|
94
|
+
index = 0
|
|
95
|
+
req.each_char do |c|
|
|
96
|
+
case @curr_state
|
|
97
|
+
when :SCGI_NONE
|
|
98
|
+
if c == ':'
|
|
99
|
+
@headers_length = @tmp_headers_length.to_i
|
|
100
|
+
@curr_state = :HEADER_KEY
|
|
101
|
+
elsif c < '0' or c > '9'
|
|
102
|
+
@curr_state = :INVALID
|
|
103
|
+
else
|
|
104
|
+
@tmp_headers_length += c
|
|
105
|
+
end
|
|
106
|
+
when :HEADER_KEY
|
|
107
|
+
if c == "\0"
|
|
108
|
+
@curr_state = :HEADER_VAL
|
|
109
|
+
elsif c == ","
|
|
110
|
+
if header('CONTENT_LENGTH').to_i == 0
|
|
111
|
+
@done = true
|
|
112
|
+
@curr_state = :DONE
|
|
113
|
+
else
|
|
114
|
+
@curr_state = :BODY
|
|
115
|
+
body_add(req[index+1, req.length])
|
|
116
|
+
if @body.length == header('CONTENT_LENGTH').to_i
|
|
117
|
+
@curr_state = :DONE
|
|
118
|
+
@done = true
|
|
119
|
+
else
|
|
120
|
+
@curr_state = :BODY
|
|
121
|
+
end
|
|
122
|
+
break
|
|
123
|
+
end
|
|
124
|
+
else
|
|
125
|
+
@curr_key += c
|
|
126
|
+
end
|
|
127
|
+
when :HEADER_VAL
|
|
128
|
+
if c == "\0"
|
|
129
|
+
header_add(@curr_key, @curr_value)
|
|
130
|
+
@curr_key = ''
|
|
131
|
+
@curr_value = ''
|
|
132
|
+
@curr_state = :HEADER_KEY
|
|
133
|
+
else
|
|
134
|
+
@curr_value += c
|
|
135
|
+
end
|
|
136
|
+
when :BODY
|
|
137
|
+
body_add(req[index, req.length])
|
|
138
|
+
if @body.length == header('CONTENT_LENGTH').to_i
|
|
139
|
+
@curr_state = :DONE
|
|
140
|
+
@done = true
|
|
141
|
+
end
|
|
142
|
+
break
|
|
143
|
+
when :DONE
|
|
144
|
+
@done = true
|
|
145
|
+
return
|
|
146
|
+
end
|
|
147
|
+
index += 1
|
|
148
|
+
end
|
|
149
|
+
end
|
|
97
150
|
end
|
|
@@ -18,6 +18,13 @@
|
|
|
18
18
|
# along with WebROaR. If not, see <http://www.gnu.org/licenses/>.
|
|
19
19
|
#++
|
|
20
20
|
|
|
21
|
+
module YAMLConfig
|
|
22
|
+
CONFIG = 1
|
|
23
|
+
USER = 2
|
|
24
|
+
SMTP = 3
|
|
25
|
+
SENDMAIL = 4
|
|
26
|
+
end
|
|
27
|
+
|
|
21
28
|
class YAMLWriter
|
|
22
29
|
|
|
23
30
|
class << self
|
|
@@ -26,7 +33,7 @@ class YAMLWriter
|
|
|
26
33
|
def write(hash, file_path, type)
|
|
27
34
|
yaml_obj = YAML::dump(hash)
|
|
28
35
|
file = File.open(file_path,"w")
|
|
29
|
-
if type ==
|
|
36
|
+
if type == YAMLConfig::CONFIG
|
|
30
37
|
header_string = get_header()
|
|
31
38
|
file.puts(header_string)
|
|
32
39
|
end
|
|
@@ -85,6 +92,9 @@ class YAMLWriter
|
|
|
85
92
|
# 9) Logging level(optional)(default is 'Server Specification/log_level')
|
|
86
93
|
# 10) Run as user (mandatory)
|
|
87
94
|
# 11) Hostnames(optional)
|
|
95
|
+
# 12) Environment Variable(optional)
|
|
96
|
+
# It defines environment variables which can be used in the deployed application. It take following parameter.
|
|
97
|
+
# I) set_env(optional)(Value is key-value pair separated by equal sign('=') e.g. LOG_DIR=/var/log/webroar)
|
|
88
98
|
# Order of the above elements does not matter.
|
|
89
99
|
# Base-uri 'admin-panel' is reserved for 'Admin Panel'.
|
|
90
100
|
# Either host_names or baseuri(not both) must present to resolve HTTP request.
|
|
@@ -103,6 +113,9 @@ class YAMLWriter
|
|
|
103
113
|
# min_worker: 2
|
|
104
114
|
# max_worker: 5
|
|
105
115
|
# log_level: SEVERE
|
|
116
|
+
# environment_variables:
|
|
117
|
+
# - set_env: LOG_DIR=/var/log/webroar
|
|
118
|
+
# - set_env: TMP_DIR=/tmp
|
|
106
119
|
# Example with host_names:
|
|
107
120
|
# Application Specification:
|
|
108
121
|
# - name: Mephisto
|
|
@@ -115,24 +128,45 @@ class YAMLWriter
|
|
|
115
128
|
# min_worker: 2
|
|
116
129
|
# max_worker: 5
|
|
117
130
|
# log_level: SEVERE
|
|
118
|
-
#
|
|
119
|
-
#
|
|
120
|
-
#
|
|
121
|
-
#
|
|
122
|
-
#
|
|
123
|
-
#
|
|
124
|
-
#
|
|
125
|
-
#
|
|
126
|
-
#
|
|
127
|
-
#
|
|
128
|
-
#
|
|
129
|
-
#
|
|
130
|
-
#
|
|
131
|
-
#
|
|
132
|
-
#
|
|
131
|
+
# environment_variables:
|
|
132
|
+
# - set_env: LOG_DIR=/var/log/webroar
|
|
133
|
+
# - set_env: TMP_DIR=/tmp
|
|
134
|
+
#
|
|
135
|
+
# (c) Headers (optional)
|
|
136
|
+
# It allows adding or changing the Expires and Cache-Control in the response headers for static assets (e.g. *.js, *.gif etc).
|
|
137
|
+
# Elements:
|
|
138
|
+
# 1) Expires header for all static assets (optional) (default is 'off')
|
|
139
|
+
# 2) Specific expires header for specific file types (optional)
|
|
140
|
+
# Elements:
|
|
141
|
+
# I) File Extensions(mandatory)
|
|
142
|
+
# II) Expires value(mandatory) (No of seconds)
|
|
143
|
+
# Possible value for expires is off or no. of seconds.
|
|
144
|
+
# Example:
|
|
145
|
+
# Headers:
|
|
146
|
+
# expires: 3600
|
|
147
|
+
# expires_by_type:
|
|
148
|
+
# - ext: png, jpg, gif
|
|
149
|
+
# expires: 31536000
|
|
150
|
+
#
|
|
151
|
+
# (d) Encoding (optional)
|
|
152
|
+
# It allows (deflate) encoding of static assets.
|
|
153
|
+
# Elements:
|
|
154
|
+
# 1) Regex value for supported Content-Type (optional) (default is 'text|xml')
|
|
155
|
+
# 2) Regex value for supported Used-Agent (optional) (default is '.*')
|
|
156
|
+
# 3) Range of Content-Length (optional)
|
|
157
|
+
# Elements:
|
|
158
|
+
# I) Lower limit of Content-Length (optional) (default is 1024 i.e. 1KB)
|
|
159
|
+
# II) Upper limit of Content-Length (optional) (default is 12328960 i.e. 10MB)
|
|
160
|
+
# Example:
|
|
161
|
+
# Encoding:
|
|
162
|
+
# Content-Type: text|xml|javascript
|
|
163
|
+
# User-Agent: .*
|
|
164
|
+
# Size Limit:
|
|
165
|
+
# lower_limit: 2094
|
|
166
|
+
# upper_limit: 12328960
|
|
133
167
|
#
|
|
134
168
|
######################################################################################"
|
|
135
169
|
end
|
|
136
170
|
end
|
|
137
171
|
|
|
138
|
-
end
|
|
172
|
+
end #end YAMLWriter
|
|
@@ -143,8 +143,27 @@ function addHelp(id)
|
|
|
143
143
|
if(id=='sendmail_location')
|
|
144
144
|
{
|
|
145
145
|
str="Location of the sendmail agent e.g. /usr/sbin/sendmail"
|
|
146
|
+
}
|
|
147
|
+
if (id == 'headers')
|
|
148
|
+
{
|
|
149
|
+
str = "It allows adding or changing the Expires and Cache-Control in the response headers for static assets (e.g. *.js, *.gif etc)."
|
|
150
|
+
}
|
|
151
|
+
if (id == 'expires')
|
|
152
|
+
{
|
|
153
|
+
str = "Expires header for all static assets (optional) (default is 'off'). Possible value for expires is off or no. of seconds."
|
|
154
|
+
}
|
|
155
|
+
if (id == 'expires_by_type')
|
|
156
|
+
{
|
|
157
|
+
str = "Specific expires header for specific file types."
|
|
158
|
+
}
|
|
159
|
+
if (id == 'expires_by_type_ext')
|
|
160
|
+
{
|
|
161
|
+
str = 'File extensions separated by comma (e.g png, jpg, gif).'
|
|
162
|
+
}
|
|
163
|
+
if (id == 'expires_by_type_expires_value')
|
|
164
|
+
{
|
|
165
|
+
str = "Expires value in no. of seconds."
|
|
146
166
|
}
|
|
147
|
-
|
|
148
167
|
if(id=='runasuser')
|
|
149
168
|
{
|
|
150
169
|
str=str+"<div style='width:99%;text-align:right'><a href=# onClick=\" $('application_specification_type1').show(); $('application_specification_analytics').show(); $('"+id+"').hide(); return false;\" class='calendar_link'>Close</a></div>"
|
data/src/head/wr_access_log.c
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
#include<time.h>
|
|
22
22
|
#include <wr_access_log.h>
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
void get_date_time1(char *str_time, int str_time_len) {
|
|
25
25
|
struct tm *now =NULL;
|
|
26
26
|
time_t time_value =0;
|
|
27
27
|
|
|
@@ -41,7 +41,7 @@ int wr_access_log(wr_req_t* req) {
|
|
|
41
41
|
|
|
42
42
|
if(fp) {
|
|
43
43
|
char str_time[32];
|
|
44
|
-
|
|
44
|
+
get_date_time1(str_time, 32);
|
|
45
45
|
const char *method = scgi_header_value_get(req->scgi, WR_EBB_REQ_METHOD);
|
|
46
46
|
const char *uri = scgi_header_value_get(req->scgi, WR_EBB_REQ_URI);
|
|
47
47
|
const char *http_version = scgi_header_value_get(req->scgi, WR_EBB_HTTP_VER);
|