Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-55262

Missing content-type on serverStatuses REST API

      Jelly template serving /gerrit-trigger/serverStatuses REST API doesn't add a Content-Type header to HTTP Response.

      In almost all cases this is harmless (JSON result is accepted) but on some combination of Browser / HTTP Proxy + Gzip compression this result to corrupted JSON response.

      Actual response headers:

      HTTP/1.1 200 OK
      Date: Wed, 19 Dec 2018 13:52:44 GMT
      X-Content-Type-Options: nosniff
      Content-Encoding: gzip
      Content-Length: 143
      Server: Jetty(9.4.z-SNAPSHOT)

      Expected response headers:

      HTTP/1.1 200 OK
      Date: Wed, 19 Dec 2018 14:16:50 GMT
      X-Content-Type-Options: nosniff
      Content-Encoding: gzip
      Content-Type: application/json
      Content-Length: 145
      Server: Jetty(9.4.z-SNAPSHOT

      Adding Jelly:stapler 'contentType' tag fix this.

      /src/main/resources/com/sonyericsson/hudson/plugins/gerrit/trigger/GerritManagement/serverStatuses.jelly

      <?jelly escape-by-default='true'?>
      <j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout"
       xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:i="jelly:fmt">
      <st:contentType value="application/json" />
      ${it.serverStatuses}
      </j:jelly>

          [JENKINS-55262] Missing content-type on serverStatuses REST API

          Florian Ramillien created issue -
          Florian Ramillien made changes -
          Description Original: Jelly template serving /gerrit-trigger/serverStatuses REST API doesn't add a Content-Type header to HTTP Response.

          In almost all cases this is harmless (JSON result is accepted) but on some combination of Browser / HTTP Proxy + Gzip compression this result to corrupted JSON response.

          Actual Response headers:
          {code:java}
          HTTP/1.1 200 OK
          Date: Wed, 19 Dec 2018 13:52:44 GMT
          X-Content-Type-Options: nosniff
          Content-Encoding: gzip
          Content-Length: 143
          Server: Jetty(9.4.z-SNAPSHOT){code}
          Expected response:

           
          {code:java}
          HTTP/1.1 200 OK
          Date: Wed, 19 Dec 2018 14:16:50 GMT
          X-Content-Type-Options: nosniff
          Content-Encoding: gzip
          Content-Type: application/json
          Content-Length: 145
          Server: Jetty(9.4.z-SNAPSHOT{code}
          Adding Jelly:stapler 'contentType' tag fix this.

          /src/main/resources/com/sonyericsson/hudson/plugins/gerrit/trigger/GerritManagement/serverStatuses.jelly
          {code:java}
          <?jelly escape-by-default='true'?>
          <j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout"
           xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:i="jelly:fmt">
          <st:contentType value="application/json" />
          ${it.serverStatuses}
          </j:jelly>{code}
          New: Jelly template serving /gerrit-trigger/serverStatuses REST API doesn't add a Content-Type header to HTTP Response.

          In almost all cases this is harmless (JSON result is accepted) but on some combination of Browser / HTTP Proxy + Gzip compression this result to corrupted JSON response.

          Actual response headers:
          {code:java}
          HTTP/1.1 200 OK
          Date: Wed, 19 Dec 2018 13:52:44 GMT
          X-Content-Type-Options: nosniff
          Content-Encoding: gzip
          Content-Length: 143
          Server: Jetty(9.4.z-SNAPSHOT){code}
          Expected response headers:
          {code:java}
          HTTP/1.1 200 OK
          Date: Wed, 19 Dec 2018 14:16:50 GMT
          X-Content-Type-Options: nosniff
          Content-Encoding: gzip
          Content-Type: application/json
          Content-Length: 145
          Server: Jetty(9.4.z-SNAPSHOT{code}
          Adding Jelly:stapler 'contentType' tag fix this.

          /src/main/resources/com/sonyericsson/hudson/plugins/gerrit/trigger/GerritManagement/serverStatuses.jelly
          {code:java}
          <?jelly escape-by-default='true'?>
          <j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout"
           xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:i="jelly:fmt">
          <st:contentType value="application/json" />
          ${it.serverStatuses}
          </j:jelly>{code}
          Martin d'Anjou made changes -
          Labels New: newbie-friendly
          Oleg Nenashev made changes -
          Labels Original: newbie-friendly New: newbie-friendly rest
          Mahmoud made changes -
          Assignee Original: rsandell [ rsandell ] New: Mahmoud [ kroking ]
          Mark Waite made changes -
          Released As New: https://github.com/jenkinsci/gerrit-trigger-plugin/releases/tag/gerrit-trigger-2.29.0
          Resolution New: Fixed [ 1 ]
          Status Original: Open [ 1 ] New: Closed [ 6 ]

            kroking Mahmoud
            framillien Florian Ramillien
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: