Skip to content
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

Extract Rex::MIME dependency #201

Merged
merged 3 commits into from
Dec 10, 2015
Merged

Extract Rex::MIME dependency #201

merged 3 commits into from
Dec 10, 2015

Conversation

gschneider-r7
Copy link
Contributor

Removes Rex as a dependency from nexpose-client altogether. The Rex::MIME module has been incorporated into nexpose-client under the Rexlite::MIME module to avoid namespace collisions.

At this time Rex::MIME was the only part of Rex that nexpose-client depended on. A few methods of Rex::Text were also pulled into the consuming classes in Rexlite::MIME.

Rex::MIME::Message was used by the Connection#import_scan and AdhocReportConfig#generate methods.

cc @sgreen-r7 @hdm @jhart-r7

All of the files pulled over are under the BSD 3-clause license in the Rex project I believe.

end

def to_s
self.header.to_s + "\r\n" + content_encoded + "\r\n"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant self detected.

@jhart-r7
Copy link
Contributor

What do we actually use this MIME code for anyway? Is it really still the case that there is nothing out there that can provide this functionality beyond Rex or a derivative?

@erran-r7
Copy link
Contributor

What do we actually use this MIME code for anyway?

The methods Nexpose::Connection#import_scan and Nexpose:: AdhocReportConfig#generate.

Is it really still the case that there is nothing out there that can provide this functionality beyond Rex or a derivative?

Either of these are candidates for refactoring. I'm not sure that a straight forward replacement exists though. Note that I only spent an hour or so looking at it several months ago.

@sgreen-r7
Copy link
Contributor

Gavin and I looked at it for a bit, and extracting that class is the quick fix, which could be completed in one PR.

Doing it this way let's us get rid of Rex in the meantime and move forward on our own schedule for the refactoring of the extracted class. The refactor is not hard, but would need a bit of testing to make sure we didn't break anything.

@erran-r7
Copy link
Contributor

Doing it this way let's us get rid of Rex in the meantime and move forward on our own schedule for the refactoring of the extracted class.

👍

@gschneider-r7
Copy link
Contributor Author

So far the best I've found for import_scan is multipart-post which is rather nice to use. However something still needs to handle the report downloads. Looking through old API samples (like before nexpose-client was a thing I think) we could possibly just do a string split on the boundary. Otherwise I have not found any nice looking, or lightweight gems for handling the multi-part report data. It's rather surprising that both of these are so lacking in the Ruby stdlib.

The big trade-off right now is whether we have 1-2 external dependencies or 0 external dependencies.

Removes Rex as a dependency from nexpose-client altogether. The
Rex::MIME module has been incorporated into nexpose-client under the
Rexlite::MIME module to avoid namespace collisions.

At this time Rex::MIME was the only part of Rex that nexpose-client
depended on. A few methods of Rex::Text were also pulled into the
consuming classes in Rexlite::MIME.
Sicne it has used Rex::MIME in place of rest-client for a while the docs
should be updated to reflect that.
sgreen-r7 added a commit that referenced this pull request Dec 10, 2015
Extract Rex::MIME dependency
@sgreen-r7 sgreen-r7 merged commit 4cc4425 into master Dec 10, 2015
@sgreen-r7 sgreen-r7 deleted the rex_lite_mime branch December 10, 2015 22:25
@sgreen-r7 sgreen-r7 restored the rex_lite_mime branch December 10, 2015 22:25
@sgreen-r7 sgreen-r7 deleted the rex_lite_mime branch December 10, 2015 22:25
@gschneider-r7 gschneider-r7 modified the milestone: 3.0 Dec 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants