This file is indexed.

/usr/include/Wt/WStreamResource is in libwt-dev 3.3.3+dfsg-4.1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
// This may look like C code, but it's really -*- C++ -*-
/*
 * Copyright (C) 2011 Emweb bvba, Kessel-Lo, Belgium.
 *
 * See the LICENSE file for terms of use.
 */
#ifndef WSTREAM_RESOURCE_H_
#define WSTREAM_RESOURCE_H_

#include <Wt/WResource>

#include <string>

namespace Wt {

/*! \class WStreamResource Wt/WStreamResource Wt/WStreamResource
 *  \brief An object which streams the data from a std::istream.
 *
 * This class can be useful base for implementing resources which streams
 * the data from std::istream derivatives.
 *
 * The utility method handleRequestPiecewise() makes use of continuations
 * to transmit data piecewise, without blocking a thread or requiring the
 * whole data to be read in memory. The size of the buffer can be changed
 * by using setBufferSize().
 *
 * \if cpp
 * Example for a custom stream resource implementation:
 * \code
class MyStreamResource : public Wt::WStreamResource
{
public:
  MyStreamResource(const std::string& fileName, Wt::WObject *parent = 0)
    : Wt::WStreamResource(parent),
      fileName_(fileName)
  {
    suggestFileName("data.txt");
  }

  ~MyStreamResource() {
    beingDeleted();
  }

  void handleRequest(const Wt::Http::Request& request,
                     Wt::Http::Response& response) {
    std::ifstream r(fileName_.c_str(), std::ios::in | std::ios::binary);
    handleRequestPiecewise(request, response, r);
  }

private:
  std::string fileName_;
};
 * \endcode
 * \endif
 *
 * \sa WFileResource
 */
class WT_API WStreamResource : public WResource
{
public:
  /*! \brief Default constructor.
   *
   * The mime type defaults to "text/plain".
   */
  WStreamResource(WObject *parent = 0);

  /*! \brief Creates a new resource with given mime-type.
   */
  WStreamResource(const std::string& mimeType, WObject *parent = 0);

  /*! \brief Destructor.
   *
   * It is up to the user to make sure that the resource is no longer
   * in use (by e.g. a WImage).
   */
  ~WStreamResource();

  /*! \brief Sets the mime-type.
   */
  void setMimeType(const std::string& mimeType);

  /*! \brief Returns the mime-type.
   */
  const std::string& mimeType() const { return mimeType_; }

  /*! \brief Configures the buffer size.
   *
   * This configures the size of the buffer used to transmit the data
   * piece by piece.
   */
  void setBufferSize(int size);

  /*! \brief Returns the buffer size.
   *
   * \sa setBufferSize()
   */
  int bufferSize() const { return bufferSize_; }

protected:
  /*! \brief Handles a request and streams the data from a std::istream.
   *
   * You can call this method from a custom handleRequest() implementations.
   */
  void handleRequestPiecewise(const Http::Request& request,
                              Http::Response& response, std::istream& input);

private:
  std::string mimeType_;
  int         bufferSize_;
  std::streamsize beyondLastByte_;
};

}

#endif // WSTREAM_RESOURCE_H_