[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    HTTP kioslave patch [ Was Re: Trivial 1.2 things ]
From:       Dawit Alemayehu <adawit () earthlink ! net>
Date:       1999-09-02 5:45:18
[Download RAW message or body]

On Wed, 01 Sep 1999, Waldo wrote:
[snipped]
> > I know exactly where the problem comes from. In the HTTP slave,
> > kdebase/kioslave/http.cpp, the code simply stores the current URL it is asked to
> > open and resolves any relative URL's based on it.  Thus, the problem.  I just
> > do not see how this can be fixed since the problem to me seems to be the site's.
> 
> I use the following code to make a baseURL (e.g. "http://securityportal.com/") 
> from a document URL (e.g. "http://securityportal.com/leftmen.cgi" ).
> baseURL is of type KURL.
> 
> void KHTMLWidget::setBaseURL( const char *_url)
> {
>     baseURL = _url;
>     baseURL.setReference( 0 );
>     baseURL.setSearchPart( 0 );
>  
>     QString p = baseURL.httpPath();
>  
>     if ( p.length() > 0 )
>     {
>        int pos = p.findRev( '/' );
>        if ( pos >= 0 )
>           p.truncate( pos );
>     }
>     p += "/";
>  
>     baseURL.setPath( p );
> }    

Okay.  I used the same exact thing to resolve the redirected relative URL
problems in "http.cpp".  Please test.

Perhaps an IO-Slave guru (Alex Zepda) can take a look at this to make sure it
does not break anything else.  I have done as much test as I can and it did not
break any of them.  YMMV.

Cheers,
Dawit A. 
["kdebase.kfm.kioslave.http-990902.diff" (text/plain)]

Index: http.cpp
===================================================================
RCS file: /home/kde/kdebase/kfm/kioslave/Attic/http.cpp,v
retrieving revision 1.41.4.5
diff -u -r1.41.4.5 http.cpp
--- http.cpp	1999/08/10 13:16:01	1.41.4.5
+++ http.cpp	1999/09/02 05:40:06
@@ -652,6 +652,17 @@
 	    {
 		Close();
 		KURL u( url );
+                u.setReference( 0 );
+                u.setSearchPart( 0 );
+                QString p = u.httpPath();
+                if ( p.length() > 0 )
+                {
+                    int pos = p.findRev( '/' );
+                    if ( pos >= 0 )
+                        p.truncate( pos );
+                }
+                p += "/";
+                u.setPath( p );
 		KURL u2( u, buffer + 10 );
 		if (!u2.isMalformed())
 		{


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic