@@ -132,10 +132,10 @@ class WebSocketsServerCore : protected WebSockets {
132
132
void handleHBPing (WSclient_t * client); // send ping in specified intervals
133
133
134
134
/* *
135
- * called if a non Websocket connection is coming in.
136
- * Note: can be override
137
- * @param client WSclient_t * ptr to the client struct
138
- */
135
+ * called if a non Websocket connection is coming in.
136
+ * Note: can be override
137
+ * @param client WSclient_t * ptr to the client struct
138
+ */
139
139
virtual void handleNonWebsocketConnection (WSclient_t * client) {
140
140
DEBUG_WEBSOCKETS (" [WS-Server][%d][handleHeader] no Websocket connection close.\n " , client->num );
141
141
client->tcp ->write (
@@ -151,10 +151,10 @@ class WebSocketsServerCore : protected WebSockets {
151
151
}
152
152
153
153
/* *
154
- * called if a non Authorization connection is coming in.
155
- * Note: can be override
156
- * @param client WSclient_t * ptr to the client struct
157
- */
154
+ * called if a non Authorization connection is coming in.
155
+ * Note: can be override
156
+ * @param client WSclient_t * ptr to the client struct
157
+ */
158
158
virtual void handleAuthorizationFailed (WSclient_t * client) {
159
159
client->tcp ->write (
160
160
" HTTP/1.1 401 Unauthorized\r\n "
@@ -170,32 +170,32 @@ class WebSocketsServerCore : protected WebSockets {
170
170
}
171
171
172
172
/* *
173
- * called for sending a Event to the app
174
- * @param num uint8_t
175
- * @param type WStype_t
176
- * @param payload uint8_t *
177
- * @param length size_t
178
- */
173
+ * called for sending a Event to the app
174
+ * @param num uint8_t
175
+ * @param type WStype_t
176
+ * @param payload uint8_t *
177
+ * @param length size_t
178
+ */
179
179
virtual void runCbEvent (uint8_t num, WStype_t type, uint8_t * payload, size_t length) {
180
180
if (_cbEvent) {
181
181
_cbEvent (num, type, payload, length);
182
182
}
183
183
}
184
184
185
185
/*
186
- * Called at client socket connect handshake negotiation time for each http header that is not
187
- * a websocket specific http header (not Connection, Upgrade, Sec-WebSocket-*)
188
- * If the custom httpHeaderValidationFunc returns false for any headerName / headerValue passed, the
189
- * socket negotiation is considered invalid and the upgrade to websockets request is denied / rejected
190
- * This mechanism can be used to enable custom authentication schemes e.g. test the value
191
- * of a session cookie to determine if a user is logged on / authenticated
192
- */
186
+ * Called at client socket connect handshake negotiation time for each http header that is not
187
+ * a websocket specific http header (not Connection, Upgrade, Sec-WebSocket-*)
188
+ * If the custom httpHeaderValidationFunc returns false for any headerName / headerValue passed, the
189
+ * socket negotiation is considered invalid and the upgrade to websockets request is denied / rejected
190
+ * This mechanism can be used to enable custom authentication schemes e.g. test the value
191
+ * of a session cookie to determine if a user is logged on / authenticated
192
+ */
193
193
virtual bool execHttpHeaderValidation (String headerName, String headerValue) {
194
194
if (_httpHeaderValidationFunc) {
195
- // return the value of the custom http header validation function
195
+ // return the value of the custom http header validation function
196
196
return _httpHeaderValidationFunc (headerName, headerValue);
197
197
}
198
- // no custom http header validation so just assume all is good
198
+ // no custom http header validation so just assume all is good
199
199
return true ;
200
200
}
201
201
@@ -205,14 +205,14 @@ class WebSocketsServerCore : protected WebSockets {
205
205
206
206
/* *
207
207
* drop native tcp connection (client->tcp)
208
- */
208
+ */
209
209
void dropNativeClient (WSclient_t * client);
210
210
211
211
private:
212
212
/*
213
- * returns an indicator whether the given named header exists in the configured _mandatoryHttpHeaders collection
214
- * @param headerName String ///< the name of the header being checked
215
- */
213
+ * returns an indicator whether the given named header exists in the configured _mandatoryHttpHeaders collection
214
+ * @param headerName String ///< the name of the header being checked
215
+ */
216
216
bool hasMandatoryHeader (String headerName);
217
217
};
218
218
0 commit comments