runc 0.1.4 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +35 -34
- data/lib/runc.rb +21 -8
- data/lib/runc/version.rb +1 -1
- data/runc.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a2a910acd2374702b595d19d419065abe659ec54b85350a07844b1d27aed9c9a
|
4
|
+
data.tar.gz: bc3a693d3ad223e3cc983b60a6f700454d0e9cc5a34d7bd4de32f0bbae21a33e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57589478fdcec08ed7ee185fde4156296273a04dfebaf760e5409c4d4f69a4d4eaeb6cd950b98f517794b12eab31319609e4e21b80cd44ba70797765ae376415
|
7
|
+
data.tar.gz: 39e08a80b0f1883eccd46cad27751d4be170bba6890754c8ad8dac0fcfe227cb0b33c96a3ddbe2d9313c504d0269e930fb5d23c94414853cd9a8d5b4eabca5b5
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,40 +1,41 @@
|
|
1
1
|
# Runc
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
3
|
+
[Runc] (pronounced "runk") is a network communication repl inspired by netcat and curl. In contrast to those tools, runc is simpler and faster to use:
|
4
|
+
|
5
|
+
```bash
|
6
|
+
$ runc -h
|
7
|
+
-B, --no-body discard the response body
|
8
|
+
-H, --no-header discard the response header
|
9
|
+
-h, --help print this message
|
10
|
+
-n, --host host name (default 'localhost')
|
11
|
+
-p, --port port (default 8000)
|
12
|
+
-v, --version print runc version
|
13
|
+
|
14
|
+
$ runc -B -p 443 -n sergioro.mx
|
15
|
+
header>
|
16
|
+
request>
|
17
|
+
> host: sergioro.mx
|
18
|
+
>
|
19
|
+
< HTTP/1.1 200 OK
|
20
|
+
< date: Mon, 27 Apr 2020 06:08:17 GMT
|
21
|
+
< ...
|
22
|
+
<
|
23
|
+
header> host: localhost, port: 8000
|
24
|
+
request> get /index.html
|
25
|
+
> host: localhost
|
26
|
+
>
|
27
|
+
< HTTP/1.1 200 OK
|
28
|
+
< content-type: text/html
|
29
|
+
< ...
|
30
|
+
<
|
13
31
|
```
|
14
32
|
|
15
|
-
|
16
|
-
|
17
|
-
$ bundle install
|
18
|
-
|
19
|
-
Or install it yourself as:
|
20
|
-
|
21
|
-
$ gem install runc
|
22
|
-
|
23
|
-
## Usage
|
24
|
-
|
25
|
-
TODO: Write usage instructions here
|
26
|
-
|
27
|
-
## Development
|
28
|
-
|
29
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
-
|
31
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
-
|
33
|
-
## Contributing
|
34
|
-
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/runc.
|
36
|
-
|
33
|
+
Features and ProTips:
|
37
34
|
|
38
|
-
|
35
|
+
- Runc relies on standard library features and has zero external dependencies.
|
36
|
+
- The default request is `GET /`.
|
37
|
+
- An empty response/header fallbacks to it's previous value.
|
38
|
+
- Case-insensitive HTTP verbs.
|
39
|
+
- Runc stands for "run connection"
|
39
40
|
|
40
|
-
|
41
|
+
[runc]: https://rubygems.org/gems/runc
|
data/lib/runc.rb
CHANGED
@@ -55,12 +55,21 @@ class Runc
|
|
55
55
|
|
56
56
|
def self.help # :nodoc:
|
57
57
|
puts <<~eos
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
58
|
+
Usage:
|
59
|
+
runc [options]
|
60
|
+
|
61
|
+
Example:
|
62
|
+
runc
|
63
|
+
header> host: example.com, port: 80
|
64
|
+
request> get
|
65
|
+
|
66
|
+
Options:
|
67
|
+
-B, --no-body discard the response body
|
68
|
+
-H, --no-header discard the response header
|
69
|
+
-h, --help print this message
|
70
|
+
-n, --host host name (default 'localhost')
|
71
|
+
-p, --port port (default 8000)
|
72
|
+
-v, --version print runc version
|
64
73
|
eos
|
65
74
|
exit
|
66
75
|
end
|
@@ -104,16 +113,20 @@ class Runc
|
|
104
113
|
def repl # :nodoc:
|
105
114
|
read_protocols
|
106
115
|
loop do
|
116
|
+
update_header
|
117
|
+
|
107
118
|
req_tmp=ask('request')
|
108
119
|
|
109
120
|
@req = req_tmp.empty? ? @req : req_tmp
|
110
121
|
|
111
|
-
update_header
|
112
|
-
|
113
122
|
update_uri
|
114
123
|
|
115
124
|
request=Net::HTTP.const_get(@req[/^\w+/].capitalize).new(@uri, @header)
|
116
125
|
|
126
|
+
if [Net::HTTP::Post, Net::HTTP::Put, Net::HTTP::Patch].include?(request.class)
|
127
|
+
request.body=ask('body')
|
128
|
+
end
|
129
|
+
|
117
130
|
http=Net::HTTP.new(@uri.host,@uri.port)
|
118
131
|
|
119
132
|
http.use_ssl = port==443 ? true : false
|
data/lib/runc/version.rb
CHANGED
data/runc.gemspec
CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
|
|
7
7
|
spec.email = ["yo@sergioro.com"]
|
8
8
|
|
9
9
|
spec.summary = %q{Network REPL}
|
10
|
-
spec.description = %q{Pronounced "
|
10
|
+
spec.description = %q{Pronounced "runk" stands for "run connection"}
|
11
11
|
spec.license = "MIT"
|
12
12
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
13
13
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: runc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sergioro
|
@@ -66,7 +66,7 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 13.0.1
|
69
|
-
description: Pronounced "
|
69
|
+
description: Pronounced "runk" stands for "run connection"
|
70
70
|
email:
|
71
71
|
- yo@sergioro.com
|
72
72
|
executables:
|