void Processor::setBugListQuery( KURL &url, const Package &product, const QString &component ) { if ( mServer->serverConfig().bugzillaVersion() == "Bugworld" ) { url.setFileName( "bugworld.cgi" ); } else { url.setFileName( "xmlquery.cgi" ); } QString user = mServer->serverConfig().user(); if ( component.isEmpty() ) url.setQuery( "?user="******"&product=" + product.name() ); else url.setQuery( "?user="******"&product=" + product.name() + "&component=" + component ); }
QValueList<Mirror> Sites::siteList() { KURL url; url.setProtocol( "http" ); url.setHost( "freedb.freedb.org" ); url.setPort( 80 ); url.setPath( "/~cddb/cddb.cgi" ); url.setQuery( QString::null ); QString hello = QString("%1 %2 %3 %4") .arg(user_, localHostName_, clientName(), clientVersion()); url.addQueryItem( "cmd", "sites" ); url.addQueryItem( "hello", hello ); url.addQueryItem( "proto", "5" ); QValueList<Mirror> result; QString tmpFile; if( KIO::NetAccess::download( url, tmpFile, 0 ) ) { result = readFile( tmpFile ); KIO::NetAccess::removeTempFile( tmpFile ); } return result; }
void DBGNet::requestPage(const QString& filePath, SiteSettings* site, bool local, int listenPort, dbgint sessid) { m_dbgFileInfo->setSite(site); m_sessionId = sessid; if(local) { QString cmd = filePath + " DBGSESSID=" + QString::number(m_sessionId) + "@clienthost:" + QString::number(listenPort); Session::self()->start(cmd , true); } else { QString uri = filePath; uri = uri.remove(0, site->localBaseDir().length()); KURL url = site->effectiveURL(); url.setPath(url.path() + uri); url.setQuery(QString("DBGSESSID=") + QString::number(m_sessionId) + "@clienthost:" + QString::number(listenPort)); Session::self()->start(url); } }
void XDNet::startDebugging(const QString& filePath, SiteSettings* site, bool local) { int id = kapp->random(); if(local) { QStringList env; env << "XDEBUG_CONFIG" << ("remote_port=" + QString::number(m_debugger->settings()->listenPort()) + "\\ remote_host=localhost" ) << "XDEBUG_SESSION_START" << QString::number(id); Session::self()->start(filePath, env, true); } else { QString uri = filePath; uri = uri.remove(0, site->localBaseDir().length()); KURL url = site->effectiveURL(); url.setPath(url.path() + uri); url.setQuery(QString("XDEBUG_SESSION_START=")+QString::number(id)); Session::self()->start(url); } }
void Location::setSearch(const String& search, DOMWindow* activeWindow, DOMWindow* firstWindow) { if (!m_frame) return; KURL url = m_frame->document()->url(); url.setQuery(search); setLocation(url.string(), activeWindow, firstWindow); }
void Location::setSearch(LocalDOMWindow* callingWindow, LocalDOMWindow* enteredWindow, const String& search) { if (!m_frame) return; KURL url = m_frame->document()->url(); url.setQuery(search); setLocation(url.string(), callingWindow, enteredWindow); }
void HTMLAnchorElement::setSearch(const String& value) { KURL url = href(); String newSearch = (value[0] == '?') ? value.substring(1) : value; // Make sure that '#' in the query does not leak to the hash. url.setQuery(newSearch.replace('#', "%23")); setHref(url.string()); }
void JSLocation::setSearch(ExecState* exec, JSValue* value) { Frame* frame = impl()->frame(); ASSERT(frame); KURL url = frame->loader()->url(); url.setQuery(value->toString(exec)); navigateIfAllowed(exec, frame, url, false); }
KURL Proxy::realStreamUrl( KURL fakeStream, int sessionId ) { KURL realStream; realStream.setProtocol( "http" ); realStream.setHost(fakeStream.host()); realStream.setPort(fakeStream.port()); realStream.setPath( "/databases" + fakeStream.directory() + "/items/" + fakeStream.fileName() ); realStream.setQuery( QString("?session-id=") + QString::number(sessionId) ); return realStream; }
void JSLocation::setSearch(ExecState* exec, JSValue value) { Frame* frame = impl()->frame(); ASSERT(frame); KURL url = frame->loader()->url(); url.setQuery(value.toString(exec)); navigateIfAllowed(exec, frame, url, !frame->script()->anyPageIsProcessingUserGesture(), false); }
static inline String formSignature(const HTMLFormElement& form) { KURL actionURL = form.getURLAttribute(actionAttr); // Remove the query part because it might contain volatile parameters such // as a session key. actionURL.setQuery(String()); StringBuilder builder; if (!actionURL.isEmpty()) builder.append(actionURL.string()); recordFormStructure(form, builder); return builder.toString(); }
void KNNetAccess::startJobSmtp() { if(smtpJobQueue.isEmpty()) return; currentSmtpJob = smtpJobQueue.first(); smtpJobQueue.remove(smtpJobQueue.begin()); currentSmtpJob->prepareForExecution(); if(currentSmtpJob->success()) { KNLocalArticle *art = static_cast<KNLocalArticle *>(currentSmtpJob->data()); // create url query part QString query("headers=0&from="); query += KURL::encode_string(art->from()->email()); QStrList emails; art->to()->emails(&emails); for(char *e = emails.first(); e; e = emails.next()) { query += "&to=" + KURL::encode_string(e); } // create url KURL destination; KNServerInfo *account = currentSmtpJob->account(); if(account->encryption() == KNServerInfo::SSL) destination.setProtocol("smtps"); else destination.setProtocol("smtp"); destination.setHost(account->server()); destination.setPort(account->port()); destination.setQuery(query); if(account->needsLogon()) { destination.setUser(account->user()); destination.setPass(account->pass()); } KIO::Job *job = KIO::storedPut(art->encodedContent(true), destination, -1, false, false, false); connect(job, SIGNAL(result(KIO::Job *)), SLOT(slotJobResult(KIO::Job *))); if(account->encryption() == KNServerInfo::TLS) job->addMetaData("tls", "on"); else job->addMetaData("tls", "off"); currentSmtpJob->setJob(job); kdDebug(5003) << "KNNetAccess::startJobSmtp(): job started" << endl; } else { threadDoneSmtp(); } }
/** * webkit_download_get_suggested_filename: * @download: the #WebKitDownload * * Retrieves the filename that was suggested by the server, or the one * derived by WebKit from the URI. * * Returns: the suggested filename * * Since: 1.1.2 */ const gchar* webkit_download_get_suggested_filename(WebKitDownload* download) { g_return_val_if_fail(WEBKIT_IS_DOWNLOAD(download), NULL); WebKitDownloadPrivate* priv = download->priv; if (priv->suggestedFilename) return priv->suggestedFilename; KURL url = KURL(KURL(), webkit_network_request_get_uri(priv->networkRequest)); url.setQuery(String()); url.removeFragmentIdentifier(); priv->suggestedFilename = g_strdup(decodeURLEscapeSequences(url.lastPathComponent()).utf8().data()); return priv->suggestedFilename; }
void MediaPlayerPrivateGStreamer::setPlaybinURL(KURL& url) { // Clean out everything after file:// url path. if (url.isLocalFile()) { url.setQuery(String()); url.removeFragmentIdentifier(); } m_url = url; if (url.protocolIsInHTTPFamily()) url.setProtocol("webkit+" + url.protocol()); LOG_MEDIA_MESSAGE("Load %s", url.string().utf8().data()); g_object_set(m_playBin.get(), "uri", url.string().utf8().data(), NULL); }
void V8Location::searchAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) { INC_STATS("DOM.Location.search._set"); v8::Handle<v8::Object> holder = info.Holder(); Location* imp = V8Location::toNative(holder); String query = toWebCoreString(value); Frame* frame = imp->frame(); if (!frame) return; KURL url = frame->loader()->url(); url.setQuery(query); navigateIfAllowed(frame, url, false, false); }
void didReceiveResponse(ResourceHandle*, const ResourceResponse& response) { m_response = adoptGRef(response.toSoupMessage()); m_download->didReceiveResponse(response); if (response.httpStatusCode() >= 400) { downloadFailed(platformDownloadNetworkError(response.httpStatusCode(), response.url().string(), response.httpStatusText())); return; } String suggestedFilename = response.suggestedFilename(); if (suggestedFilename.isEmpty()) { KURL url = response.url(); url.setQuery(String()); url.removeFragmentIdentifier(); suggestedFilename = decodeURLEscapeSequences(url.lastPathComponent()); } bool overwrite; String destinationURI = m_download->decideDestinationWithSuggestedFilename(suggestedFilename, overwrite); if (destinationURI.isEmpty()) { #if PLATFORM(GTK) GOwnPtr<char> buffer(g_strdup_printf(_("Cannot determine destination URI for download with suggested filename %s"), suggestedFilename.utf8().data())); String errorMessage = String::fromUTF8(buffer.get()); #else String errorMessage = makeString("Cannot determine destination URI for download with suggested filename ", suggestedFilename); #endif downloadFailed(platformDownloadDestinationError(response, errorMessage)); return; } GRefPtr<GFile> file = adoptGRef(g_file_new_for_uri(destinationURI.utf8().data())); GOwnPtr<GError> error; m_outputStream = adoptGRef(g_file_replace(file.get(), 0, TRUE, G_FILE_CREATE_NONE, 0, &error.outPtr())); if (!m_outputStream) { downloadFailed(platformDownloadDestinationError(response, error->message)); return; } GRefPtr<GFileInfo> info = adoptGRef(g_file_info_new()); g_file_info_set_attribute_string(info.get(), "metadata::download-uri", response.url().string().utf8().data()); g_file_set_attributes_async(file.get(), info.get(), G_FILE_QUERY_INFO_NONE, G_PRIORITY_DEFAULT, 0, 0, 0); m_download->didCreateDestination(destinationURI); }
static void appendMailtoPostFormDataToURL(KURL& url, const FormData& data, const String& encodingType) { String body = data.flattenToString(); if (equalIgnoringCase(encodingType, "text/plain")) { // Convention seems to be to decode, and s/&/\r\n/. Also, spaces are encoded as %20. body = decodeURLEscapeSequences(body.replaceWithLiteral('&', "\r\n").replace('+', ' ') + "\r\n"); } Vector<char> bodyData; bodyData.append("body=", 5); FormDataBuilder::encodeStringAsFormData(bodyData, body.utf8()); body = String(bodyData.data(), bodyData.size()).replaceWithLiteral('+', "%20"); String query = url.query(); if (!query.isEmpty()) query.append('&'); query.append(body); url.setQuery(query); }
static void openFileSystem(ScriptExecutionContext* context, const String& basePath, FileSystemType type, long long size, bool create, PassOwnPtr<AsyncFileSystemCallbacks> callbacks, FileSystemSynchronousType synchronousType) { ASSERT(context); ASSERT(type != FileSystemTypeIsolated); if (type == FileSystemTypeIsolated) return; KURL url = context->url(); if (url.hasFragmentIdentifier()) url.removeFragmentIdentifier(); url.setQuery(String()); url.setPath("/"); StringBuilder builder; builder.append("filesystem:"); builder.append(url.string()); builder.append(fileSystemTypeString(type)); KURL rootURL = context->completeURL(builder.toString()); ASSERT(rootURL.isValid()); // TODO: Ask user for file system permission. if (context->isDocument()) { int playerId = 0; Page* page = static_cast<Document*>(context)->page(); if (page) playerId = page->chrome().client()->platformPageClient()->playerID(); AsyncFileSystemBlackBerry::openFileSystem(rootURL, basePath, context->securityOrigin()->databaseIdentifier(), type, size, create, playerId, callbacks); } else { #if ENABLE(WORKERS) WorkerContext* workerContext = static_cast<WorkerContext*>(context); String mode = openFileSystemMode; mode.append(String::number(workerContext->thread()->runLoop().createUniqueId())); WorkerAsyncFileSystemBlackBerry::openFileSystem(workerContext, rootURL, mode, basePath, context->securityOrigin()->databaseIdentifier(), type, size, create, callbacks); if (synchronousType == SynchronousFileSystem) workerContext->thread()->runLoop().runInMode(workerContext, mode); #else ASSERT_NOT_REACHED(); #endif } }
void didReceiveResponse(ResourceHandle*, const ResourceResponse& response) { m_response = adoptGRef(response.toSoupMessage()); m_download->didReceiveResponse(response); if (response.httpStatusCode() >= 400) { downloadFailed(downloadNetworkError(ResourceError(errorDomainDownload, response.httpStatusCode(), response.url().string(), response.httpStatusText()))); return; } String suggestedFilename = response.suggestedFilename(); if (suggestedFilename.isEmpty()) { KURL url = response.url(); url.setQuery(String()); url.removeFragmentIdentifier(); suggestedFilename = decodeURLEscapeSequences(url.lastPathComponent()); } bool overwrite; String destinationURI = m_download->decideDestinationWithSuggestedFilename(suggestedFilename.utf8().data(), overwrite); if (destinationURI.isEmpty()) { GOwnPtr<char> errorMessage(g_strdup_printf(_("Cannot determine destination URI for download with suggested filename %s"), suggestedFilename.utf8().data())); downloadFailed(downloadDestinationError(response, errorMessage.get())); return; } GRefPtr<GFile> file = adoptGRef(g_file_new_for_uri(destinationURI.utf8().data())); GOwnPtr<GError> error; m_outputStream = adoptGRef(g_file_replace(file.get(), 0, TRUE, G_FILE_CREATE_NONE, 0, &error.outPtr())); if (!m_outputStream) { downloadFailed(downloadDestinationError(response, error->message)); return; } m_download->didCreateDestination(destinationURI); }
static KURL findUrlForAccount(const KMail::ImapAccountBase *a) { assert(a); const KMail::SieveConfig sieve = a->sieveConfig(); if(!sieve.managesieveSupported()) return KURL(); if(sieve.reuseConfig()) { // assemble Sieve url from the settings of the account: KURL u; u.setProtocol("sieve"); u.setHost(a->host()); u.setUser(a->login()); u.setPass(a->passwd()); u.setPort(sieve.port()); // Translate IMAP LOGIN to PLAIN: u.setQuery("x-mech=" + (a->auth() == "*" ? "PLAIN" : a->auth())); return u; } else { return sieve.alternateURL(); } }
void EMailThread::send() { QStringList listTo; QString mQuery; KIO::MetaData slaveConfig; KURL destination; int i, count; _sendOk = false; KIO::Scheduler::connect(SIGNAL(slaveError(KIO::Slave *, int, const QString &)), this, SLOT(slaveError(KIO::Slave *, int, const QString &))); _strBody.insert( 0, QString("Subject:%1\n\n").arg(_strSubject).latin1()); _strBody.insert( 0, QString("To:%1\n").arg(_strTo).latin1()); _bodyOffset = 0; _bodyLength = _strBody.length(); mQuery = "headers=0&from="; mQuery += KURL::encode_string(_strFrom); listTo = QStringList::split(QRegExp("[ ,;]"), _strTo); count = listTo.count(); if (count > 0) { for (i=0; i<count; i++) { mQuery += "&to="; mQuery += KURL::encode_string(listTo[i]); } } else { mQuery += "&to="; mQuery += KURL::encode_string(_strTo); } mQuery += "&size="; mQuery += QString::number(_bodyLength); if (_encryption == EMailEncryptionSSL) { destination.setProtocol("smtps"); } else { destination.setProtocol("smtp"); } destination.setHost(_strSMTPServer); destination.setPort((short)_iPort); destination.setPath("/send"); destination.setQuery(mQuery); if (_useAuthentication) { destination.setUser(_strUsername); destination.setPass(_strPassword); } if (_encryption == EMailEncryptionTLS) { slaveConfig.insert("tls", "on"); } else { slaveConfig.insert("tls", "off"); } if (_useAuthentication) { switch (_authentication) { case EMailAuthenticationPLAIN: slaveConfig.insert("sasl", "PLAIN"); break; case EMailAuthenticationLOGIN: slaveConfig.insert("sasl", "LOGIN"); break; case EMailAuthenticationCRAMMD5: slaveConfig.insert("sasl", "CRAM-MD5"); break; case EMailAuthenticationDIGESTMD5: slaveConfig.insert("sasl", "DIGEST-MD5"); break; default: slaveConfig.insert("sasl", "PLAIN"); break; } } _slave = KIO::Scheduler::getConnectedSlave(destination, slaveConfig); if (_slave) { _job = KIO::put(destination, -1, false, false, false); if (_job) { _job->addMetaData("lf2crlf+dotstuff", "slave"); connect(_job, SIGNAL(result(KIO::Job *)), this, SLOT(result(KIO::Job *))); connect(_job, SIGNAL(dataReq(KIO::Job *, QByteArray &)), this, SLOT(dataReq(KIO::Job *, QByteArray &))); KIO::Scheduler::assignJobToSlave(_slave, _job); _sendOk = true; } } }
void ElogThreadSubmit::doTransmit( ) { KURL destination; QStringList::iterator it; QStringList strListAttributes; QStringList strListAttribute; QString boundary; int iAttachment = 0; destination.setProtocol("http"); destination.setHost(_elog->configuration()->ipAddress()); destination.setPort((short)_elog->configuration()->portNumber()); destination.setQuery(""); if (!_strLogbook.isEmpty()) { destination.setPath(QString("/%1/").arg(_strLogbook)); } srand((unsigned) time(NULL)); boundary = QString("---------------------------%1%2%3").arg(rand(), 4, 16).arg(rand(), 4, 16).arg(rand(), 4, 16); // // add the attributes... // addAttribute( _dataStreamAll, boundary, "cmd", "Submit", false ); addAttribute( _dataStreamAll, boundary, "unm", _strUserName, false ); addAttribute( _dataStreamAll, boundary, "upwd", _strUserPassword, true ); addAttribute( _dataStreamAll, boundary, "exp", _strLogbook, false ); strListAttributes = QStringList::split( '\n', _strAttributes, FALSE ); for ( it = strListAttributes.begin(); it != strListAttributes.end(); ++it ) { strListAttribute = QStringList::split( '=', *it, FALSE ); if( strListAttribute.count() == 2 ) { addAttribute( _dataStreamAll, boundary, strListAttribute.first().stripWhiteSpace(), strListAttribute.last().stripWhiteSpace(), false ); } } if( _bSubmitAsHTML ) { addAttribute( _dataStreamAll, boundary, "html", "1", false ); } if( _bSuppressEmail ) { addAttribute( _dataStreamAll, boundary, "suppress", "1", false ); } addAttribute( _dataStreamAll, boundary, "Text", _strMessage, false ); QString str = QString("%1\r\n").arg(boundary); _dataStreamAll.writeRawBytes(str.ascii(), str.length()); // // add the attachments... // if( _bIncludeCapture ) { iAttachment++; addAttachment( _dataStreamAll, boundary, _byteArrayCapture, iAttachment, "Capture.png" ); } if( _bIncludeConfiguration ) { QByteArray byteArrayConfigure; QTextStream textStreamConfigure( byteArrayConfigure, IO_ReadWrite ); QCustomEvent eventConfigure(KstELOGConfigureEvent); eventConfigure.setData( &textStreamConfigure ); QApplication::sendEvent( (QObject*)_elog->app(), (QEvent*)&eventConfigure ); iAttachment++; addAttachment( _dataStreamAll, boundary, byteArrayConfigure, iAttachment, "Configure.kst" ); } if( _bIncludeDebugInfo ) { QByteArray byteArrayDebugInfo; QTextStream textStreamDebugInfo( byteArrayDebugInfo, IO_ReadWrite ); QCustomEvent eventDebugInfo(KstELOGDebugInfoEvent); eventDebugInfo.setData( &textStreamDebugInfo ); QApplication::sendEvent( (QObject*)_elog->app(), (QEvent*)&eventDebugInfo ); iAttachment++; addAttachment( _dataStreamAll, boundary, byteArrayDebugInfo, iAttachment, "DebugInfo.txt" ); } _job = KIO::http_post(destination, _byteArrayAll, false); if (_job) { _job->addMetaData("content-type", QString("multipart/form-data; boundary=%1").arg(boundary)); if (!_strWritePassword.isEmpty()) { QCString enc = KCodecs::base64Encode(_strWritePassword.ascii()); _job->addMetaData("cookies", "manual"); _job->addMetaData("setcookies", QString("Cookie: wpwd=%1").arg(enc.data())); } QObject::connect(_job, SIGNAL(result(KIO::Job*)), this, SLOT(result(KIO::Job*))); QObject::connect(_job, SIGNAL(dataReq(KIO::Job*, QByteArray&)), this, SLOT(dataReq(KIO::Job*, QByteArray&))); QObject::connect(_job, SIGNAL(data(KIO::Job*, const QByteArray&)), this, SLOT(data(KIO::Job*, const QByteArray&))); KIO::Scheduler::scheduleJob(_job); } else {
void Processor::setBugDetailsQuery( KURL &url, const Bug &bug ) { url.setFileName( "xml.cgi" ); url.setQuery( "?id=" + bug.number() ); }
void Processor::setPackageListQuery( KURL &url ) { url.setFileName( "xml.cgi" ); url.setQuery( "?data=versiontable" ); }