##// END OF EJS Templates
py3: add Python 3 exception output to test-lfs-serve-access.t...
Denis Laxalde -
r43719:09537caa stable
parent child Browse files
Show More
@@ -1,506 +1,508 b''
1 1 #require serve no-reposimplestore no-chg
2 2
3 3 $ cat >> $HGRCPATH <<EOF
4 4 > [extensions]
5 5 > lfs=
6 6 > [lfs]
7 7 > track=all()
8 8 > [web]
9 9 > push_ssl = False
10 10 > allow-push = *
11 11 > EOF
12 12
13 13 Serving LFS files can experimentally be turned off. The long term solution is
14 14 to support the 'verify' action in both client and server, so that the server can
15 15 tell the client to store files elsewhere.
16 16
17 17 $ hg init server
18 18 $ hg --config "lfs.usercache=$TESTTMP/servercache" \
19 19 > --config experimental.lfs.serve=False -R server serve -d \
20 20 > -p $HGPORT --pid-file=hg.pid -A $TESTTMP/access.log -E $TESTTMP/errors.log
21 21 $ cat hg.pid >> $DAEMON_PIDS
22 22
23 23 Uploads fail...
24 24
25 25 $ hg init client
26 26 $ echo 'this-is-an-lfs-file' > client/lfs.bin
27 27 $ hg -R client ci -Am 'initial commit'
28 28 adding lfs.bin
29 29 $ hg -R client push http://localhost:$HGPORT
30 30 pushing to http://localhost:$HGPORT/
31 31 searching for changes
32 32 abort: LFS HTTP error: HTTP Error 400: no such method: .git!
33 33 (check that lfs serving is enabled on http://localhost:$HGPORT/.git/info/lfs and "upload" is supported)
34 34 [255]
35 35
36 36 ... so do a local push to make the data available. Remove the blob from the
37 37 default cache, so it attempts to download.
38 38 $ hg --config "lfs.usercache=$TESTTMP/servercache" \
39 39 > --config "lfs.url=null://" \
40 40 > -R client push -q server
41 41 $ mv `hg config lfs.usercache` $TESTTMP/servercache
42 42
43 43 Downloads fail...
44 44
45 45 $ hg clone http://localhost:$HGPORT httpclone
46 46 (remote is using large file support (lfs); lfs will be enabled for this repository)
47 47 requesting all changes
48 48 adding changesets
49 49 adding manifests
50 50 adding file changes
51 51 added 1 changesets with 1 changes to 1 files
52 52 new changesets 525251863cad
53 53 updating to branch default
54 54 abort: LFS HTTP error: HTTP Error 400: no such method: .git!
55 55 (check that lfs serving is enabled on http://localhost:$HGPORT/.git/info/lfs and "download" is supported)
56 56 [255]
57 57
58 58 $ "$PYTHON" $RUNTESTDIR/killdaemons.py $DAEMON_PIDS
59 59
60 60 $ cat $TESTTMP/access.log $TESTTMP/errors.log
61 61 $LOCALIP - - [$LOGDATE$] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
62 62 $LOCALIP - - [$LOGDATE$] "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D525251863cad618e55d483555f3d00a2ca99597e x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob)
63 63 $LOCALIP - - [$LOGDATE$] "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob)
64 64 $LOCALIP - - [$LOGDATE$] "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob)
65 65 $LOCALIP - - [$LOGDATE$] "POST /.git/info/lfs/objects/batch HTTP/1.1" 400 - (glob)
66 66 $LOCALIP - - [$LOGDATE$] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
67 67 $LOCALIP - - [$LOGDATE$] "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob)
68 68 $LOCALIP - - [$LOGDATE$] "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bookmarks=1&bundlecaps=HG20%2Cbundle2%3DHG20%250Abookmarks%250Achangegroup%253D01%252C02%252C03%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Aphases%253Dheads%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps%250Arev-branch-cache%250Astream%253Dv2&cg=1&common=0000000000000000000000000000000000000000&heads=525251863cad618e55d483555f3d00a2ca99597e&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob)
69 69 $LOCALIP - - [$LOGDATE$] "POST /.git/info/lfs/objects/batch HTTP/1.1" 400 - (glob)
70 70
71 71 $ rm -f $TESTTMP/access.log $TESTTMP/errors.log
72 72 $ hg --config "lfs.usercache=$TESTTMP/servercache" -R server serve -d \
73 73 > -p $HGPORT --pid-file=hg.pid --prefix=subdir/mount/point \
74 74 > -A $TESTTMP/access.log -E $TESTTMP/errors.log
75 75 $ cat hg.pid >> $DAEMON_PIDS
76 76
77 77 Reasonable hint for a misconfigured blob server
78 78
79 79 $ hg -R httpclone update default --config lfs.url=http://localhost:$HGPORT/missing
80 80 abort: LFS HTTP error: HTTP Error 404: Not Found!
81 81 (the "lfs.url" config may be used to override http://localhost:$HGPORT/missing)
82 82 [255]
83 83
84 84 $ hg -R httpclone update default --config lfs.url=http://localhost:$HGPORT2/missing
85 85 abort: LFS error: *onnection *refused*! (glob) (?)
86 86 abort: LFS error: $EADDRNOTAVAIL$! (glob) (?)
87 87 abort: LFS error: No route to host! (?)
88 88 (the "lfs.url" config may be used to override http://localhost:$HGPORT2/missing)
89 89 [255]
90 90
91 91 Blob URIs are correct when --prefix is used
92 92
93 93 $ hg clone --debug http://localhost:$HGPORT/subdir/mount/point cloned2
94 94 using http://localhost:$HGPORT/subdir/mount/point
95 95 sending capabilities command
96 96 (remote is using large file support (lfs); lfs will be enabled for this repository)
97 97 query 1; heads
98 98 sending batch command
99 99 requesting all changes
100 100 sending getbundle command
101 101 bundle2-input-bundle: with-transaction
102 102 bundle2-input-part: "changegroup" (params: 1 mandatory 1 advisory) supported
103 103 adding changesets
104 104 add changeset 525251863cad
105 105 adding manifests
106 106 adding file changes
107 107 adding lfs.bin revisions
108 108 bundle2-input-part: total payload size 648
109 109 bundle2-input-part: "listkeys" (params: 1 mandatory) supported
110 110 bundle2-input-part: "phase-heads" supported
111 111 bundle2-input-part: total payload size 24
112 112 bundle2-input-part: "cache:rev-branch-cache" (advisory) supported
113 113 bundle2-input-part: total payload size 39
114 114 bundle2-input-bundle: 4 parts total
115 115 checking for updated bookmarks
116 116 updating the branch cache
117 117 added 1 changesets with 1 changes to 1 files
118 118 new changesets 525251863cad
119 119 updating to branch default
120 120 resolving manifests
121 121 branchmerge: False, force: False, partial: False
122 122 ancestor: 000000000000, local: 000000000000+, remote: 525251863cad
123 123 lfs: assuming remote store: http://localhost:$HGPORT/subdir/mount/point/.git/info/lfs
124 124 Status: 200
125 125 Content-Length: 371
126 126 Content-Type: application/vnd.git-lfs+json
127 127 Date: $HTTP_DATE$
128 128 Server: testing stub value
129 129 {
130 130 "objects": [
131 131 {
132 132 "actions": {
133 133 "download": {
134 134 "expires_at": "$ISO_8601_DATE_TIME$"
135 135 "header": {
136 136 "Accept": "application/vnd.git-lfs"
137 137 }
138 138 "href": "http://localhost:$HGPORT/subdir/mount/point/.hg/lfs/objects/f03217a32529a28a42d03b1244fe09b6e0f9fd06d7b966d4d50567be2abe6c0e"
139 139 }
140 140 }
141 141 "oid": "f03217a32529a28a42d03b1244fe09b6e0f9fd06d7b966d4d50567be2abe6c0e"
142 142 "size": 20
143 143 }
144 144 ]
145 145 "transfer": "basic"
146 146 }
147 147 lfs: downloading f03217a32529a28a42d03b1244fe09b6e0f9fd06d7b966d4d50567be2abe6c0e (20 bytes)
148 148 Status: 200
149 149 Content-Length: 20
150 150 Content-Type: application/octet-stream
151 151 Date: $HTTP_DATE$
152 152 Server: testing stub value
153 153 lfs: adding f03217a32529a28a42d03b1244fe09b6e0f9fd06d7b966d4d50567be2abe6c0e to the usercache
154 154 lfs: processed: f03217a32529a28a42d03b1244fe09b6e0f9fd06d7b966d4d50567be2abe6c0e
155 155 lfs: downloaded 1 files (20 bytes)
156 156 lfs.bin: remote created -> g
157 157 getting lfs.bin
158 158 lfs: found f03217a32529a28a42d03b1244fe09b6e0f9fd06d7b966d4d50567be2abe6c0e in the local lfs store
159 159 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
160 160 (sent 3 HTTP requests and * bytes; received * bytes in responses) (glob)
161 161
162 162 $ "$PYTHON" $RUNTESTDIR/killdaemons.py $DAEMON_PIDS
163 163
164 164 $ cat $TESTTMP/access.log $TESTTMP/errors.log
165 165 $LOCALIP - - [$LOGDATE$] "POST /missing/objects/batch HTTP/1.1" 404 - (glob)
166 166 $LOCALIP - - [$LOGDATE$] "GET /subdir/mount/point?cmd=capabilities HTTP/1.1" 200 - (glob)
167 167 $LOCALIP - - [$LOGDATE$] "GET /subdir/mount/point?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob)
168 168 $LOCALIP - - [$LOGDATE$] "GET /subdir/mount/point?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bookmarks=1&bundlecaps=HG20%2Cbundle2%3DHG20%250Abookmarks%250Achangegroup%253D01%252C02%252C03%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Aphases%253Dheads%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps%250Arev-branch-cache%250Astream%253Dv2&cg=1&common=0000000000000000000000000000000000000000&heads=525251863cad618e55d483555f3d00a2ca99597e&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob)
169 169 $LOCALIP - - [$LOGDATE$] "POST /subdir/mount/point/.git/info/lfs/objects/batch HTTP/1.1" 200 - (glob)
170 170 $LOCALIP - - [$LOGDATE$] "GET /subdir/mount/point/.hg/lfs/objects/f03217a32529a28a42d03b1244fe09b6e0f9fd06d7b966d4d50567be2abe6c0e HTTP/1.1" 200 - (glob)
171 171
172 172 Blobs that already exist in the usercache are linked into the repo store, even
173 173 though the client doesn't send the blob.
174 174
175 175 $ hg init server2
176 176 $ hg --config "lfs.usercache=$TESTTMP/servercache" -R server2 serve -d \
177 177 > -p $HGPORT --pid-file=hg.pid \
178 178 > -A $TESTTMP/access.log -E $TESTTMP/errors.log
179 179 $ cat hg.pid >> $DAEMON_PIDS
180 180
181 181 $ hg --config "lfs.usercache=$TESTTMP/servercache" -R cloned2 --debug \
182 182 > push http://localhost:$HGPORT | grep '^[{} ]'
183 183 {
184 184 "objects": [
185 185 {
186 186 "oid": "f03217a32529a28a42d03b1244fe09b6e0f9fd06d7b966d4d50567be2abe6c0e"
187 187 "size": 20
188 188 }
189 189 ]
190 190 "transfer": "basic"
191 191 }
192 192 $ find server2/.hg/store/lfs/objects | sort
193 193 server2/.hg/store/lfs/objects
194 194 server2/.hg/store/lfs/objects/f0
195 195 server2/.hg/store/lfs/objects/f0/3217a32529a28a42d03b1244fe09b6e0f9fd06d7b966d4d50567be2abe6c0e
196 196 $ "$PYTHON" $RUNTESTDIR/killdaemons.py $DAEMON_PIDS
197 197 $ cat $TESTTMP/errors.log
198 198
199 199 $ cat >> $TESTTMP/lfsstoreerror.py <<EOF
200 200 > import errno
201 201 > from hgext.lfs import blobstore
202 202 >
203 203 > _numverifies = 0
204 204 > _readerr = True
205 205 >
206 206 > def reposetup(ui, repo):
207 207 > # Nothing to do with a remote repo
208 208 > if not repo.local():
209 209 > return
210 210 >
211 211 > store = repo.svfs.lfslocalblobstore
212 212 > class badstore(store.__class__):
213 213 > def download(self, oid, src):
214 214 > '''Called in the server to handle reading from the client in a
215 215 > PUT request.'''
216 216 > origread = src.read
217 217 > def _badread(nbytes):
218 218 > # Simulate bad data/checksum failure from the client
219 219 > return b'0' * len(origread(nbytes))
220 220 > src.read = _badread
221 221 > super(badstore, self).download(oid, src)
222 222 >
223 223 > def _read(self, vfs, oid, verify):
224 224 > '''Called in the server to read data for a GET request, and then
225 225 > calls self._verify() on it before returning.'''
226 226 > global _readerr
227 227 > # One time simulation of a read error
228 228 > if _readerr:
229 229 > _readerr = False
230 230 > raise IOError(errno.EIO, r'%s: I/O error' % oid.decode("utf-8"))
231 231 > # Simulate corrupt content on client download
232 232 > blobstore._verify(oid, b'dummy content')
233 233 >
234 234 > def verify(self, oid):
235 235 > '''Called in the server to populate the Batch API response,
236 236 > letting the client re-upload if the file is corrupt.'''
237 237 > # Fail verify in Batch API for one clone command and one push
238 238 > # command with an IOError. Then let it through to access other
239 239 > # functions. Checksum failure is tested elsewhere.
240 240 > global _numverifies
241 241 > _numverifies += 1
242 242 > if _numverifies <= 2:
243 243 > raise IOError(errno.EIO, r'%s: I/O error' % oid.decode("utf-8"))
244 244 > return super(badstore, self).verify(oid)
245 245 >
246 246 > store.__class__ = badstore
247 247 > EOF
248 248
249 249 $ rm -rf `hg config lfs.usercache`
250 250 $ rm -f $TESTTMP/access.log $TESTTMP/errors.log
251 251 $ hg --config "lfs.usercache=$TESTTMP/servercache" \
252 252 > --config extensions.lfsstoreerror=$TESTTMP/lfsstoreerror.py \
253 253 > -R server serve -d \
254 254 > -p $HGPORT1 --pid-file=hg.pid -A $TESTTMP/access.log -E $TESTTMP/errors.log
255 255 $ cat hg.pid >> $DAEMON_PIDS
256 256
257 257 Test an I/O error in localstore.verify() (Batch API) with GET
258 258
259 259 $ hg clone http://localhost:$HGPORT1 httpclone2
260 260 (remote is using large file support (lfs); lfs will be enabled for this repository)
261 261 requesting all changes
262 262 adding changesets
263 263 adding manifests
264 264 adding file changes
265 265 added 1 changesets with 1 changes to 1 files
266 266 new changesets 525251863cad
267 267 updating to branch default
268 268 abort: LFS server error for "lfs.bin": Internal server error!
269 269 [255]
270 270
271 271 Test an I/O error in localstore.verify() (Batch API) with PUT
272 272
273 273 $ echo foo > client/lfs.bin
274 274 $ hg -R client ci -m 'mod lfs'
275 275 $ hg -R client push http://localhost:$HGPORT1
276 276 pushing to http://localhost:$HGPORT1/
277 277 searching for changes
278 278 abort: LFS server error for "unknown": Internal server error!
279 279 [255]
280 280 TODO: figure out how to associate the file name in the error above
281 281
282 282 Test a bad checksum sent by the client in the transfer API
283 283
284 284 $ hg -R client push http://localhost:$HGPORT1
285 285 pushing to http://localhost:$HGPORT1/
286 286 searching for changes
287 287 abort: LFS HTTP error: HTTP Error 422: corrupt blob (oid=b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c, action=upload)!
288 288 [255]
289 289
290 290 $ echo 'test lfs file' > server/lfs3.bin
291 291 $ hg --config experimental.lfs.disableusercache=True \
292 292 > -R server ci -Aqm 'another lfs file'
293 293 $ hg -R client pull -q http://localhost:$HGPORT1
294 294
295 295 Test an I/O error during the processing of the GET request
296 296
297 297 $ hg --config lfs.url=http://localhost:$HGPORT1/.git/info/lfs \
298 298 > -R client update -r tip
299 299 abort: LFS HTTP error: HTTP Error 500: Internal Server Error (oid=276f73cfd75f9fb519810df5f5d96d6594ca2521abd86cbcd92122f7d51a1f3d, action=download)!
300 300 [255]
301 301
302 302 Test a checksum failure during the processing of the GET request
303 303
304 304 $ hg --config lfs.url=http://localhost:$HGPORT1/.git/info/lfs \
305 305 > -R client update -r tip
306 306 abort: LFS HTTP error: HTTP Error 422: corrupt blob (oid=276f73cfd75f9fb519810df5f5d96d6594ca2521abd86cbcd92122f7d51a1f3d, action=download)!
307 307 [255]
308 308
309 309 $ "$PYTHON" $RUNTESTDIR/killdaemons.py $DAEMON_PIDS
310 310
311 311 $ cat $TESTTMP/access.log
312 312 $LOCALIP - - [$LOGDATE$] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
313 313 $LOCALIP - - [$LOGDATE$] "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob)
314 314 $LOCALIP - - [$LOGDATE$] "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bookmarks=1&bundlecaps=HG20%2Cbundle2%3DHG20%250Abookmarks%250Achangegroup%253D01%252C02%252C03%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Aphases%253Dheads%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps%250Arev-branch-cache%250Astream%253Dv2&cg=1&common=0000000000000000000000000000000000000000&heads=525251863cad618e55d483555f3d00a2ca99597e&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob)
315 315 $LOCALIP - - [$LOGDATE$] "POST /.git/info/lfs/objects/batch HTTP/1.1" 200 - (glob)
316 316 $LOCALIP - - [$LOGDATE$] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
317 317 $LOCALIP - - [$LOGDATE$] "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D392c05922088bacf8e68a6939b480017afbf245d x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob)
318 318 $LOCALIP - - [$LOGDATE$] "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob)
319 319 $LOCALIP - - [$LOGDATE$] "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob)
320 320 $LOCALIP - - [$LOGDATE$] "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob)
321 321 $LOCALIP - - [$LOGDATE$] "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob)
322 322 $LOCALIP - - [$LOGDATE$] "POST /.git/info/lfs/objects/batch HTTP/1.1" 200 - (glob)
323 323 $LOCALIP - - [$LOGDATE$] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
324 324 $LOCALIP - - [$LOGDATE$] "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D392c05922088bacf8e68a6939b480017afbf245d x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob)
325 325 $LOCALIP - - [$LOGDATE$] "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob)
326 326 $LOCALIP - - [$LOGDATE$] "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob)
327 327 $LOCALIP - - [$LOGDATE$] "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob)
328 328 $LOCALIP - - [$LOGDATE$] "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob)
329 329 $LOCALIP - - [$LOGDATE$] "POST /.git/info/lfs/objects/batch HTTP/1.1" 200 - (glob)
330 330 $LOCALIP - - [$LOGDATE$] "PUT /.hg/lfs/objects/b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c HTTP/1.1" 422 - (glob)
331 331 $LOCALIP - - [$LOGDATE$] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
332 332 $LOCALIP - - [$LOGDATE$] "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D392c05922088bacf8e68a6939b480017afbf245d x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob)
333 333 $LOCALIP - - [$LOGDATE$] "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bookmarks=1&bundlecaps=HG20%2Cbundle2%3DHG20%250Abookmarks%250Achangegroup%253D01%252C02%252C03%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Aphases%253Dheads%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps%250Arev-branch-cache%250Astream%253Dv2&cg=1&common=525251863cad618e55d483555f3d00a2ca99597e&heads=506bf3d83f78c54b89e81c6411adee19fdf02156+525251863cad618e55d483555f3d00a2ca99597e&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob)
334 334 $LOCALIP - - [$LOGDATE$] "POST /.git/info/lfs/objects/batch HTTP/1.1" 200 - (glob)
335 335 $LOCALIP - - [$LOGDATE$] "GET /.hg/lfs/objects/276f73cfd75f9fb519810df5f5d96d6594ca2521abd86cbcd92122f7d51a1f3d HTTP/1.1" 500 - (glob)
336 336 $LOCALIP - - [$LOGDATE$] "POST /.git/info/lfs/objects/batch HTTP/1.1" 200 - (glob)
337 337 $LOCALIP - - [$LOGDATE$] "GET /.hg/lfs/objects/276f73cfd75f9fb519810df5f5d96d6594ca2521abd86cbcd92122f7d51a1f3d HTTP/1.1" 422 - (glob)
338 338
339 339 $ grep -v ' File "' $TESTTMP/errors.log
340 340 $LOCALIP - - [$ERRDATE$] HG error: Exception happened while processing request '/.git/info/lfs/objects/batch': (glob)
341 341 $LOCALIP - - [$ERRDATE$] HG error: Traceback (most recent call last): (glob)
342 342 $LOCALIP - - [$ERRDATE$] HG error: verifies = store.verify(oid) (glob)
343 343 $LOCALIP - - [$ERRDATE$] HG error: raise IOError(errno.EIO, r'%s: I/O error' % oid.decode("utf-8")) (glob)
344 344 $LOCALIP - - [$ERRDATE$] HG error: *Error: [Errno 5] f03217a32529a28a42d03b1244fe09b6e0f9fd06d7b966d4d50567be2abe6c0e: I/O error (glob)
345 345 $LOCALIP - - [$ERRDATE$] HG error: (glob)
346 346 $LOCALIP - - [$ERRDATE$] HG error: Exception happened while processing request '/.git/info/lfs/objects/batch': (glob)
347 347 $LOCALIP - - [$ERRDATE$] HG error: Traceback (most recent call last): (glob)
348 348 $LOCALIP - - [$ERRDATE$] HG error: verifies = store.verify(oid) (glob)
349 349 $LOCALIP - - [$ERRDATE$] HG error: raise IOError(errno.EIO, r'%s: I/O error' % oid.decode("utf-8")) (glob)
350 350 $LOCALIP - - [$ERRDATE$] HG error: *Error: [Errno 5] b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c: I/O error (glob)
351 351 $LOCALIP - - [$ERRDATE$] HG error: (glob)
352 352 $LOCALIP - - [$ERRDATE$] HG error: Exception happened while processing request '/.hg/lfs/objects/b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c': (glob)
353 353 $LOCALIP - - [$ERRDATE$] HG error: Traceback (most recent call last): (glob)
354 354 $LOCALIP - - [$ERRDATE$] HG error: localstore.download(oid, req.bodyfh) (glob)
355 355 $LOCALIP - - [$ERRDATE$] HG error: super(badstore, self).download(oid, src) (glob)
356 356 $LOCALIP - - [$ERRDATE$] HG error: _(b'corrupt remote lfs object: %s') % oid (glob)
357 $LOCALIP - - [$ERRDATE$] HG error: LfsCorruptionError: corrupt remote lfs object: b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c (glob)
357 $LOCALIP - - [$ERRDATE$] HG error: LfsCorruptionError: corrupt remote lfs object: b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c (no-py3 !)
358 $LOCALIP - - [$ERRDATE$] HG error: hgext.lfs.blobstore.LfsCorruptionError: b'corrupt remote lfs object: b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c' (py3 !)
358 359 $LOCALIP - - [$ERRDATE$] HG error: (glob)
359 360 $LOCALIP - - [$ERRDATE$] Exception happened during processing request '/.hg/lfs/objects/276f73cfd75f9fb519810df5f5d96d6594ca2521abd86cbcd92122f7d51a1f3d': (glob)
360 361 Traceback (most recent call last):
361 362 self.do_write()
362 363 self.do_hgweb()
363 364 for chunk in self.server.application(env, self._start_response):
364 365 for r in self._runwsgi(req, res, repo):
365 366 rctx, req, res, self.check_perm
366 367 return func(*(args + a), **kw) (no-py3 !)
367 368 rctx.repo, req, res, lambda perm: checkperm(rctx, req, perm)
368 369 res.setbodybytes(localstore.read(oid))
369 370 blob = self._read(self.vfs, oid, verify)
370 371 raise IOError(errno.EIO, r'%s: I/O error' % oid.decode("utf-8"))
371 372 *Error: [Errno 5] 276f73cfd75f9fb519810df5f5d96d6594ca2521abd86cbcd92122f7d51a1f3d: I/O error (glob)
372 373
373 374 $LOCALIP - - [$ERRDATE$] HG error: Exception happened while processing request '/.hg/lfs/objects/276f73cfd75f9fb519810df5f5d96d6594ca2521abd86cbcd92122f7d51a1f3d': (glob)
374 375 $LOCALIP - - [$ERRDATE$] HG error: Traceback (most recent call last): (glob)
375 376 $LOCALIP - - [$ERRDATE$] HG error: res.setbodybytes(localstore.read(oid)) (glob)
376 377 $LOCALIP - - [$ERRDATE$] HG error: blob = self._read(self.vfs, oid, verify) (glob)
377 378 $LOCALIP - - [$ERRDATE$] HG error: blobstore._verify(oid, b'dummy content') (glob)
378 379 $LOCALIP - - [$ERRDATE$] HG error: hint=_(b'run hg verify'), (glob)
379 $LOCALIP - - [$ERRDATE$] HG error: LfsCorruptionError: detected corrupt lfs object: 276f73cfd75f9fb519810df5f5d96d6594ca2521abd86cbcd92122f7d51a1f3d (glob)
380 $LOCALIP - - [$ERRDATE$] HG error: LfsCorruptionError: detected corrupt lfs object: 276f73cfd75f9fb519810df5f5d96d6594ca2521abd86cbcd92122f7d51a1f3d (no-py3 !)
381 $LOCALIP - - [$ERRDATE$] HG error: hgext.lfs.blobstore.LfsCorruptionError: b'detected corrupt lfs object: 276f73cfd75f9fb519810df5f5d96d6594ca2521abd86cbcd92122f7d51a1f3d' (py3 !)
380 382 $LOCALIP - - [$ERRDATE$] HG error: (glob)
381 383
382 384 Basic Authorization headers are returned by the Batch API, and sent back with
383 385 the GET/PUT request.
384 386
385 387 $ rm -f $TESTTMP/access.log $TESTTMP/errors.log
386 388
387 389 $ cat >> $HGRCPATH << EOF
388 390 > [experimental]
389 391 > lfs.disableusercache = True
390 392 > [auth]
391 393 > l.schemes=http
392 394 > l.prefix=lo
393 395 > l.username=user
394 396 > l.password=pass
395 397 > EOF
396 398
397 399 $ hg --config extensions.x=$TESTDIR/httpserverauth.py \
398 400 > -R server serve -d -p $HGPORT1 --pid-file=hg.pid \
399 401 > -A $TESTTMP/access.log -E $TESTTMP/errors.log
400 402 $ mv hg.pid $DAEMON_PIDS
401 403
402 404 $ hg clone --debug http://localhost:$HGPORT1 auth_clone | egrep '^[{}]| '
403 405 {
404 406 "objects": [
405 407 {
406 408 "actions": {
407 409 "download": {
408 410 "expires_at": "$ISO_8601_DATE_TIME$"
409 411 "header": {
410 412 "Accept": "application/vnd.git-lfs"
411 413 "Authorization": "Basic dXNlcjpwYXNz"
412 414 }
413 415 "href": "http://localhost:$HGPORT1/.hg/lfs/objects/276f73cfd75f9fb519810df5f5d96d6594ca2521abd86cbcd92122f7d51a1f3d"
414 416 }
415 417 }
416 418 "oid": "276f73cfd75f9fb519810df5f5d96d6594ca2521abd86cbcd92122f7d51a1f3d"
417 419 "size": 14
418 420 }
419 421 ]
420 422 "transfer": "basic"
421 423 }
422 424
423 425 $ echo 'another blob' > auth_clone/lfs.blob
424 426 $ hg -R auth_clone ci -Aqm 'add blob'
425 427
426 428 $ cat > use_digests.py << EOF
427 429 > from mercurial import (
428 430 > exthelper,
429 431 > url,
430 432 > )
431 433 >
432 434 > eh = exthelper.exthelper()
433 435 > uisetup = eh.finaluisetup
434 436 >
435 437 > @eh.wrapfunction(url, 'opener')
436 438 > def urlopener(orig, *args, **kwargs):
437 439 > opener = orig(*args, **kwargs)
438 440 > opener.addheaders.append((r'X-HgTest-AuthType', r'Digest'))
439 441 > return opener
440 442 > EOF
441 443
442 444 Test that Digest Auth fails gracefully before testing the successful Basic Auth
443 445
444 446 $ hg -R auth_clone push --config extensions.x=use_digests.py
445 447 pushing to http://localhost:$HGPORT1/
446 448 searching for changes
447 449 abort: LFS HTTP error: HTTP Error 401: the server must support Basic Authentication!
448 450 (api=http://localhost:$HGPORT1/.git/info/lfs/objects/batch, action=upload)
449 451 [255]
450 452
451 453 $ hg -R auth_clone --debug push | egrep '^[{}]| '
452 454 {
453 455 "objects": [
454 456 {
455 457 "actions": {
456 458 "upload": {
457 459 "expires_at": "$ISO_8601_DATE_TIME$"
458 460 "header": {
459 461 "Accept": "application/vnd.git-lfs"
460 462 "Authorization": "Basic dXNlcjpwYXNz"
461 463 }
462 464 "href": "http://localhost:$HGPORT1/.hg/lfs/objects/df14287d8d75f076a6459e7a3703ca583ca9fb3f4918caed10c77ac8622d49b3"
463 465 }
464 466 }
465 467 "oid": "df14287d8d75f076a6459e7a3703ca583ca9fb3f4918caed10c77ac8622d49b3"
466 468 "size": 13
467 469 }
468 470 ]
469 471 "transfer": "basic"
470 472 }
471 473
472 474 $ "$PYTHON" $RUNTESTDIR/killdaemons.py $DAEMON_PIDS
473 475
474 476 $ cat $TESTTMP/access.log $TESTTMP/errors.log
475 477 $LOCALIP - - [$LOGDATE$] "GET /?cmd=capabilities HTTP/1.1" 401 - (glob)
476 478 $LOCALIP - - [$LOGDATE$] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
477 479 $LOCALIP - - [$LOGDATE$] "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob)
478 480 $LOCALIP - - [$LOGDATE$] "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bookmarks=1&bundlecaps=HG20%2Cbundle2%3DHG20%250Abookmarks%250Achangegroup%253D01%252C02%252C03%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Aphases%253Dheads%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps%250Arev-branch-cache%250Astream%253Dv2&cg=1&common=0000000000000000000000000000000000000000&heads=506bf3d83f78c54b89e81c6411adee19fdf02156+525251863cad618e55d483555f3d00a2ca99597e&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob)
479 481 $LOCALIP - - [$LOGDATE$] "POST /.git/info/lfs/objects/batch HTTP/1.1" 401 - (glob)
480 482 $LOCALIP - - [$LOGDATE$] "POST /.git/info/lfs/objects/batch HTTP/1.1" 200 - (glob)
481 483 $LOCALIP - - [$LOGDATE$] "GET /.hg/lfs/objects/276f73cfd75f9fb519810df5f5d96d6594ca2521abd86cbcd92122f7d51a1f3d HTTP/1.1" 200 - (glob)
482 484 $LOCALIP - - [$LOGDATE$] "GET /?cmd=capabilities HTTP/1.1" 401 - x-hgtest-authtype:Digest (glob)
483 485 $LOCALIP - - [$LOGDATE$] "GET /?cmd=capabilities HTTP/1.1" 200 - x-hgtest-authtype:Digest (glob)
484 486 $LOCALIP - - [$LOGDATE$] "GET /?cmd=batch HTTP/1.1" 401 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D525251863cad618e55d483555f3d00a2ca99597e+4d9397055dc0c205f3132f331f36353ab1a525a3 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull x-hgtest-authtype:Digest (glob)
485 487 $LOCALIP - - [$LOGDATE$] "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D525251863cad618e55d483555f3d00a2ca99597e+4d9397055dc0c205f3132f331f36353ab1a525a3 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull x-hgtest-authtype:Digest (glob)
486 488 $LOCALIP - - [$LOGDATE$] "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull x-hgtest-authtype:Digest (glob)
487 489 $LOCALIP - - [$LOGDATE$] "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull x-hgtest-authtype:Digest (glob)
488 490 $LOCALIP - - [$LOGDATE$] "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull x-hgtest-authtype:Digest (glob)
489 491 $LOCALIP - - [$LOGDATE$] "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull x-hgtest-authtype:Digest (glob)
490 492 $LOCALIP - - [$LOGDATE$] "GET /?cmd=branchmap HTTP/1.1" 401 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull x-hgtest-authtype:Digest (glob)
491 493 $LOCALIP - - [$LOGDATE$] "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull x-hgtest-authtype:Digest (glob)
492 494 $LOCALIP - - [$LOGDATE$] "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull x-hgtest-authtype:Digest (glob)
493 495 $LOCALIP - - [$LOGDATE$] "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull x-hgtest-authtype:Digest (glob)
494 496 $LOCALIP - - [$LOGDATE$] "POST /.git/info/lfs/objects/batch HTTP/1.1" 401 - x-hgtest-authtype:Digest (glob)
495 497 $LOCALIP - - [$LOGDATE$] "GET /?cmd=capabilities HTTP/1.1" 401 - (glob)
496 498 $LOCALIP - - [$LOGDATE$] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
497 499 $LOCALIP - - [$LOGDATE$] "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D525251863cad618e55d483555f3d00a2ca99597e+4d9397055dc0c205f3132f331f36353ab1a525a3 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob)
498 500 $LOCALIP - - [$LOGDATE$] "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob)
499 501 $LOCALIP - - [$LOGDATE$] "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob)
500 502 $LOCALIP - - [$LOGDATE$] "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob)
501 503 $LOCALIP - - [$LOGDATE$] "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob)
502 504 $LOCALIP - - [$LOGDATE$] "POST /.git/info/lfs/objects/batch HTTP/1.1" 401 - (glob)
503 505 $LOCALIP - - [$LOGDATE$] "POST /.git/info/lfs/objects/batch HTTP/1.1" 200 - (glob)
504 506 $LOCALIP - - [$LOGDATE$] "PUT /.hg/lfs/objects/df14287d8d75f076a6459e7a3703ca583ca9fb3f4918caed10c77ac8622d49b3 HTTP/1.1" 201 - (glob)
505 507 $LOCALIP - - [$LOGDATE$] "POST /?cmd=unbundle HTTP/1.1" 200 - x-hgarg-1:heads=666f726365 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob)
506 508 $LOCALIP - - [$LOGDATE$] "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob)
General Comments 0
You need to be logged in to leave comments. Login now