int Url::removeAllQueryItems ( lua_State * L )// ( const QString & key ) { QUrl* lhs = ValueInstaller2<QUrl>::check( L, 1 ); //QString* key = ValueInstaller2<QString>::check( L, 2 ); lhs->removeAllQueryItems( Util::toString( L, 2 ) ); return 0; }
void startHandleRequest(ZhttpRequest *req, int basePathStart, const QByteArray &asPath, const DomainMap::Entry &route) { Session *s = new Session(this); s->req = req; QUrl uri = req->requestUri(); QByteArray encPath = uri.encodedPath(); s->path = encPath.mid(basePathStart); QList<QByteArray> parts = s->path.split('/'); if(!parts.isEmpty() && parts.last().startsWith("jsonp")) { if(uri.hasQueryItem("callback")) { s->jsonpCallback = uri.queryItemValue("callback").toUtf8(); uri.removeAllQueryItems("callback"); } else if(uri.hasQueryItem("c")) { s->jsonpCallback = uri.queryItemValue("c").toUtf8(); uri.removeAllQueryItems("c"); } } s->asUri = uri; s->asUri.setScheme((s->asUri.scheme() == "https") ? "wss" : "ws"); if(!asPath.isEmpty()) s->asUri.setEncodedPath(asPath); else s->asUri.setEncodedPath(encPath.mid(0, basePathStart)); s->route = route; connect(req, SIGNAL(readyRead()), SLOT(req_readyRead())); connect(req, SIGNAL(bytesWritten(int)), SLOT(req_bytesWritten(int))); connect(req, SIGNAL(error()), SLOT(req_error())); sessions += s; sessionsByRequest.insert(s->req, s); processRequestInput(s); }
void QUrlProto::removeAllQueryItems(const QString &key) { QUrl *item = qscriptvalue_cast<QUrl*>(thisObject()); if (item) item->removeAllQueryItems(key); }