Improve Obex compatibility

Handle headers with excessive whilespace
Send correct reponse code when client abort onPut
This commit is contained in:
Jackson Fan
2009-07-21 03:46:37 +08:00
committed by Nick Pelly
parent a4433af5ac
commit 0b309d6ee4
2 changed files with 6 additions and 1 deletions

View File

@@ -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);
}

View File

@@ -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