Changeset 7594
- Timestamp:
- 2004-06-16T09:48:55+12:00 (20 years ago)
- Location:
- trunk/gsdl/src/recpt
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/recpt/cgiargs.h
r7429 r7594 51 51 // should be produced 52 52 // fullcontent same as content but the action should put content-type as last header. 53 enum response_t {location, content, fullcontent };53 enum response_t {location, content, fullcontent, undecided_location}; 54 54 55 55 -
trunk/gsdl/src/recpt/queryaction.cpp
r7441 r7594 418 418 arg_ainfo.savedarginfo = cgiarginfo::must; 419 419 argsinfo.addarginfo (NULL, arg_ainfo); 420 420 421 // "ifl" - I'm feeling lucky! (Go directly to the first matching document) 422 arg_ainfo.shortname = "ifl"; 423 arg_ainfo.longname = "i'm feeling lucky"; 424 arg_ainfo.multiplechar = false; 425 arg_ainfo.defaultstatus = cgiarginfo::weak; 426 arg_ainfo.argdefault = g_EmptyText; 427 arg_ainfo.savedarginfo = cgiarginfo::mustnot; 428 argsinfo.addarginfo (NULL, arg_ainfo); 429 421 430 } 422 431 … … 538 547 } 539 548 540 void queryaction::get_cgihead_info (cgiargsclass & /*args*/, recptprotolistclass * /*protos*/,549 void queryaction::get_cgihead_info (cgiargsclass &args, recptprotolistclass * /*protos*/, 541 550 response_t &response, text_t &response_data, 542 551 ostream &/*logout*/) { 552 // If this is an "I'm feeling lucky" request, we don't know the target location until later 553 if (!args["ifl"].empty()) { 554 response = undecided_location; 555 return; 556 } 557 543 558 response = content; 544 559 response_data = "text/html"; … … 1312 1327 bool syntax_error = false; 1313 1328 if (err == syntaxError) syntax_error = true; 1329 1330 if (!args["ifl"].empty()) { 1331 // Go directly to the first matching document 1332 ResultDocInfo_tarray::iterator thissection = response.docInfo.begin(); 1333 if (thissection != response.docInfo.end()) { 1334 text_t& arg_d = (*thissection).OID; 1335 text_t doc_url = "_httpdocument_"; 1336 doc_url += "&c=" + collection; 1337 doc_url += "&d=" + arg_d; 1338 1339 // location response (url may contain macros!!) 1340 textout << outconvert << disp << "Location: " << doc_url << "\n\n"; 1341 } 1342 // Ooops... there weren't any matching documents 1343 else { 1344 // Surely there must be a better way to get the query URL without the ifl argument? 1345 // This is not complete! 1346 text_t query_url = "_gwcgi_"; 1347 query_url += "?e=" + args["e"]; 1348 query_url += "&h=" + args["h"]; 1349 query_url += "&q=" + args["q"]; 1350 query_url += "&r=" + args["r"]; 1351 query_url += "&t=" + args["t"]; 1352 query_url += "&hs=" + args["hs"]; 1353 1354 textout << outconvert << disp << "Location: " << query_url << "\n\n"; 1355 } 1356 1357 textout << flush; 1358 return true; 1359 } 1360 1314 1361 //return false; 1315 1362 define_query_macros (args, disp, response.numDocs, response.isApprox); -
trunk/gsdl/src/recpt/receptionist.cpp
r7509 r7594 848 848 849 849 contentout << text_t2ascii << "Content-type: " << response_data << "\n\n"; 850 } else { 850 } 851 else if (response == undecided_location) { 852 // Wait until later to output the target location 853 // Used for the "I'm feeling lucky" functionality 854 } 855 else { 851 856 // unknown response 852 857 logout << "Error: get_cgihead_info returned an unknown response type.\n";
Note:
See TracChangeset
for help on using the changeset viewer.