请求从Chrome扩展程序取消到Django服务器

时间:2014-09-20 11:17:22

标签: django google-chrome-extension django-cors-headers

我有一个chrome扩展,可以调用本地Django服务器,如下所示:

http://127.0.0.1:8000/currentthread?threadid=2gv051

请求的标题选项卡中的以下文字:

Provisional headers are shown
Accept:*/*
Origin:chrome-extension://goacodhlgclokcokefjhmiahbgbhjbco
Referer:<SOME_DOMAIN>
User-Agent:Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36
X-DevTools-Emulate-Network-Conditions-Client-Id:A31DE079-2F0B-400A-B5BA-E3721ADB7EE6

但是,Chrome网络工具中的请求状态文字显示为(canceled)。为什么会这样,我该如何解决?我还使用django-cors-headers包添加了CORS头。

您还可以在Chrome's net-internals tool中查看错误(以及许多其他相关的有用信息):chrome://net-internals/#events

981559: URL_REQUEST
http://127.0.0.1:8000/currentthread?threadid=2gz3c9
Start Time: 2014-09-21 15:47:24.290

t=65604 [st=   0] +REQUEST_ALIVE  [dt=1002]
t=65604 [st=   0]   +URL_REQUEST_DELEGATE  [dt=1]
t=65604 [st=   0]      DELEGATE_INFO  [dt=1]
                       --> delegate_info = "extension AdBlock"
t=65605 [st=   1]   -URL_REQUEST_DELEGATE
t=65605 [st=   1]   +URL_REQUEST_START_JOB  [dt=1000]
                     --> load_flags = 9322752 (DO_NOT_SAVE_COOKIES | DO_NOT_SEND_AUTH_DATA | DO_NOT_SEND_COOKIES | ENABLE_LOAD_TIMING | REPORT_RAW_HEADERS | VERIFY_EV_CERT)
                     --> method = "GET"
                     --> priority = "LOW"
                     --> url = "http://127.0.0.1:8000/currentthread?threadid=2gz3c9"
t=65606 [st=   2]      URL_REQUEST_DELEGATE  [dt=0]
t=65606 [st=   2]      HTTP_CACHE_GET_BACKEND  [dt=0]
t=65606 [st=   2]      HTTP_CACHE_OPEN_ENTRY  [dt=0]
                       --> net_error = -2 (ERR_FAILED)
t=65606 [st=   2]      HTTP_CACHE_CREATE_ENTRY  [dt=0]
t=65606 [st=   2]      HTTP_CACHE_ADD_TO_ENTRY  [dt=0]
t=65606 [st=   2]      URL_REQUEST_DELEGATE  [dt=0]
t=65606 [st=   2]      HTTP_STREAM_REQUEST  [dt=999]
t=66605 [st=1001]   -URL_REQUEST_START_JOB
                     --> net_error = -102 (ERR_CONNECTION_REFUSED)
t=66605 [st=1001]    URL_REQUEST_DELEGATE  [dt=0]
t=66606 [st=1002] -REQUEST_ALIVE
                   --> net_error = -102 (ERR_CONNECTION_REFUSED)

0 个答案:

没有答案