Bug 22887

Summary: Support data urls as per rfc2397
Product: [Applications] konqueror Reporter: lorenzo
Component: khtmlAssignee: Leo Savernik <l.savernik>
Status: RESOLVED FIXED    
Severity: normal CC: faure
Priority: NOR    
Version: 3.0   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: preliminary patch as a kioslave
stand-alone distribution of data protocol (506kB!)
proposed changes to KIO::Slave
entirety of changes to libkiocore

Description lorenzo 2001-03-22 17:22:14 UTC
(*** This bug was imported into bugs.kde.org ***)

Package:           khtml
Version:           3.0 (using KDE 2.1.1 - CVS 20010306)
Severity:          normal
Installed from:    Debian Package 4:2.1.0.1-0.potato5 (2.2)
Compiler:          gcc version 2.95.2 20000220 (Debian GNU/Linux)
OS:                Linux 2.4.3-pre3 i686
OS/Compiler notes: 

konqueror/khtml don't render the contents of
data: encoded URLs as described in rfc2397:

Please test on:

http://sancho.ccd.uniroma2.it/%7elorenzo/tst.html

As a matter of facts the page is well rendered by NS 4 and any other browser
fails to recognize the image data... Still 
I'm sending bug-reports to any "good" browser
writer.

(Submitted via bugs.kde.org)
(Called from KBugReport dialog)
Comment 1 Leo Savernik 2002-12-29 11:51:36 UTC
Taking. 
 
I've written a patch that provides data url functionality as a kioslave. If you 
want to test it look at the patches below. 
Comment 2 Leo Savernik 2002-12-29 11:57:58 UTC
Created attachment 672 [details]
preliminary patch as a kioslave

This patch contains the core of the data protocol implementation.
Comment 3 Leo Savernik 2002-12-29 12:11:11 UTC
Created attachment 673 [details]
stand-alone distribution of data protocol (506kB!)

This package is a full source distribution of the data protocol -- implemented
as a kioslave. You can download, compile and install this package separately
without the need to recompile parts of kde.

Beware that it is preliminary and may contain subtle bugs.

And yes, this package is huge! Nearly half a meg. It's the autoconf scripts
that make even the smallest project fat.
Comment 4 Leo Savernik 2003-01-22 15:10:22 UTC
Resolving this bug.  
  
Be advised that the stand-alone package contains some bugs I have fixed in KDE  
CVS already. Do not report any bugs on the stand-alone package here.  
Comment 5 Leo Savernik 2003-02-05 19:36:01 UTC
Next strike: 
 
Now that data urls are supported by a kioslave, I want to optimize away the 
need for it. Therefore the idea is to derive from KIO::Slave directly. 
 
I realised that some changes to KIO::Slave would be necessary and Waldo Bastian 
suggested the conversion of some members to virtual by virtual_hook(). 
 
See discussion: 
http://lists.kde.org/?l=kfm-devel&m=104444641401192&w=2 
 
The following attachments contain the preliminary results. 
Comment 6 Leo Savernik 2003-02-05 19:49:41 UTC
Created attachment 892 [details]
proposed changes to KIO::Slave

This patch contains the proposed changes to KIO::Slave to make it extensible.
There are seven methods which have been virtual_hook'ed:
	suspend()
	resume()
	suspended()
	send(...)	// new
	hold()
	setHost(...)
	setConfig(...)

plus a protected ctor that sets the derived flag so that the virtual_hook is
called properly.
Comment 7 Leo Savernik 2003-02-06 13:36:30 UTC
Created attachment 894 [details]
entirety of changes to libkiocore

This patch contains all changes to be made to KIO::Slave and associated classes
to support in-process processing of data urls without the overhead of process
launching.

Changes comprise of:
Makefile.am:
* compile added files
job.cpp:
scheduler.cpp:
* replaced all calls to slave->connection()->send/suspend/resume with
  slave->send/suspend/resume
slave.cpp:
slave.h:
* added method send(cmd,data)
* added virtual_hook structures
* modified methods to respect virtual_hook if derived from slave
* added a new constructor which derived classes must use
* added a flag which marks a slave instance to be a base class (d->derived)
* made factory methods take into account the special protocols (for now
  there is only "data")
* fixed some typos
dataprotocol.cpp:
dataprotocol.h:
* these are new, they handle the core data protocol functionality
dataslave.cpp:
dataslave.h:
* these are new, serving as an adapter between Slave and DataProtocol

Sorry for the big patch. I wanted to split it up into smaller parts first but
all the changes are interdependant in such a way that a proper compilation is
not possible if parts are missing.
Comment 8 David Faure 2003-10-19 21:58:19 UTC
Leo: thanks for the data:// implementation. Can this bug be closed now?
Comment 9 Thiago Macieira 2003-10-20 00:05:52 UTC
Please note that this bug is dependent on bug #62425, to which there is a patch but one that has not been applied. If that other one isn't solved, data: URLs might get garbled, especially those that, by coincidence, the first two chars are '/'.
Comment 10 Leo Savernik 2003-10-20 12:10:51 UTC
Thiago: Data urls cannot begin with //. So iff we encounter such an url, the behaviour of the data url kioslave is undefined (concerning the rfc). Therefore  bug 62425 does not apply. Nonetheless I think data urls should be treated specially, should the patch of 62425, or any equivalent ever be applied.

David: I reopened this bug because there is still an issue left with the kioslave implementation. But meanwhile I think it should go in a bug of its own. Therefore, resolving.
Comment 11 Maksim Orlovich 2003-11-04 02:33:55 UTC
*** Bug 25334 has been marked as a duplicate of this bug. ***