Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
KDE Libraries
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Unmaintained
KDE Libraries
Commits
6d9d01c2
Commit
6d9d01c2
authored
Dec 19, 2001
by
Waldo Bastian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Accpept cookies via HTTP-EQUIV. (Fixes BR35012)
svn path=/trunk/kdelibs/; revision=127883
parent
4b5c545d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
66 additions
and
44 deletions
+66
-44
khtml/dom/html_document.cpp
khtml/dom/html_document.cpp
+5
-44
khtml/html/html_documentimpl.cpp
khtml/html/html_documentimpl.cpp
+53
-0
khtml/html/html_documentimpl.h
khtml/html/html_documentimpl.h
+3
-0
khtml/html/html_headimpl.cpp
khtml/html/html_headimpl.cpp
+5
-0
No files found.
khtml/dom/html_document.cpp
View file @
6d9d01c2
...
...
@@ -21,9 +21,6 @@
* $Id$
*/
// --------------------------------------------------------------------------
#include <dcopclient.h>
#include <kapplication.h>
#include <kdebug.h>
#include "html_document.h"
...
...
@@ -189,51 +186,15 @@ HTMLCollection HTMLDocument::all() const
DOMString
HTMLDocument
::
cookie
()
const
{
QCString
replyType
;
QByteArray
params
,
reply
;
QDataStream
stream
(
params
,
IO_WriteOnly
);
stream
<<
URL
().
string
();
if
(
!
kapp
->
dcopClient
()
->
call
(
"kcookiejar"
,
"kcookiejar"
,
"findDOMCookies(QString)"
,
params
,
replyType
,
reply
))
{
// Maybe it wasn't running (e.g. we're opening local html files)
KApplication
::
startServiceByDesktopName
(
"kcookiejar"
);
if
(
!
kapp
->
dcopClient
()
->
call
(
"kcookiejar"
,
"kcookiejar"
,
"findDOMCookies(QString)"
,
params
,
replyType
,
reply
))
{
kdWarning
(
6010
)
<<
"Can't communicate with cookiejar!"
<<
endl
;
return
DOMString
();
}
}
QDataStream
stream2
(
reply
,
IO_ReadOnly
);
if
(
replyType
!=
"QString"
)
{
kdError
(
6010
)
<<
"DCOP function findDOMCookies(...) returns "
<<
replyType
<<
", expected QString"
<<
endl
;
return
DOMString
();
}
QString
result
;
stream2
>>
result
;
return
DOMString
(
result
);
if
(
!
impl
)
return
DOMString
();
return
((
HTMLDocumentImpl
*
)
impl
)
->
cookie
();
}
void
HTMLDocument
::
setCookie
(
const
DOMString
&
value
)
{
long
windowId
=
view
()
->
winId
();
QByteArray
params
;
QDataStream
stream
(
params
,
IO_WriteOnly
);
QString
fake_header
(
"Set-Cookie: "
);
fake_header
.
append
(
value
.
string
());
fake_header
.
append
(
"
\n
"
);
stream
<<
URL
().
string
()
<<
fake_header
.
utf8
()
<<
windowId
;
if
(
!
kapp
->
dcopClient
()
->
send
(
"kcookiejar"
,
"kcookiejar"
,
"addCookies(QString,QCString,long int)"
,
params
))
{
// Maybe it wasn't running (e.g. we're opening local html files)
KApplication
::
startServiceByDesktopName
(
"kcookiejar"
);
if
(
!
kapp
->
dcopClient
()
->
send
(
"kcookiejar"
,
"kcookiejar"
,
"addCookies(QString,QCString,long int)"
,
params
))
kdWarning
(
6010
)
<<
"Can't communicate with cookiejar!"
<<
endl
;
}
if
(
impl
)
((
HTMLDocumentImpl
*
)
impl
)
->
setCookie
(
value
);
}
void
HTMLDocument
::
open
(
)
...
...
khtml/html/html_documentimpl.cpp
View file @
6d9d01c2
...
...
@@ -40,6 +40,8 @@
#include "html_miscimpl.h"
#include "rendering/render_object.h"
#include <dcopclient.h>
#include <kapplication.h>
#include <kdebug.h>
#include <kurl.h>
#include <kglobal.h>
...
...
@@ -120,6 +122,57 @@ DOMString HTMLDocumentImpl::lastModified() const
return
DOMString
();
}
DOMString
HTMLDocumentImpl
::
cookie
()
const
{
QCString
replyType
;
QByteArray
params
,
reply
;
QDataStream
stream
(
params
,
IO_WriteOnly
);
stream
<<
URL
();
if
(
!
kapp
->
dcopClient
()
->
call
(
"kcookiejar"
,
"kcookiejar"
,
"findDOMCookies(QString)"
,
params
,
replyType
,
reply
))
{
// Maybe it wasn't running (e.g. we're opening local html files)
KApplication
::
startServiceByDesktopName
(
"kcookiejar"
);
if
(
!
kapp
->
dcopClient
()
->
call
(
"kcookiejar"
,
"kcookiejar"
,
"findDOMCookies(QString)"
,
params
,
replyType
,
reply
))
{
kdWarning
(
6010
)
<<
"Can't communicate with cookiejar!"
<<
endl
;
return
DOMString
();
}
}
QDataStream
stream2
(
reply
,
IO_ReadOnly
);
if
(
replyType
!=
"QString"
)
{
kdError
(
6010
)
<<
"DCOP function findDOMCookies(...) returns "
<<
replyType
<<
", expected QString"
<<
endl
;
return
DOMString
();
}
QString
result
;
stream2
>>
result
;
return
DOMString
(
result
);
}
void
HTMLDocumentImpl
::
setCookie
(
const
DOMString
&
value
)
{
long
windowId
=
view
()
?
view
()
->
winId
()
:
0
;
QByteArray
params
;
QDataStream
stream
(
params
,
IO_WriteOnly
);
QString
fake_header
(
"Set-Cookie: "
);
fake_header
.
append
(
value
.
string
());
fake_header
.
append
(
"
\n
"
);
stream
<<
URL
()
<<
fake_header
.
utf8
()
<<
windowId
;
if
(
!
kapp
->
dcopClient
()
->
send
(
"kcookiejar"
,
"kcookiejar"
,
"addCookies(QString,QCString,long int)"
,
params
))
{
// Maybe it wasn't running (e.g. we're opening local html files)
KApplication
::
startServiceByDesktopName
(
"kcookiejar"
);
if
(
!
kapp
->
dcopClient
()
->
send
(
"kcookiejar"
,
"kcookiejar"
,
"addCookies(QString,QCString,long int)"
,
params
))
kdWarning
(
6010
)
<<
"Can't communicate with cookiejar!"
<<
endl
;
}
}
HTMLElementImpl
*
HTMLDocumentImpl
::
body
()
{
NodeImpl
*
de
=
documentElement
();
...
...
khtml/html/html_documentimpl.h
View file @
6d9d01c2
...
...
@@ -57,6 +57,8 @@ public:
DOMString
domain
()
const
;
void
setDomain
(
const
DOMString
&
newDomain
);
// not part of the DOM
DOMString
lastModified
()
const
;
DOMString
cookie
()
const
;
void
setCookie
(
const
DOMString
&
);
HTMLElementImpl
*
body
();
void
setBody
(
HTMLElementImpl
*
_body
);
...
...
@@ -74,6 +76,7 @@ public:
virtual
void
determineParseMode
(
const
QString
&
str
);
virtual
void
close
();
protected:
HTMLElementImpl
*
bodyElement
;
...
...
khtml/html/html_headimpl.cpp
View file @
6d9d01c2
...
...
@@ -299,6 +299,11 @@ void HTMLMetaElementImpl::attach()
KIO
::
http_update_cache
(
url
,
true
,
0
);
}
}
else
if
(
(
strcasecmp
(
_equiv
,
"set-cookie"
)
==
0
)
&&
!
_content
.
isNull
())
{
HTMLDocumentImpl
*
d
=
static_cast
<
HTMLDocumentImpl
*>
(
ownerDocument
());
d
->
setCookie
(
_content
);
}
HTMLElementImpl
::
attach
();
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment