BiglyBT icon indicating copy to clipboard operation
BiglyBT copied to clipboard

Encoding error when Bigly attempts to scrape a tracker (zzzot on i2p)

Open vituperative opened this issue 3 years ago • 2 comments

WARN [...Jetty-76575] ...ty.server.Server: /a/scrape org.eclipse.jetty.http.BadMessageException: 400: Bad query encoding at org.eclipse.jetty.server.Request.mergeQueryParameters(Request.java:2411) at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:195) at org.eclipse.jetty.server.Dispatcher.error(Dispatcher.java:79) at org.eclipse.jetty.server.handler.ErrorHandler.handle(ErrorHandler.java:94) at org.eclipse.jetty.server.Response.sendError(Response.java:552) at org.eclipse.jetty.server.Response.sendError(Response.java:491) at org.eclipse.jetty.servlet.DefaultServlet.doGet(DefaultServlet.java:482) at javax.servlet.http.HttpServlet.service(HttpServlet.java:655) at javax.servlet.http.HttpServlet.service(HttpServlet.java:764) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:848) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1180) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:513) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:213) at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:119) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134) at org.eclipse.jetty.rewrite.handler.RewriteHandler.handle(RewriteHandler.java:335) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134) at org.eclipse.jetty.server.Server.handle(Server.java:539) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:333) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251) at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:283) at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:108) at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93) at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303) at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148) at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671) at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589) at java.base/java.lang.Thread.run(Thread.java:833) Caused by: org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte E0 in state 3 at org.eclipse.jetty.util.Utf8Appendable.appendByte(Utf8Appendable.java:247) at org.eclipse.jetty.util.Utf8Appendable.append(Utf8Appendable.java:157) at org.eclipse.jetty.util.UrlEncoded.decodeUtf8To(UrlEncoded.java:354) at org.eclipse.jetty.util.UrlEncoded.decodeTo(UrlEncoded.java:226) at org.eclipse.jetty.util.UrlEncoded.decodeTo(UrlEncoded.java:210) at org.eclipse.jetty.server.Request.mergeQueryParameters(Request.java:2407)

vituperative avatar Feb 06 '22 15:02 vituperative

Pretty sure the code that constructs the scrape request for I2P is the same as for the clearnet

info hashes are raw byte arrays that are encoded in an annoying way:

https://stackoverflow.com/questions/3272167/how-to-convert-torrent-info-hash-for-scrape

parg avatar Feb 07 '22 17:02 parg

Thanks. Apologies, most likely not a BiglyBT issue.

When I pointed OP here, I didn't have the bottom part of the stack trace, which indicates that Jetty is trying to use UTF-8 decoding for the query params (after the URL decoding).

I've been here before, which is why I have

    request.setAttribute("org.eclipse.jetty.server.Request.queryEncoding", "ISO-8859-1");

in zzzot both for the scrape and announce jsp's, identical code, but for some reason it's broken for the OP. Perhaps something else is going on that's making the attempt to set the attribute happen too late. Maybe something changed in Jetty. I assume only BiglyBT is doing scrape to zzzot but everybody is doing announces, same code sets the query encoding for both. No ideas yet.

zzzi2p avatar Feb 07 '22 22:02 zzzi2p