0

I have a NFS location that is not managed by me and it's contents can be accessed by browsing to it, i.d. the server is serving up the folder as a HTML page.

something like https://ftp.mozilla.org/pub/firefox/releases/52.0/

Is it possible to get the list of files in a JSON format response directly in the request response? Without changing anything on the NFS server and without having to write code to parse the HTML?

e.g., Maybe I can send the request to the URL with different headers.

To clarify:

  1. When you access the address with a browser, curl or wget, you get a HTML page.

  2. My motivation is that I don't want to mount the NFS location. I want to access the files by downloading them from the URL.

  3. I don't know the type of server that is holding the shared folder.

Thanks.

RaamEE
  • 3,017
  • 4
  • 33
  • 53
  • 2
    The example you give appears to be a HTTP endpoint, not an NFS one. It's unclear how NFS has any relation to this? It's a totally different protocol. Anyway, whether you can get the data in another format depends on whatever webserver software is serving that HTML. You gave no details about the server so it's really impossible for us to know. – ADyson Jul 16 '18 at 15:38
  • Thanks @ADyson. I've edited the question according to your comments. Hopes it clearifies my question. – RaamEE Jul 16 '18 at 15:56
  • 1
    Not really. The thing you're accessing via a browser is a **HTTP** server, nothing to do with NFS. Again, it's unclear how these things are related. NFS is not served over HTTP. On this server this is evidently some webserver software which is running and is showing the contents of a folder. Maybe it's configured so it shows the same folder as the NFS share is configured to expose, but that doesn't mean it actually has anything to do with NFS. The information you can get from this server is controlled by whatever software the server runs. We have no idea what that software is – ADyson Jul 16 '18 at 16:00
  • 1
    Until we know, we can't tell you what's possible. If it's not your server you should probably ask the maintainers of the server what it supports. Either way it's nothing to with NFS (even if NFS is offered as a protocol by which you can mount the location, what is served over the HTTP protocol from the server is a totally separate service). – ADyson Jul 16 '18 at 16:01
  • Thanks @ADyson. I was hoping there was some common way that all webservers that list folder contents, will deliver the information either in JSON or HTML, just by tweaking the request. – RaamEE Jul 16 '18 at 16:07
  • 1
    Nope, it's totally dependent on the software installed and running in the webserver. There's no "built-in" functionality, it's totally configurable. Some webservers, e.g. IIS and Apache, come with some out-of-the-box simple software for listing folder content, but there's no guarantee that that's what's running here, and even then, it can be switched off, plus the exact version, configuration etc could come into play to determine exactly what is possible. From memory I don't think those particular basic tools can do JSON output, but YMMV. – ADyson Jul 16 '18 at 16:09

1 Answers1

1

In short, the answer is NO.

Not without tweaking the settings on the webserver that is serving the folder contents.

Here are some examples of how to tweak Apache to serve JSON formatted files listing for the folder.

Apache directory listing as JSON using PHP

Apache directory listing as json

Apache External Module mod_jsonindex - May not be the recommended way

http://1h.com/opensource/mod_jsonindex.html

RaamEE
  • 3,017
  • 4
  • 33
  • 53