[prev in list] [next in list] [prev in thread] [next in thread] 

List:       helix-server-cvs
Subject:    [Server-cvs] engine/dataflow http.cpp,1.24,1.25
From:       dcollins () helixcommunity ! org
Date:       2009-10-29 20:14:05
Message-ID: 200910292125.n9TLP4xr005010 () mailer ! progressive-comp ! com
[Download RAW message or body]

Update of /cvsroot/server/engine/dataflow
In directory cvs01.internal.helixcommunity.org:/tmp/cvs-serv21392

Modified Files:
	http.cpp 
Log Message:
Synopsis
========
HTTP Byte-Range support enhancements and related changes

Branches: HEAD
Reviewer: Chytanya


Description
===========

This enhances/rewrites the HTTP/1.1 byte-range support to permit multiple
ranges in a single HTTP request.  For example, the request might ask for:
    Range: bytes=50-60,90-95,120-

This would result in bytes 50 through 60, 90 through 95, and 120 through
the end of the file being sent.

Adjacent and overlapping ranges are merged, per RFC.  Examples (all
three result in bytes 50 through 80 being returned as a single range
rather than two ranges):
    Range: bytes=50-60,55-80
    Range: bytes=60-70,50-80
    Range: bytes=50-60,61-80

Another example, retrieving the first 10 bytes and the last 5 byte of the file:
    Range: bytes=0-10,-5

If (and only if) after merging range request more than one range
is actually being returned, the result is encoded as a multi-part
MIME message.  Each segment is prefixed with a MIME marker, the
contained mime/type, and range information.  For the requested range
"bytes=50-60,150-" on a 200-byte file:

[Attachment #2 (text/html)]

...data...
[Attachment #3 (text/html)]

...data...

The HTTP Content-Length header includes the size of the MIME overhead
in addition to the data sgments.  Since this field needs to be sent
to the client before we have read the range segments from the disk,
we pre-compute the MIME headers so that we can calculate the
total content length.

[...]

Files Affected
==============

server-restricted/protocol/http/httprange.cpp [new]
server-restricted/protocol/http/pub/httprange.h [new]
server-restricted/protocol/http/httmobilecheck.cpp [new]
server-restricted/protocol/http/pub/httpmobilecheck.h [new]
server-restricted/protocol/http/Umakefil
server-restricted/protocol/http/linux2.pcf [new]
server-restricted/protocol/http/unix.pcf [new]
server-restricted/protocol/http/win32.pcf [new]
server/protocol/http/Umakefil
server/protocol/http/httpprot.cpp
server/protocol/http/pub/httpprot.h
server/engine/dataflow/http.cpp
server/engine/dataflow/pub/http.h
SERVER_CURRENT_COMMON_restricted.bif


Testing Performed
=================

Unit Tests:
- N/A.

Integration Tests:
- Verified that various byte-range requests were honored using curl.

Leak Tests:
- Not performed.

Performance Tests:
- Not performed.

Platforms Tested: linux-rhel5-i686
Build verified: linux-rhel5-i686


QA Hints
========
* N/A



Index: http.cpp
===================================================================
RCS file: /cvsroot/server/engine/dataflow/http.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- http.cpp	14 Oct 2009 20:47:51 -0000	1.24
+++ http.cpp	29 Oct 2009 20:14:03 -0000	1.25
@@ -66,14 +66,15 @@
 #include "http.h"
 #include "hxurl.h"
 #include "servbuffer.h"
-
+#include "servreg.h"
 
 #include "hxheap.h"
 #include "fsmanager.h"
 
 #include "carray.h"
 
-#define READSIZE 1024
+#define READSIZE_DEF 1024
+#define READSIZE_REG "config.HTTPFileReadSize"
 
 #ifdef _DEBUG
 #undef HX_THIS_FILE
@@ -384,6 +385,9 @@
     m_pRequest = NULL;
 
     m_state = HS_GetInit;
+
+    m_ulReadSize = READSIZE_DEF;
+    pClient->m_pProc->pc->registry->GetInt(READSIZE_REG, &m_ulReadSize, pClient->m_pProc);
 }
 
 HTTP::~HTTP()
@@ -430,7 +434,7 @@
 {
     if (m_pFileObject)
     {
-        return m_pFileObject->Read(READSIZE);
+        return m_pFileObject->Read(m_ulReadSize);
     }	
     return HXR_OK;
 }


_______________________________________________
Server-cvs mailing list
Server-cvs@helixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/server-cvs

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic