2009-08-18 12:05:15 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set sw=2 ts=8 et tw=80 : */
|
|
|
|
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
|
|
|
*
|
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* The Mozilla Foundation
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 2009
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
* Jason Duell <jduell.mcbugs@gmail.com>
|
2010-04-07 01:43:09 -07:00
|
|
|
* Daniel Witte <dwitte@mozilla.com>
|
2009-08-18 12:05:15 -07:00
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
|
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
|
|
|
|
Bug 530952: Electrolysis HTTP Channel implementation. author=jduell, r=bsmedberg, sr=bz
- Supports only primitive xpcshell HTTP requests which don't set/get HTTP
headers, don't do redirects, observers, load groups, or anything else other
than basic things like looking at the reply body, Content-type, Content-length, etc.
- Tested with network/test/unit_ipc/test_simple_wrap.js (patch @ bug 521922)
- Only used if "NECKO_E10S_HTTP" set in environment.
- Force http.h to get #included before any IPDL files, to centralize #define
handling of LOG and to make sure FORCE_PR_LOGGING is set if needed (bug
545995)
2009-09-22 11:55:33 -07:00
|
|
|
#include "nsHttp.h"
|
2010-06-18 03:49:28 -07:00
|
|
|
#include "mozilla/dom/TabChild.h"
|
Bug 530952: Electrolysis HTTP Channel implementation. author=jduell, r=bsmedberg, sr=bz
- Supports only primitive xpcshell HTTP requests which don't set/get HTTP
headers, don't do redirects, observers, load groups, or anything else other
than basic things like looking at the reply body, Content-type, Content-length, etc.
- Tested with network/test/unit_ipc/test_simple_wrap.js (patch @ bug 521922)
- Only used if "NECKO_E10S_HTTP" set in environment.
- Force http.h to get #included before any IPDL files, to centralize #define
handling of LOG and to make sure FORCE_PR_LOGGING is set if needed (bug
545995)
2009-09-22 11:55:33 -07:00
|
|
|
#include "mozilla/net/NeckoChild.h"
|
2009-08-18 12:05:15 -07:00
|
|
|
#include "mozilla/net/HttpChannelChild.h"
|
Bug 530952: Electrolysis HTTP Channel implementation. author=jduell, r=bsmedberg, sr=bz
- Supports only primitive xpcshell HTTP requests which don't set/get HTTP
headers, don't do redirects, observers, load groups, or anything else other
than basic things like looking at the reply body, Content-type, Content-length, etc.
- Tested with network/test/unit_ipc/test_simple_wrap.js (patch @ bug 521922)
- Only used if "NECKO_E10S_HTTP" set in environment.
- Force http.h to get #included before any IPDL files, to centralize #define
handling of LOG and to make sure FORCE_PR_LOGGING is set if needed (bug
545995)
2009-09-22 11:55:33 -07:00
|
|
|
|
|
|
|
#include "nsStringStream.h"
|
|
|
|
#include "nsHttpHandler.h"
|
|
|
|
#include "nsMimeTypes.h"
|
|
|
|
#include "nsNetUtil.h"
|
|
|
|
|
2009-08-18 12:05:15 -07:00
|
|
|
namespace mozilla {
|
|
|
|
namespace net {
|
|
|
|
|
|
|
|
// C++ file contents
|
|
|
|
HttpChannelChild::HttpChannelChild()
|
2010-06-23 23:55:19 -07:00
|
|
|
: mIsFromCache(PR_FALSE)
|
|
|
|
, mCacheEntryAvailable(PR_FALSE)
|
|
|
|
, mCacheExpirationTime(nsICache::NO_EXPIRATION_TIME)
|
|
|
|
, mState(HCC_NEW)
|
2009-08-18 12:05:15 -07:00
|
|
|
{
|
Bug 530952: Electrolysis HTTP Channel implementation. author=jduell, r=bsmedberg, sr=bz
- Supports only primitive xpcshell HTTP requests which don't set/get HTTP
headers, don't do redirects, observers, load groups, or anything else other
than basic things like looking at the reply body, Content-type, Content-length, etc.
- Tested with network/test/unit_ipc/test_simple_wrap.js (patch @ bug 521922)
- Only used if "NECKO_E10S_HTTP" set in environment.
- Force http.h to get #included before any IPDL files, to centralize #define
handling of LOG and to make sure FORCE_PR_LOGGING is set if needed (bug
545995)
2009-09-22 11:55:33 -07:00
|
|
|
LOG(("Creating HttpChannelChild @%x\n", this));
|
2009-08-18 12:05:15 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
HttpChannelChild::~HttpChannelChild()
|
|
|
|
{
|
Bug 530952: Electrolysis HTTP Channel implementation. author=jduell, r=bsmedberg, sr=bz
- Supports only primitive xpcshell HTTP requests which don't set/get HTTP
headers, don't do redirects, observers, load groups, or anything else other
than basic things like looking at the reply body, Content-type, Content-length, etc.
- Tested with network/test/unit_ipc/test_simple_wrap.js (patch @ bug 521922)
- Only used if "NECKO_E10S_HTTP" set in environment.
- Force http.h to get #included before any IPDL files, to centralize #define
handling of LOG and to make sure FORCE_PR_LOGGING is set if needed (bug
545995)
2009-09-22 11:55:33 -07:00
|
|
|
LOG(("Destroying HttpChannelChild @%x\n", this));
|
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// HttpChannelChild::nsISupports
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2010-04-23 07:19:33 -07:00
|
|
|
// Override nsHashPropertyBag's AddRef: we don't need thread-safe refcnt
|
|
|
|
NS_IMPL_ADDREF(HttpChannelChild)
|
|
|
|
NS_IMPL_RELEASE_WITH_DESTROY(HttpChannelChild, RefcountHitZero())
|
|
|
|
|
|
|
|
void
|
|
|
|
HttpChannelChild::RefcountHitZero()
|
|
|
|
{
|
|
|
|
if (mWasOpened) {
|
|
|
|
// NeckoChild::DeallocPHttpChannel will delete this
|
|
|
|
PHttpChannelChild::Send__delete__(this);
|
|
|
|
} else {
|
|
|
|
delete this; // we never opened IPDL channel
|
|
|
|
}
|
|
|
|
}
|
Bug 530952: Electrolysis HTTP Channel implementation. author=jduell, r=bsmedberg, sr=bz
- Supports only primitive xpcshell HTTP requests which don't set/get HTTP
headers, don't do redirects, observers, load groups, or anything else other
than basic things like looking at the reply body, Content-type, Content-length, etc.
- Tested with network/test/unit_ipc/test_simple_wrap.js (patch @ bug 521922)
- Only used if "NECKO_E10S_HTTP" set in environment.
- Force http.h to get #included before any IPDL files, to centralize #define
handling of LOG and to make sure FORCE_PR_LOGGING is set if needed (bug
545995)
2009-09-22 11:55:33 -07:00
|
|
|
|
|
|
|
NS_INTERFACE_MAP_BEGIN(HttpChannelChild)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIRequest)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIChannel)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIHttpChannel)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIHttpChannelInternal)
|
2010-06-23 23:55:19 -07:00
|
|
|
NS_INTERFACE_MAP_ENTRY(nsICacheInfoChannel)
|
Bug 530952: Electrolysis HTTP Channel implementation. author=jduell, r=bsmedberg, sr=bz
- Supports only primitive xpcshell HTTP requests which don't set/get HTTP
headers, don't do redirects, observers, load groups, or anything else other
than basic things like looking at the reply body, Content-type, Content-length, etc.
- Tested with network/test/unit_ipc/test_simple_wrap.js (patch @ bug 521922)
- Only used if "NECKO_E10S_HTTP" set in environment.
- Force http.h to get #included before any IPDL files, to centralize #define
handling of LOG and to make sure FORCE_PR_LOGGING is set if needed (bug
545995)
2009-09-22 11:55:33 -07:00
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIEncodedChannel)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIResumableChannel)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsISupportsPriority)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIProxiedChannel)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsITraceableChannel)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIApplicationCacheContainer)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIApplicationCacheChannel)
|
2010-04-07 01:43:09 -07:00
|
|
|
NS_INTERFACE_MAP_END_INHERITING(HttpBaseChannel)
|
Bug 530952: Electrolysis HTTP Channel implementation. author=jduell, r=bsmedberg, sr=bz
- Supports only primitive xpcshell HTTP requests which don't set/get HTTP
headers, don't do redirects, observers, load groups, or anything else other
than basic things like looking at the reply body, Content-type, Content-length, etc.
- Tested with network/test/unit_ipc/test_simple_wrap.js (patch @ bug 521922)
- Only used if "NECKO_E10S_HTTP" set in environment.
- Force http.h to get #included before any IPDL files, to centralize #define
handling of LOG and to make sure FORCE_PR_LOGGING is set if needed (bug
545995)
2009-09-22 11:55:33 -07:00
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// HttpChannelChild::PHttpChannelChild
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
bool
|
2010-06-18 03:32:00 -07:00
|
|
|
HttpChannelChild::RecvOnStartRequest(const nsHttpResponseHead& responseHead,
|
2010-06-23 23:55:19 -07:00
|
|
|
const PRBool& useResponseHead,
|
|
|
|
const PRBool& isFromCache,
|
|
|
|
const PRBool& cacheEntryAvailable,
|
|
|
|
const PRUint32& cacheExpirationTime,
|
|
|
|
const nsCString& cachedCharset)
|
Bug 530952: Electrolysis HTTP Channel implementation. author=jduell, r=bsmedberg, sr=bz
- Supports only primitive xpcshell HTTP requests which don't set/get HTTP
headers, don't do redirects, observers, load groups, or anything else other
than basic things like looking at the reply body, Content-type, Content-length, etc.
- Tested with network/test/unit_ipc/test_simple_wrap.js (patch @ bug 521922)
- Only used if "NECKO_E10S_HTTP" set in environment.
- Force http.h to get #included before any IPDL files, to centralize #define
handling of LOG and to make sure FORCE_PR_LOGGING is set if needed (bug
545995)
2009-09-22 11:55:33 -07:00
|
|
|
{
|
|
|
|
LOG(("HttpChannelChild::RecvOnStartRequest [this=%x]\n", this));
|
|
|
|
|
|
|
|
mState = HCC_ONSTART;
|
|
|
|
|
2010-06-18 03:32:00 -07:00
|
|
|
if (useResponseHead)
|
|
|
|
mResponseHead = new nsHttpResponseHead(responseHead);
|
|
|
|
else
|
|
|
|
mResponseHead = nsnull;
|
|
|
|
|
2010-06-23 23:55:19 -07:00
|
|
|
mIsFromCache = isFromCache;
|
|
|
|
mCacheEntryAvailable = cacheEntryAvailable;
|
|
|
|
mCacheExpirationTime = cacheExpirationTime;
|
|
|
|
mCachedCharset = cachedCharset;
|
Bug 530952: Electrolysis HTTP Channel implementation. author=jduell, r=bsmedberg, sr=bz
- Supports only primitive xpcshell HTTP requests which don't set/get HTTP
headers, don't do redirects, observers, load groups, or anything else other
than basic things like looking at the reply body, Content-type, Content-length, etc.
- Tested with network/test/unit_ipc/test_simple_wrap.js (patch @ bug 521922)
- Only used if "NECKO_E10S_HTTP" set in environment.
- Force http.h to get #included before any IPDL files, to centralize #define
handling of LOG and to make sure FORCE_PR_LOGGING is set if needed (bug
545995)
2009-09-22 11:55:33 -07:00
|
|
|
|
2010-04-07 01:43:09 -07:00
|
|
|
nsresult rv = mListener->OnStartRequest(this, mListenerContext);
|
2010-06-15 16:07:10 -07:00
|
|
|
if (NS_FAILED(rv)) {
|
2010-06-09 20:19:28 -07:00
|
|
|
// TODO: Cancel request: (bug 536317)
|
Bug 530952: Electrolysis HTTP Channel implementation. author=jduell, r=bsmedberg, sr=bz
- Supports only primitive xpcshell HTTP requests which don't set/get HTTP
headers, don't do redirects, observers, load groups, or anything else other
than basic things like looking at the reply body, Content-type, Content-length, etc.
- Tested with network/test/unit_ipc/test_simple_wrap.js (patch @ bug 521922)
- Only used if "NECKO_E10S_HTTP" set in environment.
- Force http.h to get #included before any IPDL files, to centralize #define
handling of LOG and to make sure FORCE_PR_LOGGING is set if needed (bug
545995)
2009-09-22 11:55:33 -07:00
|
|
|
// - Send Cancel msg to parent
|
|
|
|
// - drop any in flight OnDataAvail msgs we receive
|
|
|
|
// - make sure we do call OnStopRequest eventually
|
|
|
|
// - return true here, not false
|
|
|
|
return false;
|
|
|
|
}
|
2010-06-15 16:07:10 -07:00
|
|
|
|
2010-06-18 03:32:00 -07:00
|
|
|
if (mResponseHead)
|
|
|
|
SetCookie(mResponseHead->PeekHeader(nsHttp::Set_Cookie));
|
2010-06-15 16:07:10 -07:00
|
|
|
|
Bug 530952: Electrolysis HTTP Channel implementation. author=jduell, r=bsmedberg, sr=bz
- Supports only primitive xpcshell HTTP requests which don't set/get HTTP
headers, don't do redirects, observers, load groups, or anything else other
than basic things like looking at the reply body, Content-type, Content-length, etc.
- Tested with network/test/unit_ipc/test_simple_wrap.js (patch @ bug 521922)
- Only used if "NECKO_E10S_HTTP" set in environment.
- Force http.h to get #included before any IPDL files, to centralize #define
handling of LOG and to make sure FORCE_PR_LOGGING is set if needed (bug
545995)
2009-09-22 11:55:33 -07:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
HttpChannelChild::RecvOnDataAvailable(const nsCString& data,
|
|
|
|
const PRUint32& offset,
|
|
|
|
const PRUint32& count)
|
|
|
|
{
|
|
|
|
LOG(("HttpChannelChild::RecvOnDataAvailable [this=%x]\n", this));
|
|
|
|
|
|
|
|
mState = HCC_ONDATA;
|
|
|
|
|
|
|
|
// NOTE: the OnDataAvailable contract requires the client to read all the data
|
|
|
|
// in the inputstream. This code relies on that ('data' will go away after
|
|
|
|
// this function). Apparently the previous, non-e10s behavior was to actually
|
|
|
|
// support only reading part of the data, allowing later calls to read the
|
|
|
|
// rest.
|
|
|
|
nsCOMPtr<nsIInputStream> stringStream;
|
|
|
|
nsresult rv = NS_NewByteInputStream(getter_AddRefs(stringStream),
|
|
|
|
data.get(),
|
|
|
|
count,
|
|
|
|
NS_ASSIGNMENT_DEPEND);
|
2010-06-15 16:07:10 -07:00
|
|
|
if (NS_FAILED(rv)) {
|
Bug 530952: Electrolysis HTTP Channel implementation. author=jduell, r=bsmedberg, sr=bz
- Supports only primitive xpcshell HTTP requests which don't set/get HTTP
headers, don't do redirects, observers, load groups, or anything else other
than basic things like looking at the reply body, Content-type, Content-length, etc.
- Tested with network/test/unit_ipc/test_simple_wrap.js (patch @ bug 521922)
- Only used if "NECKO_E10S_HTTP" set in environment.
- Force http.h to get #included before any IPDL files, to centralize #define
handling of LOG and to make sure FORCE_PR_LOGGING is set if needed (bug
545995)
2009-09-22 11:55:33 -07:00
|
|
|
// TODO: what to do here? Cancel request? Very unlikely to fail.
|
|
|
|
return false;
|
|
|
|
}
|
2010-04-07 01:43:09 -07:00
|
|
|
rv = mListener->OnDataAvailable(this, mListenerContext,
|
|
|
|
stringStream, offset, count);
|
Bug 530952: Electrolysis HTTP Channel implementation. author=jduell, r=bsmedberg, sr=bz
- Supports only primitive xpcshell HTTP requests which don't set/get HTTP
headers, don't do redirects, observers, load groups, or anything else other
than basic things like looking at the reply body, Content-type, Content-length, etc.
- Tested with network/test/unit_ipc/test_simple_wrap.js (patch @ bug 521922)
- Only used if "NECKO_E10S_HTTP" set in environment.
- Force http.h to get #included before any IPDL files, to centralize #define
handling of LOG and to make sure FORCE_PR_LOGGING is set if needed (bug
545995)
2009-09-22 11:55:33 -07:00
|
|
|
stringStream->Close();
|
2010-06-15 16:07:10 -07:00
|
|
|
if (NS_FAILED(rv)) {
|
2010-06-09 20:19:28 -07:00
|
|
|
// TODO: Cancel request: see OnStartRequest. Bug 536317
|
Bug 530952: Electrolysis HTTP Channel implementation. author=jduell, r=bsmedberg, sr=bz
- Supports only primitive xpcshell HTTP requests which don't set/get HTTP
headers, don't do redirects, observers, load groups, or anything else other
than basic things like looking at the reply body, Content-type, Content-length, etc.
- Tested with network/test/unit_ipc/test_simple_wrap.js (patch @ bug 521922)
- Only used if "NECKO_E10S_HTTP" set in environment.
- Force http.h to get #included before any IPDL files, to centralize #define
handling of LOG and to make sure FORCE_PR_LOGGING is set if needed (bug
545995)
2009-09-22 11:55:33 -07:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
HttpChannelChild::RecvOnStopRequest(const nsresult& statusCode)
|
|
|
|
{
|
|
|
|
LOG(("HttpChannelChild::RecvOnStopRequest [this=%x status=%u]\n",
|
|
|
|
this, statusCode));
|
|
|
|
|
|
|
|
mState = HCC_ONSTOP;
|
|
|
|
|
|
|
|
mIsPending = PR_FALSE;
|
|
|
|
mStatus = statusCode;
|
2010-04-07 01:43:09 -07:00
|
|
|
nsresult rv = mListener->OnStopRequest(this, mListenerContext, statusCode);
|
|
|
|
mListener = 0;
|
|
|
|
mListenerContext = 0;
|
2010-06-23 23:55:19 -07:00
|
|
|
mCacheEntryAvailable = PR_FALSE;
|
2010-04-23 07:19:33 -07:00
|
|
|
|
2010-05-28 17:26:45 -07:00
|
|
|
if (mLoadGroup)
|
|
|
|
mLoadGroup->RemoveRequest(this, nsnull, statusCode);
|
|
|
|
|
2010-06-23 23:55:19 -07:00
|
|
|
SendOnStopRequestCompleted();
|
|
|
|
|
2010-04-23 07:19:33 -07:00
|
|
|
// Corresponding AddRef in AsyncOpen().
|
|
|
|
this->Release();
|
|
|
|
|
2010-06-15 16:07:10 -07:00
|
|
|
if (NS_FAILED(rv)) {
|
2010-06-09 20:19:28 -07:00
|
|
|
// TODO: Cancel request: see OnStartRequest (bug 536317)
|
Bug 530952: Electrolysis HTTP Channel implementation. author=jduell, r=bsmedberg, sr=bz
- Supports only primitive xpcshell HTTP requests which don't set/get HTTP
headers, don't do redirects, observers, load groups, or anything else other
than basic things like looking at the reply body, Content-type, Content-length, etc.
- Tested with network/test/unit_ipc/test_simple_wrap.js (patch @ bug 521922)
- Only used if "NECKO_E10S_HTTP" set in environment.
- Force http.h to get #included before any IPDL files, to centralize #define
handling of LOG and to make sure FORCE_PR_LOGGING is set if needed (bug
545995)
2009-09-22 11:55:33 -07:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-05-13 10:28:51 -07:00
|
|
|
bool
|
|
|
|
HttpChannelChild::RecvOnProgress(const PRUint64& progress,
|
|
|
|
const PRUint64& progressMax)
|
|
|
|
{
|
|
|
|
LOG(("HttpChannelChild::RecvOnProgress [this=%p progress=%llu/%llu]\n",
|
|
|
|
this, progress, progressMax));
|
|
|
|
|
|
|
|
// cache the progress sink so we don't have to query for it each time.
|
|
|
|
if (!mProgressSink)
|
|
|
|
GetCallback(mProgressSink);
|
|
|
|
|
|
|
|
// block socket status event after Cancel or OnStopRequest has been called.
|
|
|
|
if (mProgressSink && NS_SUCCEEDED(mStatus) && mIsPending &&
|
|
|
|
!(mLoadFlags & LOAD_BACKGROUND))
|
|
|
|
{
|
|
|
|
if (progress > 0) {
|
|
|
|
NS_ASSERTION(progress <= progressMax, "unexpected progress values");
|
|
|
|
mProgressSink->OnProgress(this, nsnull, progress, progressMax);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
HttpChannelChild::RecvOnStatus(const nsresult& status,
|
|
|
|
const nsString& statusArg)
|
|
|
|
{
|
|
|
|
LOG(("HttpChannelChild::RecvOnStatus [this=%p status=%x]\n", this, status));
|
|
|
|
|
|
|
|
// cache the progress sink so we don't have to query for it each time.
|
|
|
|
if (!mProgressSink)
|
|
|
|
GetCallback(mProgressSink);
|
|
|
|
|
|
|
|
// block socket status event after Cancel or OnStopRequest has been called.
|
|
|
|
if (mProgressSink && NS_SUCCEEDED(mStatus) && mIsPending &&
|
|
|
|
!(mLoadFlags & LOAD_BACKGROUND))
|
|
|
|
{
|
|
|
|
mProgressSink->OnStatus(this, nsnull, status, statusArg.get());
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
Bug 530952: Electrolysis HTTP Channel implementation. author=jduell, r=bsmedberg, sr=bz
- Supports only primitive xpcshell HTTP requests which don't set/get HTTP
headers, don't do redirects, observers, load groups, or anything else other
than basic things like looking at the reply body, Content-type, Content-length, etc.
- Tested with network/test/unit_ipc/test_simple_wrap.js (patch @ bug 521922)
- Only used if "NECKO_E10S_HTTP" set in environment.
- Force http.h to get #included before any IPDL files, to centralize #define
handling of LOG and to make sure FORCE_PR_LOGGING is set if needed (bug
545995)
2009-09-22 11:55:33 -07:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// HttpChannelChild::nsIRequest
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2010-04-07 01:43:09 -07:00
|
|
|
HttpChannelChild::Cancel(nsresult status)
|
Bug 530952: Electrolysis HTTP Channel implementation. author=jduell, r=bsmedberg, sr=bz
- Supports only primitive xpcshell HTTP requests which don't set/get HTTP
headers, don't do redirects, observers, load groups, or anything else other
than basic things like looking at the reply body, Content-type, Content-length, etc.
- Tested with network/test/unit_ipc/test_simple_wrap.js (patch @ bug 521922)
- Only used if "NECKO_E10S_HTTP" set in environment.
- Force http.h to get #included before any IPDL files, to centralize #define
handling of LOG and to make sure FORCE_PR_LOGGING is set if needed (bug
545995)
2009-09-22 11:55:33 -07:00
|
|
|
{
|
2010-03-27 18:53:46 -07:00
|
|
|
// FIXME: bug 536317
|
|
|
|
return NS_OK;
|
Bug 530952: Electrolysis HTTP Channel implementation. author=jduell, r=bsmedberg, sr=bz
- Supports only primitive xpcshell HTTP requests which don't set/get HTTP
headers, don't do redirects, observers, load groups, or anything else other
than basic things like looking at the reply body, Content-type, Content-length, etc.
- Tested with network/test/unit_ipc/test_simple_wrap.js (patch @ bug 521922)
- Only used if "NECKO_E10S_HTTP" set in environment.
- Force http.h to get #included before any IPDL files, to centralize #define
handling of LOG and to make sure FORCE_PR_LOGGING is set if needed (bug
545995)
2009-09-22 11:55:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
HttpChannelChild::Suspend()
|
|
|
|
{
|
|
|
|
DROP_DEAD();
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
HttpChannelChild::Resume()
|
|
|
|
{
|
|
|
|
DROP_DEAD();
|
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// HttpChannelChild::nsIChannel
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
HttpChannelChild::GetSecurityInfo(nsISupports **aSecurityInfo)
|
|
|
|
{
|
2010-03-27 18:53:46 -07:00
|
|
|
// FIXME: Stub for bug 536301 .
|
|
|
|
NS_ENSURE_ARG_POINTER(aSecurityInfo);
|
|
|
|
*aSecurityInfo = 0;
|
|
|
|
return NS_OK;
|
Bug 530952: Electrolysis HTTP Channel implementation. author=jduell, r=bsmedberg, sr=bz
- Supports only primitive xpcshell HTTP requests which don't set/get HTTP
headers, don't do redirects, observers, load groups, or anything else other
than basic things like looking at the reply body, Content-type, Content-length, etc.
- Tested with network/test/unit_ipc/test_simple_wrap.js (patch @ bug 521922)
- Only used if "NECKO_E10S_HTTP" set in environment.
- Force http.h to get #included before any IPDL files, to centralize #define
handling of LOG and to make sure FORCE_PR_LOGGING is set if needed (bug
545995)
2009-09-22 11:55:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
HttpChannelChild::AsyncOpen(nsIStreamListener *listener, nsISupports *aContext)
|
|
|
|
{
|
|
|
|
LOG(("HttpChannelChild::AsyncOpen [this=%x uri=%s]\n", this, mSpec.get()));
|
|
|
|
|
|
|
|
NS_ENSURE_TRUE(gNeckoChild != nsnull, NS_ERROR_FAILURE);
|
|
|
|
NS_ENSURE_ARG_POINTER(listener);
|
|
|
|
NS_ENSURE_TRUE(!mIsPending, NS_ERROR_IN_PROGRESS);
|
|
|
|
NS_ENSURE_TRUE(!mWasOpened, NS_ERROR_ALREADY_OPENED);
|
|
|
|
|
|
|
|
// Port checked in parent, but duplicate here so we can return with error
|
2010-04-10 22:13:57 -07:00
|
|
|
// immediately
|
Bug 530952: Electrolysis HTTP Channel implementation. author=jduell, r=bsmedberg, sr=bz
- Supports only primitive xpcshell HTTP requests which don't set/get HTTP
headers, don't do redirects, observers, load groups, or anything else other
than basic things like looking at the reply body, Content-type, Content-length, etc.
- Tested with network/test/unit_ipc/test_simple_wrap.js (patch @ bug 521922)
- Only used if "NECKO_E10S_HTTP" set in environment.
- Force http.h to get #included before any IPDL files, to centralize #define
handling of LOG and to make sure FORCE_PR_LOGGING is set if needed (bug
545995)
2009-09-22 11:55:33 -07:00
|
|
|
nsresult rv;
|
|
|
|
rv = NS_CheckPortSafety(mURI);
|
|
|
|
if (NS_FAILED(rv))
|
|
|
|
return rv;
|
|
|
|
|
2010-05-30 15:30:28 -07:00
|
|
|
// Prepare uploadStream for POST data
|
|
|
|
nsCAutoString uploadStreamData;
|
|
|
|
PRInt32 uploadStreamInfo;
|
|
|
|
|
|
|
|
if (mUploadStream) {
|
|
|
|
// Read entire POST stream into string:
|
|
|
|
// This is a temporary measure until bug 564553 is implemented: we're doing
|
|
|
|
// a blocking read of a potentially arbitrarily large stream, so this isn't
|
|
|
|
// performant/safe for large file uploads.
|
|
|
|
PRUint32 bytes;
|
|
|
|
mUploadStream->Available(&bytes);
|
|
|
|
if (bytes > 0) {
|
|
|
|
rv = NS_ReadInputStreamToString(mUploadStream, uploadStreamData, bytes);
|
2010-06-15 16:07:10 -07:00
|
|
|
if (NS_FAILED(rv))
|
2010-05-30 15:30:28 -07:00
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
uploadStreamInfo = mUploadStreamHasHeaders ?
|
|
|
|
eUploadStream_hasHeaders : eUploadStream_hasNoHeaders;
|
|
|
|
} else {
|
|
|
|
uploadStreamInfo = eUploadStream_null;
|
|
|
|
}
|
|
|
|
|
2010-06-15 16:07:10 -07:00
|
|
|
const char *cookieHeader = mRequestHead.PeekHeader(nsHttp::Cookie);
|
|
|
|
if (cookieHeader) {
|
|
|
|
mUserSetCookieHeader = cookieHeader;
|
|
|
|
}
|
|
|
|
|
|
|
|
AddCookiesToRequest();
|
Bug 530952: Electrolysis HTTP Channel implementation. author=jduell, r=bsmedberg, sr=bz
- Supports only primitive xpcshell HTTP requests which don't set/get HTTP
headers, don't do redirects, observers, load groups, or anything else other
than basic things like looking at the reply body, Content-type, Content-length, etc.
- Tested with network/test/unit_ipc/test_simple_wrap.js (patch @ bug 521922)
- Only used if "NECKO_E10S_HTTP" set in environment.
- Force http.h to get #included before any IPDL files, to centralize #define
handling of LOG and to make sure FORCE_PR_LOGGING is set if needed (bug
545995)
2009-09-22 11:55:33 -07:00
|
|
|
|
2010-05-30 15:30:28 -07:00
|
|
|
//
|
|
|
|
// NOTE: From now on we must return NS_OK; all errors must be handled via
|
|
|
|
// OnStart/OnStopRequest
|
|
|
|
//
|
|
|
|
|
2010-04-10 22:13:57 -07:00
|
|
|
// notify "http-on-modify-request" observers
|
|
|
|
gHttpHandler->OnModifyRequest(this);
|
|
|
|
|
|
|
|
mIsPending = PR_TRUE;
|
|
|
|
mWasOpened = PR_TRUE;
|
2010-04-07 01:43:09 -07:00
|
|
|
mListener = listener;
|
|
|
|
mListenerContext = aContext;
|
|
|
|
|
2010-04-10 22:13:57 -07:00
|
|
|
// add ourselves to the load group.
|
|
|
|
if (mLoadGroup)
|
|
|
|
mLoadGroup->AddRequest(this, nsnull);
|
|
|
|
|
|
|
|
// FIXME: bug 536317: We may have been cancelled already, either by
|
|
|
|
// on-modify-request listeners or by load group observers; in that case,
|
|
|
|
// don't create IPDL connection. See nsHttpChannel::AsyncOpen(): I think
|
|
|
|
// we'll need something like
|
|
|
|
//
|
|
|
|
// if (mCanceled) {
|
|
|
|
// LOG(("Calling AsyncAbort [rv=%x mCanceled=%i]\n", rv, mCanceled));
|
|
|
|
// AsyncAbort(rv);
|
|
|
|
// return NS_OK;
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// (This is assuming on-modify-request/loadgroup observers will still be able
|
|
|
|
// to cancel synchronously)
|
|
|
|
|
|
|
|
//
|
|
|
|
// Send request to the chrome process...
|
|
|
|
//
|
|
|
|
|
|
|
|
// FIXME: bug 558623: Combine constructor and SendAsyncOpen into one IPC msg
|
2010-06-18 03:49:28 -07:00
|
|
|
|
|
|
|
mozilla::dom::TabChild* tabChild = nsnull;
|
|
|
|
nsCOMPtr<nsITabChild> iTabChild;
|
|
|
|
GetCallback(iTabChild);
|
|
|
|
if (iTabChild) {
|
|
|
|
tabChild = static_cast<mozilla::dom::TabChild*>(iTabChild.get());
|
|
|
|
}
|
|
|
|
|
|
|
|
gNeckoChild->SendPHttpChannelConstructor(this, tabChild);
|
Bug 530952: Electrolysis HTTP Channel implementation. author=jduell, r=bsmedberg, sr=bz
- Supports only primitive xpcshell HTTP requests which don't set/get HTTP
headers, don't do redirects, observers, load groups, or anything else other
than basic things like looking at the reply body, Content-type, Content-length, etc.
- Tested with network/test/unit_ipc/test_simple_wrap.js (patch @ bug 521922)
- Only used if "NECKO_E10S_HTTP" set in environment.
- Force http.h to get #included before any IPDL files, to centralize #define
handling of LOG and to make sure FORCE_PR_LOGGING is set if needed (bug
545995)
2009-09-22 11:55:33 -07:00
|
|
|
|
2010-04-26 08:24:21 -07:00
|
|
|
SendAsyncOpen(IPC::URI(mURI), IPC::URI(mOriginalURI), IPC::URI(mDocumentURI),
|
2010-05-30 15:30:28 -07:00
|
|
|
IPC::URI(mReferrer), mLoadFlags, mRequestHeaders,
|
|
|
|
mRequestHead.Method(), uploadStreamData,
|
|
|
|
uploadStreamInfo, mPriority, mRedirectionLimit,
|
2010-04-26 08:24:21 -07:00
|
|
|
mAllowPipelining, mForceAllowThirdPartyCookie);
|
Bug 530952: Electrolysis HTTP Channel implementation. author=jduell, r=bsmedberg, sr=bz
- Supports only primitive xpcshell HTTP requests which don't set/get HTTP
headers, don't do redirects, observers, load groups, or anything else other
than basic things like looking at the reply body, Content-type, Content-length, etc.
- Tested with network/test/unit_ipc/test_simple_wrap.js (patch @ bug 521922)
- Only used if "NECKO_E10S_HTTP" set in environment.
- Force http.h to get #included before any IPDL files, to centralize #define
handling of LOG and to make sure FORCE_PR_LOGGING is set if needed (bug
545995)
2009-09-22 11:55:33 -07:00
|
|
|
|
2010-04-10 22:13:57 -07:00
|
|
|
// The socket transport layer in the chrome process now has a logical ref to
|
|
|
|
// us, until either OnStopRequest or OnRedirect is called.
|
|
|
|
this->AddRef();
|
Bug 530952: Electrolysis HTTP Channel implementation. author=jduell, r=bsmedberg, sr=bz
- Supports only primitive xpcshell HTTP requests which don't set/get HTTP
headers, don't do redirects, observers, load groups, or anything else other
than basic things like looking at the reply body, Content-type, Content-length, etc.
- Tested with network/test/unit_ipc/test_simple_wrap.js (patch @ bug 521922)
- Only used if "NECKO_E10S_HTTP" set in environment.
- Force http.h to get #included before any IPDL files, to centralize #define
handling of LOG and to make sure FORCE_PR_LOGGING is set if needed (bug
545995)
2009-09-22 11:55:33 -07:00
|
|
|
|
2010-04-10 22:13:57 -07:00
|
|
|
mState = HCC_OPENED;
|
Bug 530952: Electrolysis HTTP Channel implementation. author=jduell, r=bsmedberg, sr=bz
- Supports only primitive xpcshell HTTP requests which don't set/get HTTP
headers, don't do redirects, observers, load groups, or anything else other
than basic things like looking at the reply body, Content-type, Content-length, etc.
- Tested with network/test/unit_ipc/test_simple_wrap.js (patch @ bug 521922)
- Only used if "NECKO_E10S_HTTP" set in environment.
- Force http.h to get #included before any IPDL files, to centralize #define
handling of LOG and to make sure FORCE_PR_LOGGING is set if needed (bug
545995)
2009-09-22 11:55:33 -07:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// HttpChannelChild::nsIHttpChannel
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
HttpChannelChild::SetRequestHeader(const nsACString& aHeader,
|
|
|
|
const nsACString& aValue,
|
|
|
|
PRBool aMerge)
|
|
|
|
{
|
2010-04-07 01:43:09 -07:00
|
|
|
nsresult rv = HttpBaseChannel::SetRequestHeader(aHeader, aValue, aMerge);
|
2010-03-23 08:14:36 -07:00
|
|
|
if (NS_FAILED(rv))
|
|
|
|
return rv;
|
|
|
|
|
|
|
|
RequestHeaderTuple* tuple = mRequestHeaders.AppendElement();
|
|
|
|
if (!tuple)
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
|
|
|
|
tuple->mHeader = aHeader;
|
|
|
|
tuple->mValue = aValue;
|
|
|
|
tuple->mMerge = aMerge;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
Bug 530952: Electrolysis HTTP Channel implementation. author=jduell, r=bsmedberg, sr=bz
- Supports only primitive xpcshell HTTP requests which don't set/get HTTP
headers, don't do redirects, observers, load groups, or anything else other
than basic things like looking at the reply body, Content-type, Content-length, etc.
- Tested with network/test/unit_ipc/test_simple_wrap.js (patch @ bug 521922)
- Only used if "NECKO_E10S_HTTP" set in environment.
- Force http.h to get #included before any IPDL files, to centralize #define
handling of LOG and to make sure FORCE_PR_LOGGING is set if needed (bug
545995)
2009-09-22 11:55:33 -07:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// HttpChannelChild::nsIHttpChannelInternal
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
HttpChannelChild::SetupFallbackChannel(const char *aFallbackKey)
|
|
|
|
{
|
|
|
|
DROP_DEAD();
|
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
2010-06-23 23:55:19 -07:00
|
|
|
// HttpChannelChild::nsICacheInfoChannel
|
Bug 530952: Electrolysis HTTP Channel implementation. author=jduell, r=bsmedberg, sr=bz
- Supports only primitive xpcshell HTTP requests which don't set/get HTTP
headers, don't do redirects, observers, load groups, or anything else other
than basic things like looking at the reply body, Content-type, Content-length, etc.
- Tested with network/test/unit_ipc/test_simple_wrap.js (patch @ bug 521922)
- Only used if "NECKO_E10S_HTTP" set in environment.
- Force http.h to get #included before any IPDL files, to centralize #define
handling of LOG and to make sure FORCE_PR_LOGGING is set if needed (bug
545995)
2009-09-22 11:55:33 -07:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2010-06-23 23:55:19 -07:00
|
|
|
HttpChannelChild::GetCacheTokenExpirationTime(PRUint32 *_retval)
|
Bug 530952: Electrolysis HTTP Channel implementation. author=jduell, r=bsmedberg, sr=bz
- Supports only primitive xpcshell HTTP requests which don't set/get HTTP
headers, don't do redirects, observers, load groups, or anything else other
than basic things like looking at the reply body, Content-type, Content-length, etc.
- Tested with network/test/unit_ipc/test_simple_wrap.js (patch @ bug 521922)
- Only used if "NECKO_E10S_HTTP" set in environment.
- Force http.h to get #included before any IPDL files, to centralize #define
handling of LOG and to make sure FORCE_PR_LOGGING is set if needed (bug
545995)
2009-09-22 11:55:33 -07:00
|
|
|
{
|
2010-06-23 23:55:19 -07:00
|
|
|
NS_ENSURE_ARG_POINTER(_retval);
|
|
|
|
if (!mCacheEntryAvailable)
|
|
|
|
return NS_ERROR_NOT_AVAILABLE;
|
Bug 530952: Electrolysis HTTP Channel implementation. author=jduell, r=bsmedberg, sr=bz
- Supports only primitive xpcshell HTTP requests which don't set/get HTTP
headers, don't do redirects, observers, load groups, or anything else other
than basic things like looking at the reply body, Content-type, Content-length, etc.
- Tested with network/test/unit_ipc/test_simple_wrap.js (patch @ bug 521922)
- Only used if "NECKO_E10S_HTTP" set in environment.
- Force http.h to get #included before any IPDL files, to centralize #define
handling of LOG and to make sure FORCE_PR_LOGGING is set if needed (bug
545995)
2009-09-22 11:55:33 -07:00
|
|
|
|
2010-06-23 23:55:19 -07:00
|
|
|
*_retval = mCacheExpirationTime;
|
2010-03-27 18:53:46 -07:00
|
|
|
return NS_OK;
|
Bug 530952: Electrolysis HTTP Channel implementation. author=jduell, r=bsmedberg, sr=bz
- Supports only primitive xpcshell HTTP requests which don't set/get HTTP
headers, don't do redirects, observers, load groups, or anything else other
than basic things like looking at the reply body, Content-type, Content-length, etc.
- Tested with network/test/unit_ipc/test_simple_wrap.js (patch @ bug 521922)
- Only used if "NECKO_E10S_HTTP" set in environment.
- Force http.h to get #included before any IPDL files, to centralize #define
handling of LOG and to make sure FORCE_PR_LOGGING is set if needed (bug
545995)
2009-09-22 11:55:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2010-06-23 23:55:19 -07:00
|
|
|
HttpChannelChild::GetCacheTokenCachedCharset(nsACString &_retval)
|
Bug 530952: Electrolysis HTTP Channel implementation. author=jduell, r=bsmedberg, sr=bz
- Supports only primitive xpcshell HTTP requests which don't set/get HTTP
headers, don't do redirects, observers, load groups, or anything else other
than basic things like looking at the reply body, Content-type, Content-length, etc.
- Tested with network/test/unit_ipc/test_simple_wrap.js (patch @ bug 521922)
- Only used if "NECKO_E10S_HTTP" set in environment.
- Force http.h to get #included before any IPDL files, to centralize #define
handling of LOG and to make sure FORCE_PR_LOGGING is set if needed (bug
545995)
2009-09-22 11:55:33 -07:00
|
|
|
{
|
2010-06-23 23:55:19 -07:00
|
|
|
if (!mCacheEntryAvailable)
|
|
|
|
return NS_ERROR_NOT_AVAILABLE;
|
Bug 530952: Electrolysis HTTP Channel implementation. author=jduell, r=bsmedberg, sr=bz
- Supports only primitive xpcshell HTTP requests which don't set/get HTTP
headers, don't do redirects, observers, load groups, or anything else other
than basic things like looking at the reply body, Content-type, Content-length, etc.
- Tested with network/test/unit_ipc/test_simple_wrap.js (patch @ bug 521922)
- Only used if "NECKO_E10S_HTTP" set in environment.
- Force http.h to get #included before any IPDL files, to centralize #define
handling of LOG and to make sure FORCE_PR_LOGGING is set if needed (bug
545995)
2009-09-22 11:55:33 -07:00
|
|
|
|
2010-06-23 23:55:19 -07:00
|
|
|
_retval = mCachedCharset;
|
|
|
|
return NS_OK;
|
Bug 530952: Electrolysis HTTP Channel implementation. author=jduell, r=bsmedberg, sr=bz
- Supports only primitive xpcshell HTTP requests which don't set/get HTTP
headers, don't do redirects, observers, load groups, or anything else other
than basic things like looking at the reply body, Content-type, Content-length, etc.
- Tested with network/test/unit_ipc/test_simple_wrap.js (patch @ bug 521922)
- Only used if "NECKO_E10S_HTTP" set in environment.
- Force http.h to get #included before any IPDL files, to centralize #define
handling of LOG and to make sure FORCE_PR_LOGGING is set if needed (bug
545995)
2009-09-22 11:55:33 -07:00
|
|
|
}
|
|
|
|
NS_IMETHODIMP
|
2010-06-23 23:55:19 -07:00
|
|
|
HttpChannelChild::SetCacheTokenCachedCharset(const nsACString &aCharset)
|
Bug 530952: Electrolysis HTTP Channel implementation. author=jduell, r=bsmedberg, sr=bz
- Supports only primitive xpcshell HTTP requests which don't set/get HTTP
headers, don't do redirects, observers, load groups, or anything else other
than basic things like looking at the reply body, Content-type, Content-length, etc.
- Tested with network/test/unit_ipc/test_simple_wrap.js (patch @ bug 521922)
- Only used if "NECKO_E10S_HTTP" set in environment.
- Force http.h to get #included before any IPDL files, to centralize #define
handling of LOG and to make sure FORCE_PR_LOGGING is set if needed (bug
545995)
2009-09-22 11:55:33 -07:00
|
|
|
{
|
2010-06-23 23:55:19 -07:00
|
|
|
if (!mCacheEntryAvailable)
|
|
|
|
return NS_ERROR_NOT_AVAILABLE;
|
Bug 530952: Electrolysis HTTP Channel implementation. author=jduell, r=bsmedberg, sr=bz
- Supports only primitive xpcshell HTTP requests which don't set/get HTTP
headers, don't do redirects, observers, load groups, or anything else other
than basic things like looking at the reply body, Content-type, Content-length, etc.
- Tested with network/test/unit_ipc/test_simple_wrap.js (patch @ bug 521922)
- Only used if "NECKO_E10S_HTTP" set in environment.
- Force http.h to get #included before any IPDL files, to centralize #define
handling of LOG and to make sure FORCE_PR_LOGGING is set if needed (bug
545995)
2009-09-22 11:55:33 -07:00
|
|
|
|
2010-06-23 23:55:19 -07:00
|
|
|
mCachedCharset = aCharset;
|
|
|
|
if (!SendSetCacheTokenCachedCharset(PromiseFlatCString(aCharset))) {
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
return NS_OK;
|
Bug 530952: Electrolysis HTTP Channel implementation. author=jduell, r=bsmedberg, sr=bz
- Supports only primitive xpcshell HTTP requests which don't set/get HTTP
headers, don't do redirects, observers, load groups, or anything else other
than basic things like looking at the reply body, Content-type, Content-length, etc.
- Tested with network/test/unit_ipc/test_simple_wrap.js (patch @ bug 521922)
- Only used if "NECKO_E10S_HTTP" set in environment.
- Force http.h to get #included before any IPDL files, to centralize #define
handling of LOG and to make sure FORCE_PR_LOGGING is set if needed (bug
545995)
2009-09-22 11:55:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2010-03-27 18:53:46 -07:00
|
|
|
HttpChannelChild::IsFromCache(PRBool *value)
|
Bug 530952: Electrolysis HTTP Channel implementation. author=jduell, r=bsmedberg, sr=bz
- Supports only primitive xpcshell HTTP requests which don't set/get HTTP
headers, don't do redirects, observers, load groups, or anything else other
than basic things like looking at the reply body, Content-type, Content-length, etc.
- Tested with network/test/unit_ipc/test_simple_wrap.js (patch @ bug 521922)
- Only used if "NECKO_E10S_HTTP" set in environment.
- Force http.h to get #included before any IPDL files, to centralize #define
handling of LOG and to make sure FORCE_PR_LOGGING is set if needed (bug
545995)
2009-09-22 11:55:33 -07:00
|
|
|
{
|
2010-03-27 18:53:46 -07:00
|
|
|
if (!mIsPending)
|
|
|
|
return NS_ERROR_NOT_AVAILABLE;
|
|
|
|
|
2010-06-23 23:55:19 -07:00
|
|
|
*value = mIsFromCache;
|
2010-03-27 18:53:46 -07:00
|
|
|
return NS_OK;
|
Bug 530952: Electrolysis HTTP Channel implementation. author=jduell, r=bsmedberg, sr=bz
- Supports only primitive xpcshell HTTP requests which don't set/get HTTP
headers, don't do redirects, observers, load groups, or anything else other
than basic things like looking at the reply body, Content-type, Content-length, etc.
- Tested with network/test/unit_ipc/test_simple_wrap.js (patch @ bug 521922)
- Only used if "NECKO_E10S_HTTP" set in environment.
- Force http.h to get #included before any IPDL files, to centralize #define
handling of LOG and to make sure FORCE_PR_LOGGING is set if needed (bug
545995)
2009-09-22 11:55:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// HttpChannelChild::nsIEncodedChannel
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
HttpChannelChild::GetContentEncodings(nsIUTF8StringEnumerator **result)
|
|
|
|
{
|
|
|
|
DROP_DEAD();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* attribute boolean applyConversion; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
HttpChannelChild::GetApplyConversion(PRBool *aApplyConversion)
|
|
|
|
{
|
|
|
|
DROP_DEAD();
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
HttpChannelChild::SetApplyConversion(PRBool aApplyConversion)
|
|
|
|
{
|
|
|
|
DROP_DEAD();
|
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// HttpChannelChild::nsIResumableChannel
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
HttpChannelChild::ResumeAt(PRUint64 startPos, const nsACString& entityID)
|
|
|
|
{
|
|
|
|
DROP_DEAD();
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
HttpChannelChild::GetEntityID(nsACString& aEntityID)
|
|
|
|
{
|
|
|
|
DROP_DEAD();
|
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// HttpChannelChild::nsISupportsPriority
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
HttpChannelChild::SetPriority(PRInt32 aPriority)
|
|
|
|
{
|
2010-04-10 21:53:35 -07:00
|
|
|
PRInt16 newValue = CLAMP(aPriority, PR_INT16_MIN, PR_INT16_MAX);
|
|
|
|
if (mPriority == newValue)
|
|
|
|
return NS_OK;
|
|
|
|
mPriority = newValue;
|
|
|
|
if (mWasOpened)
|
|
|
|
SendSetPriority(mPriority);
|
|
|
|
return NS_OK;
|
Bug 530952: Electrolysis HTTP Channel implementation. author=jduell, r=bsmedberg, sr=bz
- Supports only primitive xpcshell HTTP requests which don't set/get HTTP
headers, don't do redirects, observers, load groups, or anything else other
than basic things like looking at the reply body, Content-type, Content-length, etc.
- Tested with network/test/unit_ipc/test_simple_wrap.js (patch @ bug 521922)
- Only used if "NECKO_E10S_HTTP" set in environment.
- Force http.h to get #included before any IPDL files, to centralize #define
handling of LOG and to make sure FORCE_PR_LOGGING is set if needed (bug
545995)
2009-09-22 11:55:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// HttpChannelChild::nsIProxiedChannel
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
HttpChannelChild::GetProxyInfo(nsIProxyInfo **aProxyInfo)
|
|
|
|
{
|
|
|
|
DROP_DEAD();
|
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// HttpChannelChild::nsITraceableChannel
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
HttpChannelChild::SetNewListener(nsIStreamListener *listener,
|
|
|
|
nsIStreamListener **oldListener)
|
|
|
|
{
|
|
|
|
DROP_DEAD();
|
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// HttpChannelChild::nsIApplicationCacheContainer
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
HttpChannelChild::GetApplicationCache(nsIApplicationCache **aApplicationCache)
|
|
|
|
{
|
|
|
|
DROP_DEAD();
|
|
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
|
|
HttpChannelChild::SetApplicationCache(nsIApplicationCache *aApplicationCache)
|
|
|
|
{
|
|
|
|
DROP_DEAD();
|
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// HttpChannelChild::nsIApplicationCacheChannel
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
HttpChannelChild::GetLoadedFromApplicationCache(PRBool *retval)
|
|
|
|
{
|
2010-03-27 18:53:46 -07:00
|
|
|
// FIXME: stub for bug 536295
|
|
|
|
*retval = 0;
|
|
|
|
return NS_OK;
|
Bug 530952: Electrolysis HTTP Channel implementation. author=jduell, r=bsmedberg, sr=bz
- Supports only primitive xpcshell HTTP requests which don't set/get HTTP
headers, don't do redirects, observers, load groups, or anything else other
than basic things like looking at the reply body, Content-type, Content-length, etc.
- Tested with network/test/unit_ipc/test_simple_wrap.js (patch @ bug 521922)
- Only used if "NECKO_E10S_HTTP" set in environment.
- Force http.h to get #included before any IPDL files, to centralize #define
handling of LOG and to make sure FORCE_PR_LOGGING is set if needed (bug
545995)
2009-09-22 11:55:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
HttpChannelChild::GetInheritApplicationCache(PRBool *aInheritApplicationCache)
|
|
|
|
{
|
|
|
|
DROP_DEAD();
|
|
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
|
|
HttpChannelChild::SetInheritApplicationCache(PRBool aInheritApplicationCache)
|
|
|
|
{
|
|
|
|
// FIXME: Browser calls this early, so stub OK for now. Fix in bug 536295.
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
HttpChannelChild::GetChooseApplicationCache(PRBool *aChooseApplicationCache)
|
|
|
|
{
|
|
|
|
DROP_DEAD();
|
|
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
|
|
HttpChannelChild::SetChooseApplicationCache(PRBool aChooseApplicationCache)
|
|
|
|
{
|
|
|
|
// FIXME: Browser calls this early, so stub OK for now. Fix in bug 536295.
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
2009-08-18 12:05:15 -07:00
|
|
|
}} // mozilla::net
|
|
|
|
|