Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.13.1
    • Component/s: None
    • Labels:
      None

      Description

      GoGrid connection requests fail since GoGrid doesn't allow "zero-byte files" (HTTP 411). Right now,

      {data}

      defaults to None and therefore is not encoded to Content-Length.

      The data passed to the connection request should check for None instead of empty string and None. This way defaulting GoGrid to pass an empty string (as it was before) will fix the issue.

        Activity

        Hide
        kami Tomaz Muraus added a comment - - edited

        Uh, this is actually a regression which I have introduced in 0.13.0 (https://github.com/apache/libcloud/commit/5e782bf932ad39b0242dee42ef0d29f2a391d780).

        Previously we also included `Content-Length: 0` header with every HTTP GET request. IIRC `Content-Length: 0` is not explicitly forbidden in HTTP GET requests, but it's confusing and not a good practice.

        I guess a better solution would be to only include `Content-Length: 0` with the methods which support a body (POST, PUT, ...).

        Paul Querna wdyt?

        Show
        kami Tomaz Muraus added a comment - - edited Uh, this is actually a regression which I have introduced in 0.13.0 ( https://github.com/apache/libcloud/commit/5e782bf932ad39b0242dee42ef0d29f2a391d780 ). Previously we also included `Content-Length: 0` header with every HTTP GET request. IIRC `Content-Length: 0` is not explicitly forbidden in HTTP GET requests, but it's confusing and not a good practice. I guess a better solution would be to only include `Content-Length: 0` with the methods which support a body (POST, PUT, ...). Paul Querna wdyt?
        Hide
        kami Tomaz Muraus added a comment -

        Paul Querna bump, does my proposal seem reasonable?

        Show
        kami Tomaz Muraus added a comment - Paul Querna bump, does my proposal seem reasonable?
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 19884f31adb727f6c4d4aac58381014acac00647 in branch refs/heads/trunk from Tomaz Muraus
        [ https://git-wip-us.apache.org/repos/asf?p=libcloud.git;h=19884f3 ]

        Fix a regression introduced in 0.13.0 and make sure to include
        Content-Length 0 with PUT and POST requests. Also add test cases for it.

        Part of LIBCLOUD-362.

        Show
        jira-bot ASF subversion and git services added a comment - Commit 19884f31adb727f6c4d4aac58381014acac00647 in branch refs/heads/trunk from Tomaz Muraus [ https://git-wip-us.apache.org/repos/asf?p=libcloud.git;h=19884f3 ] Fix a regression introduced in 0.13.0 and make sure to include Content-Length 0 with PUT and POST requests. Also add test cases for it. Part of LIBCLOUD-362 .
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit c32bb6cf4c7955f0f828c44354112db7014ac5fa in branch refs/heads/trunk from Tomaz Muraus
        [ https://git-wip-us.apache.org/repos/asf?p=libcloud.git;h=c32bb6c ]

        Modify GoGridConnection to call parent request method with an empty string for
        'data' argument.

        Contributed by Bob Thompson, part of LIBCLOUD-362.

        Show
        jira-bot ASF subversion and git services added a comment - Commit c32bb6cf4c7955f0f828c44354112db7014ac5fa in branch refs/heads/trunk from Tomaz Muraus [ https://git-wip-us.apache.org/repos/asf?p=libcloud.git;h=c32bb6c ] Modify GoGridConnection to call parent request method with an empty string for 'data' argument. Contributed by Bob Thompson, part of LIBCLOUD-362 .
        Hide
        kami Tomaz Muraus added a comment -

        Bob Thompson Sorry for the delay. I've pushed a changed which I proposed in my previous comment to trunk.

        Now we send Content-Length 0 with POST and PUT request if data is '' (empty string). This should work fine unless GoGrid also requires users to send Content-Length 0 with GET requests.

        Can you please confirm it works correctly?

        Thanks!

        Show
        kami Tomaz Muraus added a comment - Bob Thompson Sorry for the delay. I've pushed a changed which I proposed in my previous comment to trunk. Now we send Content-Length 0 with POST and PUT request if data is '' (empty string). This should work fine unless GoGrid also requires users to send Content-Length 0 with GET requests. Can you please confirm it works correctly? Thanks!
        Hide
        bobt Bob Thompson added a comment -

        Great. Thanks. We are using POST requests in libcloud for GoGrid. (Note: The GoGrid API server accepts GET or POST requests).

        Show
        bobt Bob Thompson added a comment - Great. Thanks. We are using POST requests in libcloud for GoGrid. (Note: The GoGrid API server accepts GET or POST requests).
        Hide
        kami Tomaz Muraus added a comment -

        Bob Thompson You are welcome. I just want to confirm - did you test the driver with the latest trunk?

        If you haven't I would appreciate if you can do it, because I don't have GroGrid here.

        Show
        kami Tomaz Muraus added a comment - Bob Thompson You are welcome. I just want to confirm - did you test the driver with the latest trunk? If you haven't I would appreciate if you can do it, because I don't have GroGrid here.
        Hide
        bobt Bob Thompson added a comment -

        I was able to successfully create a node with your change.

        Show
        bobt Bob Thompson added a comment - I was able to successfully create a node with your change.
        Hide
        kami Tomaz Muraus added a comment -

        Great, thanks for confirming.

        Show
        kami Tomaz Muraus added a comment - Great, thanks for confirming.

          People

          • Assignee:
            kami Tomaz Muraus
            Reporter:
            bobt Bob Thompson
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development