Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.libnetworkcache
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Douglas
slapos.libnetworkcache
Commits
dddadad1
Commit
dddadad1
authored
Sep 02, 2011
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not trust sent content.
parent
848d552e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
3 deletions
+16
-3
slapos/libnetworkcache.py
slapos/libnetworkcache.py
+16
-3
No files found.
slapos/libnetworkcache.py
View file @
dddadad1
...
@@ -209,7 +209,11 @@ class NetworkcacheClient(object):
...
@@ -209,7 +209,11 @@ class NetworkcacheClient(object):
headers
=
self
.
shadir_header_dict
)
headers
=
self
.
shadir_header_dict
)
data
=
urllib2
.
urlopen
(
request
).
read
()
data
=
urllib2
.
urlopen
(
request
).
read
()
# Filtering...
# Filtering...
try
:
data_list
=
json
.
loads
(
data
)
data_list
=
json
.
loads
(
data
)
except
Exception
:
raise
DirectoryNotFound
(
'It was impossible to parse json response:
\
n
%s'
%
traceback
.
format_exc
())
filtered_data_list
=
[]
filtered_data_list
=
[]
if
self
.
signature_certificate_list
is
not
None
:
if
self
.
signature_certificate_list
is
not
None
:
for
data
in
data_list
:
for
data
in
data_list
:
...
@@ -227,8 +231,17 @@ class NetworkcacheClient(object):
...
@@ -227,8 +231,17 @@ class NetworkcacheClient(object):
'Entries: %s.'
%
(
key
,
str
(
data_list
)))
'Entries: %s.'
%
(
key
,
str
(
data_list
)))
information_json
,
signature
=
filtered_data_list
[
0
]
information_json
,
signature
=
filtered_data_list
[
0
]
try
:
information_dict
=
json
.
loads
(
information_json
)
information_dict
=
json
.
loads
(
information_json
)
except
Exception
:
raise
DirectoryNotFound
(
'It was impossible to parse json-in-json '
'response:
\
n
%s'
%
traceback
.
format_exc
())
try
:
sha512
=
information_dict
.
get
(
'sha512'
)
sha512
=
information_dict
.
get
(
'sha512'
)
except
Exception
:
raise
DirectoryNotFound
(
'It was impossible to fetch sha512 from '
'directory response (%r):
\
n
%s'
%
(
information_dict
,
traceback
.
format_exc
()))
return
self
.
download
(
sha512
)
return
self
.
download
(
sha512
)
def
_getSignatureString
(
self
,
content
):
def
_getSignatureString
(
self
,
content
):
...
...
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