Bug 97444

Summary: ASSERT in KURL::KURL() when url did not inlude path.
Product: WebKit Reporter: yannick.poirier
Component: PlatformAssignee: Nobody <webkit-unassigned>
Status: RESOLVED INVALID    
Severity: Normal CC: ap
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: Unspecified   

Description yannick.poirier 2012-09-24 03:27:34 PDT
Construct a url :  KURL(ParsedURLString, "http://www.example.com" );

KURL hits ASSERT(url == m_string) because KURL appends a slash at the end of m_string

It's reproducible with CURL ResourceHandleManager.cpp:

headerCallback(char* ptr, size_t size, size_t nmemb, void* data){
...
curl_easy_getinfo(h, CURLINFO_EFFECTIVE_URL, &hdr);
/*  hdr might not contain a path */
d->m_response.setURL(KURL(ParsedURLString, hdr));

}
Comment 1 Alexey Proskuryakov 2012-09-24 09:25:48 PDT
The ParsedURLString constructor can only be used with strings returned by KURL::string() (and then only if the URL was valid).

It's a performance optimization applicable when we know that the string is normalized the way KURL likes it. For arbitrary URL strings, use a proper constructor with a correct base URL.