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

configure fails for http protocol (i.e. sans https) #732

Closed
bencoman opened this issue Sep 6, 2018 · 10 comments
Closed

configure fails for http protocol (i.e. sans https) #732

bencoman opened this issue Sep 6, 2018 · 10 comments

Comments

@bencoman
Copy link

bencoman commented Sep 6, 2018

While working on downloading exercises directly into our Pharo IDE, exercism --verbose... provided enough info to get the server to hand us a sample JSON string that I could examine inside Pharo. However I have no sample of what the server requires for Pharo to go direct with the "submit" command.

The obvious thing is to use Wireshark to examine the protocol on the wire, but the CLI errors when trying to configure it to use HTTP.

For example, the following works...
C:> exercism configure --token d4a3xxxx-secret-xxxx9c56 --api https://api.exercism.io/v1

but this doesn't...
C:> exercism configure --token d4a3xxxx-secret-xxxx9c56 --api http://api.exercism.io/v1
failing with "Error: The token 'd4a3xxxx-secret-xxxx9c56' is invalid."

I presume plain-HTTP might be disabled on your servers. If so, can it be enabled?
Or if preferable, enabled on a different entry point like http://apitesting.exercism.io/v1
OR please advise alternatives.

Being able to observe live use of the API will really help to get our in-IDE tool working.
(btw, any other info about the api spec dropped on our issue 96 would be most welcome.)

@NobbZ
Copy link
Member

NobbZ commented Sep 6, 2018

You have plenty of other options. You could use a proxy that does HTTP to HTTPS for you, you can hack into the CLI to print out the bare requests or you could read the source code to learn how the JSON is built. In go, you can very often read the details about how types are converted into JSON in its type definitions.

But I glanced over the clients code, and it seems as if it were constructing some kind of multipart form before submitting.

@bencoman
Copy link
Author

bencoman commented Sep 6, 2018

Some good ideas. Thx @NobbZ.
I'll close this for now while I give those a try.

@bencoman bencoman closed this as completed Sep 6, 2018
@NobbZ
Copy link
Member

NobbZ commented Sep 6, 2018

Please make sure to ask your question again in exercism/exercism#4087.

We need to get our votes there, and also please feel free to ask for more features in the API there as you need them for your integration into Pharo.

@kytrinyx
Copy link
Member

kytrinyx commented Sep 9, 2018

It sounds like you might have some avenues to try.

We won't be disabling HTTPS on the live server, but it should be possible to run a copy of the website locally, which would not use HTTPS.

We are doing a multipart fileupload. Here's a test request:

POST / HTTP/1.1
Host: 127.0.0.1:49821
Accept-Encoding: gzip
Content-Length: 459
Content-Type: multipart/form-data; boundary=2982d7b5665d520d5dfd2f7521bfbf7ef6ebf698acd9fef92130f34c5161
User-Agent: Go-http-client/1.1

--2982d7b5665d520d5dfd2f7521bfbf7ef6ebf698acd9fef92130f34c5161
Content-Disposition: form-data; name="files[]"; filename="/file-1.txt"
Content-Type: application/octet-stream

This is file 1.
--2982d7b5665d520d5dfd2f7521bfbf7ef6ebf698acd9fef92130f34c5161
Content-Disposition: form-data; name="files[]"; filename="/subdir/file-2.txt"
Content-Type: application/octet-stream

This is file 2.
--2982d7b5665d520d5dfd2f7521bfbf7ef6ebf698acd9fef92130f34c5161--

@bencoman
Copy link
Author

bencoman commented Sep 10, 2018

but it should be possible to run a copy of the website locally

@kytrinyx, @iHiD, I've got the website up and running locally per https://github.com/exercism/website.
I've successfully signed up to it with my github account, but seem to have no data.
http://lvh.me:3000/my/tracks tells me I have 0 tracks and searching for python returns empty response.
How can I load it with data (e.g. python & pharo track) so facilitate observing the CLI's wire transfer in operation?

P.S. we should continue this thread at exercism/pharo-smalltalk#96 (comment) "Submitting solutions direct from Pharo"

@kytrinyx
Copy link
Member

I was going to ask: "have you run the seed script as described in the README", only to discover that the readme doesn't actually mention the seed script. Let me fix that. I'll add a comment here with the command to run (I think bundle exec rake db:seed but I need to confirm).

@kytrinyx
Copy link
Member

Ok, yes: try bundle exec rake db:seed -- it's not going to have pharo, I'm going to submit a fix for that.

You can add pharo locally by editing this list to add it: https://github.com/exercism/website/blob/813be89d0cf21e4fd75bd37ee2df826f6bed7432/app/services/git/seeds_tracks.rb#L8-L69

@kytrinyx
Copy link
Member

(I also noticed that the rake exercism:setup line which the README mentions is supposed to run the seed script. Did you run that command?)

@bencoman
Copy link
Author

bencoman commented Sep 11, 2018

Yes I ran bundle exec rake exercism:setup, but the lvh.me web site opened empty of any tracks.
In using Rails for the first time, I managed to learn rake -T gave a list of tasks and tried db:seed
The first part appeare to work, e.g I saw...

Seeding https://github.com/exercism/ballerina
Seeding https://github.com/exercism/bash
etc

but the latter part didn't...

===== Fetching ballerina =====
===== Syncing ballerina =====
Exec format error
===== Fetching bash =====
===== Syncing bash =====
Exec format error
etc

So now lvh.me:3000 has tracks, but none of them have any exercises.

btw, I notice that travis.yml does mysql_upgrade but the README doesn't.

@kytrinyx
Copy link
Member

Exec format error

That looks suspicious!

@kntsoriano do you happen to have seen this before?

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

3 participants