[Webkit-unassigned] [Bug 14124] [CURL] Support data URLs

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Oct 26 16:27:44 PDT 2007


http://bugs.webkit.org/show_bug.cgi?id=14124





------- Comment #4 from alp at atoker.com  2007-10-26 16:27 PDT -------
(In reply to comment #3)
> (From update of attachment 16876 [edit])
> >     unsigned len = in.size();
> >     const char* data = in.data();
> >
> 
> Can these just be folded into the new base64Decode call now?

Like this?

    return base64Decode(in.data(), in.size(), out);

Sure.

> 
> >+    return base64Decode(data, len, out);
> >+}
> >+
> >+bool base64Decode(const char* data, unsigned len, Vector<char>& out)
> >+{
> >+    out.clear();
> >+    if (len == 0)
> >+        return true;
> >+
> >+    // If the input string is pathologically large, just return nothing.
> >+    if (len > UINT_MAX)
> >+        return false;
> >+
> 
> Why is this change needed?

These checks were in the original base64Decode(). The first is a base case and
seems to still be necessary, but the second is probably redundant.

> 
> >     while (len && data[len-1] == '=')
> >         --len;
> > 
> 
> >+static void parseDataUrl(ResourceHandle* job)
> 
> Please name the variable "handle" instead of "job".

OK.

> 
> >+{
> >+    DeprecatedString data = job->request().url().url().latin1();
> 
> Why do you need to call latin1() here? Also, we recommend against using
> DeprecatedString in newly written code.

Its features were closest to the original code (eg. DeprecatedString::mid()).
KURL's KURL::decode_string() also expects and returns DeprecatedString, which
we call for percent-encoded data.

> 
> >+
> >+    ASSERT(data.startsWith("data:"));
> 
> URL schemes are case insensitive so this is not correct.

OK.

> 
> >+
> > void ResourceHandleManager::startJob(ResourceHandle* job)
> 
> I take it that startJob is called from the main loop.

Yeah. The job then gets queued.

> 
> > {
> >+    KURL kurl = job->request().url();
> >+    String protocol = kurl.protocol();
> >+
> >+    if (protocol == "data") {
> 
> URL schemes are insensitive, please use equalIgnoringCase here.

OK.

> 
> >+        parseDataUrl(job);
> >+        return;
> >+    }
> >+
> >     ResourceHandleInternal* d = job->getInternal();
> 


-- 
Configure bugmail: http://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the webkit-unassigned mailing list