This repository has been archived by the owner on Jun 20, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add features: flowing authentication info, hosting environment variab…
…le support; fix client disconnect and app_offline issues (#102) resubmit
- Loading branch information
Showing
18 changed files
with
2,209 additions
and
1,780 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the MIT License. See License.txt in the project root for license information. | ||
|
||
#pragma once | ||
|
||
// | ||
// The key used for hash-table lookups, consists of the port on which the http process is created. | ||
// | ||
|
||
class ENVIRONMENT_VAR_ENTRY | ||
{ | ||
public: | ||
ENVIRONMENT_VAR_ENTRY(): | ||
_cRefs(1) | ||
{ | ||
} | ||
|
||
HRESULT | ||
Initialize( | ||
PCWSTR pszName, | ||
PCWSTR pszValue | ||
) | ||
{ | ||
HRESULT hr = S_OK; | ||
if (FAILED(hr = _strName.Copy(pszName)) || | ||
FAILED(hr = _strValue.Copy(pszValue))) | ||
{ | ||
} | ||
return hr; | ||
} | ||
|
||
VOID | ||
Reference() const | ||
{ | ||
InterlockedIncrement(&_cRefs); | ||
} | ||
|
||
VOID | ||
Dereference() const | ||
{ | ||
if (InterlockedDecrement(&_cRefs) == 0) | ||
{ | ||
delete this; | ||
} | ||
} | ||
|
||
PWSTR const | ||
QueryName() | ||
{ | ||
return _strName.QueryStr(); | ||
} | ||
|
||
PWSTR const | ||
QueryValue() | ||
{ | ||
return _strValue.QueryStr(); | ||
} | ||
|
||
private: | ||
~ENVIRONMENT_VAR_ENTRY() | ||
{ | ||
} | ||
|
||
STRU _strName; | ||
STRU _strValue; | ||
mutable LONG _cRefs; | ||
}; | ||
|
||
class ENVIRONMENT_VAR_HASH : public HASH_TABLE<ENVIRONMENT_VAR_ENTRY, PWSTR> | ||
{ | ||
public: | ||
ENVIRONMENT_VAR_HASH() | ||
{} | ||
|
||
PWSTR | ||
ExtractKey( | ||
ENVIRONMENT_VAR_ENTRY * pEntry | ||
) | ||
{ | ||
return pEntry->QueryName(); | ||
} | ||
|
||
DWORD | ||
CalcKeyHash( | ||
PWSTR pszName | ||
) | ||
{ | ||
return HashStringNoCase(pszName); | ||
} | ||
|
||
BOOL | ||
EqualKeys( | ||
PWSTR pszName1, | ||
PWSTR pszName2 | ||
) | ||
{ | ||
return (_wcsicmp(pszName1, pszName2) == 0); | ||
} | ||
|
||
VOID | ||
ReferenceRecord( | ||
ENVIRONMENT_VAR_ENTRY * pEntry | ||
) | ||
{ | ||
pEntry->Reference(); | ||
} | ||
|
||
VOID | ||
DereferenceRecord( | ||
ENVIRONMENT_VAR_ENTRY * pEntry | ||
) | ||
{ | ||
pEntry->Dereference(); | ||
} | ||
|
||
static | ||
VOID | ||
CopyToMultiSz( | ||
ENVIRONMENT_VAR_ENTRY * pEntry, | ||
PVOID pvData | ||
) | ||
{ | ||
STRU strTemp; | ||
MULTISZ *pMultiSz = static_cast<MULTISZ *>(pvData); | ||
strTemp.Copy(pEntry->QueryName()); | ||
strTemp.Append(pEntry->QueryValue()); | ||
pMultiSz->Append(strTemp.QueryStr()); | ||
} | ||
|
||
static | ||
VOID | ||
CopyToTable( | ||
ENVIRONMENT_VAR_ENTRY * pEntry, | ||
PVOID pvData | ||
) | ||
{ | ||
ENVIRONMENT_VAR_ENTRY * pNewEntry = new ENVIRONMENT_VAR_ENTRY(); | ||
pNewEntry->Initialize(pEntry->QueryName(), pEntry->QueryValue()); | ||
ENVIRONMENT_VAR_HASH *pHash = static_cast<ENVIRONMENT_VAR_HASH *>(pvData); | ||
pHash->InsertRecord(pNewEntry); | ||
} | ||
|
||
private: | ||
ENVIRONMENT_VAR_HASH(const ENVIRONMENT_VAR_HASH &); | ||
void operator=(const ENVIRONMENT_VAR_HASH &); | ||
}; |
Oops, something went wrong.