I am using Jenkins 1.521 from the Jenkins APT repository on Ubuntu. I am getting a very similar symptom to the one described here i.e. when trying to view a PDF in the embedded Chrome viewer it is failing.
I have done a couple of experiments which lead me to believe that Jenkins is simply failing to include the units i.e. "bytes" in the content-range header. Is this possibly the problem?
I notice that the headers shown in previous comments don't have a unit so in my reading they don't match the production for content-range-spec in http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html section 14.16 and bytest-unit in http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html section 3.12.
My experiments:
Embedded Chrome viewer
Environment:
Ubuntu Raring
Chrome 28
Jenkins 1.521
PDF file: Not linearized, 49KB
Result:
PDF loading progress bar reaches 100% but no pages are shown
Embedded Firefox viewer (based on pdf.js)
Environment:
Ubuntu Raring
Firefox 22
Jenkins 1.521
PDF file: Not linearized, 49KB
Result:
PDF displays correctly
Standalone pdf.js
Environment:
Ubuntu Raring
Firefox 22
pdf.js mozilla-pdf.js-v0.5.5-1204-g81fa4a0
Jenkins 1.521
PDF file: Not linearized, 49KB
Result:
PDF progress bar reaches about 15% and no pages are ever displayed, Javascript exception
Patched standalone pdf.js
Environment:
Ubuntu Raring
Firefox 22
pdf.js mozilla-pdf.js-v0.5.5-1204-g81fa4a0 (patched, see below)
Jenkins 1.521
PDF file: Not linearized, 49KB
Result:
PDF displays correctly
Explanation:
After looking into the Javascript exception above, I tried a small patch to how pdf.js was parsing the header
diff -ru a/pdfjs/src/network.js b/pdfjs/src/network.js
--- a/pdfjs/src/network.js 2013-07-01 17:29:31.000000000 +0100
+++ b/pdfjs/src/network.js 2013-07-11 15:33:06.000000000 +0100
@@ -187,6 +187,9 @@
if (xhrStatus === PARTIAL_CONTENT_RESPONSE) {
var rangeHeader = xhr.getResponseHeader('Content-Range');
var matches = /bytes (\d+)-(\d+)\/(\d+)/.exec(rangeHeader);
+ if (matches == null) {
+ var matches = /(\d+)-(\d+)\/(\d+)/.exec(rangeHeader);
+ }
var begin = parseInt(matches[1], 10);
pendingRequest.onDone({
begin: begin,
I also tried downloading the artifacts and serving them up from a simple Apache HTTPD. The embedded Chrome viewer, in fact every test, worked fine.
Reproduced with Jenkins 1.461 running on Winstone.
The archived file's length is 1716 bytes.
It seems that "last-byte-pos" in Content-Range header is always bigger by 1 byte.