Skip to content

The "Api::downloadAttachment" method doesn't work with "PHPClient" #232

Closed
@aik099

Description

@aik099

When using PHPClient I'm always getting 426 Upgrade Required error, when attempting to download a file from Atlassian Cloud Jira (e.g. using https://your-domain.atlassian.net/rest/api/2/attachment/content/12345 URL).

Not having this issue with CurlClient. According to https://community.atlassian.com/t5/Jira-questions/426-Error-Upgrade-Required/qaq-p/1166653 this is related to SSL.

Returned headers:

Array
(
    [0] => HTTP/1.1 426 Upgrade Required
    [1] => Access-Control-Allow-Origin: *
    [2] => Content-Length: 18943
    [3] => Content-Type: text/html
    [4] => Vary: Accept-Encoding
    [5] => Server-Timing: atl-edge;dur=0,atl-edge-internal;dur=0,atl-edge-upstream;dur=0,atl-edge-pop;desc="aws-nil"
    [6] => Date: Tue, 07 Jan 2025 19:45:20 GMT
    [7] => Server: AtlassianEdge
    [8] => Connection: close
)

The issue is solved by specifying http_version in the stream context as 1.1. Prior to PHP 8.0, it was 1.0 and Atlassian Cloud servers don't like that.

Prior to #147 HTTP 1.0 was enforced in the CurlClient. Now we need to enforce HTTP 1.1 to have consistent logic across clients.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @aik099

        Issue actions

          The "Api::downloadAttachment" method doesn't work with "PHPClient" · Issue #232 · console-helpers/jira-api-restclient