POST Method Searches

Sharing and discussing custom search templates for LaunchBar
Post Reply
gordon142
Posts: 2
Joined: Tue Mar 04, 2008 10:29 am

POST Method Searches

Post by gordon142 » Tue Mar 04, 2008 10:35 am

Both FireFox and Omniweb support keyword searches using the POST method. Essentially, they take the parameters from the search field and submit their own form using those parameters and a search query. It's a little different than using GET where you are simply dropping a query into a URL, but some sites do not use GET for their searches. For those sites, it would be great if launch could give us a way to create search templates for search fields that need to be submitted with POST.

Dennis
Rank 3
Rank 3
Posts: 146
Joined: Mon Dec 10, 2007 7:47 pm
Location: California

Post by Dennis » Tue Mar 04, 2008 8:44 pm

From the LaunchBar 4.3.5 manual (Help->LaunchBar Help->Configuration->Search Templates):

Some search engines may require you to send search requests via Form POST instead of GET. To create search templates for these search engines, prefix the corresponding template URL with post-.

Example

post-http://en.wikipedia.org/?search=*


Does this help?

Sieges
Posts: 5
Joined: Wed Apr 09, 2008 12:44 pm
Location: Norway

Post by Sieges » Wed Apr 09, 2008 12:50 pm

This method seems to treat spaces as a +. For instance, search for "Test Test" inputs "Test+Test".

Something I am doing wrong, or is this a bug?

Dennis
Rank 3
Rank 3
Posts: 146
Joined: Mon Dec 10, 2007 7:47 pm
Location: California

Post by Dennis » Wed Apr 09, 2008 5:20 pm

It looks to me like this is a bug. The plus sign "+" is the result of HTTP-encoding of space characters. You can see the same thing happens if you search for other reserved characters. For example, using the POST search template from LaunchBar help:

post-http://en.wikipedia.org/?search=*

If you search for "#9", Wikipedia comes back with no results and shows your search terms as the HTTP-encoded value of "%239".

When doing a GET request, the values are passed in the URL, so they need to be HTTP-encoded so as not to confuse parsing of the URL. However, when they are sent with a POST request, the values are sent in the body of the request and should not be HTTP-encoded. But it looks like that's what LaunchBar is doing.

I will send a bug report to Objective Development.

Sieges
Posts: 5
Joined: Wed Apr 09, 2008 12:44 pm
Location: Norway

Post by Sieges » Wed Apr 09, 2008 7:20 pm

Wow. That was informative. Thank you very much for your explanation, Dennis 8)

Post Reply