aboutsummaryrefslogtreecommitdiff
path: root/src/java/com/juick/api/Utils.java
diff options
context:
space:
mode:
authorGravatar Ugnich Anton2013-08-30 13:10:14 +0700
committerGravatar Ugnich Anton2013-08-30 13:10:14 +0700
commit91bf74631157d8e559686ca25e4980f155d88438 (patch)
treed04790f407eba507aa3e9a6e17d9bc109b7fd982 /src/java/com/juick/api/Utils.java
parent4b1ef499dbd28c1639b9723ee2e9c5ff80002dde (diff)
PM
Diffstat (limited to 'src/java/com/juick/api/Utils.java')
-rw-r--r--src/java/com/juick/api/Utils.java12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/java/com/juick/api/Utils.java b/src/java/com/juick/api/Utils.java
index cac5612d..b406c362 100644
--- a/src/java/com/juick/api/Utils.java
+++ b/src/java/com/juick/api/Utils.java
@@ -70,8 +70,8 @@ public class Utils {
}
public static int getHttpAuthUID(Connection sql, HttpServletRequest request) {
- String auth = request.getHeader("HTTP_AUTHORIZATION");
- if (auth != null && auth.length() > 8) {
+ String auth = request.getHeader("Authorization");
+ if (auth != null && auth.length() > 8 && auth.startsWith("Basic ")) {
try {
BASE64Decoder dec = new BASE64Decoder();
String loginpassw[] = new String(dec.decodeBuffer(auth.substring(6))).split(":", 2);
@@ -84,6 +84,14 @@ public class Utils {
return 0;
}
+ public static int getVisitorQueryStringUID(Connection sql, HttpServletRequest request) {
+ String hash = request.getParameter("hash");
+ if (hash != null && hash.length() == 16) {
+ return com.juick.server.UserQueries.getUIDbyHash(sql, hash);
+ }
+ return 0;
+ }
+
public static void sendPermanentRedirect(HttpServletResponse response, String location) {
response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
response.setHeader("Location", location);