I also posted The question here http://stackoverflow.com/questions/43185804/using-httphandler-cause-django-server-side-shows-http-400-and-invalid-http-host
I am using HTTPHandler <https://docs.python.org/3/library/logging.handlers.html#httphandler> to send logging messages to a Django Web server with The following code, import loggingimport logging.handlers logger = logging.getLogger(__name__) _TARGET = '192.168.8.100:8000' _PATH = '/VideoParser/lYYDownloaderClientLog/' sh = logging.handlers.HTTPHandler(_TARGET, _PATH) logger.addHandler(sh) logger.error('testing remote logging') but The server side shows http 400 and Invalid HTTP_HOST header message like this Invalid HTTP_HOST header: '192.168.8.100:8000,192.168.8.100'. The domain name pr ovided is not valid according to RFC 1034/1035. [05/Apr/2017 10:43:14] "GET /VideoParser/lYYDownloaderClientLog/?relativeCreated =117.00654029846191&thread=5468&levelname=ERROR&exc_info=None&exc_text=None&proc ess=8920&filename=a.py&msecs=39.52503204345703&stack_info=None&levelno=40&proces sName=MainProcess&msg=testing+remote+logging&module=a&threadName=MainThread&line no=26&created=1491360192.039525&funcName=%3Cmodule%3E&args=%28%29&name= *main*& pathname=C%3A%5CUsers%5Ci%5CDocuments%5CTencent+Files%5C2281570025%5CFileRecv%5C a.py HTTP/1.1" 400 68137 while request from browser with url http://192.168.8.100:8000/VideoParser/lYYDownloaderClientLog/?filename=log55.p%20y&levelno=40&relativeCreated=88.00482749938965&funcName=%3Cmodule%3E&thread=7144%20&stack_info=None&module=log55&args=%28%29&exc_text=None&pathname=D%3A%5CBaiduYun%20Download%5C%E7%BC%96%E7%A8%8B%5CPython%5Clog55.py&levelname=ERROR&msecs=668.0548%20191070557&threadName=MainThread&process=6664&name=root&lineno=34&msg=yahoo+Serve%20r+Exception&exc_info=None&processName=MainProcess&created=1491225161.6680548 could actually send a good request to The server , The server shows The following in this case ----666666666666--- <QueryDict: {'stack_info': ['None'], 'levelno': ['40'], 'arg s': ['()'], 'exc_info': ['None'], 'created': ['1491225161.6680548'], 'process':['6664'], 'levelname': ['ERROR'], 'exc_text': ['None'], 'module': ['log55'], 'ms ecs': ['668.0548 191070557'], 'name': ['root'], 'processName': ['MainProcess'],'lineno': ['34'], 'thread': ['7144 '], 'msg': ['yahoo Serve r Exception'], 'func Name': ['<module>'], 'threadName': ['MainThread'], 'filename': ['log55.p y'], 'p athname': ['D:\\BaiduYun Download\\编程\\Python\\log55.py'], 'relativeCreated':['88.00482749938965']}>[05/Apr/2017 10:45:26] "GET /VideoParser/lYYDownloaderClientLog/?filename=log55. p%20y&levelno=40&relativeCreated=88.00482749938965&funcName=%3Cmodule%3E&thread= 7144%20&stack_info=None&module=log55&args=%28%29&exc_text=None&pathname=D%3A%5CB aiduYun%20Download%5C%E7%BC%96%E7%A8%8B%5CPython%5Clog55.py&levelname=ERROR&msec s=668.0548%20191070557&threadName=MainThread&process=6664&name=root&lineno=34&ms g=yahoo+Serve%20r+Exception&exc_info=None&processName=MainProcess&created=149122 5161.6680548 HTTP/1.1" 200 27 so what's wrong with my code using HTTPHandler <https://docs.python.org/3/library/logging.handlers.html#httphandler> to send logging messages to a Django Web server ? As I have tested: If I pass the IP address of my web server to the host parameter of HTTPHandler, the server side would show http 400 and Invalid HTTP_HOST header message, there are also exceptions , pasted here https://bpaste.net/show/f2d2e64e7a7e , while if I pass the domain name instead, then the view function works as expected . so would it be a bug within HTTPHandler? related code For debug django-test\LYYDownloaderServer\VideoParser\urls.py from django.conf.urls import urlfrom . import views app_name = 'VideoParser' urlpatterns = [ url(r'lYYDownloaderClientLog.+',views.lYYDownloaderClientLog, name='lYYDownloaderClientLog')] django-test\LYYDownloaderServer\VideoParser\views.py def lYYDownloaderClientLog(request): print('----666666666666---', request.GET) return HttpResponse("") # The server *successfully* processed the request and is not returning any content. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/2e383515-3e78-4f6a-8681-0eb7858251f3%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.

