Commit 15bbc66
authored
Normalize URLs during WARC import (#886)
It turns out we've been missing some records because redirect URLs (in the 3xx response's `Location` header) do not always exactly match the requested target URL as recorded in the WARC record. This solves the problem by normalizing URLs before trying to match them.
For example, `https://www.heat.gov/` recently stopped getting recorded because it started redirecting to `https://heat.gov`, which got recorded in the WARC as `https://heat.gov/`. The `/` path is exactly equivalent to an empty path, but because we were looking for a URL without a path, we didn't find a record, even though the correct matching record was there, just with a `/` for its path.
While working on this particular case, I found some similar problems arising from variations on this same cause, like having redundant ports (e.g. the `443` is redundant here because it is an `https` scheme: `https://whatever.com:443/`).1 parent 6b41e7a commit 15bbc66
File tree
3 files changed
+75
-16
lines changed- web_monitoring
- cli
- tests
3 files changed
+75
-16
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | 28 | | |
38 | 29 | | |
39 | 30 | | |
| |||
44 | 35 | | |
45 | 36 | | |
46 | 37 | | |
47 | | - | |
| 38 | + | |
48 | 39 | | |
49 | 40 | | |
50 | 41 | | |
| |||
54 | 45 | | |
55 | 46 | | |
56 | 47 | | |
57 | | - | |
| 48 | + | |
58 | 49 | | |
59 | 50 | | |
60 | 51 | | |
| |||
86 | 77 | | |
87 | 78 | | |
88 | 79 | | |
89 | | - | |
| 80 | + | |
90 | 81 | | |
91 | 82 | | |
92 | 83 | | |
| |||
225 | 216 | | |
226 | 217 | | |
227 | 218 | | |
228 | | - | |
| 219 | + | |
229 | 220 | | |
230 | 221 | | |
231 | 222 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
97 | 127 | | |
98 | 128 | | |
99 | 129 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
163 | 164 | | |
164 | 165 | | |
165 | 166 | | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
166 | 204 | | |
167 | 205 | | |
168 | 206 | | |
| |||
0 commit comments