Skip to main content

Simple GET-PUT-DELETE service to (temporary) store your files as an alternative to NFS shared folders.

Project description

Simple GET-PUT-DELETE service (GPDS) to (temporary) store your files as an alternative to NFS shared folders.

It uses Gunicorn WSGI server as base and pass through all it’s options. So you can simply start it using next command gpds WORKING-DIRECTORY, where working directory is path to store and read files (by default, it’ll be started on 8000 port).

This server can process only three request types, so try them with curl from your console:

curl -i -X PUT -T somefile.jpg http://localhost:8000/

HTTP/1.1 201 Created
Server: gpds/0.3.1
Date: Mon, 04 Feb 2013 16:06:27 GMT
Connection: close
Location: /55/1c/551ced9e9d54658155ae8b4197afd32087a1c551.jpg
Content-Length: 0

So, what can we see here. GPDS created new file on yours file system (201 Created HTTP response) and this file is accessible on next address http://localhost:8000/55/1c/551ced9e9d54658155ae8b4197afd32087a1c551.jpg. This big string 551…551 is SHA1 hash from uploaded file content. So we can do next trick:

curl -i -X PUT -T somefile.txt http://localhost:8000/

HTTP/1.1 200 OK
Server: gpds/0.3.1
Date: Mon, 04 Feb 2013 16:17:12 GMT
Connection: close
Location: /55/1c/551ced9e9d54658155ae8b4197afd32087a1c551.jpg
Content-Length: 0

As you can see, Location is the same as in previous request. GPDS won’t rewrite uploaded file.

OK, let’s try to access this file:

curl -i http://localhost:8000/55/1c/551ced9e9d54658155ae8b4197afd32087a1c551.jpg

HTTP/1.1 200 OK
Server: gpds/0.3.1
Date: Mon, 04 Feb 2013 16:38:26 GMT
Connection: close
Content-Length: 56737
Content-Type: image/jpeg

...file content...

Cool, our service sent our image for us properly. Now we’ll delete this file and try to access it one more time:

curl -i -X DELETE http://localhost:8000/55/1c/551ced9e9d54658155ae8b4197afd32087a1c551.jpg

HTTP/1.1 204 No Content
Server: gpds/0.3.1
Date: Mon, 04 Feb 2013 16:40:49 GMT
Connection: close
Content-Length: 0

curl -i http://localhost:8001/55/1c/551ced9e9d54658155ae8b4197afd32087a1c551.jpg

HTTP/1.1 404 Not Found
Server: gpds/0.3.1
Date: Mon, 04 Feb 2013 16:41:09 GMT
Connection: close
Content-Length: 0

As you can see GPDS successfully erased your file from disk and next time sent not found response for you.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gpds-0.4.0.tar.gz (3.7 kB view details)

Uploaded Source

File details

Details for the file gpds-0.4.0.tar.gz.

File metadata

  • Download URL: gpds-0.4.0.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for gpds-0.4.0.tar.gz
Algorithm Hash digest
SHA256 e67ccbbcde6d5c2aaa83dc31cfc9b8b3a670ddd339b08f02dda4f615d3b2f18b
MD5 bbe73eb18ba6eb04e85d8feba017892a
BLAKE2b-256 5ccee036bbf17aa79cd9f4afe024b3967963b43d0007b19dfd849b264f238e0b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page