summaryrefslogtreecommitdiffstats
path: root/netwerk/base/nsBaseChannel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'netwerk/base/nsBaseChannel.cpp')
-rw-r--r--netwerk/base/nsBaseChannel.cpp68
1 files changed, 19 insertions, 49 deletions
diff --git a/netwerk/base/nsBaseChannel.cpp b/netwerk/base/nsBaseChannel.cpp
index df8aa23db4..2671b5886a 100644
--- a/netwerk/base/nsBaseChannel.cpp
+++ b/netwerk/base/nsBaseChannel.cpp
@@ -8,7 +8,6 @@
#include "nsContentUtils.h"
#include "nsURLHelper.h"
#include "nsNetCID.h"
-#include "nsMimeTypes.h"
#include "nsUnknownDecoder.h"
#include "nsIScriptSecurityManager.h"
#include "nsMimeTypes.h"
@@ -302,6 +301,7 @@ NS_IMPL_RELEASE(nsBaseChannel)
NS_INTERFACE_MAP_BEGIN(nsBaseChannel)
NS_INTERFACE_MAP_ENTRY(nsIRequest)
NS_INTERFACE_MAP_ENTRY(nsIChannel)
+ NS_INTERFACE_MAP_ENTRY(nsIBaseChannel)
NS_INTERFACE_MAP_ENTRY(nsIThreadRetargetableRequest)
NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
NS_INTERFACE_MAP_ENTRY(nsITransportEventSink)
@@ -967,58 +967,28 @@ void nsBaseChannel::SetupNeckoTarget() {
mNeckoTarget = GetMainThreadSerialEventTarget();
}
-nsBaseChannel::ContentRange::ContentRange(const nsACString& aRangeHeader,
- uint64_t aSize)
- : mStart(0), mEnd(0), mSize(0) {
- auto parsed = nsContentUtils::ParseSingleRangeRequest(aRangeHeader, true);
- // https://fetch.spec.whatwg.org/#ref-for-simple-range-header-value%E2%91%A1
- // If rangeValue is failure, then return a network error.
- if (!parsed) {
- return;
+NS_IMETHODIMP nsBaseChannel::GetContentRange(
+ RefPtr<mozilla::net::ContentRange>* aRange) {
+ if (aRange) {
+ *aRange = mContentRange;
}
+ return NS_OK;
+}
- // Sanity check: ParseSingleRangeRequest should handle these two cases.
- // If rangeEndValue and rangeStartValue are null, then return failure.
- MOZ_ASSERT(parsed->Start().isSome() || parsed->End().isSome());
- // If rangeStartValue and rangeEndValue are numbers, and rangeStartValue
- // is greater than rangeEndValue, then return failure.
- MOZ_ASSERT(parsed->Start().isNothing() || parsed->End().isNothing() ||
- *parsed->Start() <= *parsed->End());
-
- // https://fetch.spec.whatwg.org/#ref-for-simple-range-header-value%E2%91%A1
- // If rangeStart is null:
- if (parsed->Start().isNothing()) {
- // Set rangeStart to fullLength − rangeEnd.
- mStart = aSize - *parsed->End();
-
- // Set rangeEnd to rangeStart + rangeEnd − 1.
- mEnd = mStart + *parsed->End() - 1;
-
- // Otherwise:
- } else {
- // If rangeStart is greater than or equal to fullLength, then return a
- // network error.
- if (*parsed->Start() >= aSize) {
- return;
- }
- mStart = *parsed->Start();
+NS_IMETHODIMP nsBaseChannel::SetContentRange(
+ RefPtr<mozilla::net::ContentRange> aRange) {
+ mContentRange = aRange;
+ return NS_OK;
+}
- // If rangeEnd is null or rangeEnd is greater than or equal to fullLength,
- // then set rangeEnd to fullLength − 1.
- if (parsed->End().isNothing() || *parsed->End() >= aSize) {
- mEnd = aSize - 1;
- } else {
- mEnd = *parsed->End();
- }
+NS_IMETHODIMP nsBaseChannel::GetFullMimeType(RefPtr<TMimeType<char>>* aOut) {
+ if (aOut) {
+ *aOut = mFullMimeType;
}
- mSize = aSize;
+ return NS_OK;
}
-void nsBaseChannel::ContentRange::AsHeader(nsACString& aOutString) const {
- aOutString.Assign("bytes "_ns);
- aOutString.AppendInt(mStart);
- aOutString.AppendLiteral("-");
- aOutString.AppendInt(mEnd);
- aOutString.AppendLiteral("/");
- aOutString.AppendInt(mSize);
+NS_IMETHODIMP nsBaseChannel::SetFullMimeType(RefPtr<TMimeType<char>> aType) {
+ mFullMimeType = aType;
+ return NS_OK;
}