Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/lsk569937453/rcurl


https://github.com/lsk569937453/rcurl

curl http http-client http-clients

Last synced: 27 days ago
JSON representation

Awesome Lists containing this project

README

        

# Rcurl

Rcurl is a implementation of the curl library that provides a set of functions for making HTTP(http1.1,http2)/FTP requests.

You can use it to make HTTP(http1.1,http2)/FTP requests like curl to a server and get the response.

# Document

```
Usage: rcurl.exe [OPTIONS]

Arguments:
The request url,like http://www.google.com

Options:
-X, --request Specify request method to use
-d, --data HTTP POST data
-F, --form Specify multipart MIME data
-H, --header The http headers
-c, --certificate-path-option The pem path
-u, --user Server user and password
-A, --user-agent Send User-Agent to server
-b, --cookie The Cookie option
-e, --referer Referrer URL
-o, --output Write to file instead of stdout
-T, --upload-file Transfer local FILE to destination
-Q, --quote Send command(s) to server before transfer
-k, --insecure Allow insecure server connections
-I, --head Show document info only
-r, --range Retrieve only the bytes within RANGE
-v, --verbose Make the operation more talkative
--http2
--http2-prior-knowledge
-h, --help Print help
-V, --version Print version
```

# HTTP/HTTPS

## GET

```
rcurl http://httpbin.org/get
rcurl https://httpbin.org/get
```

## POST with body

```
rcurl -X POST -d '{"a":1,"b":2}' http://httpbin.org/post
```

## PUT

```
rcurl -X PUT http://httpbin.org/put
```

## DEBUG

```
rcurl http://httpbin.org/get -v
```

## Skip Certificate validate

```
rcurl http://httpbin.org/get -k
```

## Download file

```
rcurl -o test.html http://httpbin.org/get
```

## Headers

```
rcurl -H 'a:b' -H 'c:d' http://httpbin.org/get
```

## User Agent

```
rcurl -A 'a:b' http://httpbin.org/get
```

## Cookie

```
rcurl -b 'a:b' http://httpbin.org/get
```
## Upload File
```
rcurl --upload-file .gitignore http://httpbin.org/put
```
## Http2
### Default
```
rcurl http://httpbin.org/get --http2
```
### Http2-prior-knowledge
```
rcurl https://httpbin.org/get --http2-prior-knowledge
```

# FTP/FTPS

## List directory

```
rcurl -u "demo:password" ftp://test.rebex.net:21/
```

## Upload file

```
rcurl -T LICENSE -u "demo:password" ftp://test.rebex.net:21/
```

# Unit Test Report

```
Coverage Results:
|| Tested/Total Lines:
|| src\cli\app_config.rs: 4/4 +0.00%
|| src\ftp\handler.rs: 38/60 +0.00%
|| src\http\handler.rs: 149/177 +0.00%
|| src\main.rs: 11/17 +0.00%
||
78.29% coverage, 202/258 lines covered, +0.00% change in coverage
```