Bug 2019 - content-type exception when cloning over http from hgwebdir.cgi application
Summary: content-type exception when cloning over http from hgwebdir.cgi application
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: Mercurial (show other bugs)
Version: unspecified
Hardware: All All
: normal bug
Assignee: Bugzilla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-02-03 13:16 UTC by Andreas Jorneus
Modified: 2012-05-13 05:04 UTC (History)
7 users (show)

See Also:
Python Version: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Jorneus 2010-02-03 13:16 UTC
The following error is produced when doing a clone

hg clone http://myserver/hgwebdir.cgi/media/


destination directory: mediabank
requesting all changes
** unknown exception encountered, details follow
** report bug details to http://mercurial.selenic.com/bts/
** or mercurial@selenic.com
** Mercurial Distributed SCM (version 1.4.2)
** Extensions loaded: win32text, rebase
Traceback (most recent call last):
  File "hg", line 27, in <module>
  File "mercurial\dispatch.pyc", line 16, in run
  File "mercurial\dispatch.pyc", line 30, in dispatch
  File "mercurial\dispatch.pyc", line 46, in _runcatch
  File "mercurial\dispatch.pyc", line 454, in _dispatch
  File "mercurial\dispatch.pyc", line 324, in runcommand
  File "mercurial\dispatch.pyc", line 505, in _runcommand
  File "mercurial\dispatch.pyc", line 459, in checkargs
  File "mercurial\dispatch.pyc", line 453, in <lambda>
  File "mercurial\util.pyc", line 386, in check
  File "mercurial\commands.pyc", line 649, in clone
  File "mercurial\hg.pyc", line 292, in clone
  File "mercurial\localrepo.pyc", line 2140, in clone
  File "mercurial\localrepo.pyc", line 1437, in pull
  File "mercurial\httprepo.pyc", line 200, in changegroupsubset
  File "mercurial\httprepo.pyc", line 102, in do_cmd
  File "rfc822.pyc", line 384, in __getitem__
KeyError: 'content-type'
Comment 1 kiilerix 2010-02-03 18:02 UTC
The web server apparently didn't return what was expected. A workaround -
and the solution - is to fix the web server, whatever is wrong.

But still, Mercurial shouldn't crash ... It should probably say something
like 'invalid response'.

I assume the web server can't be accessed from the internet?

Can you use wireshark and capture the request and the response (especially
the headers)?
Comment 2 Benoit Boissinot 2010-08-23 07:20 UTC
Adding nosy from issue2346
Comment 3 Martin von Gagern 2011-03-07 06:41 UTC
Had the same with the following command, involving a sourceforge project and
no hgwebdir.cgi (just like issue2346 has a public server and no hgwebdir.cgi
in the URL either).

$ hg clone \
http://crayzedsgui.hg.sourceforge.net:8000/hgroot/crayzedsgui/crayzedsgui

Wiresharked the conversation:

GET
/?pairs=0000000000000000000000000000000000000000-0000000000000000000000000000000000000000&cmd=between
HTTP/1.1

Accept-Encoding: identity

host: sourceforge.net

accept: application/mercurial-0.1

user-agent: mercurial/proto-1.0



HTTP/1.1 200 OK

Server: nginx/0.7.63

Date: Mon, 07 Mar 2011 12:31:08 GMT

Transfer-Encoding: chunked

Connection: close

Pragma: no-cache

Cache-Control: no-cache

X-XRDS-Location: http://sourceforge.net/account/xrds.php

X-UA-Compatible: IE=edge,chrome=1

Set-Cookie: VISITOR=4d74d00cd3179d71a60023ee; expires="Thu, 04-Mar-2021
12:31:08 GMT"; httponly; Max-Age=315360000; Path=/

Set-cookie:
sf.consume=08d4b325b30218fab11ba1b5e4009af42b632c2bgAJ9cQEoVQhfZXhwaXJlc3ECY2RhdGV0aW1lCmRhdGV0aW1lCnEDVQoH9gETAw4HAAAAhVJxBFUFcHJlZnNxBX1xBlUOdXNlc19yZWxhdGlvbnNxB4lVB3ZlcnNpb25xCFUBMlUDa2V5cQlVGDRkNzRkMDBjZDMxNzlkNzFhNjAwMjNlZXEKVQNfaWRxC1UgOGFlYTJlNWQ3ZmIxYzBjZWM1YjRlN2MxOGIzYmQ1NmZxDFUOX2FjY2Vzc2VkX3RpbWVxDUdB0100Az5GhFUOX2NyZWF0aW9uX3RpbWVxDkdB0100Az5FX3Uu;
expires=Tue, 19-Jan-2038 03:14:07 GMT; Path=/

Access-Control-Allow-Origin: *



20

download_hostdownloadspagemirror

0



Does this help? Is sourceforge broken? If so, could someone who knows the
internals perhaps help them fix it?
Comment 4 kiilerix 2011-03-07 07:46 UTC
gagern: There is no Mercurial repo at that URL. Use for example one of:
http://crayzedsgui.hg.sourceforge.net:8000/hgroot/crayzedsgui/silly
http://crayzedsgui.hg.sourceforge.net/hgroot/crayzedsgui/silly
http://crayzedsgui.hg.sourceforge.net/hgweb/crayzedsgui/silly

I don't know why SF sends such a response for invalid URLs.

Mercurial could however report the error in a more helpful way.
Comment 5 HG Bot 2011-05-01 13:00 UTC
Fixed by http://selenic.com/repo/hg/rev/091c86a77d19
Mads Kiilerich <mads@kiilerich.com>
httprepo: proper handling of invalid responses without content-type (issue2019)

(please test the fix)
Comment 6 HG Bot 2011-06-01 16:00 UTC
Fixed by http://selenic.com/repo/hg/rev/4e958f2a193f
Mads Kiilerich <mads@kiilerich.com>
httprepo: proper handling of invalid responses without content-type (issue2019)

(please test the fix)
Comment 7 Bugzilla 2012-05-12 09:06 UTC

--- Bug imported by bugzilla@serpentine.com 2012-05-12 09:06 EDT  ---

This bug was previously known as _bug_ 2019 at http://mercurial.selenic.com/bts/issue2019