This site is the archived OWASP Foundation Wiki and is no longer accepting Account Requests.
To view the new OWASP Foundation website, please visit https://owasp.org

HTTP Response Handling Library

From OWASP
Revision as of 07:30, 26 July 2013 by Rahul Chaudhary (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Introduction

Secure PHP Static HTTP Response Handling Library is to control the downloadable contents in the library. With control we mean the download speed with which the files are served to the users. Developers can use this library to set a speed limit on the files. This library also contains functions to resume download which is supported in most of the browsers and assists download managers.

Functions in this library

Lists of functions in this library and their uses are as follows:

  • MIME: This function is used to find out the extension of files and to determine their types from their extensions.
  • isModifiedSince: This function is used to calculate if the file has changed since the user last visited that page. If the file has been changed since the last visit, then true is returned indicating the browser to re-download the file.
  • calculateHTTPRange: This function is used to calculate which parts of file have been downloaded and which parts have NOT been downloaded. With this knowledge, the browsers and the download managers can be instructed to download only the remaining parts.
  • download: This function is used to download a file. This function is the central function that uses all of the above functions and many others to impose limits on the file download speed and to serve only those parts of file which needs to be downloaded. This function also rewrites the HTTP headers for indicating the browsers about the details of the content it is serving.
  • serveData: This function is used to serve some data to the client. This is different from serving a file. There is no limit nor restrictions on the download of this chunk of data. This chunk of data is served as a whole and not in parts.


Other Helpful Links