summaryrefslogtreecommitdiffstats
path: root/obex
diff options
context:
space:
mode:
authorJackson Fan <xyfan@motorola.com>2009-07-21 03:46:37 +0800
committerNick Pelly <npelly@google.com>2009-08-19 21:07:52 -0700
commit0b309d6ee433d55b7499d7bbd447494366ef1316 (patch)
tree44eaf2746c07cfce3a6bbb9ddacaf7c62ecf8666 /obex
parenta4433af5ac677be7c1f63447c0cd78829bdee159 (diff)
downloadframeworks_base-0b309d6ee433d55b7499d7bbd447494366ef1316.zip
frameworks_base-0b309d6ee433d55b7499d7bbd447494366ef1316.tar.gz
frameworks_base-0b309d6ee433d55b7499d7bbd447494366ef1316.tar.bz2
Improve Obex compatibility
Handle headers with excessive whilespace Send correct reponse code when client abort onPut
Diffstat (limited to 'obex')
-rw-r--r--obex/javax/obex/ObexHelper.java5
-rw-r--r--obex/javax/obex/ServerSession.java2
2 files changed, 6 insertions, 1 deletions
diff --git a/obex/javax/obex/ObexHelper.java b/obex/javax/obex/ObexHelper.java
index f569595..1b66662 100644
--- a/obex/javax/obex/ObexHelper.java
+++ b/obex/javax/obex/ObexHelper.java
@@ -897,6 +897,11 @@ public final class ObexHelper {
if (lower < 0) {
lower += 256;
}
+ // If upper and lower both equal 0, it should be the end of string.
+ // Ignore left bytes from array to avoid potential issues
+ if (upper == 0 && lower == 0) {
+ return new String(c, 0, i);
+ }
c[i] = (char)((upper << 8) | lower);
}
diff --git a/obex/javax/obex/ServerSession.java b/obex/javax/obex/ServerSession.java
index 423d5a7..675272d 100644
--- a/obex/javax/obex/ServerSession.java
+++ b/obex/javax/obex/ServerSession.java
@@ -168,7 +168,7 @@ public final class ServerSession extends ObexSession implements Runnable {
} else {
response = validateResponseCode(mListener.onPut(op));
}
- if (response != ResponseCodes.OBEX_HTTP_OK) {
+ if (response != ResponseCodes.OBEX_HTTP_OK && !op.isAborted) {
op.sendReply(response);
} else if (!op.isAborted) {
// wait for the final bit