mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-26 17:17:31 +09:00
Merge remote-tracking branch 'origin/tracking' into custom
This commit is contained in:
commit
de0b4ac202
15 changed files with 437 additions and 77 deletions
|
|
@ -520,6 +520,12 @@ bool NS_IsValidHTTPToken(const nsACString &aToken)
|
|||
return mozilla::net::nsHttp::IsValidToken(aToken);
|
||||
}
|
||||
|
||||
void
|
||||
NS_TrimHTTPWhitespace(const nsACString& aSource, nsACString& aDest)
|
||||
{
|
||||
mozilla::net::nsHttp::TrimHTTPWhitespace(aSource, aDest);
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_NewLoadGroup(nsILoadGroup **aResult, nsIPrincipal *aPrincipal)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -959,6 +959,11 @@ bool NS_IsReasonableHTTPHeaderValue(const nsACString &aValue);
|
|||
*/
|
||||
bool NS_IsValidHTTPToken(const nsACString &aToken);
|
||||
|
||||
/**
|
||||
* Strip the leading or trailing HTTP whitespace per fetch spec section 2.2.
|
||||
*/
|
||||
void NS_TrimHTTPWhitespace(const nsACString& aSource, nsACString& aDest);
|
||||
|
||||
/**
|
||||
* Return true if the given request must be upgraded to HTTPS.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -245,6 +245,18 @@ nsHttp::GetProtocolVersion(uint32_t pv)
|
|||
}
|
||||
}
|
||||
|
||||
// static
|
||||
void
|
||||
nsHttp::TrimHTTPWhitespace(const nsACString& aSource, nsACString& aDest)
|
||||
{
|
||||
nsAutoCString str(aSource);
|
||||
|
||||
// HTTP whitespace 0x09: '\t', 0x0A: '\n', 0x0D: '\r', 0x20: ' '
|
||||
static const char kHTTPWhitespace[] = "\t\n\r ";
|
||||
str.Trim(kHTTPWhitespace);
|
||||
aDest.Assign(str);
|
||||
}
|
||||
|
||||
// static
|
||||
bool
|
||||
nsHttp::IsReasonableHeaderValue(const nsACString &s)
|
||||
|
|
|
|||
|
|
@ -148,6 +148,10 @@ struct nsHttp
|
|||
static inline bool IsValidToken(const nsACString &s) {
|
||||
return IsValidToken(s.BeginReading(), s.EndReading());
|
||||
}
|
||||
|
||||
// Strip the leading or trailing HTTP whitespace per fetch spec section 2.2.
|
||||
static void TrimHTTPWhitespace(const nsACString& aSource,
|
||||
nsACString& aDest);
|
||||
|
||||
// Returns true if the specified value is reasonable given the defintion
|
||||
// in RFC 2616 section 4.2. Full strict validation is not performed
|
||||
|
|
|
|||
|
|
@ -2313,6 +2313,16 @@ WebSocketChannel::CleanupConnection()
|
|||
{
|
||||
LOG(("WebSocketChannel::CleanupConnection() %p", this));
|
||||
|
||||
// This should run on the Socket Thread to prevent potential races.
|
||||
bool onSocketThread;
|
||||
nsresult rv = mSocketThread->IsOnCurrentThread(&onSocketThread);
|
||||
if (NS_SUCCEEDED(rv) && !onSocketThread) {
|
||||
mSocketThread->Dispatch(
|
||||
NewRunnableMethod(this, &WebSocketChannel::CleanupConnection),
|
||||
NS_DISPATCH_NORMAL);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mLingeringCloseTimer) {
|
||||
mLingeringCloseTimer->Cancel();
|
||||
mLingeringCloseTimer = nullptr;
|
||||
|
|
|
|||
|
|
@ -181,11 +181,13 @@ static bool scanArp(char *ip, char *mac, size_t maclen)
|
|||
if (st == 0 || errno != ENOMEM) {
|
||||
break;
|
||||
}
|
||||
needed += needed / 8;
|
||||
size_t increased = needed;
|
||||
increased += increased / 8;
|
||||
|
||||
auto tmp = MakeUnique<char[]>(needed);
|
||||
auto tmp = MakeUnique<char[]>(increased);
|
||||
memcpy(&tmp[0], &buf[0], needed);
|
||||
buf = Move(tmp);
|
||||
needed = increased;
|
||||
}
|
||||
if (st == -1) {
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue