/** A handy shortcut that appends the given path to the URL of the * mutiplayer server. It also supports the old (version 1) api, * where a 'action' parameter was sent to 'client-user.php'. * \param path The path to add to the server.(see API::USER_*) * \param action The action to perform. eg: connect, pool */ void HTTPRequest::setApiURL(const std::string& path, const std::string &action) { // Old (0.8.1) API: send to client-user.php, and add action as a parameter if (stk_config->m_server_api_version == 1) { const std::string final_url = stk_config->m_server_api + "client-user.php"; setURL(final_url); if (action == "change-password") addParameter("action", "change_password"); else if (action == "recover") addParameter("action", "recovery"); else addParameter("action", action); } else { const std::string final_url = stk_config->m_server_api + + "v" + StringUtils::toString(stk_config->m_server_api_version) + "/" + path // eg: /user/, /server/ + action + "/"; // eg: connect/, pool/, get-server-list/ setURL(final_url); } } // setServerURL
/** A handy shortcut that appends the given path to the URL of the * mutiplayer server. It also supports the old (version 1) api, * where a 'action' parameter was sent to 'client-user.php'. * \param path The path to add to the server.(see API::USER_*) * \param action The action to perform. eg: connect, pool */ void HTTPRequest::setApiURL(const std::string& path, const std::string &action) { // Old (0.8.1) API: send to client-user.php, and add action as a parameter if(UserConfigParams::m_server_version==1) { setURL( (std::string)UserConfigParams::m_server_multiplayer + "client-user.php" ); if(action=="change-password") addParameter("action", "change_password"); else if(action=="recover") addParameter("action", "recovery"); else addParameter("action", action); } else { setURL( (std::string)UserConfigParams::m_server_multiplayer + +"v"+StringUtils::toString(UserConfigParams::m_server_version) + "/" + path + // eg: /user/, /server/ action + "/" // eg: connect/, pool/, get-server-list/ ); } } // setServerURL
int CgidWorker::start( const char * pServerRoot, const char * pChroot, uid_t uid, gid_t gid, int priority ) { char achSocket[1024]; int fd; int ret; if ( m_pid != -1 ) return 0; CgidConfig& config = getConfig(); generateSecret( config.getSecretBuf()); HttpGlobals::s_pCgid = this; config.addEnv( "PATH=/bin:/usr/bin:/usr/local/bin" ); config.addEnv( NULL ); char *p = achSocket; int i, n; memccpy( p, config.getSocket(), 0, 128 ); setURL( p ); fd = ExtWorker::startServerSock( &config, 200 ); if ( fd == -1 ) { LOG_ERR(("Cannot create a valid unix domain socket for CGI daemon." )); return -1; } m_fdCgid = fd; n = snprintf( p, 255, "uds:/%s", getConfig().getServerAddrUnixSock() ); if ( getuid() == 0 ) { chown( p + 5, 0, gid ); chmod( p + 5, 0760 ); } else { chmod( p + 5, 0700 ); } if ( pChroot ) { i = strlen( pChroot ); memmove( p + 5, p + 5 + i, n - 5 - i + 1 ); } setURL( p ); ret = spawnCgid( m_fdCgid, p, config.getSecret() ); if ( ret ==-1 ) { return -1; } setState( ST_GOOD ); return ret; }
void DolphinView::updateURL() { KFileView* fileView = (m_iconsView != 0) ? static_cast<KFileView*>(m_iconsView) : static_cast<KFileView*>(m_detailsView); KFileItem* fileItem = fileView->currentFileItem(); if (fileItem == 0) { return; } if (fileItem->isDir()) { // Prefer the local path over the URL. This assures that the // volume space information is correct. Assuming that the URL is media:/sda1, // and the local path is /windows/C: For the URL the space info is related // to the root partition (and hence wrong) and for the local path the space // info is related to the windows partition (-> correct). const QString localPath(fileItem->localPath()); if (localPath.isEmpty()) { setURL(fileItem->url()); } else { setURL(KURL(localPath)); } } else if (fileItem->isFile()) { // allow to browse through ZIP and tar files KMimeType::Ptr mime = fileItem->mimeTypePtr(); if (mime->is("application/x-zip")) { KURL url = fileItem->url(); url.setProtocol("zip"); setURL(url); } else if (mime->is("application/x-tar") || mime->is("application/x-tarz") || mime->is("application/x-tbz") || mime->is("application/x-tgz") || mime->is("application/x-tzo")) { KURL url = fileItem->url(); url.setProtocol("tar"); setURL(url); } else { fileItem->run(); } } else { fileItem->run(); } }
void HyperlinkButton::refreshFromValueTree (const ValueTree& state, ComponentBuilder&) { ComponentBuilder::refreshBasicComponentProperties (*this, state); setButtonText (state [Ids::text].toString()); setURL (URL (state [Ids::url].toString())); }
std::unique_ptr<HTTPMessage> getRequest(HTTPMethod type) { auto req = folly::make_unique<HTTPMessage>(); req->setMethod(type); req->setHTTPVersion(1, 1); req->setURL("/"); return req; }
void ResourceRequestBase::setAsIsolatedCopy(const ResourceRequest& other) { setURL(other.url().isolatedCopy()); setCachePolicy(other.cachePolicy()); setTimeoutInterval(other.timeoutInterval()); setFirstPartyForCookies(other.firstPartyForCookies().isolatedCopy()); setHTTPMethod(other.httpMethod().isolatedCopy()); setPriority(other.priority()); setRequester(other.requester()); updateResourceRequest(); m_httpHeaderFields = other.httpHeaderFields().isolatedCopy(); size_t encodingCount = other.m_responseContentDispositionEncodingFallbackArray.size(); if (encodingCount > 0) { String encoding1 = other.m_responseContentDispositionEncodingFallbackArray[0].isolatedCopy(); String encoding2; String encoding3; if (encodingCount > 1) { encoding2 = other.m_responseContentDispositionEncodingFallbackArray[1].isolatedCopy(); if (encodingCount > 2) encoding3 = other.m_responseContentDispositionEncodingFallbackArray[2].isolatedCopy(); } ASSERT(encodingCount <= 3); setResponseContentDispositionEncodingFallbackArray(encoding1, encoding2, encoding3); } if (other.m_httpBody) setHTTPBody(other.m_httpBody->isolatedCopy()); setAllowCookies(other.m_allowCookies); const_cast<ResourceRequest&>(asResourceRequest()).doPlatformSetAsIsolatedCopy(other); }
XMLURL::XMLURL(const XMLCh* const urlText, MemoryManager* const manager) : fMemoryManager(manager) , fFragment(0) , fHost(0) , fPassword(0) , fPath(0) , fPortNum(0) , fProtocol(XMLURL::Unknown) , fQuery(0) , fUser(0) , fURLText(0) , fHasInvalidChar(false) { CleanupType cleanup(this, &XMLURL::cleanUp); try { setURL(urlText); } catch(const OutOfMemoryException&) { cleanup.release(); throw; } cleanup.release(); }
IOResult Cal3DObject::Load(ILoad *iload) { IOResult res; while (IO_OK == (res = iload->OpenChunk())) { switch (iload->CurChunkID()) { case CAL3D_URL_CHUNK: { char *n; #ifdef _UNICODE iload->ReadWStringChunk(&n); #else iload->ReadCStringChunk(&n); #endif setURL(n); break; } } iload->CloseChunk(); if (res != IO_OK) return res; } return IO_OK; }
XMLURL::XMLURL(const char* const urlText, MemoryManager* const manager) : fMemoryManager(manager) , fFragment(0) , fHost(0) , fPassword(0) , fPath(0) , fPortNum(0) , fProtocol(XMLURL::Unknown) , fQuery(0) , fUser(0) , fURLText(0) , fHasInvalidChar(false) { CleanupType cleanup(this, &XMLURL::cleanUp); XMLCh* tmpText = XMLString::transcode(urlText, fMemoryManager); ArrayJanitor<XMLCh> janRel(tmpText, fMemoryManager); try { setURL(tmpText); } catch(const OutOfMemoryException&) { cleanup.release(); throw; } cleanup.release(); }
void Web3DOverlay::setProperties(const QVariantMap& properties) { Billboard3DOverlay::setProperties(properties); auto urlValue = properties["url"]; if (urlValue.isValid()) { QString newURL = urlValue.toString(); if (newURL != _url) { setURL(newURL); } } auto resolution = properties["resolution"]; if (resolution.isValid()) { bool valid; auto res = vec2FromVariant(resolution, valid); if (valid) { _resolution = res; } } auto dpi = properties["dpi"]; if (dpi.isValid()) { _dpi = dpi.toFloat(); } }
static optional<std::unique_ptr<Source>> convertGeoJSONSource(const std::string& id, const Convertible& value, Error& error) { auto dataValue = objectMember(value, "data"); if (!dataValue) { error = { "GeoJSON source must have a data value" }; return {}; } optional<GeoJSONOptions> options = convert<GeoJSONOptions>(value, error); if (!options) { return {}; } auto result = std::make_unique<GeoJSONSource>(id, *options); if (isObject(*dataValue)) { optional<GeoJSON> geoJSON = convert<GeoJSON>(*dataValue, error); if (!geoJSON) { return {}; } result->setGeoJSON(std::move(*geoJSON)); } else if (toString(*dataValue)) { result->setURL(*toString(*dataValue)); } else { error = { "GeoJSON data must be a URL or an object" }; return {}; } return { std::move(result) }; }
static void GPRS_Send(uint32_t address,uint8_t data_type, uint16_t data) { setURL(address,data_type,data); delay_s(2); getRequest(); delay_s(4); }
// config vars have changed void ConnectionDialog::updateConfig() { setURL( serverURL ); setPort( serverPort ); setNick( userNick ); ui->serverCombo->clear(); ui->serverCombo->addItems( serverList ); }
LLURLRequest::LLURLRequest( LLURLRequest::ERequestAction action, const std::string& url) : mAction(action) { LLMemType m1(LLMemType::MTYPE_IO_URL_REQUEST); initialize(); setURL(url); }
void Web3DOverlay::setProperties(const QVariantMap& properties) { Billboard3DOverlay::setProperties(properties); auto urlValue = properties["url"]; if (urlValue.isValid()) { QString newURL = urlValue.toString(); if (newURL != _url) { setURL(newURL); } } auto scriptURLValue = properties["scriptURL"]; if (scriptURLValue.isValid()) { QString newScriptURL = scriptURLValue.toString(); if (newScriptURL != _scriptURL) { setScriptURL(newScriptURL); } } auto resolution = properties["resolution"]; if (resolution.isValid()) { bool valid; auto res = vec2FromVariant(resolution, valid); if (valid) { _resolution = res; } } auto dpi = properties["dpi"]; if (dpi.isValid()) { _dpi = dpi.toFloat(); } auto maxFPS = properties["maxFPS"]; if (maxFPS.isValid()) { _desiredMaxFPS = maxFPS.toInt(); } auto showKeyboardFocusHighlight = properties["showKeyboardFocusHighlight"]; if (showKeyboardFocusHighlight.isValid()) { _showKeyboardFocusHighlight = showKeyboardFocusHighlight.toBool(); } auto inputModeValue = properties["inputMode"]; if (inputModeValue.isValid()) { QString inputModeStr = inputModeValue.toString(); if (inputModeStr == "Mouse") { _inputMode = Mouse; } else { _inputMode = Touch; } } _mayNeedResize = true; }
void Image3DOverlay::setProperties(const QVariantMap& properties) { Billboard3DOverlay::setProperties(properties); auto urlValue = properties["url"]; if (urlValue.isValid()) { QString newURL = urlValue.toString(); if (newURL != _url) { setURL(newURL); } } auto subImageBoundsVar = properties["subImage"]; if (subImageBoundsVar.isValid()) { if (subImageBoundsVar.isNull()) { _fromImage = QRect(); } else { QRect oldSubImageRect = _fromImage; QRect subImageRect = _fromImage; auto subImageBounds = subImageBoundsVar.toMap(); if (subImageBounds["x"].isValid()) { subImageRect.setX(subImageBounds["x"].toInt()); } else { subImageRect.setX(oldSubImageRect.x()); } if (subImageBounds["y"].isValid()) { subImageRect.setY(subImageBounds["y"].toInt()); } else { subImageRect.setY(oldSubImageRect.y()); } if (subImageBounds["width"].isValid()) { subImageRect.setWidth(subImageBounds["width"].toInt()); } else { subImageRect.setWidth(oldSubImageRect.width()); } if (subImageBounds["height"].isValid()) { subImageRect.setHeight(subImageBounds["height"].toInt()); } else { subImageRect.setHeight(oldSubImageRect.height()); } setClipFromSource(subImageRect); } } auto keepAspectRatioValue = properties["keepAspectRatio"]; if (keepAspectRatioValue.isValid()) { _keepAspectRatio = keepAspectRatioValue.toBool(); } auto emissiveValue = properties["emissive"]; if (emissiveValue.isValid()) { _emissive = emissiveValue.toBool(); } }
URL::URL(const char *str, bool hasDepth):url(NULL), scheme(NULL), host(NULL), port(NULL), path(NULL) { if (hasDepth) { const char *u = str; char depth[20]; char *d = depth; while (*u != ' ') *d++ = *u++; *d = '\0'; u++; while (*u == ' ') u++; int n = atoi(depth); setURL(u); setDepth(n); } else { setURL(str); } }
// Perform searches and replacements on URL bool HTTPHeader::urlRegExp(int filtergroup) { // exit immediately if list is empty if (not o.fg[filtergroup]->url_regexp_list_comp.size()) return false; #ifdef DGDEBUG std::cout << "Starting URL reg exp replace" << std::endl; #endif String newUrl(url()); if (regExp(newUrl, o.fg[filtergroup]->url_regexp_list_comp, o.fg[filtergroup]->url_regexp_list_rep)) { setURL(newUrl); return true; } return false; }
QFile* KNLoadHelper::getFile( const QString &dialogTitle ) { if (f_ile) return f_ile; KUrl url = KFileDialog::getOpenUrl( l_astPath, QString(), p_arent, dialogTitle ); if (url.isEmpty()) return 0; l_astPath = url; return setURL(url); }
KNFile *KNLoadHelper::getFile(const QString &dialogTitle) { if(f_ile) return f_ile; KURL url = KFileDialog::getOpenURL(l_astPath, QString::null, p_arent, dialogTitle); if(url.isEmpty()) return 0; l_astPath = url.url(-1); l_astPath.truncate(l_astPath.length() - url.fileName().length()); return setURL(url); }
bool ItemDocument::openURL(const KURL &url) { ItemDocumentData data(type()); if (!data.loadData(url)) return false; // Why do we stop simulating while loading a document? // Crash possible when loading a circuit document, and the Qt event loop is // reentered (such as when a PIC component pops-up a message box), which // will then call the Simulator::step function, which might use components // that have not fully initialized themselves. m_bIsLoading = true; bool wasSimulating = Simulator::self()->isSimulating(); Simulator::self()->slotSetSimulating(false); data.restoreDocument(this); Simulator::self()->slotSetSimulating(wasSimulating); m_bIsLoading = false; setURL(url); clearHistory(); m_savedState = m_currentState; setModified(false); if (FlowCodeDocument *fcd = dynamic_cast<FlowCodeDocument*>(this)) { // We need to tell all pic-depedent components about what pic type is in use emit fcd->picTypeChanged(); } requestEvent(ItemDocument::ItemDocumentEvent::ResizeCanvasToItems); // Load Z-position info m_zOrder.clear(); ItemMap::iterator end = m_itemList.end(); for (ItemMap::iterator it = m_itemList.begin(); it != end; ++it) { if (!(it->second) || it->second->parentItem()) continue; assert(it->second->itemDocument() == this); m_zOrder[it->second->baseZ()] = it->second; } slotUpdateZOrdering(); return true; }
ErrorCode CHttpPostRequest::requestURL(const char* url, UInt32 timeoutSec) { X_ASSERT(url && *url); ErrorCode ret = EC_OK; { setURL(url); setTimeout(timeoutSec * 1000); ret = perform(); ERROR_CHECK_BOOL(EC_OK == ret); } Exit0: return ret; }
void SyncConnector::pauseSyncthing(bool paused) { mSyncthingPaused = paused; if (paused) { shutdownSyncthingProcess(); killProcesses(); } else { spawnSyncthingProcess(mSyncthingFilePath, true); checkAndSpawnINotifyProcess(false); setURL(mCurrentUrl, mCurrentUrl.userName(), mCurrentUrl.password()); } }
void ConnectionDialog::on_serverCombo_activated(const QString &str) { quint16 port = 0; QString url; int sep = str.lastIndexOf(':'); if ( sep != 0 ) { url = str.left(sep); bool ok = 0; int iport = str.right( str.length() - sep - 1 ).toInt(&ok); if ( ok ) port = (quint16)((iport < 0) ? 0 : (iport > 65535) ? 65535 : iport); } setURL( url ); setPort( port ); }
void Image3DOverlay::setProperties(const QScriptValue &properties) { Billboard3DOverlay::setProperties(properties); QScriptValue urlValue = properties.property("url"); if (urlValue.isValid()) { QString newURL = urlValue.toVariant().toString(); if (newURL != _url) { setURL(newURL); } } QScriptValue subImageBounds = properties.property("subImage"); if (subImageBounds.isValid()) { if (subImageBounds.isNull()) { _fromImage = QRect(); } else { QRect oldSubImageRect = _fromImage; QRect subImageRect = _fromImage; if (subImageBounds.property("x").isValid()) { subImageRect.setX(subImageBounds.property("x").toVariant().toInt()); } else { subImageRect.setX(oldSubImageRect.x()); } if (subImageBounds.property("y").isValid()) { subImageRect.setY(subImageBounds.property("y").toVariant().toInt()); } else { subImageRect.setY(oldSubImageRect.y()); } if (subImageBounds.property("width").isValid()) { subImageRect.setWidth(subImageBounds.property("width").toVariant().toInt()); } else { subImageRect.setWidth(oldSubImageRect.width()); } if (subImageBounds.property("height").isValid()) { subImageRect.setHeight(subImageBounds.property("height").toVariant().toInt()); } else { subImageRect.setHeight(oldSubImageRect.height()); } setClipFromSource(subImageRect); } } QScriptValue emissiveValue = properties.property("emissive"); if (emissiveValue.isValid()) { _emissive = emissiveValue.toBool(); } }
/* * Function CHyperLink::ConvertStaticToHyperlink */ BOOL CHyperLink::ConvertStaticToHyperlink(HWND hwndCtl, LPCTSTR strURL) { if( !(setURL(strURL)) ) return FALSE; // Subclass the parent so we can color the controls as we desire. HWND hwndParent = GetParent(hwndCtl); if (NULL != hwndParent) { WNDPROC pfnOrigProc = (WNDPROC) GetWindowLongPtr(hwndParent, GWLP_WNDPROC); if (pfnOrigProc != _HyperlinkParentProc) { SetProp( hwndParent, PROP_ORIGINAL_PROC, (HANDLE)pfnOrigProc ); SetWindowLongPtr( hwndParent, GWLP_WNDPROC, (LONG) (WNDPROC) _HyperlinkParentProc ); } } // Make sure the control will send notifications. LONG_PTR Style = GetWindowLongPtr(hwndCtl, GWL_STYLE); SetWindowLongPtr(hwndCtl, GWL_STYLE, Style | SS_NOTIFY); // Create an updated font by adding an underline. m_StdFont = (HFONT) SendMessage(hwndCtl, WM_GETFONT, 0, 0); if( g_counter++ == 0 ) { createGlobalResources(); } // Subclass the existing control. m_pfnOrigCtlProc = (WNDPROC) GetWindowLongPtr(hwndCtl, GWLP_WNDPROC); SetProp(hwndCtl, PROP_OBJECT_PTR, (HANDLE) this); SetWindowLongPtr(hwndCtl, GWLP_WNDPROC, (LONG) (WNDPROC) _HyperlinkProc); // Set font to underlined font SendMessage(hwndCtl, WM_SETFONT, (WPARAM)CHyperLink::g_UnderlineFont, FALSE); return TRUE; }
TDEAboutContributor::TDEAboutContributor( TQWidget *_parent, const char *wname, const TQString &_name,const TQString &_email, const TQString &_url, const TQString &_work, bool showHeader, bool showFrame, bool showBold ) : TQFrame( _parent, wname ), mShowHeader(showHeader), mShowBold(showBold), d(0) { if( showFrame ) { setFrameStyle(TQFrame::Panel | TQFrame::Raised); } mLabel[0] = new TQLabel( this ); mLabel[1] = new TQLabel( this ); mLabel[2] = new TQLabel( this ); mLabel[3] = new TQLabel( this ); mText[0] = new TQLabel( this ); mText[1] = new KURLLabel( this ); mText[2] = new KURLLabel( this ); mText[3] = new TQLabel( this ); setName( _name, i18n("Author"), false ); setEmail( _email, i18n("Email"), false ); setURL( _url, i18n("Homepage"), false ); setWork( _work, i18n("Task"), false ); KURLLabel *kurl = static_cast<KURLLabel *>(mText[1]); kurl->setFloat(true); kurl->setUnderline(true); kurl->setMargin(0); connect(kurl, TQT_SIGNAL(leftClickedURL(const TQString &)), TQT_SLOT(emailClickedSlot(const TQString &))); kurl = static_cast<KURLLabel *>(mText[2]); kurl->setFloat(true); kurl->setUnderline(true); kurl->setMargin(0); connect(kurl, TQT_SIGNAL(leftClickedURL(const TQString &)), TQT_SLOT(urlClickedSlot(const TQString &))); mLabel[3]->setAlignment( AlignTop ); fontChange( font() ); updateLayout(); }
ResourceResponse::ResourceResponse(CrossThreadResourceResponseData* data) : ResourceResponse() { setURL(data->m_url); setMimeType(AtomicString(data->m_mimeType)); setExpectedContentLength(data->m_expectedContentLength); setTextEncodingName(AtomicString(data->m_textEncodingName)); setSuggestedFilename(data->m_suggestedFilename); setHTTPStatusCode(data->m_httpStatusCode); setHTTPStatusText(AtomicString(data->m_httpStatusText)); m_httpHeaderFields.adopt(data->m_httpHeaders.release()); setLastModifiedDate(data->m_lastModifiedDate); setResourceLoadTiming(data->m_resourceLoadTiming.release()); m_securityInfo = data->m_securityInfo; m_hasMajorCertificateErrors = data->m_hasMajorCertificateErrors; m_securityStyle = data->m_securityStyle; m_securityDetails.protocol = data->m_securityDetails.protocol; m_securityDetails.cipher = data->m_securityDetails.cipher; m_securityDetails.keyExchange = data->m_securityDetails.keyExchange; m_securityDetails.mac = data->m_securityDetails.mac; m_securityDetails.certID = data->m_securityDetails.certID; m_httpVersion = data->m_httpVersion; m_appCacheID = data->m_appCacheID; m_appCacheManifestURL = data->m_appCacheManifestURL.copy(); m_isMultipartPayload = data->m_isMultipartPayload; m_wasFetchedViaSPDY = data->m_wasFetchedViaSPDY; m_wasNpnNegotiated = data->m_wasNpnNegotiated; m_wasAlternateProtocolAvailable = data->m_wasAlternateProtocolAvailable; m_wasFetchedViaProxy = data->m_wasFetchedViaProxy; m_wasFetchedViaServiceWorker = data->m_wasFetchedViaServiceWorker; m_wasFallbackRequiredByServiceWorker = data->m_wasFallbackRequiredByServiceWorker; m_serviceWorkerResponseType = data->m_serviceWorkerResponseType; m_originalURLViaServiceWorker = data->m_originalURLViaServiceWorker; m_responseTime = data->m_responseTime; m_remoteIPAddress = AtomicString(data->m_remoteIPAddress); m_remotePort = data->m_remotePort; m_downloadedFilePath = data->m_downloadedFilePath; m_downloadedFileHandle = data->m_downloadedFileHandle; // Bug https://bugs.webkit.org/show_bug.cgi?id=60397 this doesn't support // whatever values may be present in the opaque m_extraData structure. }
void ressource_num::load(std::istream &file) { string tampon; ressource::load(file); cout << "Quel est le format de cette ressource?" << endl; do{ getline( file, tampon); }while(tampon.size()==0); setFormat(tampon); cout << "Quelle est la taille de cette ressource? (En octets)" << endl; do{ getline( file, tampon); }while(tampon.size()==0); setTaille(atoi(tampon.c_str())); cout << "Quem est l'URL de cette ressource?" << endl; do{ getline( file, tampon); }while(tampon.size()==0); setURL(tampon); }