2009-08-18 23:05:15 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set sw=2 ts=8 et tw=80 ft=cpp : */
|
|
|
|
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2009-08-18 23:05:15 +04:00
|
|
|
|
2010-04-27 11:12:38 +04:00
|
|
|
include protocol PNecko;
|
2017-09-08 03:28:27 +03:00
|
|
|
include protocol PStreamFilter;
|
2012-08-23 23:33:46 +04:00
|
|
|
include InputStreamParams;
|
|
|
|
include URIParams;
|
2015-09-02 02:42:59 +03:00
|
|
|
include PBackgroundSharedTypes;
|
2015-12-07 02:33:14 +03:00
|
|
|
include NeckoChannelParams;
|
2018-01-23 18:38:52 +03:00
|
|
|
include IPCServiceWorkerDescriptor;
|
2009-08-18 23:05:15 +04:00
|
|
|
|
2010-04-26 19:24:21 +04:00
|
|
|
include "mozilla/net/NeckoMessageUtils.h";
|
2012-08-23 06:13:54 +04:00
|
|
|
|
2013-10-01 23:25:07 +04:00
|
|
|
using class nsHttpHeaderArray from "nsHttpHeaderArray.h";
|
|
|
|
using mozilla::net::NetAddr from "mozilla/net/DNS.h";
|
2014-10-06 13:31:29 +04:00
|
|
|
using struct mozilla::net::ResourceTimingStruct from "mozilla/net/TimingStruct.h";
|
2010-03-23 18:14:36 +03:00
|
|
|
|
2009-08-18 23:05:15 +04:00
|
|
|
namespace mozilla {
|
|
|
|
namespace net {
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------
|
|
|
|
protocol PHttpChannel
|
|
|
|
{
|
|
|
|
manager PNecko;
|
|
|
|
|
|
|
|
parent:
|
2013-06-22 20:09:19 +04:00
|
|
|
// Note: channels are opened during construction, so no open method here:
|
|
|
|
// see PNecko.ipdl
|
2010-11-24 01:56:06 +03:00
|
|
|
|
2016-01-27 00:51:53 +03:00
|
|
|
async SetClassOfService(uint32_t cos);
|
2010-04-11 08:53:35 +04:00
|
|
|
|
2016-01-27 00:51:53 +03:00
|
|
|
async SetCacheTokenCachedCharset(nsCString charset);
|
2010-06-24 10:55:19 +04:00
|
|
|
|
2016-01-27 00:51:53 +03:00
|
|
|
async UpdateAssociatedContentSecurity(int32_t broken,
|
|
|
|
int32_t no);
|
|
|
|
async Suspend();
|
|
|
|
async Resume();
|
2010-08-11 07:07:09 +04:00
|
|
|
|
2016-01-27 00:51:53 +03:00
|
|
|
async Cancel(nsresult status);
|
2010-08-12 13:05:16 +04:00
|
|
|
|
2010-08-11 07:11:57 +04:00
|
|
|
// Reports approval/veto of redirect by child process redirect observers
|
2016-01-27 00:51:53 +03:00
|
|
|
async Redirect2Verify(nsresult result, RequestHeaderTuples changedHeaders,
|
2018-06-04 19:26:51 +03:00
|
|
|
ChildLoadInfoForwarderArgs loadInfoForwarder,
|
2016-11-14 10:15:32 +03:00
|
|
|
uint32_t loadFlags, uint32_t referrerPolicy,
|
|
|
|
OptionalURIParams referrerUri,
|
|
|
|
OptionalURIParams apiRedirectTo,
|
Bug 1246540 - HSTS Priming Proof of Concept. r=ckerschb, r=mayhemer, r=jld, r=smaug, r=dkeeler, r=jmaher, p=ally
HSTS priming changes the order of mixed-content blocking and HSTS
upgrades, and adds a priming request to check if a mixed-content load is
accesible over HTTPS and the server supports upgrading via the
Strict-Transport-Security header.
Every call site that uses AsyncOpen2 passes through the mixed-content
blocker, and has a LoadInfo. If the mixed-content blocker marks the load as
needing HSTS priming, nsHttpChannel will build and send an HSTS priming
request on the same URI with the scheme upgraded to HTTPS. If the server
allows the upgrade, then channel performs an internal redirect to the HTTPS URI,
otherwise use the result of mixed-content blocker to allow or block the
load.
nsISiteSecurityService adds an optional boolean out parameter to
determine if the HSTS state is already cached for negative assertions.
If the host has been probed within the previous 24 hours, no HSTS
priming check will be sent.
MozReview-Commit-ID: ES1JruCtDdX
--HG--
extra : rebase_source : 2ac6c93c49f2862fc0b9e595eb0598cd1ea4bedf
2016-09-27 18:27:00 +03:00
|
|
|
OptionalCorsPreflightArgs corsPreflightArgs,
|
2016-10-27 13:13:00 +03:00
|
|
|
bool chooseAppcache);
|
2010-08-11 07:11:57 +04:00
|
|
|
|
2010-08-18 02:17:00 +04:00
|
|
|
// For document loads we keep this protocol open after child's
|
|
|
|
// OnStopRequest, and send this msg (instead of __delete__) to allow
|
2013-05-16 17:30:42 +04:00
|
|
|
// partial cleanup on parent.
|
2017-10-26 16:54:37 +03:00
|
|
|
async DocumentChannelCleanup(bool clearCacheEntry);
|
2010-08-18 02:17:00 +04:00
|
|
|
|
2010-10-20 21:12:32 +04:00
|
|
|
// This might have to be sync. If this fails we must fail the document load
|
|
|
|
// to avoid endless loop.
|
|
|
|
//
|
|
|
|
// Explanation: the document loaded was loaded from the offline cache. But
|
2013-05-16 17:30:42 +04:00
|
|
|
// the cache group id (the manifest URL) of the cache group it was loaded
|
|
|
|
// from is different then the manifest the document refers to in the html
|
|
|
|
// tag. If we detect this during the cache selection algorithm, we must not
|
2010-10-20 21:12:32 +04:00
|
|
|
// load this document from the offline cache group it was just loaded from.
|
|
|
|
// Marking the cache entry as foreign in its cache group will prevent
|
|
|
|
// the document to load from the bad offline cache group. After it is marked,
|
2013-05-16 17:30:42 +04:00
|
|
|
// we reload the document to take the effect. If we fail to mark the entry
|
2010-10-20 21:12:32 +04:00
|
|
|
// as foreign, we will end up in the same situation and reload again and
|
|
|
|
// again, indefinitely.
|
2016-01-27 00:51:53 +03:00
|
|
|
async MarkOfflineCacheEntryAsForeign();
|
2010-10-20 21:12:32 +04:00
|
|
|
|
2014-03-11 02:04:28 +04:00
|
|
|
// Divert OnDataAvailable to the parent.
|
2016-01-27 00:51:53 +03:00
|
|
|
async DivertOnDataAvailable(nsCString data,
|
|
|
|
uint64_t offset,
|
|
|
|
uint32_t count);
|
2014-03-11 02:04:28 +04:00
|
|
|
|
|
|
|
// Divert OnStopRequest to the parent.
|
2016-01-27 00:51:53 +03:00
|
|
|
async DivertOnStopRequest(nsresult statusCode);
|
2014-03-11 02:04:28 +04:00
|
|
|
|
|
|
|
// Child has no more events/messages to divert to the parent.
|
2016-01-27 00:51:53 +03:00
|
|
|
async DivertComplete();
|
2014-03-11 02:04:28 +04:00
|
|
|
|
2015-09-02 02:42:59 +03:00
|
|
|
// Child has detected a CORS check failure, so needs to tell the parent
|
|
|
|
// to remove any matching entry from the CORS preflight cache.
|
2016-01-27 00:51:53 +03:00
|
|
|
async RemoveCorsPreflightCacheEntry(URIParams uri,
|
|
|
|
PrincipalInfo requestingPrincipal);
|
2015-09-02 02:42:59 +03:00
|
|
|
|
2016-10-28 05:30:58 +03:00
|
|
|
// After receiving this message, the parent calls SendDeleteSelf, and makes
|
|
|
|
// sure not to send any more messages after that.
|
|
|
|
async DeletingChannel();
|
|
|
|
|
2016-01-27 00:51:53 +03:00
|
|
|
async __delete__();
|
2010-09-15 23:26:15 +04: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 22:55:33 +04:00
|
|
|
child:
|
2016-01-27 00:51:53 +03:00
|
|
|
async OnStartRequest(nsresult channelStatus,
|
|
|
|
nsHttpResponseHead responseHead,
|
|
|
|
bool useResponseHead,
|
|
|
|
nsHttpHeaderArray requestHeaders,
|
2018-03-06 09:07:00 +03:00
|
|
|
ParentLoadInfoForwarderArgs loadInfoForwarder,
|
2016-01-27 00:51:53 +03:00
|
|
|
bool isFromCache,
|
|
|
|
bool cacheEntryAvailable,
|
2017-10-12 09:25:00 +03:00
|
|
|
uint64_t cacheEntryId,
|
2017-06-05 15:06:19 +03:00
|
|
|
int32_t cacheFetchCount,
|
2016-01-27 00:51:53 +03:00
|
|
|
uint32_t cacheExpirationTime,
|
|
|
|
nsCString cachedCharset,
|
|
|
|
nsCString securityInfoSerialization,
|
|
|
|
NetAddr selfAddr,
|
|
|
|
NetAddr peerAddr,
|
|
|
|
int16_t redirectCount,
|
2016-04-11 06:17:02 +03:00
|
|
|
uint32_t cacheKey,
|
2017-03-13 14:06:55 +03:00
|
|
|
nsCString altDataType,
|
2018-01-23 18:38:52 +03:00
|
|
|
int64_t altDataLength,
|
2018-06-13 04:02:23 +03:00
|
|
|
bool applyConversion,
|
|
|
|
ResourceTimingStruct timing);
|
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 22:55:33 +04:00
|
|
|
|
2010-08-12 13:05:16 +04:00
|
|
|
// Used to cancel child channel if we hit errors during creating and
|
|
|
|
// AsyncOpen of nsHttpChannel on the parent.
|
2016-01-27 00:51:53 +03:00
|
|
|
async FailedAsyncOpen(nsresult status);
|
2010-08-12 13:05:16 +04:00
|
|
|
|
2010-08-11 07:11:57 +04:00
|
|
|
// Called to initiate content channel redirect, starts talking to sinks
|
2010-10-09 09:07:58 +04:00
|
|
|
// on the content process and reports result via Redirect2Verify above
|
2016-06-01 22:29:21 +03:00
|
|
|
async Redirect1Begin(uint32_t registrarId,
|
2017-07-05 18:24:00 +03:00
|
|
|
URIParams newOriginalUri,
|
2018-06-13 16:41:47 +03:00
|
|
|
uint32_t newLoadFlags,
|
2016-01-27 00:51:53 +03:00
|
|
|
uint32_t redirectFlags,
|
2018-03-06 09:07:00 +03:00
|
|
|
ParentLoadInfoForwarderArgs loadInfoForwarder,
|
2016-01-27 00:51:53 +03:00
|
|
|
nsHttpResponseHead responseHead,
|
2016-06-01 22:29:21 +03:00
|
|
|
nsCString securityInfoSerialization,
|
2017-05-25 20:42:00 +03:00
|
|
|
uint64_t channelId,
|
|
|
|
NetAddr oldPeerAddr);
|
2010-10-09 09:07:58 +04:00
|
|
|
|
2010-08-11 07:11:57 +04:00
|
|
|
// Called if redirect successful so that child can complete setup.
|
2016-01-27 00:51:53 +03:00
|
|
|
async Redirect3Complete();
|
2010-08-11 07:11:57 +04:00
|
|
|
|
2014-11-12 02:05:55 +03:00
|
|
|
// Associate the child with an application ids
|
2016-01-27 00:51:53 +03:00
|
|
|
async AssociateApplicationCache(nsCString groupID,
|
|
|
|
nsCString clientID);
|
2010-10-20 21:12:32 +04:00
|
|
|
|
2015-04-20 21:42:09 +03:00
|
|
|
// Report a security message to the console associated with this
|
|
|
|
// channel.
|
2016-01-27 00:51:53 +03:00
|
|
|
async ReportSecurityMessage(nsString messageTag, nsString messageCategory);
|
2015-04-20 21:42:09 +03:00
|
|
|
|
2010-10-09 09:07:58 +04:00
|
|
|
// Tell child to delete channel (all IPDL deletes must be done from child to
|
|
|
|
// avoid races: see bug 591708).
|
2016-01-27 00:51:53 +03:00
|
|
|
async DeleteSelf();
|
2015-09-14 20:29:52 +03:00
|
|
|
|
|
|
|
// Tell the child to issue a deprecation warning.
|
2016-01-27 00:51:53 +03:00
|
|
|
async IssueDeprecationWarning(uint32_t warning, bool asError);
|
2016-10-28 05:30:58 +03:00
|
|
|
|
2017-02-15 06:40:41 +03:00
|
|
|
// When CORS blocks the request in the parent process, it doesn't have the
|
|
|
|
// correct window ID, so send the message to the child for logging to the web
|
|
|
|
// console.
|
2018-07-20 20:57:41 +03:00
|
|
|
async LogBlockedCORSRequest(nsString message, nsCString category);
|
2017-02-15 06:40:41 +03:00
|
|
|
|
2017-09-08 03:28:27 +03:00
|
|
|
async AttachStreamFilter(Endpoint<PStreamFilterParent> aEndpoint);
|
|
|
|
|
2018-01-05 02:38:07 +03:00
|
|
|
// See ADivertableParentChannel::CancelDiversion
|
|
|
|
async CancelDiversion();
|
|
|
|
|
2016-10-28 05:30:58 +03:00
|
|
|
both:
|
|
|
|
// After receiving this message, the parent also calls
|
|
|
|
// SendFinishInterceptedRedirect, and makes sure not to send any more messages
|
|
|
|
// after that. When receiving this message, the child will call
|
|
|
|
// Send__delete__() and complete the steps required to finish the redirect.
|
|
|
|
async FinishInterceptedRedirect();
|
2016-12-17 01:15:16 +03:00
|
|
|
|
2017-02-09 12:28:54 +03:00
|
|
|
async SetPriority(int16_t priority);
|
2009-08-18 23:05:15 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace net
|
|
|
|
} // namespace mozilla
|