Skip to content
Branch: master
Find file History
Latest commit f6eea5e May 2, 2019
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
src/main Polish CLI Apr 29, 2019
README.adoc Link to nohttp Apr 29, 2019
build.gradle jar.dependsOn bootJar May 1, 2019

README.adoc

This is a utility for finding and replacing http URLs using nohttp. It takes into account whitelisting rules that nohttp uses.

Usage

The application is a Spring Boot application. The application requires JDK 8+ to compile and run.

Downloading

Once you download, we recommend exporting the jar to a variable named NOHTTP. For example:

export NOHTTP='~/Downloads/nohttp-cli-0.0.1.BUILD-SNAPSHOT.jar'

Compiling

To use this app first create the jar

./gradlew :nohttp-cli:assemble

The jar will now available at nohttp-cli/build/libs/nohttp-cli-0.0.1.BUILD-SNAPSHOT.jar.

You can then export the full path to a variable.

export NOHTTP=$(pwd)/nohttp-cli/build/libs/nohttp-cli-0.0.1.BUILD-SNAPSHOT.jar

The guide assumes that the jar is now available in the variable $NOHTTP. If that is not true, you can substitute $NOHTTP for the absolute path of nohttp-cli-0.0.1.BUILD-SNAPSHOT.jar.

Running

It is best to run this in a folder that does not have any files with build output. If you use git, a great way to ensure that there are no build output is to do a fresh clone. Alternatively, you can remove all files not added to git using git clean -dfx. Keep in mind this may delete things you want (i.e. IDE related files).

Hello nohttp

The easiest approach is to run the application with no arguments. This will attempt to find http in all text based files in the current directory while ignoring .git folder.

Note

The process for checking if it is a text file uses a native invocation of grep. If you cannot run grep, then you can disable text using -T flag shown in Help.

Example 1. Find all http references in the current working directory
java -jar $NOHTTP
Example 2. Replace all http references in the current working directory
java -jar $NOHTTP -r

Help

You can get help with additional options using --help.

Example 3. Help
java -jar $NOHTTP --help
...
Usage: nohttp [-fhMrsTV] [-w=<whitelistFile>] [-D=<regex>]... [-F=<regex>]...
              [<dir>]
      [<dir>]           The directory to scan. Default is current working directory.
  -D=<regex>            Regular expression of directories to exclude scanning.
                          Specify multiple times to provide multiple exclusions.
                          Default is to exclude .git
  -f                    If true, prints out the file names.
  -F=<regex>            Regular expression of files to exclude scanning. Specify
                          multiple times to provide multiple exclusions. Default is
                          no file exclusions.
  -h, --help            Show this help message and exit.
  -M                    Disables printing each match within their specific files.
  -r                    Enables replacing the values that were found. The default is
                          to just find the results.
  -s                    Enables checking the http status before determining if
                          replacement should be done.
  -T                    Disable searching only text based files. This is determined
                          using native invocation of grep which will not work on all
                          systems, so it can be disabled.
  -V, --version         Print version information and exit.
  -w=<whitelistFile>    The path to file that contains additional whitelist of
                          allowed URLs. The format is a regular expression to
                          whitelist (ignore http URLs) per line.
You can’t perform that action at this time.