equal
deleted
inserted
replaced
364 if rctx.csp: |
364 if rctx.csp: |
365 # hgwebdir may have added CSP header. Since we generate our own, |
365 # hgwebdir may have added CSP header. Since we generate our own, |
366 # replace it. |
366 # replace it. |
367 res.headers[b'Content-Security-Policy'] = rctx.csp |
367 res.headers[b'Content-Security-Policy'] = rctx.csp |
368 |
368 |
369 # /api/* is reserved for various API implementations. Dispatch |
|
370 # accordingly. But URL paths can conflict with subrepos and virtual |
|
371 # repos in hgwebdir. So until we have a workaround for this, only |
|
372 # expose the URLs if the feature is enabled. |
|
373 apienabled = rctx.repo.ui.configbool(b'experimental', b'web.apiserver') |
|
374 if apienabled and req.dispatchparts and req.dispatchparts[0] == b'api': |
|
375 wireprotoserver.handlewsgiapirequest( |
|
376 rctx, req, res, self.check_perm |
|
377 ) |
|
378 return res.sendresponse() |
|
379 |
|
380 handled = wireprotoserver.handlewsgirequest( |
369 handled = wireprotoserver.handlewsgirequest( |
381 rctx, req, res, self.check_perm |
370 rctx, req, res, self.check_perm |
382 ) |
371 ) |
383 if handled: |
372 if handled: |
384 return res.sendresponse() |
373 return res.sendresponse() |