Skip to content
This repository has been archived by the owner on Oct 25, 2024. It is now read-only.

Commit

Permalink
Docs, actual API Usage example, todo bash example
Browse files Browse the repository at this point in the history
  • Loading branch information
dw5 authored May 9, 2024
1 parent a9abcf2 commit efee30e
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 12 deletions.
42 changes: 42 additions & 0 deletions EXAMPLES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
powershell.ps1

might need a bit of cleanup, but i'll do later.. because learned rust while making this fork in a way...
```
function swscli ($filename)
{
$file = Get-Item $filename;
$fileName = Get-Item $filename
$filetxtname = $($fileName.Name)
$uri = "http://my-simpler-srv.local:8000/"
$currentPath = Convert-Path .
$filePath="$currentPath\$fileName"
$fileBin = Get-Content -Path $fileName.FullName -Raw
$boundary = [System.Guid]::NewGuid().ToString()
$LF = "`r`n"
$bodyLines = (
"--$boundary",
"Content-Disposition: form-data; name=`"files`"; filename=`"$filetxtname`"; csrf=`"notoken`"",
"Content-Type: application/octet-stream$LF",
$fileBin,
"--$boundary--$LF"
) -join $LF
$headers = @{
"Content-Type" = "multipart/form-data; boundary=`"$boundary`""
}
Invoke-RestMethod -Uri $uri -Method POST -Headers $headers -Body $bodyLines
}
function transfersh ($filename)
{
$file = Get-Item $filename;
(Invoke-WebRequest -Method POST -InFile $file.FullName -Uri http://comapredwith.transfer.sh:8000/$($file.Name)).Content
}
# Example usage
swscli(".\my-automatic-output.csv")
```
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

### Command Line Arguments
```
Simple HTTP(s) Server 0.6.3
Simpler HTTP(s) Server 0.6.3
USAGE:
simple-http-server [FLAGS] [OPTIONS] [--] [root]
simpler-http-server [FLAGS] [OPTIONS] [--] [root]
FLAGS:
--coep Add "Cross-Origin-Embedder-Policy" HTTP header and set it to "require-corp"
Expand Down Expand Up @@ -46,7 +46,7 @@ OPTIONS:
# Installation

### Download binary
[Goto Download](https://github.com/TheWaWaR/simple-http-server/releases)
[Goto Download](https://github.com/dw5/simpler-http-server/releases)

- windows-64bit
- osx-64bit
Expand All @@ -59,10 +59,10 @@ OPTIONS:
# Install Rust
curl https://sh.rustup.rs -sSf | sh

# Install simple-http-server
cargo install simple-http-server
# Install simpler-http-server
cargo install simpler-http-server
rehash
simple-http-server -h
simpler-http-server -h
```

# Features
Expand All @@ -82,7 +82,6 @@ simple-http-server -h
- [Range, If-Range, If-Match] => [Content-Range, 206, 416]
- [x] (default disabled) Automatic render index page [index.html, index.htm]
- [x] (default disabled) Upload file
- A CSRF token is generated when upload is enabled and must be sent as a parameter when uploading a file
- [x] (default disabled) HTTP Basic Authentication (by username:password)
- [x] Sort by: filename, filesize, modified date
- [x] HTTPS support
Expand Down
5 changes: 0 additions & 5 deletions SECURITY.md

This file was deleted.

0 comments on commit efee30e

Please sign in to comment.