Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
Openfire
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Openfire
Commits
66d1f903
Commit
66d1f903
authored
Jan 27, 2015
by
Dave Cridland
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #163 from tevans/OF-626
OF-626: BOSH enhancements
parents
1a5d2119
933c9cc6
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
50 additions
and
16 deletions
+50
-16
jetty-servlets.jar
build/lib/merge/jetty-servlets.jar
+0
-0
versions.txt
build/lib/versions.txt
+1
-0
HttpBindManager.java
src/java/org/jivesoftware/openfire/http/HttpBindManager.java
+39
-3
HttpBindServlet.java
src/java/org/jivesoftware/openfire/http/HttpBindServlet.java
+9
-2
HttpSession.java
src/java/org/jivesoftware/openfire/http/HttpSession.java
+1
-11
No files found.
build/lib/merge/jetty-servlets.jar
0 → 100644
View file @
66d1f903
File added
build/lib/versions.txt
View file @
66d1f903
...
...
@@ -22,6 +22,7 @@ jetty-io.jar | Jetty 9.1.5.v20140505
jetty-security.jar | Jetty 9.1.5.v20140505 | Apache 2.0, Eclipse 1.0
jetty-server.jar | Jetty 9.1.5.v20140505 | Apache 2.0, Eclipse 1.0
jetty-servlet.jar | Jetty 9.1.5.v20140505 | Apache 2.0, Eclipse 1.0
jetty-servlets.jar | Jetty 9.1.5.v20140505 | Apache 2.0, Eclipse 1.0
jetty-util.jar | Jetty 9.1.5.v20140505 | Apache 2.0, Eclipse 1.0
jetty-webapp.jar | Jetty 9.1.5.v20140505 | Apache 2.0, Eclipse 1.0
jetty-websocket.jar | Jetty 9.1.5.v20140505 | Apache 2.0, Eclipse 1.0
...
...
src/java/org/jivesoftware/openfire/http/HttpBindManager.java
View file @
66d1f903
...
...
@@ -23,10 +23,17 @@ package org.jivesoftware.openfire.http;
import
java.io.File
;
import
java.security.KeyStore
;
import
java.security.cert.X509Certificate
;
import
java.util.EnumSet
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
javax.servlet.DispatcherType
;
import
javax.servlet.Filter
;
import
javax.servlet.FilterConfig
;
import
javax.servlet.ServletException
;
import
org.eclipse.jetty.http.HttpMethod
;
import
org.eclipse.jetty.server.Connector
;
import
org.eclipse.jetty.server.ForwardedRequestCustomizer
;
import
org.eclipse.jetty.server.Handler
;
...
...
@@ -39,15 +46,19 @@ import org.eclipse.jetty.server.SslConnectionFactory;
import
org.eclipse.jetty.server.handler.ContextHandlerCollection
;
import
org.eclipse.jetty.server.handler.DefaultHandler
;
import
org.eclipse.jetty.server.handler.HandlerCollection
;
import
org.eclipse.jetty.servlet.FilterHolder
;
import
org.eclipse.jetty.servlet.ServletContextHandler
;
import
org.eclipse.jetty.servlet.ServletHolder
;
import
org.eclipse.jetty.servlets.GzipFilter
;
import
org.eclipse.jetty.spdy.server.http.HTTPSPDYServerConnector
;
import
org.eclipse.jetty.util.ssl.SslContextFactory
;
import
org.eclipse.jetty.util.thread.QueuedThreadPool
;
import
org.eclipse.jetty.webapp.WebAppContext
;
import
org.jivesoftware.openfire.Connection
;
import
org.jivesoftware.openfire.JMXManager
;
import
org.jivesoftware.openfire.XMPPServer
;
import
org.jivesoftware.openfire.net.SSLConfig
;
import
org.jivesoftware.openfire.session.ConnectionSettings
;
import
org.jivesoftware.util.CertificateEventListener
;
import
org.jivesoftware.util.CertificateManager
;
import
org.jivesoftware.util.JiveGlobals
;
...
...
@@ -109,6 +120,13 @@ public final class HttpBindManager {
private
static
HttpBindManager
instance
=
new
HttpBindManager
();
// Compression "disabled" by default; use "optional" to enable compression (restart required)
// When enabled, http response will be compressed if the http request includes an
// "Accept" header with a value of "gzip" and/or "deflate"
private
static
boolean
isCompressionEnabled
=
!(
JiveGlobals
.
getProperty
(
ConnectionSettings
.
Server
.
COMPRESSION_SETTINGS
,
Connection
.
CompressionPolicy
.
disabled
.
toString
())
.
equalsIgnoreCase
(
Connection
.
CompressionPolicy
.
disabled
.
toString
()));
private
Server
httpBindServer
;
private
int
bindPort
;
...
...
@@ -552,6 +570,24 @@ public final class HttpBindManager {
{
ServletContextHandler
context
=
new
ServletContextHandler
(
contexts
,
boshPath
,
ServletContextHandler
.
SESSIONS
);
context
.
addServlet
(
new
ServletHolder
(
new
HttpBindServlet
()),
"/*"
);
if
(
isHttpCompressionEnabled
())
{
Filter
gzipFilter
=
new
GzipFilter
()
{
@Override
public
void
init
(
FilterConfig
config
)
throws
ServletException
{
super
.
init
(
config
);
_methods
.
add
(
HttpMethod
.
POST
.
asString
());
Log
.
info
(
"Installed response compression filter"
);
}
};
FilterHolder
filterHolder
=
new
FilterHolder
();
filterHolder
.
setFilter
(
gzipFilter
);
context
.
addFilter
(
filterHolder
,
"/*"
,
EnumSet
.
of
(
DispatcherType
.
REQUEST
));
}
}
// NOTE: disabled by default
private
boolean
isHttpCompressionEnabled
()
{
return
isCompressionEnabled
;
}
private
void
createCrossDomainHandler
(
ContextHandlerCollection
contexts
,
String
crossPath
)
...
...
src/java/org/jivesoftware/openfire/http/HttpBindServlet.java
View file @
66d1f903
...
...
@@ -168,10 +168,17 @@ public class HttpBindServlet extends HttpServlet {
String
sid
=
node
.
attributeValue
(
"sid"
);
// We have a new session
if
(
sid
==
null
)
{
if
(
node
.
elements
().
size
()
>
0
)
{
// invalid session request; missing sid
Log
.
warn
(
"Invalid client request; SID is required. ["
+
request
.
getRemoteAddr
()
+
"]"
);
sendLegacyError
(
response
,
BoshBindingError
.
badRequest
);
return
;
}
else
{
// We have a new session
createNewSession
(
request
,
response
,
node
);
}
}
else
{
handleSessionRequest
(
sid
,
request
,
response
,
node
);
}
...
...
src/java/org/jivesoftware/openfire/http/HttpSession.java
View file @
66d1f903
...
...
@@ -157,16 +157,6 @@ public class HttpSession extends LocalClientSession {
}
}
// Include Stream Compression Mechanism
if
(
conn
.
getCompressionPolicy
()
!=
Connection
.
CompressionPolicy
.
disabled
&&
!
conn
.
isCompressed
())
{
Element
compression
=
DocumentHelper
.
createElement
(
new
QName
(
"compression"
,
new
Namespace
(
""
,
"http://jabber.org/features/compress"
)));
Element
method
=
compression
.
addElement
(
"method"
);
method
.
setText
(
"zlib"
);
elements
.
add
(
compression
);
}
if
(
XMPPServer
.
getInstance
().
getIQRegisterHandler
().
isInbandRegEnabled
())
{
elements
.
add
(
DocumentHelper
.
createElement
(
new
QName
(
"register"
,
new
Namespace
(
""
,
"http://jabber.org/features/iq-register"
))));
...
...
@@ -853,7 +843,7 @@ public class HttpSession extends LocalClientSession {
Delivered
delivered
=
new
Delivered
(
deliverable
);
delivered
.
setRequestID
(
connection
.
getRequestId
());
while
(
sentElements
.
size
()
>
hold
)
{
while
(
sentElements
.
size
()
>
maxRequests
)
{
sentElements
.
remove
(
0
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment