Giter Club home page Giter Club logo

awsgroovyclouds's People

Watchers

 avatar

awsgroovyclouds's Issues

S3 returns http 307

What steps will reproduce the problem?
1. Sometimes, when using a non-default location, s3 will return http 307.
Only sometimes so this takes patience to test in real life.


The 307 response from S3 contains a new host name to try to send the
request to but there is no way to choose a host using the external methods
of the lib.
Suggested fix: Change method "callS3" and add method "replaceHost" like this:


    private void replaceHost( HttpMethodBase method, String newHost ) {
      org.apache.commons.httpclient.URI oldUri = method.URI
      String oldString = oldUri.toString()
      String oldHost = oldUri.getHost()
      String newString = oldString.replace( oldHost, newHost )
      method.URI = new org.apache.commons.httpclient.URI( newString )
      logger.info( "Changed {} to {}.", oldString, newString )
    }

    private def callS3(httpMethod, s3headers, List responseHeaders=null,
parseXMLResponse=true, handlerConfig=null)   {
        s3headers.each { k, v ->
            httpMethod.setRequestHeader(k, v)
        }

        def (statusCode, response) = connectAWS(httpMethod,
parseXMLResponse, handlerConfig)

        // retry if code is 307.
        if( 307 == statusCode ) {
          logger.warn( "Status code 307 (Temporary Redirect) received. Will
retry once if we were given a new endpoint." )
          if( response?.Endpoint ) {
            String newHost = response.Endpoint.text()
            logger.warn( "Retrying with new Uri: {}", newHost )
            replaceHost( httpMethod, newHost )
            (statusCode, response) = connectAWS( httpMethod,
parseXMLResponse, handlerConfig )
          }
        }

        if (parseXMLResponse)   {
          try {
            parseResponse(response)
          } catch( S3Exception s3ex ) {
            throw s3ex //rethrow
          }
        }
        def resultHeaders = getResponseHeaders(httpMethod, responseHeaders)
        resultHeaders.put("StatusCode", statusCode)
        return [resultHeaders, response]    
    }





What version of the product are you using? On what operating system?
0.8 on windows xp and ubuntu/64 9.10



Original issue reported on code.google.com by [email protected] on 25 Feb 2010 at 9:11

Create Bucket fails when using location parameter.

What steps will reproduce the problem?
1. Call createBucket and supply a value for the location parameter.

What is the expected output? What do you see instead?
Result: groovy.lang.MissingMethodException: "No signature of method:
java.lang.String.getContentType() is applicable for argument types: ()
values: []"

What version of the product are you using? On what operating system?
0.8 on Ubuntu 9.10 64bit



Please provide any additional information below.

Line 709 in S3Driver.groovy fails because body is a String and method
getContentType() is not available for Strings.
This is the line: "def contentType = body?.getContentType()"


The body parameter is only defined if the location parameter to
createBucket is non-null as seen in lines 261-263:

        if (location)   {
            body =
"""<CreateBucketConfiguration><LocationConstraint>${location}</LocationConstrain
t></CreateBucketConfiguration>""".toString()
        }

It is then passed to putRequest on line 264:
def (headers, response) = doPutRequest(bucketName, "/", body, s3headers)




TO FIX
Lines 264-265 should probably look more like this:
 def reqEntity = new StringRequestEntity(body, "text/xml", "utf-8")
 def (headers,response) = doPutRequest(bucketName,"/",reqEntity,s3headers)

Original issue reported on code.google.com by [email protected] on 23 Feb 2010 at 9:12

Is this project still active?

The issues are a year old, no documentation, no comment in the exmaple code... 
not really signs of a healthy Open Source project.

Original issue reported on code.google.com by [email protected] on 21 Feb 2011 at 12:34

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.