I noticed that form autocomplete widget uses absolute URL's. As far as I know, this behavior exists since D6 and it seems to be unchanged code because no one really care about this.

It seems that this absolute URL is inconsistent with core behavior: core generates relative URL for almost everything else (except files, another issue, and feeds, which is normal).

This absolute URL can break some sites behind proxies, and will generate potentially wrong caches (may be not for forms, but it still could in some weird edge cases).

If autocomplete doesn't work in relative, no URL at all will work in relative, so I'm asking why this particular URL is generated as an absolute URL? Is there or was there real problems when this code as been originally written more than 4 years ago? If so, this is undocumented today.

Comments

pounard’s picture

Attached patches for D8, D7 and D6 that reverts autocomplete URL to be relative instead of absolute.

EDIT: Better patches would be to removed completely the 'absolute' options for url() call. Then it'll use system default instead of forcing it to false. Because url() function doesn't seems to care about any kind of system default and will generate in relative if not specified, this won't (probably) not alter the behavior except if some hard rewriting by modules is being done.

catch’s picture

You should definitely drop the 'absolute' => FALSE, that's the default in all versions. I can't imagine why this would be an absolute URL off the top of my head.

pounard’s picture

Thanks for feedback, first since 2008 :) I'm going to redo my patches.

pounard’s picture

New patches.

Status: Needs review » Needs work

The last submitted patch, 1199878-relative_autocomplete_url-6.x-2.patch, failed testing.

pounard’s picture

Status: Needs review » Needs work

The problem seems to be the test itself, I should fix it, this won't be tonight!

pounard’s picture

Status: Needs work » Needs review
StatusFileSize
new1.79 KB
xen’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 1199878-relative_autocomplete_url-8.x-3.patch, failed testing.

xen’s picture

Status: Needs work » Needs review
StatusFileSize
new573 bytes

Rerolled against HEAD. The fixup of the profile.module test is gone as the module is.

pounard’s picture

Nice, thanks. It took for 4 for a 2 lines patch to pass! ^^

Status: Needs review » Needs work

The last submitted patch, 11: 1199878-relative_autocomplete_url-8.x-11.patch, failed testing.

alansaviolobo’s picture

Issue summary: View changes
Issue tags: +Needs reroll
risse’s picture

Status: Needs work » Closed (fixed)

Autocompletion system has completely changed in Drupal 8, so no changes are needed anymore.