2

I'm interested in running a graphgist locally, for which there is a script here:

https://gist.github.com/jexp/70296ce410ff431ddbef

I was able to install the modules and run the two tasks but the last line of the script:

open http://localhost:8000/?http%3A%2F%2Flocalhost%3A8000%2Fgists%2Fmy-graph-use-case.adoc

produces an error: Not Found and trying to open the link in the comments:

http://localhost:8000/gists/my-graph-use-case.adoc

causes my browser to download a file for which I have no associated application. has anyone made this work and if so, how?

ekkis
  • 9,804
  • 13
  • 55
  • 105

2 Answers2

2

according to @MichaelHunger the issue is that the default behaviour in Python's SimpleHTTPServer is such that a trailing slash (/) gets added to the end of the url, messing up the request.

according to @PratikMandrekar, in the following article, the problem is that the url as it is in the script does not explicitly specify the file name, forcing the server to redirect to the default. see:

Why does SimpleHTTPServer redirect to ?querystring/ when I request ?querystring?

so after a little experimentation I found this to work:

http://localhost:8000/index.html?http%3A%2F%2Flocalhost%3A8000%2Fgists%2Fmy-graph-use-case.adoc

notice that the colons, slashes, etc. in the inner url must be encoded for this to work

Community
  • 1
  • 1
ekkis
  • 9,804
  • 13
  • 55
  • 105
  • ah right, you're right, now I remember. I found that index.html solution too but forgot to add it to the script, got distracted. Care to send a PR ? – Michael Hunger Jun 17 '15 at 08:00
  • 1
    Github Gists don't support pull requests, sadly. I can fork but can't request a pull. – ekkis Jun 17 '15 at 17:50
0

There is a bug/default behavior in simple-http-client that makes it add slashes after query parameters which breaks our app in this case, I have to find a better replacement or fix it.

Perhaps I can also change the rabbithole project to server the graphgist files itself, so that it would be self-contained.

Michael Hunger
  • 41,339
  • 3
  • 57
  • 80
  • ah. yes, I did notice the extra slash gets added and thought that was wrong. I think the better solution would be to fix simple-http-client so you don't duplicate effort in rabbithole. if I could serve the pages from IIS or some other web server instead of using simple-http-client, perhaps that would solve the problem too? – ekkis Jun 16 '15 at 21:13
  • Michael, this seems to address the issue: http://stackoverflow.com/questions/12953542/why-does-simplehttpserver-redirect-to-querystring-when-i-request-querystring – ekkis Jun 16 '15 at 21:44
  • reading Pratik's answer in the previous issue I tried `http://localhost:8000/index.html?http://localhost:8000/gists/my-graph-use-case.adoc` which seems to have worked in that the server doesn't redirect and append a slash, however, I still get an *Error: File not found*. equally, `http://localhost:8000/index.html/?http://localhost:8000/gists/my-graph-use-case.adoc` also fails with the same error but it's a different page (the first is a Neo4j Graphgist page, the second a plain error page) – ekkis Jun 16 '15 at 21:49