vermiculus / sx.el

Stack Exchange for Emacs
http://stackapps.com/q/3950
709 stars 40 forks source link

All stuffs doesn't work after proxy. #329

Open WALL-EEEEEEE opened 7 years ago

WALL-EEEEEEE commented 7 years ago

   I have a proxy in my computer for some essential reasons. After I had installed sx.el into my Emacs, I tried to use some functions of it, sx-search or sx-tab-all-questions. All of them didn't work. I just received an error all the same, Args out of range "" 2.I think this may be a bug in sx.el behind the proxy.

vermiculus commented 7 years ago

Have you configured your emacs to work with your proxy?

WALL-EEEEEEE commented 7 years ago

Yes, it can be made to work just by setting *stack* domain name in no_proxy.I meant I can't use this plugin after the proxy, however the package.el works under it very well. So I think it may be the plugin's problem.

vermiculus commented 7 years ago

Have you seen #317? It sounds like a similar situation.

If you're already on emacs 25.1 (or updating doesn't solve your problem or #317's solution doesn't work), I'll try to get to this within the month, but I can't promise anything. I'm not really familiar with the underworkings of url.el 😦

WALL-EEEEEEE commented 7 years ago

   It doesn't help. My Emacs version is upper 25.1.

GNU Emacs 25.2.1

Copyright (C) 2017 Free Software Foundation, Inc.

GNU Emacs comes with ABSOLUTELY NO WARRANTY.

You may redistribute copies of GNU Emacs

under the terms of the GNU General Public License.

For more information about these matters, see the file named COPYING

Please fix it. Thank you. I have given you a star, come on.

vermiculus commented 7 years ago

I have given you a star, come on.

😛

Unless I can reproduce it, I really can't help. Do you have instructions on how to reproduce your setup? Can you provide a backtrace?

WALL-EEEEEEE commented 7 years ago

Just set your proxy up on your computer at first, I use privoxy for my terminal. Then, remove the proxy inside your ~/.emacs if they are there. Third, check if your package.el works well after the proxy to make sure your proxy is no problem. After all the processes above, install sx and run it. I think it will be reproduced. One thing more I need to mention, My OS is Gentoo and Emacs version is 25.2.That's all. Hope this will be helpful.

WALL-EEEEEEE commented 7 years ago

However, I ain't very familiar with Emacs, can you tell me how to debug it so I can give you some detail backtrace infos.

vermiculus commented 7 years ago

M-x toggle-debug-on-error and reproduce the error.

WALL-EEEEEEE commented 7 years ago
Debugger entered--Lisp error: (args-out-of-range "" 0 2)
  sx-encoding-gzipped-p("")
  sx-request-make("questions?site=emacs" ((pagesize . 100) (filter . "!5-i6ZwIL2GJ0CB5nbLPYd-V*qewBe1Vlyc6)En") (page . 1) (order . desc) (sort . activity)) get sx-request-response-get-items)
  sx-method-call(questions :keywords ((page . 1) (order . desc) (sort . activity)) :site "emacs" :auth t :submethod nil :filter ((question\.body_markdown question\.bounty_amount question\.comments question\.creation_date question\.closed_reason question\.closed_date question\.closed_details question\.answers question\.answer_count question\.score question\.title question\.owner question\.tags question\.last_editor question\.last_activity_date question\.accepted_answer_id question\.link question\.upvoted question\.downvoted question\.question_id question\.share_link user\.display_name user\.link user\.accept_rate user\.reputation shallow_user\.display_name shallow_user\.link shallow_user\.accept_rate shallow_user\.reputation comment\.owner comment\.body_markdown comment\.body comment\.link comment\.edited comment\.creation_date comment\.upvoted comment\.score comment\.post_type comment\.post_id comment\.comment_id answer\.answer_id answer\.creation_date answer\.last_editor answer\.last_activity_date answer\.link answer\.share_link answer\.score answer\.owner answer\.body_markdown answer\.upvoted ...) nil nil))
  #[257 "\306\300\307\310B\n\205�\311\203�\312\202�\313B\314\nBDB\315\f\316\317\320\301\321
&\207" [questions nil sx-question-list--order sx-question-list--descending sx-question-list--site sx-browse-filter sx-method-call :keywords page order desc asc sort :site :auth t :submethod :filter] 13 "\n\n(fn PAGE)"](1)
  sx-question-list-refresh(redisplay nil)
  sx-tab-all-questions(nil "emacs")
  funcall-interactively(sx-tab-all-questions nil "emacs")
  call-interactively(sx-tab-all-questions record nil)
  command-execute(sx-tab-all-questions record)
  execute-extended-command(nil "sx-tab-all-questions" "sx-tab-al")
  funcall-interactively(execute-extended-command nil "sx-tab-all-questions" "sx-tab-al")
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)

These are all the outputs.Hope it will be helpful.

vermiculus commented 7 years ago

Looks like the problem is coming from sx-request.el:192. I could easily make this a better error, but it looks like you're not getting any data at all from the request.

Can you try evaluating this code block after sx is loaded and then trying the request?

(defun sx-encoding-gzipped-p (data)
  (let ((unidata (string-as-unibyte data)))
    (when (<= 2 (length unidata))
      (equal (substring unidata 0 2)
             (unibyte-string 31 139)))))

I don't believe this will make it work, but it should give a better error (like 'end of file while parsing JSON').

The next step will be to figure out why url is failing to get the response through your proxy.