Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cider-grimoire displays the entire HTML source #867

Closed
babysnakes opened this issue Oct 31, 2014 · 22 comments
Closed

cider-grimoire displays the entire HTML source #867

babysnakes opened this issue Oct 31, 2014 · 22 comments

Comments

@babysnakes
Copy link

When running cider-grimoire it displays the entire html source, not the rendered html.

Using latest from melpa and emacs 24.4.

Thanks in advance.

@bbatsov
Copy link
Member

bbatsov commented Nov 7, 2014

Could you provide me with a way to reproduce this? cider-grimoire actually fetches plain text from grimoire, so I'm a bit puzzled by your problem.

@babysnakes
Copy link
Author

You can find my emacs setup here. I'm using 24.4 on the latest macos (compiled simply with ./configure --with-ns). If that doesn't help I can either share screen with you or (even better) launch an ec2 server and give you access provided the problem replicates there).

@babysnakes
Copy link
Author

I just tried it on ubuntu 14.04 and it doesn't replicate. I have an older mac and I'll try it there, but it'll take me a couple of days.

@arrdem
Copy link
Contributor

arrdem commented Nov 16, 2014

Confirmed. Watching Grimoire's logs while using this feature shows that a text/html request is being made when a text/plain request should be made. Not sure how this happened since this feature was working not long ago.

@bbatsov
Copy link
Member

bbatsov commented Nov 16, 2014

Can't imagine how something like this might happen. See the relevant code.

@arrdem
Copy link
Contributor

arrdem commented Nov 16, 2014

Hum... watching the logs on the live site rn lemme play with it some

@arrdem
Copy link
Contributor

arrdem commented Nov 16, 2014

Okay...

-> % curl -H "Content-Type: text/plain" grimoire.arrdem.com/1.6.0/clojure.core/conj
# 1.6.0 - clojure.core - conj

## Arities
[coll x]
[coll x & xs]

## Documentation
  conj[oin]. Returns a new collection with the xs
    'added'. (conj nil item) returns (item).  The 'addition' may
    happen at different 'places' depending on the concrete type.
## User Documentation
No user commentary. Care to add some?
....

@arrdem
Copy link
Contributor

arrdem commented Nov 16, 2014

Something's screwey here...

  1. Initially able to reproduce the above failure
  2. opened cider-grimoire.el, edited headers to text/html
  3. reloaded, continued to fail as expected
  4. edited to text/plain
  5. reloaded, worked

the fuck

@babysnakes
Copy link
Author

@arrdem, thanks for replicating the issue. I don't have access to the grimoire logs :) but I used tcpdump to catch the request in both curl and emacs. When running from emacs the request doesn't seem to include the content type header. Both tcpdump output can be found here. You can view them with tcpdump -qns 0 -X -r output-curl.pcap or with wireshark.

I looked at the function at cider-interaction.el (my source is about 2 weeks old) and it looked ok. Don't know what could go wrong. Is there a way to look at the elc file?

@arrdem
Copy link
Contributor

arrdem commented Nov 17, 2014

My initial guess is that this is an artifact of .elc caching somehow, but that doesn't make a ton of sense since I only have one version of CIDER on my emacs load path. I may have time to experiment with this in the morning. Real question is whether a fresh install of CIDER on an otherwise clean/empty Emacs instance exhibits this issue. My guess is not, but that'll indicate whether we're the problem or whether CIDER is.

@babysnakes
Copy link
Author

Ok, I did some more experimentation (although I'm not sure what to make of it):

  • Deleted the elisp directory and installed packages from scratch - still getting html.
  • Did a full git clean -fxd and installed packages from scratch - still getting html.
  • Repeated the procedure perform by @arrdem (changing to html and then back to plain - with byte-compile after each change) - got plain text version
  • Restored my old emacs directory and just byte compiled cider-interaction.el (remember I have old version) - got plain text version

Could it be that somehow the initial byte compile during installation messes up things?

@bbatsov
Copy link
Member

bbatsov commented Nov 17, 2014

Could it be that somehow the initial byte compile during installation messes up things?

Can't imagine how something like this could happen, but I guess everything is possible. Is this behaving correctly when you don't byte compile anything? I usually use the melpa package (which gets byte-compiled automatically) and I've never run into this problem.

@babysnakes
Copy link
Author

I also use melpa.

@arrdem
Copy link
Contributor

arrdem commented Nov 17, 2014

Ditto on melpa.

@Kungi
Copy link

Kungi commented Nov 18, 2014

I also use the melpa package (updated today). When I remove the .elc files from the cider package folder and restart emacs it works. When I use the byte compiled version it only shows html output.

@pw4ever
Copy link
Contributor

pw4ever commented Nov 23, 2014

Confirmed, with MELPA: cider-20141121.1705.

$ curl -H "Content-Type: text/plain" grimoire.arrdem.com/1.6.0/clojure.core/conj
<html>
<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx/1.4.6 (Ubuntu)</center>
</body>
</html>

but

$ curl -H "Content-Type: text/plain" conj.io/1.6.0/clojure.core/conj            
# 1.6.0 - clojure.core - conj

## Arities
[coll x]
[coll x & xs]

## Documentation
  conj[oin]. Returns a new collection with the xs
    'added'. (conj nil item) returns (item).  The 'addition' may
    happen at different 'places' depending on the concrete type.
## User Documentation
No user commentary. Care to add some?
...

A change of the code from

(defconst cider-grimoire-url "http://grimoire.arrdem.com/")

to

(defconst cider-grimoire-url "http://conj.io/")

fixes the problem.

@arrdem
Copy link
Contributor

arrdem commented Nov 23, 2014

Oops. Sorry @pw4ever I was expecting the redirect to be user-transparent. Re-enabling the grimoire subdomain until this patch goes through.

bbatsov added a commit that referenced this issue Nov 24, 2014
[Fix #867] Update Grimoire URL to fix (cider-grimoire-lookup) regression due to HTTP 301 (Moved Permanently)
@magnars
Copy link
Contributor

magnars commented Dec 22, 2014

Seems like this issue is back. (see #923)

Doing curl -i -H "Content-Type: text/plain" conj.io/1.6.0/clojure.core/conj I get:

HTTP/1.1 302 Found
Server: nginx/1.4.6 (Ubuntu)
Date: Mon, 22 Dec 2014 14:37:00 GMT
Content-Length: 0
Connection: keep-alive
Location: /store/org.clojure/clojure/1.6.0/clojure.core/conj

Based on the resolution last time, maybe it is again dropping the plain-text headers after the redirect?

@arrdem
Copy link
Contributor

arrdem commented Dec 22, 2014

@magnars looking at the logs I'd agree with that assessment. The latest version of CIDER works fine. I think what I'll do is hack the Grimoire routes to handle requests from the emacs client differently in my upgrade redirect logic.

@arrdem
Copy link
Contributor

arrdem commented Dec 22, 2014

clojure-grimoire/grimoire@bf5e277

Should be fixed now.

@johngit22
Copy link

Thank-You this was interesting and enlightening to play with for a little
while... Merry Xmas to you as well Reid

On Mon, Dec 22, 2014 at 6:35 PM, Reid D McKenzie [email protected]
wrote:

clojure-grimoire/grimoire@bf5e277
clojure-grimoire/grimoire@bf5e277

Should be fixed now.


Reply to this email directly or view it on GitHub
#867 (comment).

John Boyd

@arrdem
Copy link
Contributor

arrdem commented Dec 23, 2014

Grimoire 0.4.5 live, provides special handling for legacy versions of CIDER based on user-agent strings to deliver text pages rather than redirects. I was nice and didn't add a snarky message to upgrade CIDER.

@johngit22 Thanks, same to you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants