oneshot receive [file]
Receive a file from the client. If file is not specified, the content will be sent to stdout.
A simple web interface is served by default to GET requests to allow users to upload files from their browser. Users are not required to use the web interface to upload files, they can use any HTTP client to upload files to the server via a POST request. Uploading files via the web interface can be restricted to a specific CSRF token by using the --csrf-token
flag.
The web interface can be customized by providing a ui file or path glob via the –ui flag. These files are parsed as Go templates. The CSRF token (if one is being used) can be accessed through the template variable .CSRFToken
.
A web interface template can also instruct oneshot to decode base64 encoded uploads by calling the .enableBase64Decoding
function in the template. This is useful for web interfaces that upload files that are base64 encoded such as an image or video. These encoded files will be saved decoded to disk.
In order to display dynamic transfer information, oneshot needs to know the total size of the file being uploaded. Web interfaces can provide this information by setting the Content-Length header on the POST request. If a file is being uploaded as a multipart form, the content length can be provided by setting the X-Oneshot-Multipart-Content-Lengths
header in the request. Values in the X-Oneshot-Multipart-Content-Lengths
header should be of the form FILE_NAME=CONTENT_LENGTH
.
Flag | Configuration File | Description |
---|---|---|
--csrf-token |
.csrfToken |
Use a CSRF token, if left empty, a random token will be generated. |
--eol |
.eol |
How to parse EOLs in the received file. Acceptable values are ‘unix’ and ‘dos’; ‘unix’: ‘\n’, ‘dos’: ‘\r\n’. |
-U, --ui |
.ui |
Name of ui file to use. |
--decode-b64 |
.decodeBase64 |
Decode received data as base 64. |
--status-code |
.statusCode |
HTTP status code sent to client (default: 200 ) |
-H, --header |
.header |
HTTP header to send to client, can be specified multiple times. (Format: HEADER_NAME=HEADER_VALUE ) |
--include-body |
.includeBody |
Include the request body in the report. If not using json output, this will be ignored. |