[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: smart upload server



Am 30.05.2010 14:30, schrieb Mark Hymers:
> Why?  It may be a crappy protocol, but it's well-characterised, well
> understood, implemented by someone else (from our point of view) and
> doesn't smell of NIH.

The current protocol sucks because they are actual 2 protocols: FTP for
uploading and email for returning error messages because FTP cannot
return useful error messages inbound.

I do not buy your 'smell of NIH' argument. We are discussing HTTP. A
very basic 'smart upload client' without error checking could look like:

  #!/bin/sh
  URL="$1"
  CHANGESFILE="$2"
  CHECKSUM=$(openssl sha -sha256 < "$CHANGESFILE")
  curl -T "$CHANGESFILE" -X PUT -H "X-Changes-Sha256: $CHECKSUM" "$URL"
  for FILE in $(dcmd --no-changes "$CHANGESFILE"); do
    curl -T "$FILE" -X PUT -H "X-Changes-Sha256: $CHECKSUM" "$URL"
  done
  curl -H "X-Changes-Sha256: $CHECKSUM" "$URL?action=done"

We could replace the custom header 'X-Changes-Sha256' by a query
parameter. The first curl command line would change into:

  curl -T "$CHANGESFILE" -X PUT "$URL?changes-sha256=$CHECKSUM"

(I prefer the last one over my original proposal with the custom header.)

Cheers,
Torsten


Reply to: