Import nanohttpd 2.3.1 source

This commit is contained in:
yushijinhun 2018-12-30 16:31:08 +08:00
parent 3572ff8eb5
commit 6dccd97269
No known key found for this signature in database
GPG key ID: 5BC167F73EA558E4
8 changed files with 2425 additions and 23 deletions

View file

@ -10,7 +10,6 @@ repositories {
dependencies {
compile 'org.ow2.asm:asm:6.2.1'
compile 'org.nanohttpd:nanohttpd:2.3.1'
testCompile 'junit:junit:4.12'
}
@ -53,13 +52,7 @@ shadowJar {
exclude 'META-INF/maven/**'
exclude 'module-info.class'
// nanohttpd
exclude 'LICENSE.txt'
exclude 'fi/iki/elonen/util/**'
exclude 'META-INF/nanohttpd/mimetypes.properties'
relocate 'org.objectweb.asm', 'moe.yushi.authlibinjector.internal.org.objectweb.asm'
relocate 'fi.iki.elonen', 'moe.yushi.authlibinjector.internal.fi.iki.elonen'
}
defaultTasks 'clean', 'shadowJar'

View file

@ -1,9 +1,9 @@
package moe.yushi.authlibinjector.httpd;
import static fi.iki.elonen.NanoHTTPD.newFixedLengthResponse;
import static java.util.Optional.empty;
import static java.util.Optional.of;
import static java.util.Optional.ofNullable;
import static moe.yushi.authlibinjector.internal.fi.iki.elonen.NanoHTTPD.newFixedLengthResponse;
import static moe.yushi.authlibinjector.util.IOUtils.asString;
import static moe.yushi.authlibinjector.util.IOUtils.getURL;
import static moe.yushi.authlibinjector.util.IOUtils.newUncheckedIOException;
@ -18,10 +18,10 @@ import java.util.Optional;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import fi.iki.elonen.NanoHTTPD.IHTTPSession;
import fi.iki.elonen.NanoHTTPD.Response;
import fi.iki.elonen.NanoHTTPD.Response.Status;
import moe.yushi.authlibinjector.YggdrasilConfiguration;
import moe.yushi.authlibinjector.internal.fi.iki.elonen.NanoHTTPD.IHTTPSession;
import moe.yushi.authlibinjector.internal.fi.iki.elonen.NanoHTTPD.Response;
import moe.yushi.authlibinjector.internal.fi.iki.elonen.NanoHTTPD.Response.Status;
import moe.yushi.authlibinjector.internal.org.json.simple.JSONObject;
import moe.yushi.authlibinjector.util.JsonUtils;
import moe.yushi.authlibinjector.util.Logging;

View file

@ -2,8 +2,8 @@ package moe.yushi.authlibinjector.httpd;
import java.util.Optional;
import fi.iki.elonen.NanoHTTPD.IHTTPSession;
import fi.iki.elonen.NanoHTTPD.Response;
import moe.yushi.authlibinjector.internal.fi.iki.elonen.NanoHTTPD.IHTTPSession;
import moe.yushi.authlibinjector.internal.fi.iki.elonen.NanoHTTPD.Response;
public interface URLFilter {

View file

@ -1,7 +1,8 @@
package moe.yushi.authlibinjector.httpd;
import static fi.iki.elonen.NanoHTTPD.Response.Status.INTERNAL_ERROR;
import static fi.iki.elonen.NanoHTTPD.Response.Status.NOT_FOUND;
import static moe.yushi.authlibinjector.internal.fi.iki.elonen.NanoHTTPD.Response.Status.INTERNAL_ERROR;
import static moe.yushi.authlibinjector.internal.fi.iki.elonen.NanoHTTPD.Response.Status.NOT_FOUND;
import java.io.IOException;
import java.util.List;
import java.util.Optional;
@ -9,7 +10,7 @@ import java.util.logging.Level;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import fi.iki.elonen.NanoHTTPD;
import moe.yushi.authlibinjector.internal.fi.iki.elonen.NanoHTTPD;
import moe.yushi.authlibinjector.util.Logging;
public class URLProcessor {

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,6 @@
/**
* Modified <a href="https://github.com/NanoHttpd/nanohttpd">nanohttpd</a>.
* <p>
* See license in META-INF/licenses/nanohttpd.txt
*/
package moe.yushi.authlibinjector.internal.fi.iki.elonen;

View file

@ -1,12 +1,26 @@
Copyright (c) 2012-2013 by Paul S. Hawke, 2001,2005-2013 by Jarno Elonen, 2010 by Konstantinos Togias
All rights reserved.
Copyright (c) 2012 - 2016, nanohttpd
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the NanoHttpd organization nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
3. Neither the name of the nanohttpd nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.

View file

@ -0,0 +1,30 @@
#default mime types for nanohttpd, use META-INF/mimetypes.properties for user defined mimetypes
css=text/css
htm=text/html
html=text/html
xml=text/xml
java=text/x-java-source, text/java
md=text/plain
txt=text/plain
asc=text/plain
gif=image/gif
jpg=image/jpeg
jpeg=image/jpeg
png=image/png
svg=image/svg+xml
mp3=audio/mpeg
m3u=audio/mpeg-url
mp4=video/mp4
ogv=video/ogg
flv=video/x-flv
mov=video/quicktime
swf=application/x-shockwave-flash
js=application/javascript
pdf=application/pdf
doc=application/msword
ogg=application/x-ogg
zip=application/octet-stream
exe=application/octet-stream
class=application/octet-stream
m3u8=application/vnd.apple.mpegurl
ts=video/mp2t