Commit 66478b73 authored by Liang Ding's avatar Liang Ding

🐛 Fix #40

parent 4e4a1386
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
*/ */
package org.b3log.solo.processor; package org.b3log.solo.processor;
import org.b3log.latke.Keys;
import org.b3log.latke.http.RequestContext; import org.b3log.latke.http.RequestContext;
import org.b3log.latke.http.handler.Handler; import org.b3log.latke.http.handler.Handler;
import org.b3log.latke.util.Requests; import org.b3log.latke.util.Requests;
...@@ -27,13 +28,14 @@ import org.b3log.solo.util.Solos; ...@@ -27,13 +28,14 @@ import org.b3log.solo.util.Solos;
* Before request handler. * Before request handler.
* *
* @author <a href="http://88250.b3log.org">Liang Ding</a> * @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.0.1, Jan 12, 2020 * @version 1.0.0.2, Jan 12, 2020
* @since 3.6.7 * @since 3.6.7
*/ */
public class BeforeRequestHandler implements Handler { public class BeforeRequestHandler implements Handler {
@Override @Override
public void handle(final RequestContext context) { public void handle(final RequestContext context) {
context.attr(Keys.HttpRequest.START_TIME_MILLIS, System.currentTimeMillis());
final String remoteAddr = Requests.getRemoteAddr(context.getRequest()); final String remoteAddr = Requests.getRemoteAddr(context.getRequest());
if (Solos.BLACKLIST_IPS.contains(remoteAddr)) { if (Solos.BLACKLIST_IPS.contains(remoteAddr)) {
context.setStatus(429); context.setStatus(429);
......
...@@ -40,7 +40,7 @@ import org.json.JSONObject; ...@@ -40,7 +40,7 @@ import org.json.JSONObject;
* Article permalink handler. * Article permalink handler.
* *
* @author <a href="http://88250.b3log.org">Liang Ding</a> * @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.0.3, Nov 3, 2019 * @version 1.0.0.4, Jan 12, 2020
* @since 3.2.0 * @since 3.2.0
*/ */
public class PermalinkHandler implements Handler { public class PermalinkHandler implements Handler {
...@@ -124,7 +124,6 @@ public class PermalinkHandler implements Handler { ...@@ -124,7 +124,6 @@ public class PermalinkHandler implements Handler {
* *
* @param context the specified request context * @param context the specified request context
* @param article the specified article * @param article the specified article
* @see Dispatcher#rendTODO(RequestContext)
*/ */
private void dispatchToArticleProcessor(final RequestContext context, final JSONObject article) { private void dispatchToArticleProcessor(final RequestContext context, final JSONObject article) {
context.attr(Article.ARTICLE, article); context.attr(Article.ARTICLE, article);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment