This is a utility for finding and replacing http URLs using nohttp. It takes into account which URLs are allowed by nohttp.
The application is an executable jar application. The application requires JDK 8+ to compile and run.
-
Snapshots are available for download at https://repo.spring.io/libs-snapshot/io/spring/nohttp/nohttp-cli/
-
Releases are available for download at https://repo.maven.apache.org/maven2/io/spring/nohttp/nohttp-cli/
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'
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
.
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).
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 |
java -jar $NOHTTP
java -jar $NOHTTP -r
You can get help with additional options using --help
.
java -jar $NOHTTP --help
...
Usage: nohttp [-fhMrsTV] [-w=<allowlistFile>] [-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=<allowlistFile> The path to file that contains additional allowlist of
allowed URLs. The format is a regular expression to
allowlist (ignore http URLs) per line.