off = pReq->m_pHeaderIndex->m_headerOff[ headerIndex ];
if ( !off )
return NULL;
- if ( *(pReq->m_pHttpHeader + off +
- pReq->m_pHeaderIndex->m_headerLen[ headerIndex ]) )
- *( pReq->m_pHttpHeader + off +
- pReq->m_pHeaderIndex->m_headerLen[ headerIndex ]) = 0;
+ if ( *(pReq->m_pHttpHeader + off
+ + pReq->m_pHeaderIndex->m_headerLen[ headerIndex ]) )
+ {
+ *( pReq->m_pHttpHeader + off
+ + pReq->m_pHeaderIndex->m_headerLen[ headerIndex ]) = 0;
+ }
return pReq->m_pHttpHeader + off;
}
static char * GetHeaderVar( LSAPI_Request * pReq, const char * name )
{
int i;
+ char * pValue;
for( i = 0; i < H_TRANSFER_ENCODING; ++i )
{
if ( pReq->m_pHeaderIndex->m_headerOff[i] )
{
if ( strcmp( name, CGI_HEADERS[i] ) == 0 )
- return pReq->m_pHttpHeader + pReq->m_pHeaderIndex->m_headerOff[i];
+ {
+ pValue = pReq->m_pHttpHeader
+ + pReq->m_pHeaderIndex->m_headerOff[i];
+ if ( *(pValue + pReq->m_pHeaderIndex->m_headerLen[i]) != '\0')
+ {
+ *(pValue + pReq->m_pHeaderIndex->m_headerLen[i]) = '\0';
+ }
+ return pValue;
+ }
}
}
if ( pReq->m_pHeader->m_cntUnknownHeaders > 0 )
++p; ++pKey;
}
if (( pKey == pKeyEnd )&& (!*p ))
- return pReq->m_pHttpHeader + pCur->valueOff;
+ {
+ pValue = pReq->m_pHttpHeader + pCur->valueOff;
+
+ if ( *(pValue + pCur->valueLen) != '\0')
+ {
+ *(pValue + pCur->valueLen) = '\0';
+ }
+ return pValue;
+ }
++pCur;
}
}