Changeset c582a21 in trunk


Ignore:
Timestamp:
2016-04-23T02:23:49Z (9 years ago)
Author:
Brian Warner <warner@…>
Branches:
master
Children:
afb7718
Parents:
3e73461
Message:

webapi.rst: fixups

Re-indent the blocks for consistency, improve the explanation of
?filename=foo.jpg to match it's new location, use new-style reference
for urls-and-utf8 footnote.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified docs/frontends/webapi.rst

    r3e73461 rc582a21  
    10411041``GET /uri/$DIRCAP/[SUBDIRS../]FILENAME``
    10421042
    1043  This will retrieve the contents of the given file. The HTTP response body
     1043``GET /named/$FILECAP/FILENAME``
     1044
     1045 These will retrieve the contents of the given file. The HTTP response body
    10441046 will contain the sequence of bytes that make up the file.
    10451047
    1046 ``GET /named/$FILECAP/FILENAME``
    1047 
    1048  This is an alternate download form which makes it easier to get the correct
    1049  filename. The Tahoe server will provide the contents of the given file, with
    1050  a Content-Type header derived from the given filename. This form is used to
    1051  get browsers to use the "Save Link As" feature correctly, and also helps
    1052  command-line tools like "wget" and "curl" use the right filename. Note that
    1053  this form can *only* be used with file caps; it is an error to use a
    1054  directory cap after the /named/ prefix.
     1048 The ``/named/`` form is an alternative to ``/uri/$FILECAP`` which makes it
     1049 easier to get the correct filename. The Tahoe server will provide the
     1050 contents of the given file, with a Content-Type header derived from the
     1051 given filename. This form is used to get browsers to use the "Save Link As"
     1052 feature correctly, and also helps command-line tools like "wget" and "curl"
     1053 use the right filename. Note that this form can *only* be used with file
     1054 caps; it is an error to use a directory cap after the /named/ prefix.
    10551055
    10561056 URLs may also use /file/$FILECAP/FILENAME as a synonym for
    10571057 /named/$FILECAP/FILENAME. The use of "/file/" is deprecated in favor of
    10581058 "/named/" and support for "/file/" will be removed in a future release of
    1059  Tahoe-LAFS..
    1060 
    1061 
    1062 If you want the HTTP response to include a useful Content-Type header, either
    1063 use the second or third form or add a "filename=foo" query argument, like
    1064 "GET /uri/$FILECAP?filename=foo.jpg".  The bare "GET /uri/$FILECAP" does not
    1065 give the Tahoe node enough information to determine a Content-Type (since
    1066 LAFS immutable files are merely sequences of bytes, not typed and named file
    1067 objects).
    1068 
    1069 If the URL has both filename= and "save=true" in the query arguments, then
    1070 the server to add a "Content-Disposition: attachment" header, along with a
    1071 filename= parameter. When a user clicks on such a link, most browsers will
    1072 offer to let the user save the file instead of displaying it inline (indeed,
    1073 most browsers will refuse to display it inline). "true", "t", "1", and other
    1074 case-insensitive equivalents are all treated the same.
    1075 
    1076 Character-set handling in URLs and HTTP headers is a dubious art [1]_. For
    1077 maximum compatibility, Tahoe simply copies the bytes from the filename=
    1078 argument into the Content-Disposition header's filename= parameter, without
    1079 trying to interpret them in any particular way.
     1059 Tahoe-LAFS.
     1060
     1061 If you use the first form (``/uri/$FILECAP``) and want the HTTP response to
     1062 include a useful Content-Type header, add a "filename=foo" query argument,
     1063 like "GET /uri/$FILECAP?filename=foo.jpg". The bare "GET /uri/$FILECAP" does
     1064 not give the Tahoe node enough information to determine a Content-Type
     1065 (since LAFS immutable files are merely sequences of bytes, not typed and
     1066 named file objects).
     1067
     1068 If the URL has both filename= and "save=true" in the query arguments, then
     1069 the server to add a "Content-Disposition: attachment" header, along with a
     1070 filename= parameter. When a user clicks on such a link, most browsers will
     1071 offer to let the user save the file instead of displaying it inline (indeed,
     1072 most browsers will refuse to display it inline). "true", "t", "1", and other
     1073 case-insensitive equivalents are all treated the same.
     1074
     1075 Character-set handling in URLs and HTTP headers is a :ref:`dubious
     1076 art<urls-and-utf8>`. For maximum compatibility, Tahoe simply copies the
     1077 bytes from the filename= argument into the Content-Disposition header's
     1078 filename= parameter, without trying to interpret them in any particular way.
    10801079
    10811080
Note: See TracChangeset for help on using the changeset viewer.