5

This is the error:

   curl: (1) Protocol "https" not supported or disabled in libcurl
    !! Submission failed: unexpected error: input file does not exist
    !! Please try again later.

I am using Windows 10.

I see a possibly relevant answer here, but I don't know where this code would be added within Octave.

Community
  • 1
  • 1
Antoni Parellada
  • 4,253
  • 6
  • 49
  • 114

6 Answers6

9

The URL is changed. Use the new one in submissionUrl() function in lib/submitWithConfiguration.m file.

function submissionUrl = submissionUrl()
  %submissionUrl = 'https://www-origin.coursera.org/api/onDemandProgrammingImmediateFormSubmissions.v1';
  submissionUrl = 'https://www.coursera.org/api/onDemandProgrammingImmediateFormSubmissions.v1';
end

For check URL you can use curl in terminal.

curl -k 'https://www.coursera.org/api/onDemandProgrammingImmediateFormSubmissions.v1'

You must get something like {"message":"","statusCode":404}

With wrong URL you dose't get anything.

Iman
  • 424
  • 5
  • 18
3

Try to use the patch that changes following lines in the response function of submitWithConfiguration.m:

params = {'jsonBody', body};
%responseBody = urlread(submissionUrl, 'post', params); OLD CODE
[code, responseBody] = system(sprintf('echo jsonBody=%s | curl -k -X POST -d @- %s', body, submissionUrl));

d @- takes data in a file on the current stdin (the echo fills in).
-k allows curl to perform "insecure" SSL
(see curl --help)
HTH

==================
your code is the one i have, but i'm W7.
Do another try by setting quotes around the url in :
function submissionUrl = submissionUrl()
submissionUrl =
'"https://www-origin.coursera.org/api/onDemandProgrammingImmediateFormSubmissions.v1"'; end

(caution use : ' " and " ' that will quote the "https://.." on the command line.)

If it doesn't work, do a direct call to coursera with a command line (cmd) :

curl -k "https://www-origin.coursera.org/api/onDemandProgrammingImmediateFormSubmissions.v1"

This will call coursera and, as there is no sent form , the site will respond with an html page with near the end ... Action not found ....

if this works, the pb is probably not inside curl, but somewhere else. let us know.

pirela
  • 498
  • 6
  • 15
3

There was a typo in Answer #1, which was corrected in Answer #2.

The change is: In the function, function response = submitParts(conf, email, token, parts) Apply the following changes

  1. Comment the line responseBody = urlread(submissionUrl, 'post', params);

  2. Type the following in place of it, [code, responseBody] = system(sprintf('echo jsonBody=%s | curl -k -XPOST -d @- %s', body, submissionUrl));

So the final code of the function looks like

function response = submitParts(conf, email, token, parts)
  body = makePostBody(conf, email, token, parts);
  submissionUrl = submissionUrl();
  params = {'jsonBody', body};
  #responseBody = urlread(submissionUrl, 'post', params);
  [code, responseBody] = system(sprintf('echo jsonBody=%s | curl -k -XPOST -d @- %s', body, submissionUrl));
  response = loadjson(responseBody);
end
nachiappanpl
  • 693
  • 1
  • 5
  • 8
1

Change the following in submitWithConfiguration.m:

curl -k -X POST

to

curl -k -XPOST

and try again.

Sardar Usama
  • 19,536
  • 9
  • 36
  • 58
Achyut
  • 11
  • 2
0

I just ran into this issue on Windows 10 today. In my case the request was performing correctly but the curl command was outputting timing information by default which was throwing off the validation logic in the submission script.

The submission was succeeding, but if I printed the response string, it looked something like this:

% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                             Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  1562  100   548  100  1014    548   1014  0:00:01 --:--:--  0:00:01  2082
100  1562  100   548  100  1014    548   1014  0:00:01 --:--:--  0:00:01  2082
{"id":"Blablablabla","courseId":"Blablabla","itemId":"Blabla",...}

I noticed that it was using the curl command to make the request, so I added the --silent flag to the code that creates the curl command to execute in submitWithConfiguration.m (in my case on line 134).

% use urlread or curl to send submit results to the grader and get a response
function response = getResponse(url, body)
% try using urlread() and a secure connection
  params = {'jsonBody', body};
  [response, success] = urlread(url, 'post', params);

  if (success == 0)
    % urlread didn't work, try curl & the peer certificate patch
    if ispc
      % testing note: use 'jsonBody =' for a test case
      json_command = sprintf('echo jsonBody=%s | curl --silent -k -X POST -d @- %s', body, url);
      %                                               ^^^^^^^^ this right here!!
    else
      % it's linux/OS X, so use the other form
      json_command = sprintf('echo ''jsonBody=%s'' | curl --silent -k -X POST -d @- %s', body, url);
    end
    % get the response body for the peer certificate patch method
    [code, response] = system(json_command);
    % test the success code
    if (code ~= 0)
      fprintf('[error] submission with curl() was not successful\n');
    end
  end
end

Now the response looked like a more reasonable:

{"id":"Blablablabla","courseId":"Blablabla","itemId":"Blabla",...}

And the submittion completed successfully.

Max G J Panas
  • 941
  • 11
  • 17
0

I was having the same problem. All I did to overcome this problem is, I changed the path to ex2 folder and it worked for me.