Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Tarassov2018-12-13 20:13:35 +0000
committerEugene Tarassov2018-12-13 20:13:35 +0000
commita65bdbf5aaa3c1138caa0dd55d3fe9c4bca7e014 (patch)
treebd01b3f9cd7dfa48607d84d751d9f16633855abb
parentd368c18ad59c03702d8a5e1a8a1f4b3a73f22710 (diff)
downloadorg.eclipse.tcf-a65bdbf5aaa3c1138caa0dd55d3fe9c4bca7e014.tar.gz
org.eclipse.tcf-a65bdbf5aaa3c1138caa0dd55d3fe9c4bca7e014.tar.xz
org.eclipse.tcf-a65bdbf5aaa3c1138caa0dd55d3fe9c4bca7e014.zip
TCF Core: improved TCF over HTTP implementation
-rw-r--r--plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/core/ChannelHTTP.java12
1 files changed, 7 insertions, 5 deletions
diff --git a/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/core/ChannelHTTP.java b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/core/ChannelHTTP.java
index 7f5f41959..2f295a4f8 100644
--- a/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/core/ChannelHTTP.java
+++ b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/core/ChannelHTTP.java
@@ -77,6 +77,7 @@ public class ChannelHTTP extends AbstractChannel {
while (!stopped) {
String s = inp.readLine();
if (s == null) break;
+ if (s.length() > 0) continue;
Protocol.invokeLater(new Runnable() {
IToken cmd;
@Override
@@ -108,11 +109,11 @@ public class ChannelHTTP extends AbstractChannel {
@Override
protected void write(int n) throws IOException {
if (n < 0) {
- if (n == EOM && wr_cnt > 0) {
+ if (wr_cnt > 0) {
try {
int i = 0;
char type = (char)wr_buf[i++];
- while (i < wr_cnt && wr_buf[i] == 0) i++;
+ while (i >= wr_cnt || wr_buf[i++] != 0) break;
switch (type) {
case 'C':
sendCommand(i);
@@ -160,6 +161,7 @@ public class ChannelHTTP extends AbstractChannel {
}
private String getArgs(int i) throws Exception {
+ if (i >= wr_cnt) return null;
StringBuffer args = new StringBuffer();
while (i < wr_cnt) {
if (args.length() > 0) args.append('&');
@@ -185,17 +187,17 @@ public class ChannelHTTP extends AbstractChannel {
byte[] t = new byte[i - p];
System.arraycopy(wr_buf, p, t, 0, t.length);
Token token = new Token(t);
- while (wr_buf[i] == 0) i++;
+ i++;
p = i;
while (wr_buf[i] != 0) i++;
String service = new String(wr_buf, p, i - p, "UTF-8");
- while (wr_buf[i] == 0) i++;
+ i++;
p = i;
while (wr_buf[i] != 0) i++;
String command = new String(wr_buf, p, i - p, "UTF-8");
- while (i < wr_buf.length && wr_buf[i] == 0) i++;
+ i++;
sendRequest(token, service, command, getArgs(i));
}

Back to the top