cabal upload has poor error messages (just an HTTP response code) #260

Closed
bos opened this Issue May 24, 2012 · 5 comments

Projects

None yet

1 participant

Contributor
bos commented May 24, 2012

(Imported from Trac #267, reported by guest on 2008-04-09)

All these bugs are against the homeomorphic library I have written. To
play along, you can do

darcs get --partial http://www.cs.york.ac.uk/fp/darcs/homeomorphic

$ cabal upload dist
E:\Neil\homeomorphic>cabal upload dist\homeomorphic-0.1.tar.gz
Hackage username: NeilMitchell?
Hackage password: yoda
Uploading dist\homeomorphic-0.1.tar.gz...
ERROR: dist\homeomorphic-0.1.tar.gz: 400 Error in upload

400 error in upload - not the worlds most helpful error message...

Duncan says:

Indeed. There is an error message available but I'm not sure how we get
at it. Any ideas Ross?

Another ticket for this one.

Contributor
bos commented May 24, 2012

(Imported comment by ross on 2008-04-09)

The CGI script uses outputError, which returns a response with a status header 400 Error in upload, with the error message (in HTML) in the body. Cabal upload is presumably ignoring the message because it wants plain text, but the CGI library doesn't offer that.

Contributor
bos commented May 24, 2012

(Imported comment by ross on 2008-04-10)

OK, I can bypass outputError and send the plain text on request. Then cabal upload can stop ignoring it.

Contributor
bos commented May 24, 2012

(Imported comment by @dcoutts on 2008-04-10)

Replying to ross:

OK, I can bypass outputError and send the plain text on request. Then cabal upload can stop ignoring it.

That'd be great.

At the moment we're sending Accept: text/plain and getting Content-Type: text/html; charset=ISO-8859-1 as a response.

As a note to whoever wants to do the client-side change in future:

inspect

[ s | Header HdrContentType s <\- rspHeaders resp ]
to see if it starts with "text/plain" and if so print the rspBody resp
Contributor
bos commented May 24, 2012

(Imported comment by ross on 2008-05-01)

Replying to @dcoutts:

At the moment we're sending Accept: text/plain and getting Content-Type: text/html; charset=ISO-8859-1 as a response.

That is done by outputError in the cgi package. Björn Bringert is rewriting outputError and friends to check HTTP_ACCEPT and send the error messages as text/plain if requested. When that's done, the server side will require only a recompile.

Contributor
bos commented May 24, 2012

(Imported comment by @dcoutts on 2008-05-01)

cabal-install now reports error messages if the server returns them using mime type text/plain.

Sun Aug 10 11:36:07 BST 2008  Lemmih <lemmih@gmail.com>
  * Print upload error messages if they are in text/plain.
@bos bos closed this May 24, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment