mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge m-c to m-i.
This commit is contained in:
commit
70a3c27b9c
@ -11,8 +11,7 @@ import java.security.GeneralSecurityException;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import org.mozilla.gecko.sync.GlobalConstants;
|
import org.mozilla.gecko.sync.GlobalConstants;
|
||||||
|
import org.mozilla.gecko.sync.Logger;
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import ch.boye.httpclientandroidlib.HttpEntity;
|
import ch.boye.httpclientandroidlib.HttpEntity;
|
||||||
import ch.boye.httpclientandroidlib.HttpResponse;
|
import ch.boye.httpclientandroidlib.HttpResponse;
|
||||||
@ -22,7 +21,6 @@ import ch.boye.httpclientandroidlib.impl.client.DefaultHttpClient;
|
|||||||
import ch.boye.httpclientandroidlib.params.CoreProtocolPNames;
|
import ch.boye.httpclientandroidlib.params.CoreProtocolPNames;
|
||||||
|
|
||||||
public class SyncStorageRequest implements Resource {
|
public class SyncStorageRequest implements Resource {
|
||||||
|
|
||||||
public static HashMap<String, String> SERVER_ERROR_MESSAGES;
|
public static HashMap<String, String> SERVER_ERROR_MESSAGES;
|
||||||
static {
|
static {
|
||||||
HashMap<String, String> errors = new HashMap<String, String>();
|
HashMap<String, String> errors = new HashMap<String, String>();
|
||||||
@ -99,18 +97,18 @@ public class SyncStorageRequest implements Resource {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleHttpResponse(HttpResponse response) {
|
public void handleHttpResponse(HttpResponse response) {
|
||||||
Log.d(LOG_TAG, "SyncStorageResourceDelegate handling response: " + response.getStatusLine() + ".");
|
Logger.debug(LOG_TAG, "SyncStorageResourceDelegate handling response: " + response.getStatusLine() + ".");
|
||||||
SyncStorageRequestDelegate d = this.request.delegate;
|
SyncStorageRequestDelegate d = this.request.delegate;
|
||||||
SyncStorageResponse res = new SyncStorageResponse(response);
|
SyncStorageResponse res = new SyncStorageResponse(response);
|
||||||
// It is the responsibility of the delegate handlers to completely consume the response.
|
// It is the responsibility of the delegate handlers to completely consume the response.
|
||||||
if (res.wasSuccessful()) {
|
if (res.wasSuccessful()) {
|
||||||
d.handleRequestSuccess(res);
|
d.handleRequestSuccess(res);
|
||||||
} else {
|
} else {
|
||||||
Log.w(LOG_TAG, "HTTP request failed.");
|
Logger.warn(LOG_TAG, "HTTP request failed.");
|
||||||
try {
|
try {
|
||||||
Log.w(LOG_TAG, "HTTP response body: " + res.getErrorMessage());
|
Logger.warn(LOG_TAG, "HTTP response body: " + res.getErrorMessage());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(LOG_TAG, "Can't fetch HTTP response body.", e);
|
Logger.error(LOG_TAG, "Can't fetch HTTP response body.", e);
|
||||||
}
|
}
|
||||||
d.handleRequestFailure(res);
|
d.handleRequestFailure(res);
|
||||||
}
|
}
|
||||||
@ -138,6 +136,7 @@ public class SyncStorageRequest implements Resource {
|
|||||||
// Clients can use their delegate interface to specify X-If-Unmodified-Since.
|
// Clients can use their delegate interface to specify X-If-Unmodified-Since.
|
||||||
String ifUnmodifiedSince = this.request.delegate.ifUnmodifiedSince();
|
String ifUnmodifiedSince = this.request.delegate.ifUnmodifiedSince();
|
||||||
if (ifUnmodifiedSince != null) {
|
if (ifUnmodifiedSince != null) {
|
||||||
|
Logger.debug(LOG_TAG, "Making request with X-If-Unmodified-Since = " + ifUnmodifiedSince);
|
||||||
request.setHeader("x-if-unmodified-since", ifUnmodifiedSince);
|
request.setHeader("x-if-unmodified-since", ifUnmodifiedSince);
|
||||||
}
|
}
|
||||||
if (request.getMethod().equalsIgnoreCase("DELETE")) {
|
if (request.getMethod().equalsIgnoreCase("DELETE")) {
|
||||||
|
@ -165,14 +165,8 @@ public class SyncClientsEngineStage implements GlobalSyncStage {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String ifUnmodifiedSince() {
|
public String ifUnmodifiedSince() {
|
||||||
Long timestampInMilliseconds = session.config.getPersistedServerClientRecordTimestamp();
|
// Temporary fix for bug 739519.
|
||||||
|
return null;
|
||||||
// It's the first upload so we don't care about X-If-Unmodified-Since.
|
|
||||||
if (timestampInMilliseconds == 0) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Utils.millisecondsToDecimalSecondsString(timestampInMilliseconds);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user