This commit is contained in:
JustArchi
2018-04-11 22:23:31 +02:00
parent ac2356eaf0
commit 94145b3b23
3 changed files with 14 additions and 22 deletions

View File

@@ -1179,15 +1179,6 @@ namespace ArchiSteamFarm.Localization {
} }
} }
/// <summary>
/// Wyszukuje zlokalizowany ciąg podobny do ciągu Status code: {0}.
/// </summary>
internal static string StatusCode {
get {
return ResourceManager.GetString("StatusCode", resourceCulture);
}
}
/// <summary> /// <summary>
/// Wyszukuje zlokalizowany ciąg podobny do ciągu Still idling: {0} ({1}). /// Wyszukuje zlokalizowany ciąg podobny do ciągu Still idling: {0} ({1}).
/// </summary> /// </summary>

View File

@@ -225,10 +225,6 @@ StackTrace:
<data name="Starting" xml:space="preserve"> <data name="Starting" xml:space="preserve">
<value>Starting...</value> <value>Starting...</value>
</data> </data>
<data name="StatusCode" xml:space="preserve">
<value>Status code: {0}</value>
<comment>{0} will be replaced by status code number/name</comment>
</data>
<data name="Success" xml:space="preserve"> <data name="Success" xml:space="preserve">
<value>Success!</value> <value>Success!</value>
</data> </data>

View File

@@ -366,13 +366,25 @@ namespace ArchiSteamFarm {
} }
if (response == null) { if (response == null) {
if (Debugging.IsUserDebugging) {
ArchiLogger.LogGenericDebug("null <- " + httpMethod + " " + requestUri);
}
return null; return null;
} }
if (Debugging.IsUserDebugging) {
ArchiLogger.LogGenericDebug(response.StatusCode + " <- " + httpMethod + " " + requestUri);
}
if (response.IsSuccessStatusCode) { if (response.IsSuccessStatusCode) {
return response; return response;
} }
if (Debugging.IsUserDebugging) {
ArchiLogger.LogGenericDebug(string.Format(Strings.Content, await response.Content.ReadAsStringAsync().ConfigureAwait(false)));
}
// WARNING: We still have undisposed response by now, make sure to dispose it ASAP if we're not returning it! // WARNING: We still have undisposed response by now, make sure to dispose it ASAP if we're not returning it!
if ((response.StatusCode >= HttpStatusCode.Ambiguous) && (response.StatusCode < HttpStatusCode.BadRequest) && (maxRedirections > 0)) { if ((response.StatusCode >= HttpStatusCode.Ambiguous) && (response.StatusCode < HttpStatusCode.BadRequest) && (maxRedirections > 0)) {
Uri redirectUri = response.Headers.Location; Uri redirectUri = response.Headers.Location;
@@ -398,15 +410,8 @@ namespace ArchiSteamFarm {
return await InternalRequest(redirectUri, httpMethod, data, referer, httpCompletionOption, --maxRedirections).ConfigureAwait(false); return await InternalRequest(redirectUri, httpMethod, data, referer, httpCompletionOption, --maxRedirections).ConfigureAwait(false);
} }
using (response) { response.Dispose();
if (Debugging.IsUserDebugging) { return null;
ArchiLogger.LogGenericDebug(string.Format(Strings.ErrorFailingRequest, requestUri));
ArchiLogger.LogGenericDebug(string.Format(Strings.StatusCode, response.StatusCode));
ArchiLogger.LogGenericDebug(string.Format(Strings.Content, await response.Content.ReadAsStringAsync().ConfigureAwait(false)));
}
return null;
}
} }
private async Task<StringResponse> UrlGetToString(string request, string referer = null, byte maxTries = MaxTries) { private async Task<StringResponse> UrlGetToString(string request, string referer = null, byte maxTries = MaxTries) {