-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug fix: improve quality of URL encoder / sanitizer
with unit tests that illustrate the difficulty, which is a direct result of poor library support in Java
- Loading branch information
1 parent
decb1be
commit a2ecd17
Showing
62 changed files
with
5,701 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 75 additions & 2 deletions
77
...eiver/src/main/java/com/github/warren_bank/exoplayer_airplay_receiver/utils/UriUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
...eiver/src/main/java/com/github/warren_bank/exoplayer_airplay_receiver/utils/UrlUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.github.warren_bank.exoplayer_airplay_receiver.utils; | ||
|
||
import java.net.URI; | ||
import java.net.URL; | ||
import java.net.URLDecoder; | ||
|
||
public class UrlUtils { | ||
|
||
public static String decodeURL(String strUrl) { | ||
try { | ||
return URLDecoder.decode(strUrl, "UTF-8"); | ||
} | ||
catch(Exception e) { | ||
return strUrl; | ||
} | ||
} | ||
|
||
public static String encodeURL(String strUrl) { | ||
try { | ||
URL url = new URL(strUrl); | ||
|
||
return UrlUtils.encodeURL(url); | ||
} | ||
catch(Exception e) { | ||
return strUrl; | ||
} | ||
} | ||
|
||
public static String encodeURL(URL url) { | ||
try { | ||
URI uri = new URI(url.getProtocol(), url.getUserInfo(), url.getHost(), url.getPort(), url.getPath(), url.getQuery(), url.getRef()); | ||
|
||
return uri.toASCIIString(); | ||
} | ||
catch(Exception e) { | ||
return url.toExternalForm(); | ||
} | ||
} | ||
|
||
} |
0
tests/01.sh → ... - curl sender - examples in README/01.sh
100755 → 100644
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
!**/bin | ||
!**/lib | ||
!**/src | ||
!**/out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@echo off | ||
|
||
set JDK_HOME=C:\Android\android-studio-2021.3.1.17\jre | ||
set JRE_HOME=%JDK_HOME%\jre | ||
set PATH=%JRE_HOME%\bin;%JDK_HOME%\bin;%PATH% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
@echo off | ||
|
||
call "%~dp0.\0-env.bat" | ||
|
||
set output_dir=%~dp0..\out\%~n0 | ||
|
||
set options= | ||
set options=%options% --source-path "%~dp0..\lib" | ||
set options=%options% -d "%output_dir%" | ||
set options=%options% -encoding "UTF-8" | ||
set options=%options% -g:none | ||
|
||
set sourcefile="%~dp0..\src\Main.java" | ||
|
||
if exist "%output_dir%" rmdir /Q /S "%output_dir%" | ||
mkdir "%output_dir%" | ||
|
||
javac %options% %sourcefile% | ||
|
||
echo. | ||
pause |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
@echo off | ||
|
||
call "%~dp0.\0-env.bat" | ||
|
||
set output_dir=%~dp0..\out\%~n0 | ||
set stdout_file="%output_dir%\stdout.txt" | ||
set stderr_file="%output_dir%\stderr.txt" | ||
|
||
set options= | ||
set options=%options% --class-path "%output_dir%\..\1-compile" | ||
|
||
set mainclass="Main" | ||
|
||
if exist "%output_dir%" rmdir /Q /S "%output_dir%" | ||
mkdir "%output_dir%" | ||
|
||
java %options% %mainclass% 1>%stdout_file% 2>%stderr_file% |
Oops, something went wrong.