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

VERIFIED FIXED in Firefox1.0beta

Status

()

defect
P2
normal
VERIFIED FIXED
15 years ago
13 years ago

People

(Reporter: bugs, Assigned: bugs)

Tracking

unspecified
Firefox1.0beta
Points:
---
Bug Flags:
blocking-aviary1.0 -

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

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
done.
Status: ASSIGNED → RESOLVED
Last Resolved: 15 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.

Updated

15 years ago
Flags: blocking-aviary1.0?
Whiteboard: see comments 3 and 4

Comment 5

15 years ago
ben, are you getting this on the 1.0 branch?
Flags: blocking-aviary1.0? → blocking-aviary1.0+
Posted patch patchSplinter Review
fix call sites
Status: REOPENED → RESOLVED
Last Resolved: 15 years ago15 years ago
Resolution: --- → FIXED

Comment 7

15 years ago
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?

Comment 9

15 years ago
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-
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
Last Resolved: 15 years ago14 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.