SEBWIN-645, SEBWIN-663: Reverted to informational build version for user agent of network resource requests.
This commit is contained in:
parent
cba73bd727
commit
4aa856f98a
1 changed files with 6 additions and 4 deletions
|
@ -11,7 +11,6 @@ using System.IO;
|
|||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Net.Mime;
|
||||
using System.Threading.Tasks;
|
||||
using SafeExamBrowser.Configuration.Contracts;
|
||||
|
@ -90,9 +89,12 @@ namespace SafeExamBrowser.Configuration.DataResources
|
|||
private HttpRequestMessage Build(HttpMethod method, Uri uri)
|
||||
{
|
||||
var request = new HttpRequestMessage(method, uri);
|
||||
var userAgent = new ProductInfoHeaderValue("SEB", appConfig.ProgramBuildVersion);
|
||||
var success = request.Headers.TryAddWithoutValidation("User-Agent", $"SEB/{appConfig.ProgramInformationalVersion}");
|
||||
|
||||
request.Headers.UserAgent.Add(userAgent);
|
||||
if (!success)
|
||||
{
|
||||
logger.Warn("Failed to add user agent header to request!");
|
||||
}
|
||||
|
||||
return request;
|
||||
}
|
||||
|
@ -145,7 +147,7 @@ namespace SafeExamBrowser.Configuration.DataResources
|
|||
|
||||
private LoadStatus HandleBrowserResource(HttpResponseMessage response, out Stream data)
|
||||
{
|
||||
data = default(Stream);
|
||||
data = default;
|
||||
|
||||
logger.Debug($"The {(IsUnauthorized(response) ? "resource needs authentication" : " response data is HTML")}.");
|
||||
|
||||
|
|
Loading…
Reference in a new issue