Skip to content

Commit

Permalink
add some debug to id gitlab issue
Browse files Browse the repository at this point in the history
  • Loading branch information
felliott committed Nov 22, 2023
1 parent 2963571 commit bcb07b6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 3 additions & 0 deletions waterbutler/providers/gitlab/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,9 @@ async def download(self, path: GitLabPath, **kwargs): # type: ignore

logger.debug('download-headers:: {}'.format([(x, resp.headers[x]) for x in resp.headers]))

logger.error('gitlab-size-headers: content-length:({}) '
'x-gitlab-size:({})'.format(resp.headers.get('Content-Length'),
resp.headers.get('X-Gitlab-Size')))
# get size from X-Gitlab-Size header, since some responses don't set Content-Length
return streams.ResponseStreamReader(resp, size=int(resp.headers['X-Gitlab-Size']))

Expand Down
12 changes: 11 additions & 1 deletion waterbutler/server/api/v1/provider/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import pytz
from dateutil.parser import parse as datetime_parser
from tornado import httputil

from waterbutler.server import utils
from waterbutler.core import mime_types
Expand Down Expand Up @@ -103,7 +104,16 @@ async def download_file(self):
if ext in mime_types:
self.set_header('Content-Type', mime_types[ext])

await self.write_stream(stream)
try:
await self.write_stream(stream)
except httputil.HTTPOutputError as exc:
logger.error('Caught HTTPOutputError, checking content-length sizes')
logger.error(
'*** stream.size:({}) content-length:({})'.format(
stream.size, self._headers.get('Content-Length')
)
)
raise exc

if getattr(stream, 'partial', False) and isinstance(stream, ResponseStreamReader):
await stream.response.release()
Expand Down

0 comments on commit bcb07b6

Please sign in to comment.