Changeset - c344a7fca2a7
[Not reviewed]
beta
0 1 0
Marcin Kuzminski - 13 years ago 2012-07-10 22:42:42
marcin@python-works.com
reset response charset to fix Egit/JGit issues
1 file changed with 4 insertions and 3 deletions:
0 comments (0 inline, 0 general)
rhodecode/lib/middleware/pygrack.py
Show inline comments
 
@@ -76,27 +76,28 @@ class GitRepository(object):
 
        # please, resist the urge to add '\n' to git capture and increment
 
        # line count by 1.
 
        # The code in Git client not only does NOT need '\n', but actually
 
        # blows up if you sprinkle "flush" (0000) as "0001\n".
 
        # It reads binary, per number of bytes specified.
 
        # if you do add '\n' as part of data, count it.
 
        smart_server_advert = '# service=%s' % git_command
 
        server_advert = '# service=%s' % git_command
 
        packet_len = str(hex(len(server_advert) + 4)[2:].rjust(4, '0')).lower()
 
        try:
 
            out = subprocessio.SubprocessIOChunker(
 
                r'git %s --stateless-rpc --advertise-refs "%s"' % (
 
                                git_command[4:], self.content_path),
 
                starting_values=[
 
                    str(hex(len(smart_server_advert) + 4)[2:]
 
                        .rjust(4, '0') + smart_server_advert + '0000')
 
                    packet_len + server_advert + '0000'
 
                ]
 
            )
 
        except EnvironmentError, e:
 
            log.exception(e)
 
            raise exc.HTTPExpectationFailed()
 
        resp = Response()
 
        resp.content_type = 'application/x-%s-advertisement' % str(git_command)
 
        resp.charset = None
 
        resp.app_iter = out
 
        return resp
 

	
 
    def backend(self, request, environ):
 
        """
 
        WSGI Response producer for HTTP POST Git Smart HTTP requests.
0 comments (0 inline, 0 general)