[cpp-sp COMMIT] in /branches/REL_2_4: Shibboleth.sln isapi_shib/isapi_shib.cpp isapi_shib/isapi_shib.rc
noreply at shibboleth.net
noreply at shibboleth.net
Wed Nov 2 03:22:22 GMT 2011
Author: scantor
Date: Wed Nov 2 03:22:22 2011
New Revision: 3536
URL: http://svn.shibboleth.net/view/cpp-sp?rev=3536&view=rev
Log:
https://issues.shibboleth.net/jira/browse/SSPCPP-401
Modified:
branches/REL_2_4/Shibboleth.sln
branches/REL_2_4/isapi_shib/isapi_shib.cpp
branches/REL_2_4/isapi_shib/isapi_shib.rc
Modified: branches/REL_2_4/Shibboleth.sln
URL: http://svn.shibboleth.net/view/cpp-sp/branches/REL_2_4/Shibboleth.sln?rev=3536&r1=3535&r2=3536&view=diff
==============================================================================
--- branches/REL_2_4/Shibboleth.sln (original)
+++ branches/REL_2_4/Shibboleth.sln Wed Nov 2 03:22:22 2011
@@ -252,10 +252,8 @@
{B2423DCE-048D-4BAA-9AB9-F5D1FCDD3D25}.Release|x64.ActiveCfg = Release|x64
{B2423DCE-048D-4BAA-9AB9-F5D1FCDD3D25}.Release|x64.Build.0 = Release|x64
{666A63A7-983F-4C19-8411-207F24305198}.Debug|Win32.ActiveCfg = Debug|Win32
- {666A63A7-983F-4C19-8411-207F24305198}.Debug|Win32.Build.0 = Debug|Win32
{666A63A7-983F-4C19-8411-207F24305198}.Debug|x64.ActiveCfg = Debug|x64
{666A63A7-983F-4C19-8411-207F24305198}.Release|Win32.ActiveCfg = Release|Win32
- {666A63A7-983F-4C19-8411-207F24305198}.Release|Win32.Build.0 = Release|Win32
{666A63A7-983F-4C19-8411-207F24305198}.Release|x64.ActiveCfg = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
Modified: branches/REL_2_4/isapi_shib/isapi_shib.cpp
URL: http://svn.shibboleth.net/view/cpp-sp/branches/REL_2_4/isapi_shib/isapi_shib.cpp?rev=3536&r1=3535&r2=3536&view=diff
==============================================================================
--- branches/REL_2_4/isapi_shib/isapi_shib.cpp (original)
+++ branches/REL_2_4/isapi_shib/isapi_shib.cpp Wed Nov 2 03:22:22 2011
@@ -321,61 +321,6 @@
return strcmp(bufptr,s)==0;
}
-void GetServerVariable(PHTTP_FILTER_CONTEXT pfc, LPSTR lpszVariable, dynabuf& s, DWORD size=80, bool bRequired=true)
-{
- s.reserve(size);
- s.erase();
- size=s.size();
-
- while (!pfc->GetServerVariable(pfc,lpszVariable,s,&size)) {
- // Grumble. Check the error.
- DWORD e=GetLastError();
- if (e==ERROR_INSUFFICIENT_BUFFER)
- s.reserve(size);
- else
- break;
- }
- if (bRequired && s.empty())
- throw ERROR_NO_DATA;
-}
-
-void GetServerVariable(LPEXTENSION_CONTROL_BLOCK lpECB, LPSTR lpszVariable, dynabuf& s, DWORD size=80, bool bRequired=true)
-{
- s.reserve(size);
- s.erase();
- size=s.size();
-
- while (!lpECB->GetServerVariable(lpECB->ConnID,lpszVariable,s,&size)) {
- // Grumble. Check the error.
- DWORD e=GetLastError();
- if (e==ERROR_INSUFFICIENT_BUFFER)
- s.reserve(size);
- else
- break;
- }
- if (bRequired && s.empty())
- throw ERROR_NO_DATA;
-}
-
-void GetHeader(PHTTP_FILTER_PREPROC_HEADERS pn, PHTTP_FILTER_CONTEXT pfc,
- LPSTR lpszName, dynabuf& s, DWORD size=80, bool bRequired=true)
-{
- s.reserve(size);
- s.erase();
- size=s.size();
-
- while (!pn->GetHeader(pfc,lpszName,s,&size)) {
- // Grumble. Check the error.
- DWORD e=GetLastError();
- if (e==ERROR_INSUFFICIENT_BUFFER)
- s.reserve(size);
- else
- break;
- }
- if (bRequired && s.empty())
- throw ERROR_NO_DATA;
-}
-
/****************************************************************************/
// ISAPI Filter
@@ -396,13 +341,18 @@
// URL path always come from IIS.
dynabuf var(256);
- GetHeader(pn,pfc,"url",var,256,false);
+ GetHeader("url",var,256,false);
setRequestURI(var);
// Port may come from IIS or from site def.
if (!g_bNormalizeRequest || (pfc->fIsSecurePort && site.m_sslport.empty()) || (!pfc->fIsSecurePort && site.m_port.empty())) {
- GetServerVariable(pfc,"SERVER_PORT",var,10);
- m_port = atoi(var);
+ GetServerVariable("SERVER_PORT",var,10);
+ if (var.empty()) {
+ m_port = pfc->fIsSecurePort ? 443 : 80;
+ }
+ else {
+ m_port = atoi(var);
+ }
}
else if (pfc->fIsSecurePort) {
m_port = atoi(site.m_sslport.c_str());
@@ -416,15 +366,20 @@
if (m_scheme.empty() || !g_bNormalizeRequest)
m_scheme=pfc->fIsSecurePort ? "https" : "http";
- GetServerVariable(pfc,"SERVER_NAME",var,32);
-
- // Make sure SERVER_NAME is "authorized" for use on this site. If not, set to canonical name.
- m_hostname = var;
- if (site.m_name!=m_hostname && site.m_aliases.find(m_hostname)==site.m_aliases.end())
- m_hostname=site.m_name;
+ GetServerVariable("SERVER_NAME",var,32);
+
+ // Make sure SERVER_NAME is "authorized" for use on this site. If not, or empty, set to canonical name.
+ if (var.empty()) {
+ m_hostname = site.m_name;
+ }
+ else {
+ m_hostname = var;
+ if (site.m_name!=m_hostname && site.m_aliases.find(m_hostname)==site.m_aliases.end())
+ m_hostname=site.m_name;
+ }
if (!g_spoofKey.empty()) {
[... 362 lines stripped ...]
More information about the commits
mailing list