You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jclouds.apache.org by "Andrew Phillips (JIRA)" <ji...@apache.org> on 2013/06/27 21:42:20 UTC

[jira] [Commented] (JCLOUDS-155) HTTP headers are incorrectly treated case sensitive causing OpenStack x-storage-url to fail

    [ https://issues.apache.org/jira/browse/JCLOUDS-155?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13694992#comment-13694992 ] 

Andrew Phillips commented on JCLOUDS-155:
-----------------------------------------

See http://markmail.org/thread/wavoo62qd7gwjuzy
                
> HTTP headers are incorrectly treated case sensitive causing OpenStack x-storage-url to fail
> -------------------------------------------------------------------------------------------
>
>                 Key: JCLOUDS-155
>                 URL: https://issues.apache.org/jira/browse/JCLOUDS-155
>             Project: jclouds
>          Issue Type: Bug
>          Components: jclouds-blobstore
>    Affects Versions: 1.7.0, 1.5.10, 1.6.1
>         Environment: Apache 2.2 with mod_wsgi produces HTTP header "x-storage-url"
>            Reporter: Rodney Beede
>            Priority: Blocker
>              Labels: openstack, swift
>
> There is a bug in jclouds (confirmed 1.6 and 1.5, probably also 1.7) where it does not correctly detect the OpenStack "X-Storage-Url" HTTP header due to a code logic bug regarding case sensitivity.  When parsing the authentication response the "X-Storage-Url" header is sent back from the server.  Some web servers send back this header as "x-storage-url" instead which causes jclouds to not grab the value and thus use the wrong URL for subsequent requests.
> The code points are detailed below.  The code should be modified to use case insensitive matches for the header values as HTTP headers are case insensitive according to RFC 2616.
> As Swift grizzly has a guide for using Apache this will become an important issue as more people use that web server for their proxy-server.  http://docs.openstack.org/developer/swift/apache_deployment_guide.html
> jclouds-1.6.x\common\openstack\src\main\java\org\jclouds\openstack\reference\AuthHeaders.java
> 	public static final String URL_SUFFIX = "-Url";
> 	public static final String STORAGE_URL = "X-Storage" + URL_SUFFIX;
> jclouds-1.6.x\apis\swift\src\main\java\org\jclouds\openstack\swift\config\SwiftRestClientModule.java
>    public static class StorageEndpointModule extends OpenStackAuthenticationModule {
>       @Provides
>       @Singleton
>       @Storage
>       protected Supplier<URI> provideStorageUrl(URIFromAuthenticationResponseForService.Factory factory) {
>          return factory.create(AuthHeaders.STORAGE_URL);
>       }
>    }
>    
>   
> NOTE:  Creates a URIFromAuthenticationResponseForService object with uses AuthHeaders.STORAGE_URL as the reference.
> jclouds-1.6.x\common\openstack\src\main\java\org\jclouds\openstack\functions\URIFromAuthenticationResponseForService.java
>    public static interface Factory {
>       URIFromAuthenticationResponseForService create(String service);
>    }
>    Leads to
>    
>    public URIFromAuthenticationResponseForService(Supplier<AuthenticationResponse> auth, @Assisted String service) {
>       this.auth = auth;
>       this.service = service;
>    }
>    
>    So we have an AuthenticationResponse (inside Supplier) and "String service" or this.service = AuthHeaders.STORAGE_URL = "X-Storage-Url"
>    
>    
> jclouds-1.6.x\common\openstack\src\main\java\org\jclouds\openstack\domain\AuthenticationResponse.java
>    public AuthenticationResponse(String authToken, Map<String, URI> services) {
>       this.authToken = checkNotNull(authToken, "authToken");
>       this.services = ImmutableMap.copyOf(checkNotNull(services, "services"));
>    }
>    public Map<String, URI> getServices() {
>       return services;
>    }
> NOTE:  Map<String, URI> services is a map of the header name to URI.  This map is case sensitive, but it shouldn't be.
> Allowable values should be:
> 	X-Storage-Url
> 	x-storage-url
> 	x-StoRage-URl
> 	etc...

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira