mirror of
https://github.com/YACReader/yacreader
synced 2025-07-23 15:35:03 -04:00
antes de a?adir la clase Comic de YACReader a YACReaderLibrary
navegaci?n web con paginaci?n rudimentaria implementada
This commit is contained in:
@ -26,7 +26,8 @@ HttpConnectionHandler* HttpConnectionHandlerPool::getConnectionHandler() {
|
||||
}
|
||||
}
|
||||
if (!freeHandler) {
|
||||
int maxConnectionHandlers=settings->value("maxThreads",10).toInt();
|
||||
//CAMBIADO
|
||||
int maxConnectionHandlers= 100;//settings->value("maxThreads",10).toInt();
|
||||
if (pool.count()<maxConnectionHandlers) {
|
||||
freeHandler=new HttpConnectionHandler(settings,requestHandler);
|
||||
pool.append(freeHandler);
|
||||
|
@ -50,6 +50,7 @@ void HttpListener::incomingConnection(int socketDescriptor) {
|
||||
QTcpSocket* socket=new QTcpSocket(this);
|
||||
socket->setSocketDescriptor(socketDescriptor);
|
||||
connect(socket, SIGNAL(disconnected()), socket, SLOT(deleteLater()));
|
||||
//CAMBIADO 503 por 429
|
||||
socket->write("HTTP/1.1 503 too many connections\r\nConnection: close\r\n\r\nToo many connections\r\n");
|
||||
socket->disconnectFromHost();
|
||||
}
|
||||
|
@ -104,6 +104,11 @@ void HttpResponse::write(QByteArray data, bool lastPart) {
|
||||
}
|
||||
}
|
||||
|
||||
void HttpResponse::writeText(QString text, bool lastPart)
|
||||
{
|
||||
write(text.toAscii(),lastPart);
|
||||
}
|
||||
|
||||
|
||||
bool HttpResponse::hasSentLastPart() const {
|
||||
return sentLastPart;
|
||||
|
@ -83,6 +83,7 @@ public:
|
||||
@param lastPart Indicator, if this is the last part of the response.
|
||||
*/
|
||||
void write(QByteArray data, bool lastPart=false);
|
||||
void writeText(QString text, bool lastPart=false);
|
||||
|
||||
/**
|
||||
Indicates wheter the body has been sent completely. Used by the connection
|
||||
|
@ -119,6 +119,8 @@ void StaticFileController::setContentType(QString fileName, HttpResponse& respon
|
||||
else if (fileName.endsWith(".html") || fileName.endsWith(".htm")) {
|
||||
response.setHeader("Content-Type", qPrintable("text/html; charset=charset="+encoding));
|
||||
}
|
||||
else if (fileName.endsWith(".js"))
|
||||
response.setHeader("Content-Type", qPrintable("text/javascript; charset=charset="+encoding));
|
||||
// Todo: add all of your content types
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user