Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Importing scm-manager repository in to GitLab validation of the URL fails in GitLab due to Content-Type in response. #2212

Closed
real-mrjkc opened this issue May 23, 2024 · 2 comments

Comments

@real-mrjkc
Copy link

Issue description

When importing SCM-MANAGER repository in to GitLab the validation fails in GitLab because scm-manager responds with the content-type that is not expected .

Related to issue: https://gitlab.com/gitlab-org/gitlab/-/issues/439047

When GitLab validates the scm manager URL and whether it is a git repository it sends a User-Agent: ruby in the request to http://scm-manager:8080/scm/repo/scmadmin/test.git/info/refs?service=git-upload-pack, in this case scm manager responds with the webpage Content-Type: text/html;charset=utf-8 and not the correct Content-Type: application/x-git-upload-pack-advertisement. But if I send a User-Agent: git/2.33.0 scm manager responds with the correct content type.

curl -s --head -u scmadmin:PASSWORD \
-H "User-Agent: git/2.33.0" \
-H "Accept: */*" \
"http://scm-manager:8080/scm/repo/scmadmin/test.git/info/refs?service=git-upload-pack"

HTTP/1.1 200 OK
...
Content-Type: application/x-git-upload-pack-advertisement
...

curl -s --head -u scmadmin:PASSWORD \
-H "User-Agent: ruby" \
-H "Accept: */*" \
"http://scm-manager:8080/scm/repo/scmadmin/test.git/info/refs?service=git-upload-pack"

HTTP/1.1 200 OK
...
Content-Type: text/html;charset=utf-8
...

Due to this import from scm manager to GitLab can not be done. Perhaps we should make scm manager to respond with Content-Type: application/x-git-upload-pack-advertisement from the URL http://scm-manager:8080/scm/repo/scmadmin/test.git/info/refs?service=git-upload-pack regardless of the User-Agent

@fscholdei
Copy link
Member

Based on the user agent, it is decided whether the SCMM interface is called in the browser or an SCM client retrieves repository data. A distinction is made between the providers Git, Mercurial and Subversion. I think that our API is correct at this point.

@real-mrjkc
Copy link
Author

Thanks for confirming, I will close this for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants