Coder Social home page Coder Social logo

Comments (10)

creationix avatar creationix commented on September 26, 2024

So I found two issues, both on github's end. (though both I could workaround if needed).

  1. If you override the Agent header to be what the git cli tool sends (git/1.8.1.2 instead of jsgit/0.2.3), it will give a redirect instead of a 404
  2. It redirects. I haven't implemented redirect following because url parsing isn't cross-platform yet. Why don't they provide the proper url for you to clone?

If you clone using the proper url, it works fine, even without changing away from my custom agent header.

TRACE=1 jsgit clone http://gist.github.com/gist/036c175d18a8a692a89d.git milestones

Notice the /gist/ at the front of the path.

from js-git.

ghostbar avatar ghostbar commented on September 26, 2024

So: What are you using for the redirections and how can I help to solve the cross-platform issue? Where should be implemented and what should I be looking for?

from js-git.

creationix avatar creationix commented on September 26, 2024

So for redirects, I just need more logic in smart-http. But the problem with url parsing is I'm using the "url" module from node.js. In http redirects it gives the new url as a string, but smart-http works in terms of already parsed urls.

There is a strict line between what's allowed to be used in js-git proper and what js-git-node-platform can use. Anything exported by the platform can be used by js-git, but that then means all ports of the platform have to implement that interface as well.

Urlparse is pure javascript. Maybe we could just include the source from node.js in the browser ports and make it part of the platform interface?

from js-git.

camshaft avatar camshaft commented on September 26, 2024

Component has a really interesting implementation of parsing urls in the browser.

from js-git.

creationix avatar creationix commented on September 26, 2024

Actually, since the node url parser doesn't work for all git urls anyway, (It can't handle urls like [email protected]:user/repo.git), I should just include the url parser in helpers/urlparse.js.

from js-git.

JamesMGreene avatar JamesMGreene commented on September 26, 2024

Might be able to steal some of the logic from @visionmedia's https://npmjs.org/package/github-url-from-git

from js-git.

stuartpb avatar stuartpb commented on September 26, 2024

wrt. the first Github issue (the one based on the user-agent), is js-git sending the appropriate Content-Type (application/x-git- something)? I know there's an extant bug ticket for Bitbucket about it (with the author of the Python Git module Dulwich arguing against UA spoofing): https://bitbucket.org/site/master/issue/6666/detect-git-requests-by-content-type-header

from js-git.

creationix avatar creationix commented on September 26, 2024

@stuartpb yes, I'm sending the proper content type. It's sniffing on the user agent. I'm implementing redirect support and a way to send a custom useragent. That should make it possible to clone from gists.

from js-git.

creationix avatar creationix commented on September 26, 2024

Added hack in http code for gist. creationix/git-net@708721e

Now to implement redirect...

from js-git.

creationix avatar creationix commented on September 26, 2024

Done!
creationix/git-net@da8c27d

from js-git.

Related Issues (20)

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.