Skip to content
This repository has been archived by the owner on Aug 2, 2021. It is now read-only.

GET request for '/' should return HTTP 200 #155

Closed
gbalint opened this issue Dec 12, 2017 · 24 comments
Closed

GET request for '/' should return HTTP 200 #155

gbalint opened this issue Dec 12, 2017 · 24 comments

Comments

@gbalint
Copy link

gbalint commented Dec 12, 2017

GET request for just '/' (as opposed to bzz:/ etc.) should return a HTTP 200 and some minimal status info, not an error about an invalid protocol

https://github.com/ethereum/go-ethereum/blob/master/swarm/api/http/server.go#L555

@cobordism
Copy link

Ideally this page would also explain how to add a bzz:// URL handler to your browser (if there isn't one yet)

@gbalint
Copy link
Author

gbalint commented Dec 18, 2017

Note: you can not add a bzz:// handler to your browser, see #151 (comment)

@cooganb
Copy link

cooganb commented Dec 22, 2017

@gbalint just FYI, i'm poking around here to see if i can help on this issue.

@cooganb
Copy link

cooganb commented Dec 24, 2017

@gbalint what kind of status info do you think would be good? and would that be delivered as an error message?

just for reference, here's what i'm getting when i ping localhost:8500/ :

screen shot 2017-12-24 at 12 02 23 pm

@cobordism
Copy link

Here is an idea.
The page starts with

Welcome to Ethereum Swarm.

and then have an input form with title "enter a name or a hash" and default value theswarm.eth and when the button is clicked, the user gets redirected to bzz://theswarm.eth

Than, in future, we can extend this landing page with links to the stats page, admin page etc. etc.

@holisticode
Copy link
Contributor

holisticode commented Dec 24, 2017 via email

@cooganb
Copy link

cooganb commented Dec 25, 2017

Great, so we're thinking about making it a landing page with an input form that can accept hashes or ENS domains, knit together the correct address and send the user on their way?

Any other links to be provided on the landing page?

@holisticode how (if at all) does the page currently handle json requests? And what's the protocol now for accept header?

Last, are there any web development guidelines for swarm that could direct what the landing page looks like?

Thanks in advance for any help!

@cobordism
Copy link

I feel like having a minimally functional landing page is a good first step.
Once it is up and running, we can talk about tweaking it and adding features.

The current landing-error-page I consider to be (almost) a bug.

Great, so we're thinking about making it a landing page with an input form that can accept hashes or ENS domains, knit together the correct address and send the user on their way?

that's my feeling for a good minimal working example, yes.

Any other links to be provided on the landing page?

Perhaps just one to https://swarm-guide.readthedocs.io/en/latest/ ?

@cooganb
Copy link

cooganb commented Dec 26, 2017

@homotopycolimit okay, sounds good.

i'd like to get some work done on this. i want to make sure my git etiquette is correct: i'll create a new branch from the ethereum-go master and work on a new method for the HandleGetFile function where entering in an "empty" address, like / or bzz:// would result in the user getting a very basic landing page which would have a header, an input form & button for hashes / ENS and link to swarm docs?

@cobordism
Copy link

an "empty" address, like / or bzz://

I think this issue is specifically only for / but apart from that you are correct.
You create a new branch on a forked master and then you can make a PR to https://github.com/ethersphere/go-ethereum/ referencing this issue. You make that PR right away - before you have actually fixed the issue - this let's us know that you intend to work on it.

@gbalint What's our policy for moving from ethersphere/go-ethereum to ethereum/go-ethereum repo? Shall we say that when we are all happy here at ethersphere, cooganb shall create a PR to the ethereum/go-ethereum repo and we approve and merge there? I forgot what (if anything) we had decided.

@gbalint
Copy link
Author

gbalint commented Dec 26, 2017

@homotopycolimit I think we decided that currently we stay with ethersphere fork. I suggest @cooganb the same method as ours: first make a PR against ethersphere/go-ethereum/master and when the discussion is over there and the PR is accepted, then make another PR against ethereum/go-ethereum/master, mention that the swarm team approved the change, and get it reviewed by the go-ethereum team too.

@gbalint
Copy link
Author

gbalint commented Dec 26, 2017

Another question: what should be the result if the content-type in the request header is application/json? Let's not reduce our usecase to the web browser.

@cobordism
Copy link

cobordism commented Dec 26, 2017

what should be the result if the content-type in the request header is application/json? Let's not reduce our usecase to the web browser.

ah! I had only considered the browser!

I don't know what the json response should be. You want there to be a default json response too? ...Maybe just a very simple json files with a single entry supported_protocols:[bzz,bzz-raw,bzz-list,bzz-immutable]. (OK I just made that up, do you have any better suggestions? Can we just give HTTP 200 and an empty json {}?)

@gbalint
Copy link
Author

gbalint commented Dec 26, 2017

I like having standard-like extra fields in the json with meta-information, something like:
{
"success": false,
"error": {
"code": XXX,
"message": "Empty bzz url"
}
}

But that would mostly make sense if we would use the same format across our json responses.

@cobordism
Copy link

But that would mostly make sense if we would use the same format across our json responses.

What could be a good first step to solve the issue at hand (i.e. get from an error to a valid HTTP 200)?
We can always iterate later and expand the response.

I'd also like to emphasize that the browser http://localhost:8500 landing page is the first thing that most people who are currently playing around with swarm will see; at it will be the first thing they see after successfully installing and starting swarm.

@gbalint
Copy link
Author

gbalint commented Dec 28, 2017

Ok, let's skip the json response for this issue, it can be a separate one: #185

@cooganb
Copy link

cooganb commented Jan 2, 2018

hey all, i'm trying to get my setup going and encountered a few issues.

first, i checked out a local branch from the ethersphere/go-ethereum master, but when trying to push the new branch back to the master to create the first "blank" PR, i get this:

[ec2-user@ip-172-31-58-0 go-ethereum]$ git push origin issue-155
Username for 'https://github.com': cooganb
Password for 'https://cooganb@github.com':
remote: Permission to ethersphere/go-ethereum.git denied to cooganb.
fatal: unable to access 'https://github.com/ethersphere/go-ethereum/': The requested URL returned error: 403

does someone need to grant me permission to push? or am i doing something incorrectly with the command line?

second, i'm trying to figure out how to test my code before asking for a pull-request. i'm a novice, so my apologies in advance for basic questions, but how exactly do i go about testing changes on the code locally to be confident enough to issue a real PR?

@cobordism
Copy link

you want to fork the ethereum/go-ethereum repository and push to your own fork.
You create a Pull Request from your fork of the repo to the ethersphere fork.
You can issue a PR right away even before your code is ready and update the code later.

@gbalint gbalint moved this from To do to Backlog in Swarm Core - Sprint planning Jan 2, 2018
@cooganb
Copy link

cooganb commented Jan 3, 2018

Let me know if I did this correctly!

@gbalint
Copy link
Author

gbalint commented Jan 4, 2018

No, your pull request is not correct:
"cooganb wants to merge 58 commits into cooganb:master from ethersphere:master"

You would like to submit the PR in the other direction: into ethersphere:master from your fork. And I would also create a branch in your fork and not submit the PR from master.

You can also see that it is not what you wanted because the diff contains a lot of stuff which is not made by you:
https://github.com/cooganb/go-ethereum/pull/1/files

@gbalint
Copy link
Author

gbalint commented Jan 4, 2018

@cooganb I suggest you to read this guide, it helps understanding forks, PRs and the whole workflow to contribute to an open source project: https://gist.github.com/Chaser324/ce0505fbed06b947d962

@cooganb
Copy link

cooganb commented Jan 4, 2018 via email

cooganb added a commit to cooganb/go-ethereum that referenced this issue Jan 5, 2018
@cooganb
Copy link

cooganb commented Jan 5, 2018

@homotopycolimit okay! round 2. apologies for my earlier issue . followed the doc you sent @gbalint and hopefully did it correctly this time.

@gbalint
Copy link
Author

gbalint commented Jan 5, 2018

@cooganb Yes, the PR is in correct format now 👍

cooganb added a commit to cooganb/go-ethereum that referenced this issue Jan 12, 2018
@gbalint gbalint moved this from Backlog to In review in Swarm Core - Sprint planning Jan 23, 2018
gbalint pushed a commit that referenced this issue Feb 26, 2018
…equest when running Swarm (#15926)

* swarm: began work on GetHandleFile method re: issue #155

* swarm: now able to serve landing page template

* swarm: added landing page template

* swarm: landing page has working input

* swarm: fixed CSS issue in template

* swarm: deleted extra lines

* swarm: deleted time header and made redirect a relative path

* swarm: removed code mistakenly left
@gbalint gbalint moved this from In review to Done in Swarm Core - Sprint planning Apr 19, 2018
@gbalint gbalint closed this as completed Apr 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
No open projects
Development

No branches or pull requests

4 participants