diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py index bd5adf84..6b37bc6b 100644 --- a/copyparty/httpcli.py +++ b/copyparty/httpcli.py @@ -10,7 +10,6 @@ import json import string import socket import ctypes -import traceback from datetime import datetime import calendar @@ -50,6 +49,7 @@ class HttpCli(object): self.tls = hasattr(self.s, "cipher") self.bufsz = 1024 * 32 + self.hint = None self.absolute_urls = False self.out_headers = {"Access-Control-Allow-Origin": "*"} @@ -72,6 +72,7 @@ class HttpCli(object): """returns true if connection can be reused""" self.keepalive = False self.headers = {} + self.hint = None try: headerlines = read_header(self.sr) if not headerlines: @@ -130,6 +131,9 @@ class HttpCli(object): if v is not None: self.log("[H] {}: \033[33m[{}]".format(k, v), 6) + if "&" in self.req and "?" not in self.req: + self.hint = "did you mean '?' instead of '&'" + # split req into vpath + uparam uparam = {} if "?" not in self.req: @@ -199,6 +203,9 @@ class HttpCli(object): self.log("{}\033[0m, {}".format(str(ex), self.vpath), 3) msg = "
{}\r\nURL: {}\r\n".format(str(ex), self.vpath) + if self.hint: + msg += "hint: {}\r\n".format(self.hint) + self.reply(msg.encode("utf-8", "replace"), status=ex.code) return self.keepalive except Pebkac: diff --git a/copyparty/httpconn.py b/copyparty/httpconn.py index 97a07b39..fbdbd4de 100644 --- a/copyparty/httpconn.py +++ b/copyparty/httpconn.py @@ -3,7 +3,6 @@ from __future__ import print_function, unicode_literals import re import os -import sys import time import socket diff --git a/copyparty/up2k.py b/copyparty/up2k.py index 38482119..eed2e16a 100644 --- a/copyparty/up2k.py +++ b/copyparty/up2k.py @@ -653,7 +653,7 @@ class Up2k(object): try: parser = MParser(parser) except: - self.log("invalid argument: " + parser, 1) + self.log("invalid argument (could not find program): " + parser, 1) return for tag in entags: