mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 536324 - e10s HTTP: refactor nsHashPropertyBag. Part 2: contentLength implementors. r=jduell, a=beta5+
This commit is contained in:
parent
b5ef3261e3
commit
4439f97632
@ -2407,8 +2407,8 @@ NOT_IMPLEMENTED_IF_FUNC_1(GetContentType, nsACString &value)
|
||||
NOT_IMPLEMENTED_IF_FUNC_1(SetContentType, const nsACString &value)
|
||||
NOT_IMPLEMENTED_IF_FUNC_1(GetContentCharset, nsACString &value)
|
||||
NOT_IMPLEMENTED_IF_FUNC_1(SetContentCharset, const nsACString &value)
|
||||
NOT_IMPLEMENTED_IF_FUNC_1(GetContentLength, PRInt32 *value)
|
||||
NOT_IMPLEMENTED_IF_FUNC_1(SetContentLength, PRInt32 value)
|
||||
NOT_IMPLEMENTED_IF_FUNC_1(GetContentLength, PRInt64 *value)
|
||||
NOT_IMPLEMENTED_IF_FUNC_1(SetContentLength, PRInt64 value)
|
||||
NOT_IMPLEMENTED_IF_FUNC_1(Open, nsIInputStream **_retval)
|
||||
NOT_IMPLEMENTED_IF_FUNC_2(AsyncOpen, nsIStreamListener *listener,
|
||||
nsISupports *context)
|
||||
|
@ -265,13 +265,13 @@ nsWyciwygChannel::SetContentCharset(const nsACString &aContentCharset)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWyciwygChannel::GetContentLength(PRInt32 *aContentLength)
|
||||
nsWyciwygChannel::GetContentLength(PRInt64 *aContentLength)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWyciwygChannel::SetContentLength(PRInt32 aContentLength)
|
||||
nsWyciwygChannel::SetContentLength(PRInt64 aContentLength)
|
||||
{
|
||||
mContentLength = aContentLength;
|
||||
|
||||
@ -506,10 +506,9 @@ nsWyciwygChannel::OnDataAvailable(nsIRequest *request, nsISupports *ctx,
|
||||
|
||||
rv = mListener->OnDataAvailable(this, mListenerContext, input, offset, count);
|
||||
|
||||
// XXX handle 64-bit stuff for real
|
||||
if (mProgressSink && NS_SUCCEEDED(rv) && !(mLoadFlags & LOAD_BACKGROUND))
|
||||
mProgressSink->OnProgress(this, nsnull, PRUint64(offset + count),
|
||||
PRUint64(mContentLength));
|
||||
mContentLength);
|
||||
|
||||
return rv; // let the pump cancel on failure
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ protected:
|
||||
PRPackedBool mNeedToWriteCharset;
|
||||
PRInt32 mCharsetSource;
|
||||
nsCString mCharset;
|
||||
PRInt32 mContentLength;
|
||||
PRInt64 mContentLength;
|
||||
PRUint32 mLoadFlags;
|
||||
nsCOMPtr<nsIURI> mURI;
|
||||
nsCOMPtr<nsIURI> mOriginalURI;
|
||||
|
@ -1012,13 +1012,13 @@ nsJSChannel::SetContentCharset(const nsACString &aContentCharset)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJSChannel::GetContentLength(PRInt32 *aContentLength)
|
||||
nsJSChannel::GetContentLength(PRInt64 *aContentLength)
|
||||
{
|
||||
return mStreamChannel->GetContentLength(aContentLength);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJSChannel::SetContentLength(PRInt32 aContentLength)
|
||||
nsJSChannel::SetContentLength(PRInt64 aContentLength)
|
||||
{
|
||||
return mStreamChannel->SetContentLength(aContentLength);
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ public:
|
||||
NS_IF_ADDREF(*result = mJarReader);
|
||||
}
|
||||
|
||||
PRInt32 GetContentLength()
|
||||
PRInt64 GetContentLength()
|
||||
{
|
||||
return mContentLength;
|
||||
}
|
||||
@ -127,7 +127,7 @@ private:
|
||||
nsCString mJarDirSpec;
|
||||
nsCOMPtr<nsIInputStream> mJarStream;
|
||||
nsCString mJarEntry;
|
||||
PRInt32 mContentLength;
|
||||
PRInt64 mContentLength;
|
||||
};
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS1(nsJARInputThunk, nsIInputStream)
|
||||
@ -173,8 +173,11 @@ nsJARInputThunk::EnsureJarStream()
|
||||
}
|
||||
|
||||
// ask the JarStream for the content length
|
||||
rv = mJarStream->Available((PRUint32 *) &mContentLength);
|
||||
// XXX want a 64-bit value from nsIInputStream::Available()
|
||||
PRUint32 contentLength;
|
||||
rv = mJarStream->Available(&contentLength);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
mContentLength = contentLength;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -629,7 +632,7 @@ nsJARChannel::SetContentCharset(const nsACString &aContentCharset)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::GetContentLength(PRInt32 *result)
|
||||
nsJARChannel::GetContentLength(PRInt64 *result)
|
||||
{
|
||||
// if content length is unknown, query mJarInput...
|
||||
if (mContentLength < 0 && mJarInput)
|
||||
@ -640,7 +643,7 @@ nsJARChannel::GetContentLength(PRInt32 *result)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::SetContentLength(PRInt32 aContentLength)
|
||||
nsJARChannel::SetContentLength(PRInt64 aContentLength)
|
||||
{
|
||||
// XXX does this really make any sense at all?
|
||||
mContentLength = aContentLength;
|
||||
@ -902,14 +905,14 @@ nsJARChannel::OnDataAvailable(nsIRequest *req, nsISupports *ctx,
|
||||
|
||||
nsresult rv;
|
||||
|
||||
// XXX want 64-bit values in OnDataAvailable
|
||||
rv = mListener->OnDataAvailable(this, mListenerContext, stream, offset, count);
|
||||
|
||||
// simply report progress here instead of hooking ourselves up as a
|
||||
// nsITransportEventSink implementation.
|
||||
// XXX do the 64-bit stuff for real
|
||||
if (mProgressSink && NS_SUCCEEDED(rv) && !(mLoadFlags & LOAD_BACKGROUND))
|
||||
mProgressSink->OnProgress(this, nsnull, PRUint64(offset + count),
|
||||
PRUint64(mContentLength));
|
||||
mContentLength);
|
||||
|
||||
return rv; // let the pump cancel on failure
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ private:
|
||||
nsCOMPtr<nsISupports> mListenerContext;
|
||||
nsCString mContentType;
|
||||
nsCString mContentCharset;
|
||||
PRInt32 mContentLength;
|
||||
PRInt64 mContentLength;
|
||||
PRUint32 mLoadFlags;
|
||||
nsresult mStatus;
|
||||
PRPackedBool mIsPending;
|
||||
|
@ -407,13 +407,13 @@ nsIconChannel::SetContentCharset(const nsACString &aContentCharset)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsIconChannel::GetContentLength(PRInt32 *aContentLength)
|
||||
NS_IMETHODIMP nsIconChannel::GetContentLength(PRInt64 *aContentLength)
|
||||
{
|
||||
*aContentLength = mContentLength;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsIconChannel::SetContentLength(PRInt32 aContentLength)
|
||||
NS_IMETHODIMP nsIconChannel::SetContentLength(PRInt64 aContentLength)
|
||||
{
|
||||
NS_NOTREACHED("nsIconChannel::SetContentLength");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
@ -69,7 +69,7 @@ public:
|
||||
protected:
|
||||
nsCOMPtr<nsIURI> mUrl;
|
||||
nsCOMPtr<nsIURI> mOriginalURI;
|
||||
PRInt32 mContentLength;
|
||||
PRInt64 mContentLength;
|
||||
nsCOMPtr<nsILoadGroup> mLoadGroup;
|
||||
nsCOMPtr<nsIInterfaceRequestor> mCallbacks;
|
||||
nsCOMPtr<nsISupports> mOwner;
|
||||
|
@ -399,13 +399,13 @@ nsIconChannel::SetContentCharset(const nsACString &aContentCharset)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsIconChannel::GetContentLength(PRInt32 *aContentLength)
|
||||
NS_IMETHODIMP nsIconChannel::GetContentLength(PRInt64 *aContentLength)
|
||||
{
|
||||
*aContentLength = mContentLength;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsIconChannel::SetContentLength(PRInt32 aContentLength)
|
||||
NS_IMETHODIMP nsIconChannel::SetContentLength(PRInt64 aContentLength)
|
||||
{
|
||||
NS_NOTREACHED("nsIconChannel::SetContentLength");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
@ -636,13 +636,13 @@ nsIconChannel::SetContentCharset(const nsACString &aContentCharset)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsIconChannel::GetContentLength(PRInt32 *aContentLength)
|
||||
NS_IMETHODIMP nsIconChannel::GetContentLength(PRInt64 *aContentLength)
|
||||
{
|
||||
*aContentLength = mContentLength;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsIconChannel::SetContentLength(PRInt32 aContentLength)
|
||||
NS_IMETHODIMP nsIconChannel::SetContentLength(PRInt64 aContentLength)
|
||||
{
|
||||
NS_NOTREACHED("nsIconChannel::SetContentLength");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
@ -70,7 +70,7 @@ public:
|
||||
protected:
|
||||
nsCOMPtr<nsIURI> mUrl;
|
||||
nsCOMPtr<nsIURI> mOriginalURI;
|
||||
PRInt32 mContentLength;
|
||||
PRInt64 mContentLength;
|
||||
nsCOMPtr<nsILoadGroup> mLoadGroup;
|
||||
nsCOMPtr<nsIInterfaceRequestor> mCallbacks;
|
||||
nsCOMPtr<nsISupports> mOwner;
|
||||
|
@ -693,13 +693,13 @@ nsIconChannel::SetContentCharset(const nsACString &aContentCharset)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsIconChannel::GetContentLength(PRInt32 *aContentLength)
|
||||
NS_IMETHODIMP nsIconChannel::GetContentLength(PRInt64 *aContentLength)
|
||||
{
|
||||
*aContentLength = mContentLength;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsIconChannel::SetContentLength(PRInt32 aContentLength)
|
||||
NS_IMETHODIMP nsIconChannel::SetContentLength(PRInt64 aContentLength)
|
||||
{
|
||||
NS_NOTREACHED("nsIconChannel::SetContentLength");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
@ -72,7 +72,7 @@ public:
|
||||
protected:
|
||||
nsCOMPtr<nsIURI> mUrl;
|
||||
nsCOMPtr<nsIURI> mOriginalURI;
|
||||
PRInt32 mContentLength;
|
||||
PRInt64 mContentLength;
|
||||
nsCOMPtr<nsILoadGroup> mLoadGroup;
|
||||
nsCOMPtr<nsIInterfaceRequestor> mCallbacks;
|
||||
nsCOMPtr<nsISupports> mOwner;
|
||||
|
@ -50,14 +50,6 @@
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Content-Length of a channel. Used instead of the nsIChannel.contentLength
|
||||
* property.
|
||||
* Not available before onStartRequest has been called.
|
||||
* Type: PRUint64
|
||||
*/
|
||||
#define NS_CHANNEL_PROP_CONTENT_LENGTH_STR "content-length"
|
||||
|
||||
/**
|
||||
* MIME Content-Disposition header of channel.
|
||||
* Not available before onStartRequest.
|
||||
@ -73,12 +65,9 @@
|
||||
#define NS_CHANNEL_PROP_CHANNEL_POLICY_STR "channel-policy"
|
||||
|
||||
#ifdef IMPL_NS_NET
|
||||
#define NS_CHANNEL_PROP_CONTENT_LENGTH gNetStrings->kContentLength
|
||||
#define NS_CHANNEL_PROP_CONTENT_DISPOSITION gNetStrings->kContentDisposition
|
||||
#define NS_CHANNEL_PROP_CHANNEL_POLICY gNetStrings->kChannelPolicy
|
||||
#else
|
||||
#define NS_CHANNEL_PROP_CONTENT_LENGTH \
|
||||
NS_LITERAL_STRING(NS_CHANNEL_PROP_CONTENT_LENGTH_STR)
|
||||
#define NS_CHANNEL_PROP_CONTENT_DISPOSITION \
|
||||
NS_LITERAL_STRING(NS_CHANNEL_PROP_CONTENT_DISPOSITION_STR)
|
||||
#define NS_CHANNEL_PROP_CHANNEL_POLICY \
|
||||
|
@ -47,8 +47,6 @@ class nsNetStrings {
|
||||
public:
|
||||
nsNetStrings();
|
||||
|
||||
/** "content-length" */
|
||||
const nsLiteralString kContentLength;
|
||||
const nsLiteralString kContentDisposition;
|
||||
const nsLiteralString kChannelPolicy;
|
||||
};
|
||||
|
@ -86,7 +86,8 @@ private:
|
||||
// nsBaseChannel
|
||||
|
||||
nsBaseChannel::nsBaseChannel()
|
||||
: mLoadFlags(LOAD_NORMAL)
|
||||
: mContentLength(-1)
|
||||
, mLoadFlags(LOAD_NORMAL)
|
||||
, mStatus(NS_OK)
|
||||
, mQueriedProgressSink(PR_TRUE)
|
||||
, mSynthProgressEvents(PR_FALSE)
|
||||
@ -185,23 +186,6 @@ nsBaseChannel::HasContentTypeHint() const
|
||||
return !mContentType.EqualsLiteral(UNKNOWN_CONTENT_TYPE);
|
||||
}
|
||||
|
||||
void
|
||||
nsBaseChannel::SetContentLength64(PRInt64 len)
|
||||
{
|
||||
// XXX: Storing the content-length as a property may not be what we want.
|
||||
// It has the drawback of being copied if we redirect this channel.
|
||||
// Maybe it is time for nsIChannel2.
|
||||
SetPropertyAsInt64(NS_CHANNEL_PROP_CONTENT_LENGTH, len);
|
||||
}
|
||||
|
||||
PRInt64
|
||||
nsBaseChannel::ContentLength64()
|
||||
{
|
||||
PRInt64 len;
|
||||
nsresult rv = GetPropertyAsInt64(NS_CHANNEL_PROP_CONTENT_LENGTH, &len);
|
||||
return NS_SUCCEEDED(rv) ? len : -1;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsBaseChannel::PushStreamConverter(const char *fromType,
|
||||
const char *toType,
|
||||
@ -222,7 +206,7 @@ nsBaseChannel::PushStreamConverter(const char *fromType,
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
mListener = converter;
|
||||
if (invalidatesContentLength)
|
||||
SetContentLength64(-1);
|
||||
mContentLength = -1;
|
||||
if (result) {
|
||||
*result = nsnull;
|
||||
converter.swap(*result);
|
||||
@ -520,20 +504,16 @@ nsBaseChannel::SetContentCharset(const nsACString &aContentCharset)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBaseChannel::GetContentLength(PRInt32 *aContentLength)
|
||||
nsBaseChannel::GetContentLength(PRInt64 *aContentLength)
|
||||
{
|
||||
PRInt64 len = ContentLength64();
|
||||
if (len > PR_INT32_MAX || len < 0)
|
||||
*aContentLength = -1;
|
||||
else
|
||||
*aContentLength = (PRInt32) len;
|
||||
*aContentLength = mContentLength;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBaseChannel::SetContentLength(PRInt32 aContentLength)
|
||||
nsBaseChannel::SetContentLength(PRInt64 aContentLength)
|
||||
{
|
||||
SetContentLength64(aContentLength);
|
||||
mContentLength = aContentLength;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -755,8 +735,7 @@ nsBaseChannel::OnDataAvailable(nsIRequest *request, nsISupports *ctxt,
|
||||
offset, count);
|
||||
if (mSynthProgressEvents && NS_SUCCEEDED(rv)) {
|
||||
PRUint64 prog = PRUint64(offset) + count;
|
||||
PRUint64 progMax = ContentLength64();
|
||||
OnTransportStatus(nsnull, nsITransport::STATUS_READING, prog, progMax);
|
||||
OnTransportStatus(nsnull, nsITransport::STATUS_READING, prog, mContentLength);
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
@ -185,10 +185,11 @@ public:
|
||||
return mPump || mWaitingOnAsyncRedirect;
|
||||
}
|
||||
|
||||
// Set the content length that should be reported for this channel. Pass -1
|
||||
// to indicate an unspecified content length.
|
||||
void SetContentLength64(PRInt64 len);
|
||||
PRInt64 ContentLength64();
|
||||
// Get or set the content length that should be reported for this channel. -1
|
||||
// indicates an unspecified content length.
|
||||
PRInt64& ContentLength() {
|
||||
return mContentLength;
|
||||
}
|
||||
|
||||
// Helper function for querying the channel's notification callbacks.
|
||||
template <class T> void GetCallback(nsCOMPtr<T> &result) {
|
||||
@ -289,6 +290,7 @@ private:
|
||||
nsCOMPtr<nsIChannel> mRedirectChannel;
|
||||
nsCString mContentType;
|
||||
nsCString mContentCharset;
|
||||
PRInt64 mContentLength;
|
||||
PRUint32 mLoadFlags;
|
||||
nsresult mStatus;
|
||||
PRPackedBool mQueriedProgressSink;
|
||||
|
@ -40,8 +40,7 @@
|
||||
NS_HIDDEN_(nsNetStrings*) gNetStrings;
|
||||
|
||||
nsNetStrings::nsNetStrings()
|
||||
: NS_LITERAL_STRING_INIT(kContentLength, NS_CHANNEL_PROP_CONTENT_LENGTH_STR),
|
||||
NS_LITERAL_STRING_INIT(kContentDisposition, NS_CHANNEL_PROP_CONTENT_DISPOSITION_STR),
|
||||
: NS_LITERAL_STRING_INIT(kContentDisposition, NS_CHANNEL_PROP_CONTENT_DISPOSITION_STR),
|
||||
NS_LITERAL_STRING_INIT(kChannelPolicy, NS_CHANNEL_PROP_CHANNEL_POLICY_STR)
|
||||
{}
|
||||
|
||||
|
@ -359,20 +359,17 @@ HttpBaseChannel::SetContentCharset(const nsACString& aContentCharset)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HttpBaseChannel::GetContentLength(PRInt32 *aContentLength)
|
||||
HttpBaseChannel::GetContentLength(PRInt64 *aContentLength)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aContentLength);
|
||||
|
||||
if (!mResponseHead)
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
|
||||
// XXX truncates to 32 bit
|
||||
*aContentLength = mResponseHead->ContentLength();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HttpBaseChannel::SetContentLength(PRInt32 value)
|
||||
HttpBaseChannel::SetContentLength(PRInt64 value)
|
||||
{
|
||||
NS_NOTYETIMPLEMENTED("nsHttpChannel::SetContentLength");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
@ -129,8 +129,8 @@ public:
|
||||
NS_IMETHOD SetContentType(const nsACString& aContentType);
|
||||
NS_IMETHOD GetContentCharset(nsACString& aContentCharset);
|
||||
NS_IMETHOD SetContentCharset(const nsACString& aContentCharset);
|
||||
NS_IMETHOD GetContentLength(PRInt32 *aContentLength);
|
||||
NS_IMETHOD SetContentLength(PRInt32 aContentLength);
|
||||
NS_IMETHOD GetContentLength(PRInt64 *aContentLength);
|
||||
NS_IMETHOD SetContentLength(PRInt64 aContentLength);
|
||||
NS_IMETHOD Open(nsIInputStream **aResult);
|
||||
|
||||
// HttpBaseChannel::nsIHttpChannel
|
||||
|
@ -730,10 +730,6 @@ nsHttpChannel::CallOnStartRequest()
|
||||
if (mResponseHead && mResponseHead->ContentCharset().IsEmpty())
|
||||
mResponseHead->SetContentCharset(mContentCharsetHint);
|
||||
|
||||
if (mResponseHead)
|
||||
SetPropertyAsInt64(NS_CHANNEL_PROP_CONTENT_LENGTH,
|
||||
mResponseHead->ContentLength());
|
||||
|
||||
// Allow consumers to override our content type
|
||||
if ((mLoadFlags & LOAD_CALL_CONTENT_SNIFFERS) &&
|
||||
gIOService->GetContentSniffers().Count() != 0) {
|
||||
@ -2112,16 +2108,16 @@ nsHttpChannel::CheckCache()
|
||||
// size of the cached content, then the cached response is partial...
|
||||
// either we need to issue a byte range request or we need to refetch
|
||||
// the entire document.
|
||||
nsInt64 contentLength = mCachedResponseHead->ContentLength();
|
||||
if (contentLength != nsInt64(-1)) {
|
||||
PRInt64 contentLength = mCachedResponseHead->ContentLength();
|
||||
if (contentLength != -1) {
|
||||
PRUint32 size;
|
||||
rv = mCacheEntry->GetDataSize(&size);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (nsInt64(size) != contentLength) {
|
||||
if (PRInt64(size) != contentLength) {
|
||||
LOG(("Cached data size does not match the Content-Length header "
|
||||
"[content-length=%lld size=%u]\n", PRInt64(contentLength), size));
|
||||
if ((nsInt64(size) < contentLength) && mCachedResponseHead->IsResumable()) {
|
||||
"[content-length=%lld size=%u]\n", contentLength, size));
|
||||
if ((PRInt64(size) < contentLength) && mCachedResponseHead->IsResumable()) {
|
||||
// looks like a partial entry.
|
||||
rv = SetupByteRangeRequest(size);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
@ -3718,7 +3714,7 @@ nsHttpChannel::OnDataAvailable(nsIRequest *request, nsISupports *ctxt,
|
||||
// of a byte range request, the content length stored in the cached
|
||||
// response headers is what we want to use here.
|
||||
|
||||
PRUint64 progressMax(PRUint64(mResponseHead->ContentLength()));
|
||||
PRUint64 progressMax(mResponseHead->ContentLength());
|
||||
PRUint64 progress = mLogicalOffset + PRUint64(count);
|
||||
NS_ASSERTION(progress <= progressMax, "unexpected progress values");
|
||||
|
||||
|
@ -370,7 +370,7 @@ nsViewSourceChannel::SetContentCharset(const nsACString &aContentCharset)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsViewSourceChannel::GetContentLength(PRInt32 *aContentLength)
|
||||
nsViewSourceChannel::GetContentLength(PRInt64 *aContentLength)
|
||||
{
|
||||
NS_ENSURE_TRUE(mChannel, NS_ERROR_FAILURE);
|
||||
|
||||
@ -378,7 +378,7 @@ nsViewSourceChannel::GetContentLength(PRInt32 *aContentLength)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsViewSourceChannel::SetContentLength(PRInt32 aContentLength)
|
||||
nsViewSourceChannel::SetContentLength(PRInt64 aContentLength)
|
||||
{
|
||||
NS_ENSURE_TRUE(mChannel, NS_ERROR_FAILURE);
|
||||
|
||||
|
@ -37,7 +37,6 @@
|
||||
|
||||
#include "nsMultiMixedConv.h"
|
||||
#include "nsMemory.h"
|
||||
#include "nsInt64.h"
|
||||
#include "plstr.h"
|
||||
#include "nsIHttpChannel.h"
|
||||
#include "nsIServiceManager.h"
|
||||
@ -324,14 +323,14 @@ nsPartChannel::SetContentCharset(const nsACString &aContentCharset)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPartChannel::GetContentLength(PRInt32 *aContentLength)
|
||||
nsPartChannel::GetContentLength(PRInt64 *aContentLength)
|
||||
{
|
||||
*aContentLength = mContentLength; // XXX truncates 64-bit value
|
||||
*aContentLength = mContentLength;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPartChannel::SetContentLength(PRInt32 aContentLength)
|
||||
nsPartChannel::SetContentLength(PRInt64 aContentLength)
|
||||
{
|
||||
mContentLength = aContentLength;
|
||||
return NS_OK;
|
||||
@ -797,7 +796,7 @@ nsMultiMixedConv::SendStart(nsIChannel *aChannel) {
|
||||
rv = mPartChannel->SetContentType(mContentType);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = mPartChannel->SetContentLength(mContentLength); // XXX Truncates 64-bit!
|
||||
rv = mPartChannel->SetContentLength(mContentLength);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = mPartChannel->SetContentDisposition(mContentDisposition);
|
||||
@ -939,7 +938,7 @@ nsMultiMixedConv::ParseHeaders(nsIChannel *aChannel, char *&aPtr,
|
||||
if (headerStr.LowerCaseEqualsLiteral("content-type")) {
|
||||
mContentType = headerVal;
|
||||
} else if (headerStr.LowerCaseEqualsLiteral("content-length")) {
|
||||
mContentLength = atoi(headerVal.get()); // XXX 64-bit math?
|
||||
PR_sscanf(headerVal.get(), "%lld", &mContentLength);
|
||||
} else if (headerStr.LowerCaseEqualsLiteral("content-disposition")) {
|
||||
mContentDisposition = headerVal;
|
||||
} else if (headerStr.LowerCaseEqualsLiteral("set-cookie")) {
|
||||
@ -980,7 +979,7 @@ nsMultiMixedConv::ParseHeaders(nsIChannel *aChannel, char *&aPtr,
|
||||
|
||||
mIsByteRangeRequest = PR_TRUE;
|
||||
if (mContentLength == LL_MAXUINT)
|
||||
mContentLength = PRUint64(PRInt64(mByteRangeEnd - mByteRangeStart + nsInt64(1)));
|
||||
mContentLength = PRUint64(PRInt64(mByteRangeEnd - mByteRangeStart + 1));
|
||||
}
|
||||
}
|
||||
*newLine = tmpChar;
|
||||
|
@ -247,14 +247,14 @@ NS_IMETHODIMP nsExtProtocolChannel::SetContentCharset(const nsACString &aContent
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsExtProtocolChannel::GetContentLength(PRInt32 * aContentLength)
|
||||
NS_IMETHODIMP nsExtProtocolChannel::GetContentLength(PRInt64 * aContentLength)
|
||||
{
|
||||
*aContentLength = -1;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsExtProtocolChannel::SetContentLength(PRInt32 aContentLength)
|
||||
nsExtProtocolChannel::SetContentLength(PRInt64 aContentLength)
|
||||
{
|
||||
NS_NOTREACHED("SetContentLength");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
Loading…
Reference in New Issue
Block a user