1

XHR request signatures and Dojo

published on 2008|03|25

Recently I discussed Zend Framework’s XHR integration. As a result of my research I’ve filed a bug to let Dojo send the X-Requested-With-header per default. A patch has landed in Dojo and will be part of the 1.1 release.

4

Dojo and the Zend Framework

published on 2008|02|08

The Zend Framework provides a neat function in its request object called isXmlHttpRequest(). The following is therefore possible:

public function someAction()
{
    if ($this->getRequest()->isXmlHttpRequest()) {
        // AJAX request specific parts
    }
}

Zend_Controller_Request_Http::isXmlHttpRequest() checks internally if the request header X-Requested-With is set to “XMLHttpRequest”. If this condition is fullfilled, the request is considered an XH request. However, Prototype, jQuery and YUI set this request in their XHR abstractions, Dojo does not. The following snippet helps to set this in Dojo:

dojo.xhrGet({
    url: <url>,
    load: <callback>,
    headers: {"X-Requested-With": "XMLHttpRequest"}
});

This stucks the X-Requested-With header into the XMLHttp-request and isXmlHttpRequest() will return bool(true).

What the others do

Interesting to see that Rails is a bit more generous in what it accepts as an XHR. As this header is a pseudo standard it would be worth doing it exactly the same way as Rails does it. Nothing is worse than a pseudo standard with slightly different implementations.

def xml_http_request?
  !(@env['HTTP_X_REQUESTED_WITH'] !~ /XMLHttpRequest/i)
end

The RequestHandlerComponent from CakePHP provides a method isAjax() in the stricter Zend Framework variant. Django, Pylons and TurboGears seem not to provide such helpers.

2

The other side: Security 2.0 alpha

published on 2006|02|07

Talk on Webmontag is over. Now it’s time to publish some security related issues I found out over the last weeks.

Read more …
10

/usr/portage, 3.0

published on 2005|12|02

Was ihr nun vor euch sehen könnt, ist die dritte Version von /usr/portage. Mit einem Haufen neuer Features kommt sie daher.

Read more …
(Page 1 of 1, totaling 4 entries)