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
e4ed261b
Commit
e4ed261b
authored
May 01, 2015
by
Dave Cridland
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #209 from tevans/OF-909
OF-909: Include ack in BOSH response body element
parents
606d34c2
8e19f5ba
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
31 deletions
+10
-31
HttpBindServlet.java
src/java/org/jivesoftware/openfire/http/HttpBindServlet.java
+3
-11
HttpConnection.java
src/java/org/jivesoftware/openfire/http/HttpConnection.java
+2
-2
HttpSession.java
src/java/org/jivesoftware/openfire/http/HttpSession.java
+5
-18
No files found.
src/java/org/jivesoftware/openfire/http/HttpBindServlet.java
View file @
e4ed261b
...
...
@@ -299,9 +299,9 @@ public class HttpBindServlet extends HttpServlet {
if
(
async
)
{
response
.
getOutputStream
().
setWriteListener
(
new
WriteListenerImpl
(
context
,
byteContent
));
}
else
{
// BOSH communication should not
have Chunked encoding. Ensure that the
//
buffer can hold the entire response to prevent chunking
.
context
.
getResponse
().
set
BufferSize
(
byteContent
.
length
);
// BOSH communication should not
use Chunked encoding.
//
This is prevented by explicitly setting the Content-Length header
.
context
.
getResponse
().
set
ContentLength
(
byteContent
.
length
);
context
.
getResponse
().
getOutputStream
().
write
(
byteContent
);
context
.
getResponse
().
getOutputStream
().
flush
();
context
.
complete
();
...
...
@@ -348,14 +348,6 @@ public class HttpBindServlet extends HttpServlet {
sendLegacyError
(
context
,
error
,
null
);
}
protected
static
String
createEmptyBody
(
boolean
terminate
)
{
final
Element
body
=
DocumentHelper
.
createElement
(
"body"
);
if
(
terminate
)
{
body
.
addAttribute
(
"type"
,
"terminate"
);
}
body
.
addNamespace
(
""
,
"http://jabber.org/protocol/httpbind"
);
return
body
.
asXML
();
}
protected
static
String
createErrorBody
(
String
type
,
String
condition
)
{
final
Element
body
=
DocumentHelper
.
createElement
(
"body"
);
body
.
addNamespace
(
""
,
"http://jabber.org/protocol/httpbind"
);
...
...
src/java/org/jivesoftware/openfire/http/HttpConnection.java
View file @
e4ed261b
...
...
@@ -122,9 +122,9 @@ public class HttpConnection {
}
if
(
body
==
null
)
{
body
=
HttpBindServlet
.
createEmptyBody
(
false
);
body
=
getSession
()
.
createEmptyBody
(
false
);
}
HttpBindServlet
.
respond
(
this
.
getSession
(),
this
.
context
,
body
,
async
);
HttpBindServlet
.
respond
(
getSession
(),
this
.
context
,
body
,
async
);
}
/**
...
...
src/java/org/jivesoftware/openfire/http/HttpSession.java
View file @
e4ed261b
...
...
@@ -710,7 +710,7 @@ public class HttpSession extends LocalClientSession {
try
{
// If onTimeout does not result in a complete(), the container falls back to default behavior.
// This is why this body is to be delivered in a non-async fashion.
connection
.
deliverBody
(
createEmptyBody
(),
false
);
connection
.
deliverBody
(
createEmptyBody
(
false
),
false
);
setLastResponseEmpty
(
true
);
// This connection timed out we need to increment the request count
...
...
@@ -1014,13 +1014,8 @@ public class HttpSession extends LocalClientSession {
private
String
createDeliverable
(
Collection
<
Deliverable
>
elements
)
{
StringBuilder
builder
=
new
StringBuilder
();
builder
.
append
(
"<body xmlns='"
+
"http://jabber.org/protocol/httpbind"
+
"'"
);
long
ack
=
getLastAcknowledged
();
if
(
ack
>
lastRequestID
)
builder
.
append
(
" ack='"
).
append
(
ack
).
append
(
"'"
);
builder
.
append
(
">"
);
builder
.
append
(
"<body xmlns='http://jabber.org/protocol/httpbind' ack='"
)
.
append
(
getLastAcknowledged
()).
append
(
"'>"
);
setLastResponseEmpty
(
elements
.
size
()
==
0
);
synchronized
(
elements
)
{
...
...
@@ -1095,20 +1090,12 @@ public class HttpSession extends LocalClientSession {
});
}
private
String
createEmptyBody
()
{
Element
body
=
DocumentHelper
.
createElement
(
"body"
);
body
.
addNamespace
(
""
,
"http://jabber.org/protocol/httpbind"
);
long
ack
=
getLastAcknowledged
();
if
(
ack
>
lastRequestID
)
body
.
addAttribute
(
"ack"
,
String
.
valueOf
(
ack
));
return
body
.
asXML
();
}
protected
static
String
createEmptyBody
(
boolean
terminate
)
protected
String
createEmptyBody
(
boolean
terminate
)
{
final
Element
body
=
DocumentHelper
.
createElement
(
"body"
);
if
(
terminate
)
{
body
.
addAttribute
(
"type"
,
"terminate"
);
}
body
.
addNamespace
(
""
,
"http://jabber.org/protocol/httpbind"
);
body
.
addAttribute
(
"ack"
,
String
.
valueOf
(
getLastAcknowledged
()));
return
body
.
asXML
();
}
...
...
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