Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
All my "Trackback URL for this post" links are broken. When I follow this link, I get the following error:
<response>
<error>1</error>
<message>Missing TrackBack url.</message>
</response>
For a demonstration, visit http://www.cosky.com/trackback/61
I'm not sure if it's a configuration error or a compatibility bug with some other module (clean URLs?)
Thanks for any advice,
Eric Cosky
Comments
Comment #1
Eric Cosky CreditAttribution: Eric Cosky commentedI misunderstood how trackbacks work. It is working correctly, I just didn't realize it.
In case it helps someone else I will explain what happened to me.
After enabling the trackback module, you will see the "Trackback URL for this post" link at the bottom of your articles. This link, if followed, produces an error because it is not intended to be followed by a human. This link is intended to be fed into a "trackback" field of another post, usually on another website. The other website may support and perform auto-discovery of trackback URLs in the content, which would cause this link to be hit although I'm not sure how it can hit this link directly if the article itself is what is being linked. When the other website performs the trackback, it does an HTTP GET to the trackback URL which is passed the URL of the other website's article with the trackback in it. This variable is eventually accessed by the function trackback_receive() inside of the trackback.module file. If the $_REQUEST['url'] is not specified, this function basically just bails out. If it's set, it will add the remote trackback to the (local) article. However, if it's not set, it just produces a really unfriendly error that doesn't help anyone understand what's going on - "Missing TrackBack url.". Perhaps this is enough for someone familiar with all this stuff, but I wasn't, and it took a while to understand why this link was messed up. It wasn't, is why. It just wasn't meant for human consumption.
I'm not sure if the response can be made human-friendly, but it seems like it might make sense to have the code just return a "Document has moved here" type of HTML page like Wordpress does if there are no GET parameters at all since that would imply no trackback action was being attempted.
Comment #2
Eric Cosky CreditAttribution: Eric Cosky commentedComment #3
gnassar CreditAttribution: gnassar commentedWell, this probably is a problem of sorts, as the error returned doesn't help, and implies that the module isn't handling the request properly. It shouldn't even be looking for a submitted URL -- there is no POST payload in a regular browser request, and even if trackback is written to accept GETs (it shouldn't) and a return link were provided, the content-type field should be wrong if done through the browser. Trackback requires the content-type to be application/x-www-form-urlencoded.
Probably, the right error string for this would be along the lines of "There is no POST payload. Trackback pings can't be done manually" or something along those lines.
Comment #4
ipwa CreditAttribution: ipwa commentedYeah the error message is confusing, is there a way to change this?
Comment #5
thePanz CreditAttribution: thePanz commentedPlease, formulate a friendly error message and I'll edit Trackback output :)
Comment #6
TheInspector CreditAttribution: TheInspector commentedI've changed the trackback.ping.inc in modules/trackback to forward to the node if the it get's an error(in other words: when someone visits the url in the browser).
Change the function trackback_page($node) to the following:
function trackback_page($node) {
$output = array();
$output[] = '<?xml version="1.0" encoding="utf-8"?>';
$output[] = '';
$trackback = trackback_receive($node);
if (empty($trackback->error)) {
db_query("INSERT INTO {trackback_received} (nid, created, site, name, subject, url, excerpt, status) VALUES (%d, %d, '%s', '%s', '%s', '%s', '%s', %d)", $trackback->nid, $trackback->created, $trackback->site, $trackback->name, $trackback->subject, $trackback->url, $trackback->excerpt, $trackback->status);
$trackback->trid = db_last_insert_id('trackback_received', 'trid');
trackback_invoke_trackback($trackback, 'insert');
watchdog('trackback', 'Added trackback %subject.', array('%subject' => $trackback->subject), WATCHDOG_NOTICE, _trackback_path($trackback, t('view')));
$output[] = '0';
$output[] = '';
header('Content-Type: text/xml');
print implode("\n", $output) ."\n";
}
else {
header("Location: ".url("node/".$node->nid));
}
}
Comment #7
thePanz CreditAttribution: thePanz commentedThe above edits are in contrast with the Trackback protocol specs: read them in the module page. Trackback sould also be enable ONLY in POST (HTTP requests) and not via GET.
We should redirect GET request to node page providing an error message?
Comment #8
phpsharma CreditAttribution: phpsharma commentedI got the concept...