[jira] [Commented] (WAGON-432) Maven sends duplicate User-Agent header

2015-04-20 Thread Jason van Zyl (JIRA)

[ 
https://issues.apache.org/jira/browse/WAGON-432?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14502671#comment-14502671
 ] 

Jason van Zyl commented on WAGON-432:
-

Definitely unrelated, I just need to  fix it before I can use Wagon 2.9 for 
Maven 3.3.3.

 Maven sends duplicate User-Agent header
 ---

 Key: WAGON-432
 URL: https://issues.apache.org/jira/browse/WAGON-432
 Project: Maven Wagon
  Issue Type: Bug
  Components: wagon-http
Affects Versions: 2.8
Reporter: Michael Osipov
Priority: Minor
 Attachments: 
 0001-WAGON-432-do-not-set-User-Agent-header-by-default.patch, 
 headergroup-after-setHeaders.png, headergroup-after-setUserAgent.png, 
 headergroup-before-execution.png, maven-3.1.1.png, maven-3.2.2.png


 Maven 3.1.1 sends only one {{User-Agent}} header, 3.2.2 sends twice. See 
 screenshots.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (WAGON-432) Maven sends duplicate User-Agent header

2015-04-20 Thread Jan Sievers (JIRA)

[ 
https://issues.apache.org/jira/browse/WAGON-432?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14502536#comment-14502536
 ] 

Jan Sievers commented on WAGON-432:
---

@Jason AFAICT the stacktrace seems unrelated to the code changed here. 

 Maven sends duplicate User-Agent header
 ---

 Key: WAGON-432
 URL: https://issues.apache.org/jira/browse/WAGON-432
 Project: Maven Wagon
  Issue Type: Bug
  Components: wagon-http
Affects Versions: 2.8
Reporter: Michael Osipov
Priority: Minor
 Attachments: 
 0001-WAGON-432-do-not-set-User-Agent-header-by-default.patch, 
 headergroup-after-setHeaders.png, headergroup-after-setUserAgent.png, 
 headergroup-before-execution.png, maven-3.1.1.png, maven-3.2.2.png


 Maven 3.1.1 sends only one {{User-Agent}} header, 3.2.2 sends twice. See 
 screenshots.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (WAGON-432) Maven sends duplicate User-Agent header

2015-04-20 Thread Jason van Zyl (JIRA)

[ 
https://issues.apache.org/jira/browse/WAGON-432?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14502895#comment-14502895
 ] 

Jason van Zyl commented on WAGON-432:
-

Fixed on 824adca8df1e36bc8b8cc9267f5e3a3a93cdef44

 Maven sends duplicate User-Agent header
 ---

 Key: WAGON-432
 URL: https://issues.apache.org/jira/browse/WAGON-432
 Project: Maven Wagon
  Issue Type: Bug
  Components: wagon-http
Affects Versions: 2.8
Reporter: Michael Osipov
Assignee: Jason van Zyl
Priority: Minor
 Attachments: 
 0001-WAGON-432-do-not-set-User-Agent-header-by-default.patch, 
 headergroup-after-setHeaders.png, headergroup-after-setUserAgent.png, 
 headergroup-before-execution.png, maven-3.1.1.png, maven-3.2.2.png


 Maven 3.1.1 sends only one {{User-Agent}} header, 3.2.2 sends twice. See 
 screenshots.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (WAGON-432) Maven sends duplicate User-Agent header

2015-04-17 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/WAGON-432?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14499936#comment-14499936
 ] 

ASF GitHub Bot commented on WAGON-432:
--

Github user jsievers closed the pull request at:

https://github.com/apache/maven-wagon/pull/19


 Maven sends duplicate User-Agent header
 ---

 Key: WAGON-432
 URL: https://issues.apache.org/jira/browse/WAGON-432
 Project: Maven Wagon
  Issue Type: Bug
  Components: wagon-http
Affects Versions: 2.8
Reporter: Michael Osipov
Priority: Minor
 Attachments: 
 0001-WAGON-432-do-not-set-User-Agent-header-by-default.patch, 
 headergroup-after-setHeaders.png, headergroup-after-setUserAgent.png, 
 headergroup-before-execution.png, maven-3.1.1.png, maven-3.2.2.png


 Maven 3.1.1 sends only one {{User-Agent}} header, 3.2.2 sends twice. See 
 screenshots.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (WAGON-432) Maven sends duplicate User-Agent header

2015-04-17 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/WAGON-432?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14499823#comment-14499823
 ] 

ASF GitHub Bot commented on WAGON-432:
--

GitHub user jsievers opened a pull request:

https://github.com/apache/maven-wagon/pull/19

[WAGON-432] make sure User-Agent header is sent exactly once

- remove unnecessary explicit default User-Agent (all 3 HTTP wagon
  providers [http, lightweight, webdav] send a User-Agent by default
  already)
- when adding headers, use setHeader() instead of addHeader().
  this will avoid sending the same header key multiple times
- adapt header listener in tests so it will detect header keys
  sent multiple times
- add tests to make sure default User-Agent is always present and
  User-Agent is present only once even if set multiple times
  using different methods

Signed-off-by: Jan Sievers jan.siev...@sap.com

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/jsievers/maven-wagon master

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/maven-wagon/pull/19.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #19


commit fadfcd9af264429674457b7696550c59c5059c5c
Author: Jan Sievers jan.siev...@sap.com
Date:   2015-04-17T12:31:46Z

[WAGON-432] make sure User-Agent header is sent exactly once

- remove unnecessary explicit default User-Agent (all 3 HTTP wagon
  providers [http, lightweight, webdav] send a User-Agent by default
  already)
- when adding headers, use setHeader() instead of addHeader().
  this will avoid sending the same header key multiple times
- adapt header listener in tests so it will detect header keys
  sent multiple times
- add tests to make sure default User-Agent is always present and
  User-Agent is present only once even if set multiple times
  using different methods

Signed-off-by: Jan Sievers jan.siev...@sap.com




 Maven sends duplicate User-Agent header
 ---

 Key: WAGON-432
 URL: https://issues.apache.org/jira/browse/WAGON-432
 Project: Maven Wagon
  Issue Type: Bug
  Components: wagon-http
Affects Versions: 2.8
Reporter: Michael Osipov
Priority: Minor
 Attachments: 
 0001-WAGON-432-do-not-set-User-Agent-header-by-default.patch, 
 headergroup-after-setHeaders.png, headergroup-after-setUserAgent.png, 
 headergroup-before-execution.png, maven-3.1.1.png, maven-3.2.2.png


 Maven 3.1.1 sends only one {{User-Agent}} header, 3.2.2 sends twice. See 
 screenshots.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (WAGON-432) Maven sends duplicate User-Agent header

2015-04-17 Thread Jan Sievers (JIRA)

[ 
https://issues.apache.org/jira/browse/WAGON-432?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14499826#comment-14499826
 ] 

Jan Sievers commented on WAGON-432:
---

pull request including unit tests:
https://github.com/apache/maven-wagon/pull/19

 Maven sends duplicate User-Agent header
 ---

 Key: WAGON-432
 URL: https://issues.apache.org/jira/browse/WAGON-432
 Project: Maven Wagon
  Issue Type: Bug
  Components: wagon-http
Affects Versions: 2.8
Reporter: Michael Osipov
Priority: Minor
 Attachments: 
 0001-WAGON-432-do-not-set-User-Agent-header-by-default.patch, 
 headergroup-after-setHeaders.png, headergroup-after-setUserAgent.png, 
 headergroup-before-execution.png, maven-3.1.1.png, maven-3.2.2.png


 Maven 3.1.1 sends only one {{User-Agent}} header, 3.2.2 sends twice. See 
 screenshots.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (WAGON-432) Maven sends duplicate User-Agent header

2015-04-17 Thread Michael Osipov (JIRA)

[ 
https://issues.apache.org/jira/browse/WAGON-432?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14499870#comment-14499870
 ] 

Michael Osipov commented on WAGON-432:
--

[~jsievers], did you verify/know that {{setHeader}} overrides the first header 
value only on Apache HttpClient?

 Maven sends duplicate User-Agent header
 ---

 Key: WAGON-432
 URL: https://issues.apache.org/jira/browse/WAGON-432
 Project: Maven Wagon
  Issue Type: Bug
  Components: wagon-http
Affects Versions: 2.8
Reporter: Michael Osipov
Priority: Minor
 Attachments: 
 0001-WAGON-432-do-not-set-User-Agent-header-by-default.patch, 
 headergroup-after-setHeaders.png, headergroup-after-setUserAgent.png, 
 headergroup-before-execution.png, maven-3.1.1.png, maven-3.2.2.png


 Maven 3.1.1 sends only one {{User-Agent}} header, 3.2.2 sends twice. See 
 screenshots.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (WAGON-432) Maven sends duplicate User-Agent header

2015-04-17 Thread Jason van Zyl (JIRA)

[ 
https://issues.apache.org/jira/browse/WAGON-432?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14499880#comment-14499880
 ] 

Jason van Zyl commented on WAGON-432:
-

@jan, applied on 824adca8df1e36bc8b8cc9267f5e3a3a93cdef44

If it looks good then can you please close the PR?

 Maven sends duplicate User-Agent header
 ---

 Key: WAGON-432
 URL: https://issues.apache.org/jira/browse/WAGON-432
 Project: Maven Wagon
  Issue Type: Bug
  Components: wagon-http
Affects Versions: 2.8
Reporter: Michael Osipov
Priority: Minor
 Attachments: 
 0001-WAGON-432-do-not-set-User-Agent-header-by-default.patch, 
 headergroup-after-setHeaders.png, headergroup-after-setUserAgent.png, 
 headergroup-before-execution.png, maven-3.1.1.png, maven-3.2.2.png


 Maven 3.1.1 sends only one {{User-Agent}} header, 3.2.2 sends twice. See 
 screenshots.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (WAGON-432) Maven sends duplicate User-Agent header

2015-04-17 Thread Jan Sievers (JIRA)

[ 
https://issues.apache.org/jira/browse/WAGON-432?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14499900#comment-14499900
 ] 

Jan Sievers commented on WAGON-432:
---

@Michael yes I know. To fix the issue in general for all HTTP headers I guess 
you would have to replace all addHeader() calls with setHeader() throughout the 
wagon codebase.

If you check the unit tests I provided with my fix, this is verified for header 
User-Agent only.
I did verify that header User-Agent is now only set using setHeader(), not 
addHeader() throughout the wagon codebase.

I just wanted to keep the fix focused on the concrete issue here and not bloat 
it with hypothetic problems for other headers in other places which I'm not 
entirely sure about. If you are familiar enough with the rest of the HTTP 
headers, feel free to fix the rest on top of my patch.

 Maven sends duplicate User-Agent header
 ---

 Key: WAGON-432
 URL: https://issues.apache.org/jira/browse/WAGON-432
 Project: Maven Wagon
  Issue Type: Bug
  Components: wagon-http
Affects Versions: 2.8
Reporter: Michael Osipov
Priority: Minor
 Attachments: 
 0001-WAGON-432-do-not-set-User-Agent-header-by-default.patch, 
 headergroup-after-setHeaders.png, headergroup-after-setUserAgent.png, 
 headergroup-before-execution.png, maven-3.1.1.png, maven-3.2.2.png


 Maven 3.1.1 sends only one {{User-Agent}} header, 3.2.2 sends twice. See 
 screenshots.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (WAGON-432) Maven sends duplicate User-Agent header

2015-04-17 Thread Jason van Zyl (JIRA)

[ 
https://issues.apache.org/jira/browse/WAGON-432?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14499976#comment-14499976
 ] 

Jason van Zyl commented on WAGON-432:
-

I will try to roll this into the next Maven release, but I just updated Maven 
to use 2.9-SNAPSHOT and a massive number of ITs fail with this error:

Caused by: java.lang.StringIndexOutOfBoundsException: String index out of 
range: 0
  
at java.lang.String.charAt(String.java:658) 


at org.apache.maven.wagon.PathUtils.host(PathUtils.java:141)


at 
org.apache.maven.wagon.repository.Repository.setUrl(Repository.java:145)

 
at 
org.apache.maven.wagon.repository.Repository.init(Repository.java:91) 

 
at 
org.apache.maven.artifact.repository.DefaultArtifactRepository.init(DefaultArtifactRepository.java:95)

 
at 
org.apache.maven.artifact.repository.DefaultArtifactRepository.init(DefaultArtifactRepository.java:66)

 
at 
org.apache.maven.artifact.repository.metadata.MetadataBridge$MetadataRepository.init(MetadataBridge.java:154)

  
at 
org.apache.maven.artifact.repository.metadata.MetadataBridge.merge(MetadataBridge.java:64)

   
... 51 more 
   

I changed some code around here so not sure if it's my change or Wagon but I'll 
try to fix it and then roll the new version of Wagon into the new Maven release.

 Maven sends duplicate User-Agent header
 ---

 Key: WAGON-432
 URL: https://issues.apache.org/jira/browse/WAGON-432
 Project: Maven Wagon
  Issue Type: Bug
  Components: wagon-http
Affects Versions: 2.8
Reporter: Michael Osipov
Priority: Minor
 Attachments: 
 0001-WAGON-432-do-not-set-User-Agent-header-by-default.patch, 
 headergroup-after-setHeaders.png, headergroup-after-setUserAgent.png, 
 headergroup-before-execution.png, maven-3.1.1.png, maven-3.2.2.png


 Maven 3.1.1 sends only one {{User-Agent}} header, 3.2.2 sends twice. See 
 screenshots.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (WAGON-432) Maven sends duplicate User-Agent header

2015-04-15 Thread Jason van Zyl (JIRA)

[ 
https://issues.apache.org/jira/browse/WAGON-432?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14496128#comment-14496128
 ] 

Jason van Zyl commented on WAGON-432:
-

@robert, I'd like to release Maven 3.3.2 today so if you don't have time to 
analyze the problem this can wait. @jan in the meantime, I suggest you take a 
look at https://github.com/takari/aether-connector-okhttp

I will try and make that more consumable today via extension and have it ready 
for tomorrow's hangout.

 Maven sends duplicate User-Agent header
 ---

 Key: WAGON-432
 URL: https://issues.apache.org/jira/browse/WAGON-432
 Project: Maven Wagon
  Issue Type: Bug
  Components: wagon-http
Affects Versions: 2.8
Reporter: Michael Osipov
Priority: Minor
 Attachments: 
 0001-WAGON-432-do-not-set-User-Agent-header-by-default.patch, 
 headergroup-after-setHeaders.png, headergroup-after-setUserAgent.png, 
 headergroup-before-execution.png, maven-3.1.1.png, maven-3.2.2.png


 Maven 3.1.1 sends only one {{User-Agent}} header, 3.2.2 sends twice. See 
 screenshots.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (WAGON-432) Maven sends duplicate User-Agent header

2015-04-15 Thread Robert Scholte (JIRA)

[ 
https://issues.apache.org/jira/browse/WAGON-432?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14496590#comment-14496590
 ] 

Robert Scholte commented on WAGON-432:
--

I'd like to write some unittests first, which is a challenge. We just have to 
be aware that it's not only Aether which is using Wagon. No matter the 
combination of method calls, it should always result in one {{User-Agent}}.

 Maven sends duplicate User-Agent header
 ---

 Key: WAGON-432
 URL: https://issues.apache.org/jira/browse/WAGON-432
 Project: Maven Wagon
  Issue Type: Bug
  Components: wagon-http
Affects Versions: 2.8
Reporter: Michael Osipov
Priority: Minor
 Attachments: 
 0001-WAGON-432-do-not-set-User-Agent-header-by-default.patch, 
 headergroup-after-setHeaders.png, headergroup-after-setUserAgent.png, 
 headergroup-before-execution.png, maven-3.1.1.png, maven-3.2.2.png


 Maven 3.1.1 sends only one {{User-Agent}} header, 3.2.2 sends twice. See 
 screenshots.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (WAGON-432) Maven sends duplicate User-Agent header

2015-04-13 Thread Michael Osipov (JIRA)

[ 
https://issues.apache.org/jira/browse/WAGON-432?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14492913#comment-14492913
 ] 

Michael Osipov commented on WAGON-432:
--

Why do still want to waste your time? did an analysis already. Please read 
comment 3.

 Maven sends duplicate User-Agent header
 ---

 Key: WAGON-432
 URL: https://issues.apache.org/jira/browse/WAGON-432
 Project: Maven Wagon
  Issue Type: Bug
  Components: wagon-http
Affects Versions: 2.8
Reporter: Michael Osipov
Priority: Minor
 Attachments: 
 0001-WAGON-432-do-not-set-User-Agent-header-by-default.patch, 
 headergroup-after-setHeaders.png, headergroup-after-setUserAgent.png, 
 headergroup-before-execution.png, maven-3.1.1.png, maven-3.2.2.png


 Maven 3.1.1 sends only one {{User-Agent}} header, 3.2.2 sends twice. See 
 screenshots.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (WAGON-432) Maven sends duplicate User-Agent header

2015-04-13 Thread Jason van Zyl (JIRA)

[ 
https://issues.apache.org/jira/browse/WAGON-432?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14492715#comment-14492715
 ] 

Jason van Zyl commented on WAGON-432:
-

@robert, you want to do anymore investigation or are you fine with me applying 
Jan's patch?

 Maven sends duplicate User-Agent header
 ---

 Key: WAGON-432
 URL: https://issues.apache.org/jira/browse/WAGON-432
 Project: Maven Wagon
  Issue Type: Bug
  Components: wagon-http
Affects Versions: 2.8
Reporter: Michael Osipov
Priority: Minor
 Attachments: 
 0001-WAGON-432-do-not-set-User-Agent-header-by-default.patch, 
 headergroup-after-setHeaders.png, headergroup-after-setUserAgent.png, 
 headergroup-before-execution.png, maven-3.1.1.png, maven-3.2.2.png


 Maven 3.1.1 sends only one {{User-Agent}} header, 3.2.2 sends twice. See 
 screenshots.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (WAGON-432) Maven sends duplicate User-Agent header

2015-04-13 Thread Robert Scholte (JIRA)

[ 
https://issues.apache.org/jira/browse/WAGON-432?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14492797#comment-14492797
 ] 

Robert Scholte commented on WAGON-432:
--

I still don't understand why the User-Agent header (with exactly the same 
value) is set twice. So let me investigate this a bit more first.

 Maven sends duplicate User-Agent header
 ---

 Key: WAGON-432
 URL: https://issues.apache.org/jira/browse/WAGON-432
 Project: Maven Wagon
  Issue Type: Bug
  Components: wagon-http
Affects Versions: 2.8
Reporter: Michael Osipov
Priority: Minor
 Attachments: 
 0001-WAGON-432-do-not-set-User-Agent-header-by-default.patch, 
 headergroup-after-setHeaders.png, headergroup-after-setUserAgent.png, 
 headergroup-before-execution.png, maven-3.1.1.png, maven-3.2.2.png


 Maven 3.1.1 sends only one {{User-Agent}} header, 3.2.2 sends twice. See 
 screenshots.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (WAGON-432) Maven sends duplicate User-Agent header

2015-04-13 Thread Michael Osipov (JIRA)

[ 
https://issues.apache.org/jira/browse/WAGON-432?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14492688#comment-14492688
 ] 

Michael Osipov commented on WAGON-432:
--

Jason, please apply for now and check whether this works or not. We should 
remove any specific user agent handling from Wagon. The client must simply 
supply its headers thath is it. Please file another issue to review and clean 
up header code in {{wagon-http}}. I will start a discussion at at later point 
about that.

 Maven sends duplicate User-Agent header
 ---

 Key: WAGON-432
 URL: https://issues.apache.org/jira/browse/WAGON-432
 Project: Maven Wagon
  Issue Type: Bug
  Components: wagon-http
Affects Versions: 2.8
Reporter: Michael Osipov
Priority: Minor
 Attachments: 
 0001-WAGON-432-do-not-set-User-Agent-header-by-default.patch, 
 headergroup-after-setHeaders.png, headergroup-after-setUserAgent.png, 
 headergroup-before-execution.png, maven-3.1.1.png, maven-3.2.2.png


 Maven 3.1.1 sends only one {{User-Agent}} header, 3.2.2 sends twice. See 
 screenshots.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (WAGON-432) Maven sends duplicate User-Agent header

2015-04-13 Thread Jason van Zyl (JIRA)

[ 
https://issues.apache.org/jira/browse/WAGON-432?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14492673#comment-14492673
 ] 

Jason van Zyl commented on WAGON-432:
-

So this seems like something wrong in our plugins? Can we apply Jan's patch? 
The current behaviour of duplicating the same header is definitely not right 
and Jan's patch appears to fix this problem. In the absence of anyone 
understanding what's actually going on in all the plugins I think we should 
apply Jan's patch.

 Maven sends duplicate User-Agent header
 ---

 Key: WAGON-432
 URL: https://issues.apache.org/jira/browse/WAGON-432
 Project: Maven Wagon
  Issue Type: Bug
  Components: wagon-http
Affects Versions: 2.8
Reporter: Michael Osipov
Priority: Minor
 Attachments: 
 0001-WAGON-432-do-not-set-User-Agent-header-by-default.patch, 
 headergroup-after-setHeaders.png, headergroup-after-setUserAgent.png, 
 headergroup-before-execution.png, maven-3.1.1.png, maven-3.2.2.png


 Maven 3.1.1 sends only one {{User-Agent}} header, 3.2.2 sends twice. See 
 screenshots.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (WAGON-432) Maven sends duplicate User-Agent header

2015-04-12 Thread Robert Scholte (JIRA)

[ 
https://issues.apache.org/jira/browse/WAGON-432?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14491388#comment-14491388
 ] 

Robert Scholte commented on WAGON-432:
--

[~michael-o], well, {{HttpClient}} didn't set the {{User-Agent}}. And that's 
probably correct: the application _using_ {{HttpClient}} should set its value. 
Please read http://markmail.org/message/lwx5rgbd4lmttmzq to understand the 
situation and why we made these changes in detail. In (very) short: the missing 
{{User-Agent}} suddenly caused the following error:
{noformat}
org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata could 
not be retrieved from repositories due to an error: repository
metadata for: 'artifact org.apache.maven.its.doap:maven-it-plugin' could not be 
retrieved from repository: central due to an error:
Authorization failed: Access denied to:
http://repo.maven.apache.org/maven2/org/apache/maven/its/doap/maven-it-plugin/maven-metadata.xml
, ReasonPhrase:Denied Access.
{noformat}.

 Maven sends duplicate User-Agent header
 ---

 Key: WAGON-432
 URL: https://issues.apache.org/jira/browse/WAGON-432
 Project: Maven Wagon
  Issue Type: Bug
  Components: wagon-http
Affects Versions: 2.8
Reporter: Michael Osipov
Priority: Minor
 Attachments: 
 0001-WAGON-432-do-not-set-User-Agent-header-by-default.patch, 
 headergroup-after-setHeaders.png, headergroup-after-setUserAgent.png, 
 headergroup-before-execution.png, maven-3.1.1.png, maven-3.2.2.png


 Maven 3.1.1 sends only one {{User-Agent}} header, 3.2.2 sends twice. See 
 screenshots.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (WAGON-432) Maven sends duplicate User-Agent header

2015-04-12 Thread Michael Osipov (JIRA)

[ 
https://issues.apache.org/jira/browse/WAGON-432?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14491372#comment-14491372
 ] 

Michael Osipov commented on WAGON-432:
--

[~jvanzyl], I did not try the patch. It might work. Though, this is merely a 
workaround for a bigger issue. The header handling code is a mess to me. We can 
handle it like this for now but should create another issue to clean up the 
code.

[~rfscholte], how can this be a problem? {{HttpClient}} sets a {{User-Agent}} 
by default if you don't override it. Wagon is not the transport but the 
{{HttpClient}} is.

 Maven sends duplicate User-Agent header
 ---

 Key: WAGON-432
 URL: https://issues.apache.org/jira/browse/WAGON-432
 Project: Maven Wagon
  Issue Type: Bug
  Components: wagon-http
Affects Versions: 2.8
Reporter: Michael Osipov
Priority: Minor
 Attachments: 
 0001-WAGON-432-do-not-set-User-Agent-header-by-default.patch, 
 headergroup-after-setHeaders.png, headergroup-after-setUserAgent.png, 
 headergroup-before-execution.png, maven-3.1.1.png, maven-3.2.2.png


 Maven 3.1.1 sends only one {{User-Agent}} header, 3.2.2 sends twice. See 
 screenshots.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (WAGON-432) Maven sends duplicate User-Agent header

2015-04-12 Thread Michael Osipov (JIRA)

[ 
https://issues.apache.org/jira/browse/WAGON-432?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14491580#comment-14491580
 ] 

Michael Osipov commented on WAGON-432:
--

That is confusing because the {{HttpClientBuilder}} does **always** set a 
[[https://github.com/apache/httpclient/blob/trunk/httpclient/src/main/java/org/apache/http/impl/client/HttpClientBuilder.java#L1029-L1038|default
 user agent]] if you won't provide one.
If something did not work, I assume that something is fishy about the Wagon 
code.

 Maven sends duplicate User-Agent header
 ---

 Key: WAGON-432
 URL: https://issues.apache.org/jira/browse/WAGON-432
 Project: Maven Wagon
  Issue Type: Bug
  Components: wagon-http
Affects Versions: 2.8
Reporter: Michael Osipov
Priority: Minor
 Attachments: 
 0001-WAGON-432-do-not-set-User-Agent-header-by-default.patch, 
 headergroup-after-setHeaders.png, headergroup-after-setUserAgent.png, 
 headergroup-before-execution.png, maven-3.1.1.png, maven-3.2.2.png


 Maven 3.1.1 sends only one {{User-Agent}} header, 3.2.2 sends twice. See 
 screenshots.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (WAGON-432) Maven sends duplicate User-Agent header

2015-04-11 Thread Robert Scholte (JIRA)

[ 
https://issues.apache.org/jira/browse/WAGON-432?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14491006#comment-14491006
 ] 

Robert Scholte commented on WAGON-432:
--

Up until WAGON-401 there was no default User-Agent set, which exposed a problem 
in autumn 2013 (see its description). It is a good thing that it now always has 
a User-Agent, however I'm especially interested why/where it is set twice.

 Maven sends duplicate User-Agent header
 ---

 Key: WAGON-432
 URL: https://issues.apache.org/jira/browse/WAGON-432
 Project: Maven Wagon
  Issue Type: Bug
  Components: wagon-http
Affects Versions: 2.8
Reporter: Michael Osipov
Priority: Minor
 Attachments: 
 0001-WAGON-432-do-not-set-User-Agent-header-by-default.patch, 
 headergroup-after-setHeaders.png, headergroup-after-setUserAgent.png, 
 headergroup-before-execution.png, maven-3.1.1.png, maven-3.2.2.png


 Maven 3.1.1 sends only one {{User-Agent}} header, 3.2.2 sends twice. See 
 screenshots.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (WAGON-432) Maven sends duplicate User-Agent header

2015-04-11 Thread Jason van Zyl (JIRA)

[ 
https://issues.apache.org/jira/browse/WAGON-432?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14491012#comment-14491012
 ] 

Jason van Zyl commented on WAGON-432:
-

The client application should always be responsible for setting the user agent, 
why would the library do it? How was this causing a problem?

 Maven sends duplicate User-Agent header
 ---

 Key: WAGON-432
 URL: https://issues.apache.org/jira/browse/WAGON-432
 Project: Maven Wagon
  Issue Type: Bug
  Components: wagon-http
Affects Versions: 2.8
Reporter: Michael Osipov
Priority: Minor
 Attachments: 
 0001-WAGON-432-do-not-set-User-Agent-header-by-default.patch, 
 headergroup-after-setHeaders.png, headergroup-after-setUserAgent.png, 
 headergroup-before-execution.png, maven-3.1.1.png, maven-3.2.2.png


 Maven 3.1.1 sends only one {{User-Agent}} header, 3.2.2 sends twice. See 
 screenshots.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (WAGON-432) Maven sends duplicate User-Agent header

2015-04-11 Thread Jason van Zyl (JIRA)

[ 
https://issues.apache.org/jira/browse/WAGON-432?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14491002#comment-14491002
 ] 

Jason van Zyl commented on WAGON-432:
-

@Michael, you see any issue removing this heading after your investigation? 
After looking through Maven/Aether I don't see why this is necessary.

 Maven sends duplicate User-Agent header
 ---

 Key: WAGON-432
 URL: https://issues.apache.org/jira/browse/WAGON-432
 Project: Maven Wagon
  Issue Type: Bug
  Components: wagon-http
Affects Versions: 2.8
Reporter: Michael Osipov
Priority: Minor
 Attachments: 
 0001-WAGON-432-do-not-set-User-Agent-header-by-default.patch, 
 headergroup-after-setHeaders.png, headergroup-after-setUserAgent.png, 
 headergroup-before-execution.png, maven-3.1.1.png, maven-3.2.2.png


 Maven 3.1.1 sends only one {{User-Agent}} header, 3.2.2 sends twice. See 
 screenshots.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (WAGON-432) Maven sends duplicate User-Agent header

2015-04-07 Thread Michael Osipov (JIRA)

[ 
https://issues.apache.org/jira/browse/WAGON-432?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14482904#comment-14482904
 ] 

Michael Osipov commented on WAGON-432:
--

Hi Jason,

here analysis:

Back then in July 2014 I made an analysis of the AbstractHttpClientWagon 
regarding header handling and it is a mess. I did not create another ticket 
(which I should have done actually) just because I did not have any time to 
work on. Header definitions are spread over several maps/config elements, 
headers are set which cannot be set by a client at all and headers are set 
multiple times.

1. If you take a look at the setHeaders method. You'll see that non-sense 
headers are set, merged from zillion sources and always with an 'add', so you 
cannot even override them. Including deprecated fields.

2. getUserAgent: it uses several sources as well...

3. execute: setMethod is called which does already set the User-Agent and the 
explicit setHeader method might be called.


Now the problem is that setHeaders(Properties) is called once from Aether Wagon 
Transporter correctly and triggers execute. See screenshot 
headergroup-before-execution.png. Stepping into setHeaders(HttpUriRequest) 
triggers config.isUseDefaultHeaders() which in turn performs method.addHeader( 
User-Agent, DEFAULT_USER_AGENT );.
So far headergroup looks here [Cache-control: no-cache, Cache-store: no-store, 
Pragma: no-cache, Expires: 0, Accept-Encoding: gzip, User-Agent: 
Apache-Maven-Wagon/2.8 (Java 1.7.0_71; ].

httpHeaders are copied into the request. The former has 
{User-Agent=Apache-Maven/3.2.5 (Java 1.7.0_71; Windows XP 5.1)}.

We do have two headers in the request: User-Agent: Apache-Maven-Wagon/2.8 (Java 
1.7.0_71; , User-Agent: Apache-Maven/3.2.5 (Java 1.7.0_71; Windows XP 5.1)]. 
See headergroup-after-setHeaders.png.

Now lets execute getUserAgent and the if clause: the Wagon header is gone but 
Maven is twice. See headergroup-after-setUserAgent.png.

You might think now that #setHeader from HttpCore should do the magic but it 
doesn't. Javadocs say: Overwrites the first header with the same name. The new 
header will be appended to the end of the list, if no header with the given 
name can be found.

Now it should be clear. The mess with the header code in 
AbstractHttpClientWagon and the lack of reading the Javadoc lead to that bug.

Wether the behavior from HttpCore is reasonable or not should be discussed with 
Oleg Kalnichevski on the HttpComponents users mailing list, personally the 
behavior is surprising to me and always requires a removeHeaders but this 
probably won't change before version 5.0.

I hope this helps.

Michael

 Maven sends duplicate User-Agent header
 ---

 Key: WAGON-432
 URL: https://issues.apache.org/jira/browse/WAGON-432
 Project: Maven Wagon
  Issue Type: Bug
  Components: wagon-http
Affects Versions: 2.8
Reporter: Michael Osipov
Priority: Minor
 Attachments: maven-3.1.1.png, maven-3.2.2.png


 Maven 3.1.1 sends only one {{User-Agent}} header, 3.2.2 sends twice. See 
 screenshots.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)