Skip to content

Commit 6b6360d

Browse files
pombredannesbs2001
authored andcommitted
Add FIXME comment to Etag function
We are not using etag correctly. Also the function name is misleading as we are checking the Etag in this create_etag function Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
1 parent 597dc02 commit 6b6360d

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

vulnerabilities/helpers.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
import json
2424
import re
2525

26-
import yaml
2726
import requests
2827
import toml
28+
import yaml
2929

3030
# TODO add logging here
3131

@@ -50,6 +50,13 @@ def fetch_yaml(url):
5050
return yaml.safe_load(response.content)
5151

5252

53+
# FIXME: this is NOT how etags work .
54+
# We should instead send the proper HTTP header
55+
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-None-Match
56+
# and integrate this finely in the processing as this typically needs to use
57+
# streaming=True requests, and proper handling of the HTTP return code
58+
# In all cases this ends up being a single request, not a HEADD followed
59+
# by another real request
5360
def create_etag(data_src, url, etag_key):
5461
"""
5562
Etags are like hashes of web responses. For a data source `data_src`,

0 commit comments

Comments
 (0)