Commit 74805719 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Fixed parsing for Flash clients.

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@6830 b35dd754-fafc-0310-a699-88a17e54d16e
parent c76c5992
......@@ -163,6 +163,28 @@ hr {
<h2>3.2.0 RC 2 -- <span style="font-weight: normal;">February 1, 2007</span></h2>
<h3>Wildfire New Features</h3>
<ul>
<li>No changes</li>
</ul>
<h3>Wildfire Bug Fixes</h3>
<ul>
<li>Flash clients can now connect to the server.</li>
</ul>
<h3>Wildfire Enterprise</h3>
<ul>
<li>No changes</li>
</ul>
<h3>Wildfire Connection Manager Module</h3>
<ul>
<li>Flash clients can now connect to the server.</li>
</ul>
<h2>3.2.0 RC -- <span style="font-weight: normal;">January 25, 2007</span></h2>
<h3>Wildfire New Features</h3>
......
......@@ -10,7 +10,6 @@
package org.jivesoftware.wildfire.net;
import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.dom4j.io.XMPPPacketReader;
import org.jivesoftware.util.LocaleUtils;
......@@ -38,7 +37,6 @@ public abstract class StanzaHandler {
* The utf-8 charset for decoding and encoding Jabber packet streams.
*/
protected static String CHARSET = "UTF-8";
private static final String STREAM_START = "<stream:stream";
private Connection connection;
// DANIELE: Indicate if a session is already created
......@@ -84,7 +82,7 @@ public abstract class StanzaHandler {
public void process(String stanza, XMPPPacketReader reader) throws Exception {
boolean initialStream = stanza.startsWith(STREAM_START);
boolean initialStream = stanza.startsWith("<stream:stream") || stanza.startsWith("<flash:stream");
if (!sessionCreated || initialStream) {
if (!initialStream) {
// Ignore <?xml version="1.0"?>
......@@ -116,17 +114,7 @@ public abstract class StanzaHandler {
return;
}
// Create DOM object from received stanza
Element doc;
try {
doc = reader.read(new StringReader(stanza)).getRootElement();
} catch (DocumentException e) {
if (stanza.equals("</stream:stream>")) {
connection.close();
return;
}
// Throw the exception. This will close the connection
throw e;
}
Element doc = reader.read(new StringReader(stanza)).getRootElement();
if (doc == null) {
// No document found.
return;
......
......@@ -128,7 +128,7 @@ public class NIOConnection implements Connection {
synchronized (this) {
if (!isClosed()) {
try {
deliverRawText("</stream:stream>");
deliverRawText(flashClient ? "</flash:stream>" : "</stream:stream>");
} catch (Exception e) {
// Ignore
}
......
......@@ -225,8 +225,8 @@ class XMLLightweightParser {
if (ch == '"') {
status = XMLLightweightParser.INSIDE_PARAM_VALUE;
} else if (ch == '>') {
if (insideRootTag &&
("stream:stream>".equals(head.toString()) || ("?xml>".equals(head.toString())))) {
if (insideRootTag && ("stream:stream>".equals(head.toString()) ||
("?xml>".equals(head.toString())) || ("flash:stream>".equals(head.toString())))) {
// Found closing stream:stream
int end = buffer.length() - readByte + (i + 1);
// Skip LF, CR and other "weird" characters that could appear
......@@ -267,7 +267,8 @@ class XMLLightweightParser {
}
}
}
if (head.length() > 0 && "/stream:stream>".equals(head.toString())) {
if (head.length() > 0 &&
("/stream:stream>".equals(head.toString()) || ("/flash:stream>".equals(head.toString())))) {
// Found closing stream:stream
foundMsg("</stream:stream>");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment