Actions
Bug #6874
closedDynamic DNS w/ DNSimple
Start date:
10/24/2016
Due date:
% Done:
100%
Estimated time:
Plus Target Version:
Release Notes:
Affected Version:
2.3.2
Affected Architecture:
Description
Around line 1380 in src/etc/inc/dyndns.class is a chunk of code that looks like this:
case 'dnsimple': /* Responds with HTTP 200 on success. Responds with HTTP 4xx on error. Returns JSON data as body */ $header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE); $header = substr($data, 0, $header_size); $body = substr($data, $header_size); if (preg_match("/Status: 200\s/i", $header)) { $status = $status_intro . $success_str . gettext("IP Address Updated Successfully!"); $successful_update = true; } else if (preg_match("/Status: 4\d\d\s/i", $header)) {
The problem is right about if (preg_match("/Status: 200\s/i", $header)) {
which is correctly checking the response.
The actual response header looks like this:
HTTP/1.1 200 OK^M Server: nginx^M Date: Mon, 24 Oct 2016 06:13:15 GMT^M Content-Type: application/json; charset=utf-8^M Transfer-Encoding: chunked^M Connection: keep-alive^M Access-Control-Allow-Origin: *^M Access-Control-Allow-Headers: Authorization,Accepts,Content-Type,X-DNSimple-Token,X-DNSimple-Domain-Token,X-CSRF-Token,x-requested-with^M Access-Control-Allow-Methods: GET,POST,PUT,DELETE,OPTIONS^M ETag: W/"ece8e39eaf0ef8783c19b83ab439b367"^M Cache-Control: max-age=0, private, must-revalidate^M X-Request-Id: 4f8ab086-79b0-423b-8119-d146cd1baf2c^M X-Runtime: 0.041082^M X-Content-Type-Options: nosniff^M X-Download-Options: noopen^M X-Frame-Options: DENY^M X-Permitted-Cross-Domain-Policies: none^M X-XSS-Protection: 1; mode=block^M Strict-Transport-Security: max-age=31536000^M ^M
I changed it to if (preg_match("/200\sOK\s/i", $header)) {
and it's working fine.
It'd be nice if this were updated to work with v2 of their API, but I'd be happy if that change made it into the next release.
Actions