aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--AndroidAsync/src/com/koushikdutta/async/http/server/AsyncHttpServerResponseImpl.java16
-rw-r--r--AndroidAsync/src/com/koushikdutta/async/parser/DocumentParser.java2
2 files changed, 7 insertions, 11 deletions
diff --git a/AndroidAsync/src/com/koushikdutta/async/http/server/AsyncHttpServerResponseImpl.java b/AndroidAsync/src/com/koushikdutta/async/http/server/AsyncHttpServerResponseImpl.java
index 8839f99..844ecf3 100644
--- a/AndroidAsync/src/com/koushikdutta/async/http/server/AsyncHttpServerResponseImpl.java
+++ b/AndroidAsync/src/com/koushikdutta/async/http/server/AsyncHttpServerResponseImpl.java
@@ -232,10 +232,6 @@ public class AsyncHttpServerResponseImpl implements AsyncHttpServerResponse {
end = Integer.parseInt(parts[1]);
else
end = totalLength - 1;
-// else if (start != 0)
-// end = (int)file.length() - 1;
-// else
-// end = Math.min((int)file.length() - 1, 50000);
responseCode(206);
getHeaders().getHeaders().set("Content-Range", String.format("bytes %d-%d/%d", start, end, totalLength));
@@ -301,21 +297,23 @@ public class AsyncHttpServerResponseImpl implements AsyncHttpServerResponse {
@Override
public void onCompleted(Exception ex) {
- if (ex != null) {
- ex.printStackTrace();
- }
end();
}
@Override
public boolean isOpen() {
- return mSink.isOpen();
+ if (mSink != null)
+ return mSink.isOpen();
+ return mSocket.isOpen();
}
@Override
public void close() {
end();
- mSink.close();
+ if (mSink != null)
+ mSink.close();
+ else
+ mSocket.close();
}
@Override
diff --git a/AndroidAsync/src/com/koushikdutta/async/parser/DocumentParser.java b/AndroidAsync/src/com/koushikdutta/async/parser/DocumentParser.java
index a11783e..fe54e04 100644
--- a/AndroidAsync/src/com/koushikdutta/async/parser/DocumentParser.java
+++ b/AndroidAsync/src/com/koushikdutta/async/parser/DocumentParser.java
@@ -7,8 +7,6 @@ import com.koushikdutta.async.callback.CompletedCallback;
import com.koushikdutta.async.future.Future;
import com.koushikdutta.async.future.TransformFuture;
import com.koushikdutta.async.http.body.DocumentBody;
-import com.koushikdutta.async.parser.AsyncParser;
-import com.koushikdutta.async.parser.ByteBufferListParser;
import com.koushikdutta.async.stream.ByteBufferListInputStream;
import org.w3c.dom.Document;