diff --git a/Jellyfin.Api/Controllers/DynamicHlsController.cs b/Jellyfin.Api/Controllers/DynamicHlsController.cs
index f2fdeeea59..af69166300 100644
--- a/Jellyfin.Api/Controllers/DynamicHlsController.cs
+++ b/Jellyfin.Api/Controllers/DynamicHlsController.cs
@@ -1944,7 +1944,7 @@ namespace Jellyfin.Api.Controllers
return Task.CompletedTask;
});
- return FileStreamResponseHelpers.GetStaticFileResult(segmentPath, MimeTypes.GetMimeType(segmentPath), false, HttpContext);
+ return FileStreamResponseHelpers.GetStaticFileResult(segmentPath, MimeTypes.GetMimeType(segmentPath));
}
private int? GetCurrentTranscodingIndex(string playlist, string segmentExtension)
diff --git a/Jellyfin.Api/Controllers/HlsSegmentController.cs b/Jellyfin.Api/Controllers/HlsSegmentController.cs
index 7325dca0ae..78634f0bfc 100644
--- a/Jellyfin.Api/Controllers/HlsSegmentController.cs
+++ b/Jellyfin.Api/Controllers/HlsSegmentController.cs
@@ -69,7 +69,7 @@ namespace Jellyfin.Api.Controllers
return BadRequest("Invalid segment.");
}
- return FileStreamResponseHelpers.GetStaticFileResult(file, MimeTypes.GetMimeType(file), false, HttpContext);
+ return FileStreamResponseHelpers.GetStaticFileResult(file, MimeTypes.GetMimeType(file));
}
///
@@ -186,7 +186,7 @@ namespace Jellyfin.Api.Controllers
return Task.CompletedTask;
});
- return FileStreamResponseHelpers.GetStaticFileResult(path, MimeTypes.GetMimeType(path), false, HttpContext);
+ return FileStreamResponseHelpers.GetStaticFileResult(path, MimeTypes.GetMimeType(path));
}
}
}
diff --git a/Jellyfin.Api/Controllers/ImageController.cs b/Jellyfin.Api/Controllers/ImageController.cs
index aafffc2a1d..5da1af42a7 100644
--- a/Jellyfin.Api/Controllers/ImageController.cs
+++ b/Jellyfin.Api/Controllers/ImageController.cs
@@ -570,8 +570,7 @@ namespace Jellyfin.Api.Controllers
blur,
backgroundColor,
foregroundLayer,
- item,
- Request.Method.Equals(HttpMethods.Head, StringComparison.OrdinalIgnoreCase))
+ item)
.ConfigureAwait(false);
}
@@ -654,8 +653,7 @@ namespace Jellyfin.Api.Controllers
blur,
backgroundColor,
foregroundLayer,
- item,
- Request.Method.Equals(HttpMethods.Head, StringComparison.OrdinalIgnoreCase))
+ item)
.ConfigureAwait(false);
}
@@ -738,8 +736,7 @@ namespace Jellyfin.Api.Controllers
blur,
backgroundColor,
foregroundLayer,
- item,
- Request.Method.Equals(HttpMethods.Head, StringComparison.OrdinalIgnoreCase))
+ item)
.ConfigureAwait(false);
}
@@ -822,8 +819,7 @@ namespace Jellyfin.Api.Controllers
blur,
backgroundColor,
foregroundLayer,
- item,
- Request.Method.Equals(HttpMethods.Head, StringComparison.OrdinalIgnoreCase))
+ item)
.ConfigureAwait(false);
}
@@ -906,8 +902,7 @@ namespace Jellyfin.Api.Controllers
blur,
backgroundColor,
foregroundLayer,
- item,
- Request.Method.Equals(HttpMethods.Head, StringComparison.OrdinalIgnoreCase))
+ item)
.ConfigureAwait(false);
}
@@ -990,8 +985,7 @@ namespace Jellyfin.Api.Controllers
blur,
backgroundColor,
foregroundLayer,
- item,
- Request.Method.Equals(HttpMethods.Head, StringComparison.OrdinalIgnoreCase))
+ item)
.ConfigureAwait(false);
}
@@ -1074,8 +1068,7 @@ namespace Jellyfin.Api.Controllers
blur,
backgroundColor,
foregroundLayer,
- item,
- Request.Method.Equals(HttpMethods.Head, StringComparison.OrdinalIgnoreCase))
+ item)
.ConfigureAwait(false);
}
@@ -1158,8 +1151,7 @@ namespace Jellyfin.Api.Controllers
blur,
backgroundColor,
foregroundLayer,
- item,
- Request.Method.Equals(HttpMethods.Head, StringComparison.OrdinalIgnoreCase))
+ item)
.ConfigureAwait(false);
}
@@ -1242,8 +1234,7 @@ namespace Jellyfin.Api.Controllers
blur,
backgroundColor,
foregroundLayer,
- item,
- Request.Method.Equals(HttpMethods.Head, StringComparison.OrdinalIgnoreCase))
+ item)
.ConfigureAwait(false);
}
@@ -1326,8 +1317,7 @@ namespace Jellyfin.Api.Controllers
blur,
backgroundColor,
foregroundLayer,
- item,
- Request.Method.Equals(HttpMethods.Head, StringComparison.OrdinalIgnoreCase))
+ item)
.ConfigureAwait(false);
}
@@ -1410,8 +1400,7 @@ namespace Jellyfin.Api.Controllers
blur,
backgroundColor,
foregroundLayer,
- item,
- Request.Method.Equals(HttpMethods.Head, StringComparison.OrdinalIgnoreCase))
+ item)
.ConfigureAwait(false);
}
@@ -1494,8 +1483,7 @@ namespace Jellyfin.Api.Controllers
blur,
backgroundColor,
foregroundLayer,
- item,
- Request.Method.Equals(HttpMethods.Head, StringComparison.OrdinalIgnoreCase))
+ item)
.ConfigureAwait(false);
}
@@ -1596,7 +1584,6 @@ namespace Jellyfin.Api.Controllers
backgroundColor,
foregroundLayer,
null,
- Request.Method.Equals(HttpMethods.Head, StringComparison.OrdinalIgnoreCase),
info)
.ConfigureAwait(false);
}
@@ -1698,7 +1685,6 @@ namespace Jellyfin.Api.Controllers
backgroundColor,
foregroundLayer,
null,
- Request.Method.Equals(HttpMethods.Head, StringComparison.OrdinalIgnoreCase),
info)
.ConfigureAwait(false);
}
@@ -1907,7 +1893,6 @@ namespace Jellyfin.Api.Controllers
string? backgroundColor,
string? foregroundLayer,
BaseItem? item,
- bool isHeadRequest,
ItemImageInfo? imageInfo = null)
{
if (percentPlayed.HasValue)
@@ -1988,8 +1973,7 @@ namespace Jellyfin.Api.Controllers
return await GetImageResult(
options,
cacheDuration,
- responseHeaders,
- isHeadRequest).ConfigureAwait(false);
+ responseHeaders).ConfigureAwait(false);
}
private ImageFormat[] GetOutputFormats(ImageFormat? format)
@@ -2068,8 +2052,7 @@ namespace Jellyfin.Api.Controllers
private async Task GetImageResult(
ImageProcessingOptions imageProcessingOptions,
TimeSpan? cacheDuration,
- IDictionary headers,
- bool isHeadRequest)
+ IDictionary headers)
{
var (imagePath, imageContentType, dateImageModified) = await _imageProcessor.ProcessImage(imageProcessingOptions).ConfigureAwait(false);
@@ -2120,12 +2103,6 @@ namespace Jellyfin.Api.Controllers
}
}
- // if the request is a head request, return a NoContent result with the same headers as it would with a GET request
- if (isHeadRequest)
- {
- return NoContent();
- }
-
return PhysicalFile(imagePath, imageContentType ?? MediaTypeNames.Text.Plain);
}
}
diff --git a/Jellyfin.Api/Controllers/VideosController.cs b/Jellyfin.Api/Controllers/VideosController.cs
index 89b150598c..44263fd989 100644
--- a/Jellyfin.Api/Controllers/VideosController.cs
+++ b/Jellyfin.Api/Controllers/VideosController.cs
@@ -465,7 +465,7 @@ namespace Jellyfin.Api.Controllers
StreamingHelpers.AddDlnaHeaders(state, Response.Headers, true, state.Request.StartTimeTicks, Request, _dlnaManager);
var httpClient = _httpClientFactory.CreateClient(NamedClient.Default);
- return await FileStreamResponseHelpers.GetStaticRemoteStreamResult(state, isHeadRequest, httpClient, HttpContext).ConfigureAwait(false);
+ return await FileStreamResponseHelpers.GetStaticRemoteStreamResult(state, httpClient, HttpContext).ConfigureAwait(false);
}
if (@static.HasValue && @static.Value && state.InputProtocol != MediaProtocol.File)
@@ -494,9 +494,7 @@ namespace Jellyfin.Api.Controllers
return FileStreamResponseHelpers.GetStaticFileResult(
state.MediaPath,
- contentType,
- isHeadRequest,
- HttpContext);
+ contentType);
}
// Need to start ffmpeg (because media can't be returned directly)
diff --git a/Jellyfin.Api/Helpers/AudioHelper.cs b/Jellyfin.Api/Helpers/AudioHelper.cs
index bec961dadb..27497cd599 100644
--- a/Jellyfin.Api/Helpers/AudioHelper.cs
+++ b/Jellyfin.Api/Helpers/AudioHelper.cs
@@ -138,7 +138,7 @@ namespace Jellyfin.Api.Helpers
StreamingHelpers.AddDlnaHeaders(state, _httpContextAccessor.HttpContext.Response.Headers, true, streamingRequest.StartTimeTicks, _httpContextAccessor.HttpContext.Request, _dlnaManager);
var httpClient = _httpClientFactory.CreateClient(NamedClient.Default);
- return await FileStreamResponseHelpers.GetStaticRemoteStreamResult(state, isHeadRequest, httpClient, _httpContextAccessor.HttpContext).ConfigureAwait(false);
+ return await FileStreamResponseHelpers.GetStaticRemoteStreamResult(state, httpClient, _httpContextAccessor.HttpContext).ConfigureAwait(false);
}
if (streamingRequest.Static && state.InputProtocol != MediaProtocol.File)
@@ -167,9 +167,7 @@ namespace Jellyfin.Api.Helpers
return FileStreamResponseHelpers.GetStaticFileResult(
state.MediaPath,
- contentType,
- isHeadRequest,
- _httpContextAccessor.HttpContext);
+ contentType);
}
// Need to start ffmpeg (because media can't be returned directly)
diff --git a/Jellyfin.Api/Helpers/FileStreamResponseHelpers.cs b/Jellyfin.Api/Helpers/FileStreamResponseHelpers.cs
index 6385b62c96..5bdd3fe2e8 100644
--- a/Jellyfin.Api/Helpers/FileStreamResponseHelpers.cs
+++ b/Jellyfin.Api/Helpers/FileStreamResponseHelpers.cs
@@ -22,14 +22,12 @@ namespace Jellyfin.Api.Helpers
/// Returns a static file from a remote source.
///
/// The current .
- /// Whether the current request is a HTTP HEAD request so only the headers get returned.
/// The making the remote request.
/// The current http context.
/// A cancellation token that can be used to cancel the operation.
/// A containing the API response.
public static async Task GetStaticRemoteStreamResult(
StreamState state,
- bool isHeadRequest,
HttpClient httpClient,
HttpContext httpContext,
CancellationToken cancellationToken = default)
@@ -45,12 +43,6 @@ namespace Jellyfin.Api.Helpers
httpContext.Response.Headers[HeaderNames.AcceptRanges] = "none";
- if (isHeadRequest)
- {
- httpContext.Response.Headers[HeaderNames.ContentType] = contentType;
- return new OkResult();
- }
-
return new FileStreamResult(await response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false), contentType);
}
@@ -59,23 +51,11 @@ namespace Jellyfin.Api.Helpers
///
/// The path to the file.
/// The content type of the file.
- /// Whether the current request is a HTTP HEAD request so only the headers get returned.
- /// The current http context.
/// An the file.
public static ActionResult GetStaticFileResult(
string path,
- string contentType,
- bool isHeadRequest,
- HttpContext httpContext)
+ string contentType)
{
- httpContext.Response.ContentType = contentType;
-
- // if the request is a head request, return an OkResult (200) with the same headers as it would with a GET request
- if (isHeadRequest)
- {
- return new OkResult();
- }
-
return new PhysicalFileResult(path, contentType) { EnableRangeProcessing = true };
}