Bug 24602 - [Gtk] Searching in thepiratebay.org doesn't work with more than 1 word
Summary: [Gtk] Searching in thepiratebay.org doesn't work with more than 1 word
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords: Gtk, Soup
Depends on:
Blocks:
 
Reported: 2009-03-14 16:02 PDT by Gustavo Noronha (kov)
Modified: 2009-07-21 10:15 PDT (History)
2 users (show)

See Also:


Attachments
proposed fix (2.62 KB, patch)
2009-03-14 16:07 PDT, Gustavo Noronha (kov)
no flags Details | Formatted Diff | Diff
proposed fix (2.72 KB, patch)
2009-03-15 06:57 PDT, Gustavo Noronha (kov)
andersca: review+
Details | Formatted Diff | Diff
webkit-bug-24602-drop-workaround.patch (69 bytes, text/plain)
2009-07-21 05:08 PDT, Priit Laes (IRC: plaes)
no flags Details
webkit-bug-24602-drop-workaround.patch (2.30 KB, patch)
2009-07-21 05:11 PDT, Priit Laes (IRC: plaes)
gustavo: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Gustavo Noronha (kov) 2009-03-14 16:02:31 PDT
This is caused by the fact that thepiratebay's search responds with a redirect to an URI containing whatever was searched, but doesn't properly encode the URI, so you get something like this:

HTTP/1.1 302 Found
Soup-Debug-Timestamp: 1237071670
Soup-Debug: SoupMessage 7 (0xa159f10)
Set-Cookie: searchTitle=0; expires=Sun, 14-Mar-2010 23:01:19 GMT; path=/
Location: /search/foo bar/0/99/0
Content-Type: text/html
Content-Length: 0
Date: Sat, 14 Mar 2009 23:01:19 GMT
Server: lighttpd

libsoup currently uses the URI with no processing to make sure it's valid, and gets a 400 Bad Request.
Comment 1 Gustavo Noronha (kov) 2009-03-14 16:07:04 PDT
Created attachment 28631 [details]
proposed fix
Comment 2 Xan Lopez 2009-03-14 23:53:43 PDT
(In reply to comment #1)
> Created an attachment (id=28631) [review]
> proposed fix
> 

+    SoupURI* soup_uri = soup_uri_new(newURL.string().utf8().data());
+    soup_message_set_uri(msg, soup_uri);
+

You are leaking the new URI, need to call soup_uri_free on it.
Comment 3 Gustavo Noronha (kov) 2009-03-15 06:57:01 PDT
Created attachment 28634 [details]
proposed fix

Yep, Xan's write =).
Comment 4 Anders Carlsson 2009-03-15 10:14:52 PDT
Comment on attachment 28634 [details]
proposed fix

r=me
Comment 5 Gustavo Noronha (kov) 2009-03-15 10:41:49 PDT
Landed as r41719.
Comment 6 Gustavo Noronha (kov) 2009-03-15 10:43:44 PDT
(In reply to comment #3)
> Created an attachment (id=28634) [review]
> proposed fix
> 
> Yep, Xan's write =).
> 

right is what I meant, of course... /me hits his head against the wall =)
Comment 7 Priit Laes (IRC: plaes) 2009-07-21 05:08:58 PDT
Created attachment 33171 [details]
webkit-bug-24602-drop-workaround.patch

Drop workaround required for <=libsoup-2.26.2
Comment 8 Priit Laes (IRC: plaes) 2009-07-21 05:11:08 PDT
Created attachment 33172 [details]
webkit-bug-24602-drop-workaround.patch
Comment 9 Gustavo Noronha (kov) 2009-07-21 10:07:08 PDT
Comment on attachment 33172 [details]
webkit-bug-24602-drop-workaround.patch

looks good r=me
Comment 10 Gustavo Noronha (kov) 2009-07-21 10:14:55 PDT
Comment on attachment 33172 [details]
webkit-bug-24602-drop-workaround.patch

Landed as r46178.
Comment 11 Gustavo Noronha (kov) 2009-07-21 10:15:59 PDT
Comment on attachment 33172 [details]
webkit-bug-24602-drop-workaround.patch

Landed as r46178.