Closed Bug 241028 Opened 21 years ago Closed 20 years ago

Should be able to create smart keywords for searches that use HTTP POST

Categories

(Firefox :: Bookmarks & History, defect, P2)

defect

Tracking

()

VERIFIED FIXED
Firefox1.0beta

People

(Reporter: bugs, Assigned: bugs)

Details

Attachments

(2 files)

Currently we can only do %s substitution on keywords created using URLs that use
HTTP GET via http://www.foo.com/bar.cgi?q=%s

The number of HTTP POST search engines is fairly large significant and it'd be
worthwhile supporting that too. This requires some modifications to bookmarks
and the browser, specifically...

Add a new field to bookmarks: 

POSTDATA="prop1=val1<CRLF>prop2=val2<CRLF>prop3=%s<CRLF>"

%s is used (again) to designate the section to be substituted by the user value.

The code in browser's getShortcutOrURL is then structured like this:

function getShortcutOrURL (aPostDataRef) 
{
  if (!bookmarks.resolveKeyword(aPotentialKeywordURL)) {
    // look for " " in URL
    // chop keyword off the start
    var keywordURL = bookmarks.resolveKeyword(keyword);
    if (keywordURL && userValue) {
      if (bookmark has postdata)
        aPostDataRef.value = getPostData(postdata, keyword);
      else
        // replace %s in keywordURL with keyword
    }
  }
}

function getPostData(aStringData, aKeyword)
{
  var dataStream = Components.classes["@mozilla.org/io/string-input-stream;1"]
                            .createInstance(Components.interfaces.nsIStringStream);
  // replace %s in aStringData with aKeyword
  dataStream.setData(aStringData, aStringData.length);

  var mimeStream = Components.classes["@mozilla.org/network/mime-input-stream;1"]
                           
.createInstance(Components.interfaces.nsIMIMEInputStream);
  mimeStream.addHeader("Content-Type", "text/plain");
  mimeStream.addContentLength = true;
  mimeStream.setData(dataStream);
  return mimeStream.QueryInterface(Components.interfaces.nsIInputStream);
}

The "Add Smart Keyword..." menu item can then be shown for the following cases:

- method attribute unspecified
- method="GET"
- method="POST" and
  - enctype attribute unspecified
  - enctype="text/plain"
Status: NEW → ASSIGNED
Priority: -- → P2
Target Milestone: --- → Firefox1.0beta
Attached patch patch (deleted) β€” β€” Splinter Review
done.
Status: ASSIGNED → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
reopening, this line is wrong:
               b.loadURIWithFlags(aURI, nsIWebNavigation.LOAD_FLAGS_NONE,
-                                 aReferrerURI, null, null);
+                                 aReferrerURI, aPostData, null);

it is either wrong or insufficient - browser.xml was not changed to accept postdata:
http://lxr.mozilla.org/seamonkey/source/toolkit/content/widgets/browser.xml#141

(b is a reference to a <browser>)
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
additionally, this caller:
+      var t = gBrowser.addTab(url, aPostData); // open link in new tab

does not match the signature of addTab.
Flags: blocking-aviary1.0?
Whiteboard: see comments 3 and 4
ben, are you getting this on the 1.0 branch?
Flags: blocking-aviary1.0? → blocking-aviary1.0+
Attached patch patch (deleted) β€” β€” Splinter Review
fix call sites
Status: REOPENED → RESOLVED
Closed: 21 years ago20 years ago
Resolution: --- → FIXED
First patch:
Trunk checkin: 2004-04-20 02:45 (after the 1.7 branch was created, of which
aviary branched from).
Aviary checkin: 2004-05-16 11:16 and 2004-05-16 20:07.

Second patch: 
Aviary checkin 2004-10-05 21:00.
Trunk checkin: None yet.
Keywords: fixed-aviary1.0
Whiteboard: see comments 3 and 4 → needed-trunk, see comment 7
the code in comment 3 passes the postdata as the 4th parameter, where it should
be the 5th. also, shouldn't it pass the charset too?
Reopening once more.
Status: RESOLVED → REOPENED
Keywords: fixed-aviary1.0
Resolution: FIXED → ---
Whiteboard: needed-trunk, see comment 7 → see comment 8
no longer a blocker.
Flags: blocking-aviary1.0+ → blocking-aviary1.0-
comment 8 fixed by jshin in rev. 1.63 of tabbrowser.xml, quoting bug 199237.
http://bonsai.mozilla.org/cvsquery.cgi?treeid=default&module=all&branch=HEAD&branchtype=match&dir=&file=&filetype=match&who=&whotype=match&sortby=Date&hours=2&date=explicit&mindate=2004-12-26+08%3A58&maxdate=2004-12-26+09%3A00&cvsroot=%2Fcvsroot
Status: REOPENED → RESOLVED
Closed: 20 years ago20 years ago
Resolution: --- → FIXED
Whiteboard: see comment 8
Ben, within your initial statement you mentioned a new field for bookmark
properties, which should hold the post data. It is still not present in current
trunk builds. The users aren't able to change any of the data.

Solution: When a bookmark contains a POST_DATA attribute a field for the post
data should be shown.

=> Reopen again.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
This is a field in the datasource, but its not really user-editable, and this is
beyond the scope of this bug.

What you're asking for is an enhancement, and something I'd WONTFIX most likely,
since most users will _not_ understand what this field would be.  But at the
least, this belongs in a different bug.
Status: REOPENED → RESOLVED
Closed: 20 years ago20 years ago
Resolution: --- → FIXED
Status: RESOLVED → VERIFIED
sorry for bugspam, long-overdue mass reassign of ancient QA contact bugs, filter on "beltznerLovesGoats" to get rid of this mass change
QA Contact: mconnor → bookmarks
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: