зеркало из https://github.com/mozilla/pjs.git
Back out Bug 536324 part 2.
This commit is contained in:
Родитель
03a104a7e0
Коммит
34d3553dfc
|
@ -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, PRInt64 *value)
|
||||
NOT_IMPLEMENTED_IF_FUNC_1(SetContentLength, PRInt64 value)
|
||||
NOT_IMPLEMENTED_IF_FUNC_1(GetContentLength, PRInt32 *value)
|
||||
NOT_IMPLEMENTED_IF_FUNC_1(SetContentLength, PRInt32 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(PRInt64 *aContentLength)
|
||||
nsWyciwygChannel::GetContentLength(PRInt32 *aContentLength)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWyciwygChannel::SetContentLength(PRInt64 aContentLength)
|
||||
nsWyciwygChannel::SetContentLength(PRInt32 aContentLength)
|
||||
{
|
||||
mContentLength = aContentLength;
|
||||
|
||||
|
@ -506,9 +506,10 @@ 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),
|
||||
mContentLength);
|
||||
PRUint64(mContentLength));
|
||||
|
||||
return rv; // let the pump cancel on failure
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ protected:
|
|||
PRPackedBool mNeedToWriteCharset;
|
||||
PRInt32 mCharsetSource;
|
||||
nsCString mCharset;
|
||||
PRInt64 mContentLength;
|
||||
PRInt32 mContentLength;
|
||||
PRUint32 mLoadFlags;
|
||||
nsCOMPtr<nsIURI> mURI;
|
||||
nsCOMPtr<nsIURI> mOriginalURI;
|
||||
|
|
|
@ -1012,13 +1012,13 @@ nsJSChannel::SetContentCharset(const nsACString &aContentCharset)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJSChannel::GetContentLength(PRInt64 *aContentLength)
|
||||
nsJSChannel::GetContentLength(PRInt32 *aContentLength)
|
||||
{
|
||||
return mStreamChannel->GetContentLength(aContentLength);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJSChannel::SetContentLength(PRInt64 aContentLength)
|
||||
nsJSChannel::SetContentLength(PRInt32 aContentLength)
|
||||
{
|
||||
return mStreamChannel->SetContentLength(aContentLength);
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ public:
|
|||
NS_IF_ADDREF(*result = mJarReader);
|
||||
}
|
||||
|
||||
PRInt64 GetContentLength()
|
||||
PRInt32 GetContentLength()
|
||||
{
|
||||
return mContentLength;
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ private:
|
|||
nsCString mJarDirSpec;
|
||||
nsCOMPtr<nsIInputStream> mJarStream;
|
||||
nsCString mJarEntry;
|
||||
PRInt64 mContentLength;
|
||||
PRInt32 mContentLength;
|
||||
};
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS1(nsJARInputThunk, nsIInputStream)
|
||||
|
@ -173,11 +173,8 @@ nsJARInputThunk::EnsureJarStream()
|
|||
}
|
||||
|
||||
// ask the JarStream for the content length
|
||||
// XXX want a 64-bit value from nsIInputStream::Available()
|
||||
PRUint32 contentLength;
|
||||
rv = mJarStream->Available(&contentLength);
|
||||
rv = mJarStream->Available((PRUint32 *) &mContentLength);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
mContentLength = contentLength;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -632,7 +629,7 @@ nsJARChannel::SetContentCharset(const nsACString &aContentCharset)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::GetContentLength(PRInt64 *result)
|
||||
nsJARChannel::GetContentLength(PRInt32 *result)
|
||||
{
|
||||
// if content length is unknown, query mJarInput...
|
||||
if (mContentLength < 0 && mJarInput)
|
||||
|
@ -643,7 +640,7 @@ nsJARChannel::GetContentLength(PRInt64 *result)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::SetContentLength(PRInt64 aContentLength)
|
||||
nsJARChannel::SetContentLength(PRInt32 aContentLength)
|
||||
{
|
||||
// XXX does this really make any sense at all?
|
||||
mContentLength = aContentLength;
|
||||
|
@ -905,14 +902,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),
|
||||
mContentLength);
|
||||
PRUint64(mContentLength));
|
||||
|
||||
return rv; // let the pump cancel on failure
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ private:
|
|||
nsCOMPtr<nsISupports> mListenerContext;
|
||||
nsCString mContentType;
|
||||
nsCString mContentCharset;
|
||||
PRInt64 mContentLength;
|
||||
PRInt32 mContentLength;
|
||||
PRUint32 mLoadFlags;
|
||||
nsresult mStatus;
|
||||
PRPackedBool mIsPending;
|
||||
|
|
|
@ -407,13 +407,13 @@ nsIconChannel::SetContentCharset(const nsACString &aContentCharset)
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsIconChannel::GetContentLength(PRInt64 *aContentLength)
|
||||
NS_IMETHODIMP nsIconChannel::GetContentLength(PRInt32 *aContentLength)
|
||||
{
|
||||
*aContentLength = mContentLength;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsIconChannel::SetContentLength(PRInt64 aContentLength)
|
||||
NS_IMETHODIMP nsIconChannel::SetContentLength(PRInt32 aContentLength)
|
||||
{
|
||||
NS_NOTREACHED("nsIconChannel::SetContentLength");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
|
|
@ -69,7 +69,7 @@ public:
|
|||
protected:
|
||||
nsCOMPtr<nsIURI> mUrl;
|
||||
nsCOMPtr<nsIURI> mOriginalURI;
|
||||
PRInt64 mContentLength;
|
||||
PRInt32 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(PRInt64 *aContentLength)
|
||||
NS_IMETHODIMP nsIconChannel::GetContentLength(PRInt32 *aContentLength)
|
||||
{
|
||||
*aContentLength = mContentLength;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsIconChannel::SetContentLength(PRInt64 aContentLength)
|
||||
NS_IMETHODIMP nsIconChannel::SetContentLength(PRInt32 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(PRInt64 *aContentLength)
|
||||
NS_IMETHODIMP nsIconChannel::GetContentLength(PRInt32 *aContentLength)
|
||||
{
|
||||
*aContentLength = mContentLength;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsIconChannel::SetContentLength(PRInt64 aContentLength)
|
||||
NS_IMETHODIMP nsIconChannel::SetContentLength(PRInt32 aContentLength)
|
||||
{
|
||||
NS_NOTREACHED("nsIconChannel::SetContentLength");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
|
|
@ -70,7 +70,7 @@ public:
|
|||
protected:
|
||||
nsCOMPtr<nsIURI> mUrl;
|
||||
nsCOMPtr<nsIURI> mOriginalURI;
|
||||
PRInt64 mContentLength;
|
||||
PRInt32 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(PRInt64 *aContentLength)
|
||||
NS_IMETHODIMP nsIconChannel::GetContentLength(PRInt32 *aContentLength)
|
||||
{
|
||||
*aContentLength = mContentLength;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsIconChannel::SetContentLength(PRInt64 aContentLength)
|
||||
NS_IMETHODIMP nsIconChannel::SetContentLength(PRInt32 aContentLength)
|
||||
{
|
||||
NS_NOTREACHED("nsIconChannel::SetContentLength");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
|
|
@ -72,7 +72,7 @@ public:
|
|||
protected:
|
||||
nsCOMPtr<nsIURI> mUrl;
|
||||
nsCOMPtr<nsIURI> mOriginalURI;
|
||||
PRInt64 mContentLength;
|
||||
PRInt32 mContentLength;
|
||||
nsCOMPtr<nsILoadGroup> mLoadGroup;
|
||||
nsCOMPtr<nsIInterfaceRequestor> mCallbacks;
|
||||
nsCOMPtr<nsISupports> mOwner;
|
||||
|
|
|
@ -50,6 +50,14 @@
|
|||
*/
|
||||
|
||||
|
||||
/**
|
||||
* 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.
|
||||
|
@ -65,9 +73,12 @@
|
|||
#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,6 +47,8 @@ class nsNetStrings {
|
|||
public:
|
||||
nsNetStrings();
|
||||
|
||||
/** "content-length" */
|
||||
const nsLiteralString kContentLength;
|
||||
const nsLiteralString kContentDisposition;
|
||||
const nsLiteralString kChannelPolicy;
|
||||
};
|
||||
|
|
|
@ -86,8 +86,7 @@ private:
|
|||
// nsBaseChannel
|
||||
|
||||
nsBaseChannel::nsBaseChannel()
|
||||
: mContentLength(-1)
|
||||
, mLoadFlags(LOAD_NORMAL)
|
||||
: mLoadFlags(LOAD_NORMAL)
|
||||
, mStatus(NS_OK)
|
||||
, mQueriedProgressSink(PR_TRUE)
|
||||
, mSynthProgressEvents(PR_FALSE)
|
||||
|
@ -186,6 +185,23 @@ 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,
|
||||
|
@ -206,7 +222,7 @@ nsBaseChannel::PushStreamConverter(const char *fromType,
|
|||
if (NS_SUCCEEDED(rv)) {
|
||||
mListener = converter;
|
||||
if (invalidatesContentLength)
|
||||
mContentLength = -1;
|
||||
SetContentLength64(-1);
|
||||
if (result) {
|
||||
*result = nsnull;
|
||||
converter.swap(*result);
|
||||
|
@ -504,16 +520,20 @@ nsBaseChannel::SetContentCharset(const nsACString &aContentCharset)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBaseChannel::GetContentLength(PRInt64 *aContentLength)
|
||||
nsBaseChannel::GetContentLength(PRInt32 *aContentLength)
|
||||
{
|
||||
*aContentLength = mContentLength;
|
||||
PRInt64 len = ContentLength64();
|
||||
if (len > PR_INT32_MAX || len < 0)
|
||||
*aContentLength = -1;
|
||||
else
|
||||
*aContentLength = (PRInt32) len;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBaseChannel::SetContentLength(PRInt64 aContentLength)
|
||||
nsBaseChannel::SetContentLength(PRInt32 aContentLength)
|
||||
{
|
||||
mContentLength = aContentLength;
|
||||
SetContentLength64(aContentLength);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -735,7 +755,8 @@ nsBaseChannel::OnDataAvailable(nsIRequest *request, nsISupports *ctxt,
|
|||
offset, count);
|
||||
if (mSynthProgressEvents && NS_SUCCEEDED(rv)) {
|
||||
PRUint64 prog = PRUint64(offset) + count;
|
||||
OnTransportStatus(nsnull, nsITransport::STATUS_READING, prog, mContentLength);
|
||||
PRUint64 progMax = ContentLength64();
|
||||
OnTransportStatus(nsnull, nsITransport::STATUS_READING, prog, progMax);
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
|
|
@ -185,11 +185,10 @@ public:
|
|||
return mPump || mWaitingOnAsyncRedirect;
|
||||
}
|
||||
|
||||
// Get or set the content length that should be reported for this channel. -1
|
||||
// indicates an unspecified content length.
|
||||
PRInt64& ContentLength() {
|
||||
return mContentLength;
|
||||
}
|
||||
// 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();
|
||||
|
||||
// Helper function for querying the channel's notification callbacks.
|
||||
template <class T> void GetCallback(nsCOMPtr<T> &result) {
|
||||
|
@ -290,7 +289,6 @@ private:
|
|||
nsCOMPtr<nsIChannel> mRedirectChannel;
|
||||
nsCString mContentType;
|
||||
nsCString mContentCharset;
|
||||
PRInt64 mContentLength;
|
||||
PRUint32 mLoadFlags;
|
||||
nsresult mStatus;
|
||||
PRPackedBool mQueriedProgressSink;
|
||||
|
|
|
@ -40,7 +40,8 @@
|
|||
NS_HIDDEN_(nsNetStrings*) gNetStrings;
|
||||
|
||||
nsNetStrings::nsNetStrings()
|
||||
: NS_LITERAL_STRING_INIT(kContentDisposition, NS_CHANNEL_PROP_CONTENT_DISPOSITION_STR),
|
||||
: 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(kChannelPolicy, NS_CHANNEL_PROP_CHANNEL_POLICY_STR)
|
||||
{}
|
||||
|
||||
|
|
|
@ -359,17 +359,20 @@ HttpBaseChannel::SetContentCharset(const nsACString& aContentCharset)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HttpBaseChannel::GetContentLength(PRInt64 *aContentLength)
|
||||
HttpBaseChannel::GetContentLength(PRInt32 *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(PRInt64 value)
|
||||
HttpBaseChannel::SetContentLength(PRInt32 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(PRInt64 *aContentLength);
|
||||
NS_IMETHOD SetContentLength(PRInt64 aContentLength);
|
||||
NS_IMETHOD GetContentLength(PRInt32 *aContentLength);
|
||||
NS_IMETHOD SetContentLength(PRInt32 aContentLength);
|
||||
NS_IMETHOD Open(nsIInputStream **aResult);
|
||||
|
||||
// HttpBaseChannel::nsIHttpChannel
|
||||
|
|
|
@ -763,6 +763,10 @@ 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) {
|
||||
|
@ -2459,16 +2463,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.
|
||||
PRInt64 contentLength = mCachedResponseHead->ContentLength();
|
||||
if (contentLength != -1) {
|
||||
nsInt64 contentLength = mCachedResponseHead->ContentLength();
|
||||
if (contentLength != nsInt64(-1)) {
|
||||
PRUint32 size;
|
||||
rv = mCacheEntry->GetDataSize(&size);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (PRInt64(size) != contentLength) {
|
||||
if (nsInt64(size) != contentLength) {
|
||||
LOG(("Cached data size does not match the Content-Length header "
|
||||
"[content-length=%lld size=%u]\n", contentLength, size));
|
||||
if ((PRInt64(size) < contentLength) && mCachedResponseHead->IsResumable()) {
|
||||
"[content-length=%lld size=%u]\n", PRInt64(contentLength), size));
|
||||
if ((nsInt64(size) < contentLength) && mCachedResponseHead->IsResumable()) {
|
||||
// looks like a partial entry.
|
||||
rv = SetupByteRangeRequest(size);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -4069,7 +4073,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(mResponseHead->ContentLength());
|
||||
PRUint64 progressMax(PRUint64(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(PRInt64 *aContentLength)
|
||||
nsViewSourceChannel::GetContentLength(PRInt32 *aContentLength)
|
||||
{
|
||||
NS_ENSURE_TRUE(mChannel, NS_ERROR_FAILURE);
|
||||
|
||||
|
@ -378,7 +378,7 @@ nsViewSourceChannel::GetContentLength(PRInt64 *aContentLength)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsViewSourceChannel::SetContentLength(PRInt64 aContentLength)
|
||||
nsViewSourceChannel::SetContentLength(PRInt32 aContentLength)
|
||||
{
|
||||
NS_ENSURE_TRUE(mChannel, NS_ERROR_FAILURE);
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
|
||||
#include "nsMultiMixedConv.h"
|
||||
#include "nsMemory.h"
|
||||
#include "nsInt64.h"
|
||||
#include "plstr.h"
|
||||
#include "nsIHttpChannel.h"
|
||||
#include "nsIServiceManager.h"
|
||||
|
@ -323,14 +324,14 @@ nsPartChannel::SetContentCharset(const nsACString &aContentCharset)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPartChannel::GetContentLength(PRInt64 *aContentLength)
|
||||
nsPartChannel::GetContentLength(PRInt32 *aContentLength)
|
||||
{
|
||||
*aContentLength = mContentLength;
|
||||
*aContentLength = mContentLength; // XXX truncates 64-bit value
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPartChannel::SetContentLength(PRInt64 aContentLength)
|
||||
nsPartChannel::SetContentLength(PRInt32 aContentLength)
|
||||
{
|
||||
mContentLength = aContentLength;
|
||||
return NS_OK;
|
||||
|
@ -796,7 +797,7 @@ nsMultiMixedConv::SendStart(nsIChannel *aChannel) {
|
|||
rv = mPartChannel->SetContentType(mContentType);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = mPartChannel->SetContentLength(mContentLength);
|
||||
rv = mPartChannel->SetContentLength(mContentLength); // XXX Truncates 64-bit!
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = mPartChannel->SetContentDisposition(mContentDisposition);
|
||||
|
@ -938,7 +939,7 @@ nsMultiMixedConv::ParseHeaders(nsIChannel *aChannel, char *&aPtr,
|
|||
if (headerStr.LowerCaseEqualsLiteral("content-type")) {
|
||||
mContentType = headerVal;
|
||||
} else if (headerStr.LowerCaseEqualsLiteral("content-length")) {
|
||||
PR_sscanf(headerVal.get(), "%lld", &mContentLength);
|
||||
mContentLength = atoi(headerVal.get()); // XXX 64-bit math?
|
||||
} else if (headerStr.LowerCaseEqualsLiteral("content-disposition")) {
|
||||
mContentDisposition = headerVal;
|
||||
} else if (headerStr.LowerCaseEqualsLiteral("set-cookie")) {
|
||||
|
@ -979,7 +980,7 @@ nsMultiMixedConv::ParseHeaders(nsIChannel *aChannel, char *&aPtr,
|
|||
|
||||
mIsByteRangeRequest = PR_TRUE;
|
||||
if (mContentLength == LL_MAXUINT)
|
||||
mContentLength = PRUint64(PRInt64(mByteRangeEnd - mByteRangeStart + 1));
|
||||
mContentLength = PRUint64(PRInt64(mByteRangeEnd - mByteRangeStart + nsInt64(1)));
|
||||
}
|
||||
}
|
||||
*newLine = tmpChar;
|
||||
|
|
|
@ -247,14 +247,14 @@ NS_IMETHODIMP nsExtProtocolChannel::SetContentCharset(const nsACString &aContent
|
|||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsExtProtocolChannel::GetContentLength(PRInt64 * aContentLength)
|
||||
NS_IMETHODIMP nsExtProtocolChannel::GetContentLength(PRInt32 * aContentLength)
|
||||
{
|
||||
*aContentLength = -1;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsExtProtocolChannel::SetContentLength(PRInt64 aContentLength)
|
||||
nsExtProtocolChannel::SetContentLength(PRInt32 aContentLength)
|
||||
{
|
||||
NS_NOTREACHED("SetContentLength");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
|
Загрузка…
Ссылка в новой задаче