forked from nori0428/mod_websocket
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmod_websocket.patch
More file actions
235 lines (217 loc) · 8.93 KB
/
mod_websocket.patch
File metadata and controls
235 lines (217 loc) · 8.93 KB
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
diff -ur lighttpd-1.4.28.orig/configure.ac lighttpd-1.4.28.new/configure.ac
--- lighttpd-1.4.28.orig/configure.ac 2010-08-13 20:10:15.000000000 +0900
+++ lighttpd-1.4.28.new/configure.ac 2011-07-21 15:14:47.000000000 +0900
@@ -67,6 +67,13 @@
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
+AC_CHECK_SIZEOF(size_t)
+
+dnl Checks for Endian
+AC_C_BIGENDIAN
+if test "x$ac_cv_c_bigendian" = "xyes"; then
+ CFLAGS="$CFLAGS -DWORDS_BIGENDIAN"
+fi
AC_CHECK_MEMBER(struct tm.tm_gmtoff,[AC_DEFINE([HAVE_STRUCT_TM_GMTOFF],[1],[gmtoff in struct tm])],,[#include <time.h>])
AC_CHECK_TYPES(struct sockaddr_storage,,,[#include <sys/socket.h>])
@@ -290,6 +297,31 @@
AC_SUBST(SSL_LIB)
fi
+AC_MSG_CHECKING(whether --with-websocket option specified)
+AC_ARG_WITH(
+ websocket,
+ [ --with-websocket@<:@=IETF-{00,08}@:>@
+ specify draft version : default=IETF-00],
+ [ websocket=$withval ],
+ [ websocket=no ])
+AC_MSG_RESULT(${websocket})
+if test "x${websocket}" == "xyes" ||
+ test "x${websocket}" == "xietf-00" ||
+ test "x${websocket}" == "xIETF-00"; then
+ websocket="IETF-00"
+ WEBSOCKET_VERSION_CFLAGS="-D_MOD_WEBSOCKET_SPEC_IETF_00_"
+elif test "x${websocket}" == "xietf-08" ||
+ test "x${websocket}" == "xIETF-08"; then
+ WEBSOCKET_VERSION_CFLAGS="-D_MOD_WEBSOCKET_SPEC_IETF_08_"
+elif test "x${websocket}" == "xno"; then
+ WEBSOCKET_VERSION_CFLAGS="-D_MOD_WEBSOCKET_SPEC_IETF_00_"
+else
+ AC_MSG_ERROR([websocket option is invalid. plz specify IETF-{00,08}])
+fi
+AC_SUBST(websocket)
+AC_SUBST(WEBSOCKET_VERSION_CFLAGS)
+AM_CONDITIONAL(WEBSOCKET_USE_OPENSSL, test x$use_openssl = xyes)
+
AC_MSG_CHECKING(for perl regular expressions support)
AC_ARG_WITH(pcre, AC_HELP_STRING([--with-pcre],[Enable pcre support (default yes)]),
[WITH_PCRE=$withval],[WITH_PCRE=yes])
@@ -625,6 +657,13 @@
do_build="mod_cgi mod_fastcgi mod_extforward mod_proxy mod_evhost mod_simple_vhost mod_access mod_alias mod_setenv mod_usertrack mod_auth mod_status mod_accesslog"
do_build="$do_build mod_rrdtool mod_secdownload mod_expire mod_compress mod_dirlisting mod_indexfile mod_userdir mod_webdav mod_staticfile mod_scgi mod_flv_streaming"
+if test "x${websocket}" != "xno"; then
+ plugins="mod_websocket(${websocket})"
+ do_build="$do_build $plugins"
+else
+ no_build="$no_build mod_websocket"
+fi
+
plugins="mod_rewrite mod_redirect mod_ssi mod_trigger_b4_dl"
features="regex-conditionals"
if test ! "x$PCRE_LIB" = x; then
lighttpd-1.4.28.new/だけに発見: configure.ac~
diff -ur lighttpd-1.4.28.orig/src/Makefile.am lighttpd-1.4.28.new/src/Makefile.am
--- lighttpd-1.4.28.orig/src/Makefile.am 2010-08-12 05:44:17.000000000 +0900
+++ lighttpd-1.4.28.new/src/Makefile.am 2011-07-21 15:16:56.000000000 +0900
@@ -95,6 +95,16 @@
common_libadd =
endif
+lib_LTLIBRARIES += mod_websocket.la
+if WEBSOCKET_USE_OPENSSL
+mod_websocket_la_SOURCES = mod_websocket.h mod_websocket.c base64.c mod_websocket_conv.c mod_websocket_connector.c mod_websocket_handshake.c mod_websocket_frame.c
+else
+mod_websocket_la_SOURCES = mod_websocket.h mod_websocket.c sha1.h sha1.c base64.c mod_websocket_conv.c mod_websocket_connector.c mod_websocket_handshake.c mod_websocket_frame.c
+endif
+mod_websocket_la_CFLAGS = $(AM_CFLAGS) $(WEBSOCKET_VERSION_CFLAGS)
+mod_websocket_la_LDFLAGS = -module -export-dynamic -avoid-version -no-undefined
+mod_websocket_la_LIBADD = $(common_libadd) -licui18n -licuuc
+
lib_LTLIBRARIES += mod_flv_streaming.la
mod_flv_streaming_la_SOURCES = mod_flv_streaming.c
mod_flv_streaming_la_LDFLAGS = -module -export-dynamic -avoid-version -no-undefined
lighttpd-1.4.28.new/srcだけに発見: Makefile.am~
diff -ur lighttpd-1.4.28.orig/src/base.h lighttpd-1.4.28.new/src/base.h
--- lighttpd-1.4.28.orig/src/base.h 2010-08-07 21:44:17.000000000 +0900
+++ lighttpd-1.4.28.new/src/base.h 2011-07-20 16:37:05.000000000 +0900
@@ -331,7 +331,8 @@
CON_STATE_WRITE,
CON_STATE_RESPONSE_END,
CON_STATE_ERROR,
- CON_STATE_CLOSE
+ CON_STATE_CLOSE,
+ CON_STATE_READ_CONTINUOUS
} connection_state_t;
typedef enum { COND_RESULT_UNSET, COND_RESULT_FALSE, COND_RESULT_TRUE } cond_result_t;
lighttpd-1.4.28.new/srcだけに発見: base.h~
diff -ur lighttpd-1.4.28.orig/src/connections-glue.c lighttpd-1.4.28.new/src/connections-glue.c
--- lighttpd-1.4.28.orig/src/connections-glue.c 2010-08-17 18:04:38.000000000 +0900
+++ lighttpd-1.4.28.new/src/connections-glue.c 2011-07-20 16:38:07.000000000 +0900
@@ -14,6 +14,7 @@
case CON_STATE_REQUEST_END: return "req-end";
case CON_STATE_RESPONSE_START: return "resp-start";
case CON_STATE_RESPONSE_END: return "resp-end";
+ case CON_STATE_READ_CONTINUOUS: return "read-continuous";
default: return "(unknown)";
}
}
@@ -31,6 +32,7 @@
case CON_STATE_REQUEST_END: return "Q";
case CON_STATE_RESPONSE_START: return "s";
case CON_STATE_RESPONSE_END: return "S";
+ case CON_STATE_READ_CONTINUOUS: return "F";
default: return "x";
}
}
lighttpd-1.4.28.new/srcだけに発見: connections-glue.c~
diff -ur lighttpd-1.4.28.orig/src/connections.c lighttpd-1.4.28.new/src/connections.c
--- lighttpd-1.4.28.orig/src/connections.c 2010-08-17 18:04:38.000000000 +0900
+++ lighttpd-1.4.28.new/src/connections.c 2011-07-20 16:43:07.000000000 +0900
@@ -1163,6 +1163,8 @@
}
break;
+ case CON_STATE_READ_CONTINUOUS:
+ break;
default: break;
}
@@ -1236,7 +1238,8 @@
}
if (con->state == CON_STATE_READ ||
- con->state == CON_STATE_READ_POST) {
+ con->state == CON_STATE_READ_POST ||
+ con->state == CON_STATE_READ_CONTINUOUS) {
connection_handle_read_state(srv, con);
}
@@ -1499,6 +1502,9 @@
done = -1;
case HANDLER_WAIT_FOR_EVENT:
/* come back here */
+ if (con->state == CON_STATE_READ_CONTINUOUS) {
+ break;
+ }
connection_set_state(srv, con, CON_STATE_HANDLE_REQUEST);
break;
@@ -1638,12 +1644,16 @@
break;
case CON_STATE_READ_POST:
case CON_STATE_READ:
+ case CON_STATE_READ_CONTINUOUS:
if (srv->srvconf.log_state_handling) {
log_error_write(srv, __FILE__, __LINE__, "sds",
"state for fd", con->fd, connection_get_state(con->state));
}
connection_handle_read_state(srv, con);
+ if (con->state == CON_STATE_READ_CONTINUOUS) {
+ plugins_call_read_continuous(srv, con);
+ }
break;
case CON_STATE_WRITE:
if (srv->srvconf.log_state_handling) {
@@ -1807,6 +1817,9 @@
fdevent_event_del(srv->ev, &(con->fde_ndx), con->fd);
}
break;
+ case CON_STATE_READ_CONTINUOUS:
+ /* leave up to plugins */
+ break;
default:
fdevent_event_del(srv->ev, &(con->fde_ndx), con->fd);
break;
lighttpd-1.4.28.new/srcだけに発見: connections.c~
diff -ur lighttpd-1.4.28.orig/src/plugin.c lighttpd-1.4.28.new/src/plugin.c
--- lighttpd-1.4.28.orig/src/plugin.c 2010-08-17 18:04:38.000000000 +0900
+++ lighttpd-1.4.28.new/src/plugin.c 2011-07-20 16:44:28.000000000 +0900
@@ -44,6 +44,7 @@
PLUGIN_FUNC_INIT,
PLUGIN_FUNC_CLEANUP,
PLUGIN_FUNC_SET_DEFAULTS,
+ PLUGIN_FUNC_READ_CONTINUOUS,
PLUGIN_FUNC_SIZEOF
} plugin_t;
@@ -274,6 +275,7 @@
PLUGIN_TO_SLOT(PLUGIN_FUNC_HANDLE_DOCROOT, handle_docroot)
PLUGIN_TO_SLOT(PLUGIN_FUNC_HANDLE_PHYSICAL, handle_physical)
PLUGIN_TO_SLOT(PLUGIN_FUNC_CONNECTION_RESET, connection_reset)
+PLUGIN_TO_SLOT(PLUGIN_FUNC_READ_CONTINUOUS, read_continuous)
#undef PLUGIN_TO_SLOT
@@ -403,6 +405,7 @@
PLUGIN_TO_SLOT(PLUGIN_FUNC_HANDLE_DOCROOT, handle_docroot);
PLUGIN_TO_SLOT(PLUGIN_FUNC_HANDLE_PHYSICAL, handle_physical);
PLUGIN_TO_SLOT(PLUGIN_FUNC_CONNECTION_RESET, connection_reset);
+ PLUGIN_TO_SLOT(PLUGIN_FUNC_READ_CONTINUOUS, read_continuous);
PLUGIN_TO_SLOT(PLUGIN_FUNC_CLEANUP, cleanup);
PLUGIN_TO_SLOT(PLUGIN_FUNC_SET_DEFAULTS, set_defaults);
#undef PLUGIN_TO_SLOT
lighttpd-1.4.28.new/srcだけに発見: plugin.c~
diff -ur lighttpd-1.4.28.orig/src/plugin.h lighttpd-1.4.28.new/src/plugin.h
--- lighttpd-1.4.28.orig/src/plugin.h 2010-02-02 08:28:20.000000000 +0900
+++ lighttpd-1.4.28.new/src/plugin.h 2011-07-20 16:45:40.000000000 +0900
@@ -23,6 +23,7 @@
#define PHYSICALPATH_FUNC CONNECTION_FUNC
#define REQUESTDONE_FUNC CONNECTION_FUNC
#define URIHANDLER_FUNC CONNECTION_FUNC
+#define READ_CONT_FUNC CONNECTION_FUNC
#define PLUGIN_DATA size_t id
@@ -55,6 +56,7 @@
*/
handler_t (* handle_subrequest) (server *srv, connection *con, void *p_d); /* */
handler_t (* connection_reset) (server *srv, connection *con, void *p_d); /* */
+ handler_t (* read_continuous) (server *srv, connection *con, void *p_d); /* */
void *data;
/* dlopen handle */
@@ -74,6 +76,7 @@
handler_t plugins_call_handle_connection_close(server *srv, connection *con);
handler_t plugins_call_handle_joblist(server *srv, connection *con);
handler_t plugins_call_connection_reset(server *srv, connection *con);
+handler_t plugins_call_read_continuous(server *srv, connection *con);
handler_t plugins_call_handle_trigger(server *srv);
handler_t plugins_call_handle_sighup(server *srv);
lighttpd-1.4.28.new/srcだけに発見: plugin.h~