quibble: with hhvm, "could not load extension asset expand.svg" due to lack of proper Content-Type header
Closed, ResolvedPublic

Description

Spotted on MultimediaViewer when running quibble with hhvm. The Qunit tests fail:

mmv.provider.Image
  ✖ Image load with preloading supported
    HeadlessChrome 0.0.0 (Linux 0.0.0)
  Promise rejected during "Image load with preloading supported": could not load image from /extensions/MultimediaViewer/resources/mmv/img/expand.svg
      at mightThrow (http://localhost:9876/load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=vector&version=1ex5wzx:49:598)
      at process (http://localhost:9876/load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=vector&version=1ex5wzx:50:269)

The HHVM server does not serve them apparently. It works fine with php7.

ZUUL_PROJECT=mediawiki/extensions/MultimediaViewer quibble --db sqlite --run qunit --skip-zuul --skip-deps

From Special:Version:

Entry pointURL
Article path/index.php/$1
Script path/
index.php/index.php
api.php/api.php
load.php/load.php

At least in the Firefox javascript console it works:

09:59:32.886 img = new window.Image()
09:59:32.894 <img>
09:59:53.196 img.src='/extensions/MultimediaViewer/resources/mmv/img/expand.svg'
09:59:53.204 "/extensions/MultimediaViewer/resources/mmv/img/expand.svg"
09:59:53.246 GET 
http://127.0.0.1:8888/extensions/MultimediaViewer/resources/mmv/img/expand.svg [HTTP/1.1 200 OK 0ms]
hashar created this task.May 25 2018, 10:13 PM
Restricted Application added a project: Multimedia. · View Herald TranscriptMay 25 2018, 10:13 PM
hashar updated the task description. (Show Details)May 25 2018, 10:13 PM
hashar updated the task description. (Show Details)May 28 2018, 7:14 AM
hashar updated the task description. (Show Details)May 28 2018, 8:00 AM

Response headers with php7:

< HTTP/1.1 200 OK
< Host: 127.0.0.1:8888
< Connection: close
< Content-Type: image/svg+xml
< Content-Length: 478

With hhvm:

< HTTP/1.1 200 OK
< Content-Type: application/octet-stream
< Cache-Control: max-age=2592000
< Expires: Wed, 27 Jun 2018 08:13:56 GMT
< Accept-Ranges: bytes
< Last-Modified: Fri, 25 May 2018 21:44:34 GMT
< X-Powered-By: HHVM/3.18.6-dev
< Date: Mon, 28 May 2018 08:13:56 GMT
< Connection: keep-alive
< Content-Length: 478

I guess since HHVM sets the Content-Type to application/octet-stream, the browser ends up rejecting the image though it managed to fetch it properly.

hashar renamed this task from quibble: with hhvm, could not load extension asset to quibble: with hhvm, "could not load extension asset expand.svg" due to lack of proper Content-Type header.May 28 2018, 8:29 AM
hashar added projects: HHVM, Upstream.

https://docs.hhvm.com/hhvm/configuration/INI-settings#server-mode__static-file-extension-defaults

Static File Extension Defaults

These are the default file extensions for hhvm.static_file.extensions:

array(11) {
  ["zip"]=>
  string(15) "application/zip"
  ["jpeg"]=>
  string(10) "image/jpeg"
  ["html"]=>
  string(9) "text/html"
  ["css"]=>
  string(8) "text/css"
  ["gif"]=>
  string(9) "image/gif"
  ["mp3"]=>
  string(10) "audio/mpeg"
  ["png"]=>
  string(9) "image/png"
  ["tif"]=>
  string(10) "image/tiff"
  ["jpg"]=>
  string(10) "image/jpeg"
  ["tiff"]=>
  string(10) "image/tiff"
  ["txt"]=>
  string(10) "text/plain"
}

There is no svg type here :] We have to pass to hhvm something like hhvm.static_file.extensions[svg]=image/svg+xml

hashar claimed this task.May 28 2018, 8:29 AM
hashar moved this task from Backlog to Defect on the HHVM board.

Change 435748 had a related patch set uploaded (by Hashar; owner: Hashar):
[integration/quibble@master] hhvm server should set .svg Content-Type

https://gerrit.wikimedia.org/r/435748

Change 435748 merged by jenkins-bot:
[integration/quibble@master] hhvm server should set .svg Content-Type

https://gerrit.wikimedia.org/r/435748

Mentioned in SAL (#wikimedia-releng) [2018-05-28T11:01:33Z] <hashar> tagging quibble 0.0.13 hhvm server should set .svg Content-Type | T195634

Change 435767 had a related patch set uploaded (by Hashar; owner: Hashar):
[integration/config@master] docker: quibble 0.0.13

https://gerrit.wikimedia.org/r/435767

Change 435768 had a related patch set uploaded (by Hashar; owner: Hashar):
[integration/config@master] Bump Quibble jobs to 0.0.13

https://gerrit.wikimedia.org/r/435768

Change 435767 merged by jenkins-bot:
[integration/config@master] docker: quibble 0.0.13

https://gerrit.wikimedia.org/r/435767

Mentioned in SAL (#wikimedia-releng) [2018-05-28T11:09:25Z] <hashar> Building Quibble Docker images 0.0.13 | T195634

Change 435768 merged by jenkins-bot:
[integration/config@master] Bump Quibble jobs to 0.0.13

https://gerrit.wikimedia.org/r/435768

hashar closed this task as Resolved.May 28 2018, 12:08 PM

Validated against MultimediaViewer

Change 436565 had a related patch set uploaded (by Hashar; owner: Hashar):
[integration/quibble@master] Add missing test file

https://gerrit.wikimedia.org/r/436565

Change 436565 merged by jenkins-bot:
[integration/quibble@master] Add missing test file

https://gerrit.wikimedia.org/r/436565

Vvjjkkii renamed this task from quibble: with hhvm, "could not load extension asset expand.svg" due to lack of proper Content-Type header to 18baaaaaaa.Jul 1 2018, 1:07 AM
Vvjjkkii reopened this task as Open.
Vvjjkkii triaged this task as High priority.
Vvjjkkii removed hashar as the assignee of this task.
Vvjjkkii updated the task description. (Show Details)
Vvjjkkii removed a subscriber: gerritbot.
CommunityTechBot assigned this task to hashar.
CommunityTechBot raised the priority of this task from High to Needs Triage.
CommunityTechBot closed this task as Resolved.
CommunityTechBot renamed this task from 18baaaaaaa to quibble: with hhvm, "could not load extension asset expand.svg" due to lack of proper Content-Type header.
CommunityTechBot added a subscriber: gerritbot.