Skip to content
This repository was archived by the owner on Jul 31, 2022. It is now read-only.

Commit fab618d

Browse files
committed
QA on redirect handler, exchange, and cookie
1 parent 2e99c9d commit fab618d

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

src/ktt/lib/httpserver/SimpleHttpCookie.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ public final String toString(){
7878
if(path != null)
7979
OUT.append("; Path=").append(path);
8080
if(secure)
81-
OUT.append(secure);
81+
OUT.append("; Secure=").append(secure);
8282
if(httpOnly)
83-
OUT.append(httpOnly);
83+
OUT.append("; HttpOnly=").append(httpOnly);
8484
if(sameSite != null)
8585
OUT.append("; SameSite=").append(sameSite);
8686

src/ktt/lib/httpserver/SimpleHttpExchangeImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ public final String toString(){
464464
OUT.append("fragment") .append("= ") .append(fragment) .append(", ");
465465
OUT.append("requestHeaders") .append("= ") .append(requestHeaders) .append(", ");
466466
OUT.append("requestMethod") .append("= ") .append(requestMethod) .append(", ");
467-
OUT.append("responseHeader") .append("= ") .append(getResponseHeaders()) .append(", ");
467+
OUT.append("responseHeaders") .append("= ") .append(getResponseHeaders()) .append(", ");
468468
OUT.append("responseCode") .append("= ") .append(getResponseCode()) .append(", ");
469469
OUT.append("rawGet") .append("= ") .append(rawGet) .append(", ");
470470
OUT.append("getMap") .append("= ") .append(getMap) .append(", ");

src/ktt/lib/httpserver/handler/RedirectHandler.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import java.io.IOException;
88

99
/**
10-
* A request handler that redirects to a different URL without pushing to the history.
10+
* A request handler that redirects to a different URL without pushing to the history. The URL may not work correctly if it does not have a valid authority (<code>http</code>/<code>https</code>).
1111
*
1212
* @see SimpleHttpHandler
1313
* @see com.sun.net.httpserver.HttpHandler
@@ -33,8 +33,13 @@ public RedirectHandler(final String link){
3333

3434
@Override
3535
public final void handle(final SimpleHttpExchange exchange) throws IOException{
36-
exchange.getResponseHeaders().set("Location",link);
37-
exchange.send(HttpCode.HTTP_Found);
36+
try{
37+
System.out.println("started");
38+
exchange.getResponseHeaders().set("Location", link);
39+
exchange.send(HttpCode.HTTP_Found);
40+
}catch(final Exception e){
41+
e.printStackTrace();
42+
}
3843
}
3944

4045
//

0 commit comments

Comments
 (0)