-
-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a Value::WebSocket
class
#176
base: 0.2.0
Are you sure you want to change the base?
Conversation
1b0d0bd
to
9ad9504
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're going to be parsing the websocket URIs using URI()
we should store the whole URI::WS
/URI::WSS
object as @uri
, similar to Values::URL
. This way the URI classes handle the formatting and the various URI fields.
So we should allow to pass only the whole |
@AI-Mozi you could probably copy |
2a3945b
to
635b86d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noticed some things.
lib/ronin/recon/values/web_socket.rb
Outdated
# | ||
def self.ws(host,port=80,path=nil,query=nil) | ||
url = "ws://#{host}:#{port}" | ||
url << "#{path}" if path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rubocop would probably complain about "#{path}"
. Just path
is better.
lib/ronin/recon/values/web_socket.rb
Outdated
# | ||
def self.wss(host,port=443,path=nil,query=nil) | ||
url = "wss://#{host}:#{port}" | ||
url << "#{path}" if path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rubocop would probably complain about "#{path}"
. Just path
is better.
lib/ronin/recon/values/web_socket.rb
Outdated
url << "#{path}" if path | ||
url << "?#{query}" if query | ||
|
||
new(url) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be easier to just do new(URI::WS.build(host: host, ...))
.
lib/ronin/recon/values/web_socket.rb
Outdated
url << "#{path}" if path | ||
url << "?#{query}" if query | ||
|
||
new(url) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be easier to just do new(URI::WSS.build(host: host, ...))
.
lib/ronin/recon/values/web_socket.rb
Outdated
# The URI object for the website. | ||
# | ||
def to_uri | ||
URI_CLASSES.fetch(scheme).build(host: host, port: port, path: path, query: query) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably easier to just return @uri
to avoid re-creating URIs.
lib/ronin/recon/values/web_socket.rb
Outdated
|
||
# The parsed URI. | ||
# | ||
# @return [URI::HTTP, URI::HTTPS] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/URI::HTTP/URI::WS/g
635b86d
to
390675e
Compare
#171