void // private AbyssServer::Session::Impl::refillBufferFromConnection() { /*---------------------------------------------------------------------------- Get the next chunk of data from the connection into the buffer. -----------------------------------------------------------------------------*/ bool succeeded; succeeded = SessionRefillBuffer(this->cSessionP); if (!succeeded) throw AbyssServer::Exception( 408, "Client disconnected or sent nothing for a long time " "when the server was expecting the request body " ); }
static void refillBufferFromConnection(xmlrpc_env * const envP, TSession * const abyssSessionP, const char * const trace) { /*---------------------------------------------------------------------------- Get the next chunk of data from the connection into the buffer. -----------------------------------------------------------------------------*/ abyss_bool succeeded; succeeded = SessionRefillBuffer(abyssSessionP); if (!succeeded) xmlrpc_env_set_fault_formatted( envP, XMLRPC_TIMEOUT_ERROR, "Timed out waiting for " "client to send its POST data"); else { if (trace) traceChunkRead(abyssSessionP); } }
/************************************** * GetBody Devuelve el body de una peticion **************************************/ int XmlRpcServer::GetBody(TSession *ses,char *body,short bodyLen) { int len=0; //MIentras no hayamos leido del todo while (len<bodyLen) { char * buffer; size_t readed; //If there is no data available if (!SessionReadDataAvail(ses)) //Refill buffer SessionRefillBuffer(ses); //Read data SessionGetReadData(ses,bodyLen-len,(const char**)&buffer,&readed); //If not readed if (!readed) //error return Error("Not enought data readed"); //Copy memcpy(body+len,buffer,readed); //Increased readed len+=readed; } //Return return len; /*/ //Obtenemos lo que quedaba en el buffer ConnReadInit(r->conn); //Obtenemos lo que hay en la conexion if (r->conn->buffersize > bodyLen) len = bodyLen; else len = r->conn->buffersize; //Copiamos memcpy(body,r->conn->buffer,len); //MIentras no hayamos leido del todo while (len<bodyLen) { int size; //Iniciamos la lectura ConnReadInit(r->conn); //Leemos if(!ConnRead(r->conn,100)) return 0; //Obtenemos lo que hay en la conexion if (r->conn->buffersize > bodyLen - len) size = bodyLen - len; else size = r->conn->buffersize; //Copiamos memcpy(body+len,r->conn->buffer,size); //Incrementamos el buffer len += size; //Increase buffer pos r->conn->bufferpos += len; } //Reset buffer r->conn->buffersize = 0; r->conn->bufferpos = 0; //Clean buffer ConnReadInit(r->conn); //Salimos bien return 1; * */ }