package com.heroku.api.http;

import com.heroku.api.Heroku;

/**
 * Provider for User-Agent header values used by HTTP clients.
 *
 * To provide a custom User-Agent value, implement this interface
 * and create a <i>provider-configuration file</i> at
 * <tt>META-INF/services/com.heroku.api.http.UserAgentValueProvider</tt>
 * containing the fully-qualified name of your provider class.
 * See {@link java.util.ServiceLoader} for details.
 *
 * @see java.util.ServiceLoader
 * @see Http.UserAgent
 *
 * @author Ryan Brainard
*/
public interface UserAgentValueProvider {

    String getHeaderValue();
    String getHeaderValue(String customPart);

    class DEFAULT implements UserAgentValueProvider {
        private final String userAgentValuePattern = "heroku.jar-%s-v%s";

        @Override
        public String getHeaderValue() {
            return getHeaderValue("unspecified");
        }

        @Override
        public String getHeaderValue(String customPart) {
            return String.format(userAgentValuePattern, customPart, Heroku.JarProperties.getProperty("heroku.jar.version"));
        }
    }
}

@@ -432,16 +432,154 @@
 etails.%0A
+ * %0A * To conform to RFC 2616 Section 14.43, consider prepending the value%0A * from the %7B@link DEFAULT%7D provider with your own user agent.%0A
  *%0A * @s
@@ -900,13 +900,12 @@
 .jar
--%25s-v
+/%25s 
 %25s%22;
@@ -1004,19 +1004,8 @@
 ue(%22
-unspecified
 %22);%0A
@@ -1077,26 +1077,38 @@
 (String 
-customPart
+subComponentUserAgents
 ) %7B%0A    
@@ -1162,20 +1162,8 @@
 ern,
- customPart,
  Her
@@ -1213,16 +1213,40 @@
 ersion%22)
+, subComponentUserAgents
 );%0A     

Change User-Agent format to match RFC 2616 Section 14.43 (http://tools.ietf.org/html/rfc2616#section-14.43) standard for version numbers and subcomponents