예제 #1
0
static void startFileHandler(HttpQueue *q)
{
    HttpConn    *conn;
    HttpRx      *rx;
    HttpTx      *tx;
    HttpPacket  *packet;

    conn = q->conn;
    rx = conn->rx;
    tx = conn->tx;
    
    if (tx->finalized || conn->error) {
        return;

    } else if (rx->flags & HTTP_PUT) {
        handlePutRequest(q);
        
    } else if (rx->flags & HTTP_DELETE) {
        handleDeleteRequest(q);
        
    } else if (rx->flags & HTTP_OPTIONS) {
        httpHandleOptions(q->conn);
        
    } else if (!(tx->flags & HTTP_TX_NO_BODY)) {
        /* Create a single data packet based on the entity length */
        packet = httpCreateEntityPacket(0, tx->entityLength, readFileData);
        if (!tx->outputRanges) {
            /* Can set a content length */
            tx->length = tx->entityLength;
        }
        /* Add to the output service queue */
        httpPutForService(q, packet, 0);
    }
}
예제 #2
0
static void startFileHandler(HttpQueue *q)
{
    HttpConn    *conn;
    HttpRx      *rx;
    HttpTx      *tx;
    HttpPacket  *packet;

	int beint;
				
	printf("\n  startFileHandler  \n");

    conn = q->conn;
    rx = conn->rx;
    tx = conn->tx;
    assure(!tx->finalized);
    
    if (rx->flags & HTTP_PUT) {
        handlePutRequest(q);
        
    } else if (rx->flags & HTTP_DELETE) {
        handleDeleteRequest(q);
        
    } else if (!(tx->flags & HTTP_TX_NO_BODY)) {
        /* Create a single data packet based on the entity length */
        packet = httpCreateEntityPacket(0, tx->entityLength, readFileData);
        if (!tx->outputRanges) {
            /* Can set a content length */
			
			if(strcmp(tx->filename ,"C:\\Project\\appweb-4.2.0\\windows-x86-vsdebug\\web\\movie.mp4") == 0)
			{	
				tx->cacheBuffer = 0;
				tx->length = 400000;

			}
			else
			{
				tx->length = tx->entityLength;
			}	
	beint = tx->length;

	printf("\n--------------------\n");
	printf("beint,tx->filename : %d \t +%s+",beint,tx->filename);
	printf("\n--------------------\n");


        }
        /* Add to the output service queue */
        httpPutForService(q, packet, 0);
    }

}