Giter VIP home page Giter VIP logo

Comments (11)

cobordism avatar cobordism commented on May 31, 2024 1

https://gist.github.com/homotopycolimit/7b70436326535ef19028f836680a1f3c

from swarm.

cobordism avatar cobordism commented on May 31, 2024

I agree that manifest should not have a hash associated to the empty path.

I think that the empty path entry ' ' could still function as the default, but should resolve to another path (eg. / or /index.html) and that this path then should resolve to a content hash.

If a manifest is called with bzz and there is no default entry, then we should return the HTTP 300 multiple choice error and the error page should link/redirect to the bzz-list:// view.

I also think that the browser should redirect to that path (/ or /index.html) instead of simply displaying the contents.
Pros: It solves all our trailing / problems and problems with relative paths
Cons: It makes URL a little uglier (theswarm.eth/index.html instead of theswarm.eth) --(though note, theswarm.eth doesn't work currently, you need theswarm.eth/)

from swarm.

lmars avatar lmars commented on May 31, 2024

@homotopycolimit the issue with redirecting the empty path to some other non-empty path then means I can't have content at a path which is a substring of another path. For example, assume I upload an image at the following three paths:

  • bzz://example.eth/image
  • bzz://example.eth/images/1
  • bzz://example.eth/images/2

Then a manifest is stored at /image which has an empty path entry (which will be served for /image) and entries for s/1 and s/2.

With your proposed solution, requests to /image will actually get redirected to /image/, which may not be what I want?

from swarm.

lmars avatar lmars commented on May 31, 2024

By the way, I'm of the personal opinion that manifests should use the Unix filesystem model, branch on / rather than common prefixes, paths within a manifest don't contain /.

This is suboptimal for very large sites which have many paths in the same directory, but I think that is the exception rather than the rule, and they can use the same optimisations as is done on a filesystem, split your paths into sub-directories.

See ethereum/go-ethereum#14349.

from swarm.

cobordism avatar cobordism commented on May 31, 2024

I can't have content at a path which is a substring of another path.

That is a very good point. Is there a way around this? Can't we let a manifest contain a non-manifest content hash at image and also a manifest hash at images?

[
  {"path": "image", "type": "image/png", "hash": "<hash>"},
  {"path": "images", "type": "application/bzz-manifest+json", "hash": "<hash2>"}
]

I agree it can only work if the substring matches something which is not a manifest... otherwise we'd have ambiguity in resolving manifests.... :(

from swarm.

cobordism avatar cobordism commented on May 31, 2024

By the way, I'm of the personal opinion that manifests should use the Unix filesystem model, branch on / rather than common prefixes, paths within a manifest don't contain /.

I seem to recall that, since the very beginning already, @nagydani was against treating / as a special breaking character. Dani, can you perhaps weigh in here and fill us in?

from swarm.

lmars avatar lmars commented on May 31, 2024

Can't we let a manifest contain a non-manifest content hash at image and also a manifest hash at images?

Sure, by using a Unix filesystem model rather than branching on the common prefix ๐Ÿ˜‰.

The way I see it, we have many issues and bugs with the current manifest implementation which would be fixed with a simpler model. We seem to be only maintaining this more complex manifest implementation to keep the JSON manifests small even for large collections of files which haven't already been split on a particular character (e.g. /), but have we benchmarked when this would become a problem? Thousands, millions, billions of entries in a single manifest?

I'd like to see us have a rock solid implementation for the current 99% case (i.e. I generate a static website locally as a directory tree of files and upload it using swarm --recursive up). We could then have a separate swarm --recursive --prefix-trie up which uses prefix-trie manifests rather than splitting on / if that is a requirement for performance reasons.

from swarm.

cobordism avatar cobordism commented on May 31, 2024

see also: #178

from swarm.

zelig avatar zelig commented on May 31, 2024

i would like to keep the question of manifest representation and interpretation separate.
Unix filesystem like interpretation is for the display.
I am resistant to going back to a suboptimal solution (splitting on /)
Also for provable site inclusions, manifest will be represented with POT structures in future so
it is best thought of as a native 'binary' format.

So how about redirecting to / if the url is path is empty, in order for relative urls to work, and in the matching ignore the leading slash. I think there was a long period when this was working.
We should also chop the trailing / of non-empty paths ending in / and redirect (whether we have catchall feature of arbitrary suffixes or not).

Please let me know what problems if any this would have.

from swarm.

cobordism avatar cobordism commented on May 31, 2024

So how about redirecting to / if the url is path is empty,

What exactly does this mean? Would we redirect from index.html to index.html/ ?
We can have a manifest which has a file-hash for entry index.html or we can have a manifest which has a manifest hash for index.html and this manifest in turn has the file-hash as the only/default entry.
It is always this second version which gives us problems, no?

and in the matching ignore the leading slash.

would this not lead to ambiguity? What if I have both entries in my manifest?

from swarm.

cobordism avatar cobordism commented on May 31, 2024

@zelig can you answer these 10 points: #178 (comment)

from swarm.

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.