Closed sjones6 closed 6 years ago
Just to clarify, from the command line you can run export CONTENT_TYPE=application/json && export REQUEST_METHOD=POST && carton exec ./scrollery-cgi.pl '{"U}'R_NAME": "test", "PASSWORD": "asdf"}
and the script will successfully run. We just need to figure out how to mimic that in our dev web server.
We may also need to update line 72 of SQE_CGI.pm from
$self->content_type() ne 'application/json'
to
$self->content_type() !~ m/application\/json/
The head can contain the character encoding after the type so it won't always be the exact string.
Good catch! I just updated that and get this hopeless error: Use of uninitialized value in concatenation (.) or string at /Library/Perl/5.18/Carton/CLI.pm line 395.
You will also need to change line 105 of scrollery-cgi.pl from $cgi->print('{"SESSION_ID":"'.$cgi->session_id.'", "USER_ID":'.$dbh->user_id.'}');
to $cgi->print('{"SESSION_ID":"'.$cgi->session_id.'"}');
$cgi->$dbh->user_id no longer works.
@Bronson-Brown-deVost Can you try this and see what you get back:
For me, the request just hangs and I get no response from the Perl script:
export GATEWAY_INTERFACE="CGI/1.1" && export SCRIPT_NAME="/Users/Spencer/Code/sqe_master/client/resources/cgi-bin/scrollery-cgi.pl" && export SERVER_NAME="localhost" && export SERVER_PORT="9090" && export SERVER_PROTOCOL="HTTP/1.1" && export SERVER_SOFTWARE="Node/v8.9.3" && export HTTP_HOST="localhost:9090" && export HTTP_CONNECTION="keep-alive" && export HTTP_CONTENT_LENGTH="88" && export HTTP_PRAGMA="no-cache" && export HTTP_CACHE_CONTROL="no-cache" && export HTTP_ACCEPT="application/json, text/plain, */*" && export HTTP_ORIGIN="http://localhost:9090" && export HTTP_USER_AGENT="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36" && export HTTP_CONTENT_TYPE="application/json;charset=UTF-8" && export HTTP_REFERER="http://localhost:9090/" && export HTTP_ACCEPT_ENCODING="gzip, deflate, br" && export HTTP_ACCEPT_LANGUAGE="en-US,en;q=0.9,de;q=0.8,el;q=0.7" && export HTTP_COOKIE="_ga=GA1.1.261807809.1506213384; __hstc=181257784.36dc4097d0779d0b82fefbe20a2f5936.1506213384672.1506213384672.1506213384672.1; hubspotutk=36dc4097d0779d0b82fefbe20a2f5936" && export REQUEST_METHOD="POST" && export QUERY_STRING="" && export REMOTE_ADDR="::1" && export REMOTE_PORT="54797" && export CONTENT_LENGTH="88" && export CONTENT_TYPE="application/json;charset=UTF-8" && carton exec /Users/Spencer/Code/sqe_master/client/resources/cgi-bin/scrollery-cgi.pl 'POSTDATA={"USER_NAME":"test","PASSWORD":"asdf","transaction":"validateSession","SCROLLVERSION":1}'
That works if you remove POSTDATA= We no longer need that, just send the bare JSON string and also make the modification to line 105 of scrollery-cgi.pl that I just mentioned. You should get a positive result.
@Bronson-Brown-deVost : Brilliant! Progress!
Can you push the updates to Perl file or do we need to hold on that?
I will push up now, I have to go get ice cream with the family now, and I will be away for a while now. I might come back later this evening, my apologies.
My push is not working, and I must leave, people are getting very angry. Just change line 105 to $cgi->print('{"SESSION_ID":"'.$cgi->session_id.'"}');
I will figure out what needs to happen to get us our user_id back (it is not hard).
I just added this correction to the CGI and added also two functions to the CGI: user_id() and scroll_version_id()
Am 21.04.2018 um 13:58 schrieb Spencer Jones notifications@github.com<mailto:notifications@github.com>:
$self->content_type() !~ m/application\/json/
-- Priv.Doz. Dr. Ingo Kottsieper Forschungsstelle Qumran-Wörterbuch Akademie der Wissenschaften zu Göttingen Friedländer Weg 11 D-37085 Göttingen
//
Evangelische-Theologische Fakultät Alttestamentliches Seminar Westfälische Wilhelms-Universität Münster Universitätsstr. 13-17 D-48143 Münster
Germany
Ice cream is important! :)
I think @ikottsi pushed the updates needed since the latest pull for API since to have resolved.
@Bronson-Brown-deVost @ikottsi : We're back up and running with the dev-server.js connecting to the new API. Thanks for the good debugging!
What is the current version of the API? We should update the sqe-manifest.json with these changes to make sure we're recorded the appropriate version of the API. If we haven't incremented that up to at least a new minor version, we should since there's breaking changes.
@sjones6 thanks for all the work on this, I'm glad it is back operational now. The SQE_DB_API is currently at 0.0.3, I recommend bumping it to 0.1.0 given the major structural changes. The scrollery website should also get a version update for this up to 0.1.1 maybe, and that should be typically set in the sqe-manifest.json before merging. Thank you @ikottsi for updating the API and for adding user_id(), we store it, and I think we do use it somewhere, but can't remember right now. I will check, however, and if we don't need it, we can adjust accordingly.
@sjones6 What are you doing to get this to work? I am still getting errors.
@Bronson-Brown-deVost @ikottsi : Thanks for the collaboration in getting the dev environment fixed up!
FYI: the API version is already set to 0.1 in the squ_manifest.json, so I think we should just tag the API repo appropriately.
Coverage increased (+0.02%) to 82.555% when pulling 7166451707129684922a65061f7dba6a02a40e0c on dev_server into 1a4e282c8f2375f096fc624275b107a3771b2e1e on master.