コード例 #1
0
/* Static helper function to perform a resolve without mucking about with this class */
XalanDOMString XalanParsedURI::resolve(
	const XalanDOMChar			*relative,
	XalanDOMString::size_type	relativeLen,
	const XalanDOMChar			*base,
	XalanDOMString::size_type	baseLen
)
{
	XalanParsedURI relativeURI(relative, relativeLen);
	XalanParsedURI baseURI(base, baseLen);

	relativeURI.resolve(baseURI);
	return relativeURI.make();
}
コード例 #2
0
ファイル: XalanParsedURI.cpp プロジェクト: apache/xalan-c
/* Static helper function to perform a resolve without mucking about with this class */
XalanDOMString& XalanParsedURI::resolve(
    const XalanDOMChar          *relative,
    XalanDOMString::size_type   relativeLen,
    const XalanDOMChar          *base,
    XalanDOMString::size_type   baseLen,
    XalanDOMString&             theResult
)
{
    XalanParsedURI relativeURI(relative, relativeLen, theResult.getMemoryManager());
    XalanParsedURI baseURI(base, baseLen, theResult.getMemoryManager());

    relativeURI.resolve(baseURI);
    return relativeURI.make(theResult);
}
コード例 #3
0
ファイル: HTTPRequest.cpp プロジェクト: Josok/EasyDarwin
QTSS_Error HTTPRequest::ParseURI(StringParser* parser)
{

    // read in the complete URL into fRequestAbsURI
    parser->ConsumeUntil(&fAbsoluteURI, sURLStopConditions);
  
    StringParser urlParser(&fAbsoluteURI);
  
    // we always should have a slash before the URI
    // If not, that indicates this is a full URI
    if (fAbsoluteURI.Ptr[0] != '/')
    {
            //if it is a full URL, store the scheme and host name
            urlParser.ConsumeLength(&fAbsoluteURIScheme, 7); //consume "http://"
            urlParser.ConsumeUntil(&fHostHeader, '/');
    }
  
    // whatever is in this position is the relative URI
    StrPtrLen relativeURI(urlParser.GetCurrentPosition(), urlParser.GetDataReceivedLen() - urlParser.GetDataParsedLen());
    // read this URI into fRequestRelURI
    fRelativeURI = relativeURI;
    
    // Allocate memory for fRequestPath
    UInt32 len = fRelativeURI.Len;
    len++;
    //char* relativeURIDecoded = NEW char[len];
	char relativeURIDecoded[512] = { 0 };

    SInt32 theBytesWritten = StringTranslator::DecodeURL(fRelativeURI.Ptr, fRelativeURI.Len,
                                                       relativeURIDecoded, len);
     
    //if negative, an error occurred, reported as an QTSS_Error
    //we also need to leave room for a terminator.
    if ((theBytesWritten < 0) || ((UInt32)theBytesWritten == len))
    {
        fStatusCode = httpBadRequest;
        return QTSS_BadArgument;
    }

	fRequestPath = NULL;
    ////fRequestPath = NEW char[theBytesWritten + 1];
    ////::memcpy(fRequestPath, relativeURIDecoded + 1, theBytesWritten); 
    //////delete relativeURIDecoded;
    ////fRequestPath[theBytesWritten] = '\0';
    return QTSS_NoErr;
}