Gentlemen,
for quite some time now I've been hunting down a problem that creeped up when
scala-tools.org upgraded from Nexus 1.8 to 1.9 and suddently stopped properly
accepting my projects artifacts, which I upload with buildr.
Nexus acks all my uploads with HTTP status 201, but does not actually put them
into the repository. Rather, all artifacts show up with length "zero bytes".
I've watched an upload with wireshark, here is the relevant HTTP conversation
for a small .md5 file:
REQUEST (from buildr):
PUT
/content/repositories/snapshots/org/parboiled/parboiled-core/0.11.0-SNAPSHOT/parboiled-core-0.11.0-SNAPSHOT.jar.md5
HTTP/1.1
Accept: */*
Content-Md5: 86a26a5d1cc83fd24ee5d4cd33c08883
Content-Type: application/x-www-form-urlencoded
Connection: close
Authorization: Basic bWF0aGlhcy5kb2VuaXR6OjYyRW5wZVhya1Yyaw==
Content-Length: 32
Host: nexus.scala-tools.org
70a147c20ee97fae4147d13e05eab073
RESPONSE (from Nexus 1.9):
HTTP/1.1 201 Created
Server: nginx/0.6.36
Date: Fri, 18 Feb 2011 21:34:32 GMT
Connection: close
Set-Cookie: JSESSIONID=1c37c78e-6234-4710-af6d-dd4b12359f78; Path=/; HttpOnly
Set-Cookie: rememberMe=deleteMe; Path=/; Expires=Thu, 17-Feb-2011 21:34:32 GMT
Content-Length: 0
This snippet looks ok, however the file does not make it into the repository.
The strange thing is, uploads with other build tools (SBT, Maven) work
flawlessly.
To cut a long story short, the problem is that
1. Buildr does not send the right Content-Type header with its PUT request
("application/x-www-form-urlencoded" does not appear to be correct)
2. Nexus 1.9 does not issue proper error status codes upon receiving content
with incorrect Content-Type headers
There are two possible solutions: Buildr can either send the correct
Content-Type header or it can send no Content-Type header at all. In the latter
case the HTTP spec allows Nexus to inspect the request content and "guess" the
Content-Type, which it does and which works nicely.
So I propose to simply remove the Content-Type header from PUT requests issued
by Buildr upload.
Up until this is done all uploads to repositories running Nexus 1.9 will
silently fail...
Cheers,
Mathias
---
[email protected]
http://www.parboiled.org