LMMS
Loading...
Searching...
No Matches
juce_WebInputStream.h
Go to the documentation of this file.
1/*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 The code included in this file is provided under the terms of the ISC license
11 http://www.isc.org/downloads/software-support-policy/isc-license. Permission
12 To use, copy, modify, and/or distribute this software for any purpose with or
13 without fee is hereby granted provided that the above copyright notice and
14 this permission notice appear in all copies.
15
16 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
17 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
18 DISCLAIMED.
19
20 ==============================================================================
21*/
22
23namespace juce
24{
25
26//==============================================================================
33{
34 public:
44 WebInputStream (const URL& url, bool addParametersToRequestBody);
45
47 ~WebInputStream() override;
48
57 WebInputStream& withExtraHeaders (const String& extraHeaders);
58
69 WebInputStream& withCustomRequestCommand (const String& customRequestCommand);
70
78 WebInputStream& withConnectionTimeout (int timeoutInMs);
79
88 WebInputStream& withNumRedirectsToFollow (int numRedirects);
89
90 //==============================================================================
97 {
98 public:
100 virtual ~Listener() = default;
101
110 virtual bool postDataSendProgress (WebInputStream& request, int bytesSent, int totalBytes)
111 {
112 ignoreUnused (request, bytesSent, totalBytes);
113 return true;
114 }
115 };
116
135 bool connect (Listener* listener);
136
138 bool isError() const;
139
141 void cancel();
142
144 StringPairArray getRequestHeaders() const;
145
155 StringPairArray getResponseHeaders();
156
166 int getStatusCode();
167
168 //==============================================================================
181 int64 getTotalLength() override;
182
198 int read (void* destBuffer, int maxBytesToRead) override;
199
201 bool isExhausted() override;
202
207 int64 getPosition() override;
208
222 bool setPosition (int64 wantedPos) override;
223
224 private:
225 static void createHeadersAndPostData (const URL&, String&, MemoryBlock&, bool);
226 static StringPairArray parseHttpHeaders (const String&);
227
228 class Pimpl;
229 friend class Pimpl;
230
231 std::unique_ptr<Pimpl> pimpl;
232 bool hasCalledConnect = false;
233
235};
236
237} // namespace juce
InputStream()=default
Definition juce_MemoryBlock.h:33
Definition juce_String.h:53
Definition juce_StringPairArray.h:35
Definition juce_URL.h:38
Definition juce_WebInputStream.h:97
virtual bool postDataSendProgress(WebInputStream &request, int bytesSent, int totalBytes)
Definition juce_WebInputStream.h:110
Definition juce_curl_Network.cpp:111
WebInputStream & withConnectionTimeout(int timeoutInMs)
Definition juce_WebInputStream.cpp:37
WebInputStream & withExtraHeaders(const String &extraHeaders)
Definition juce_WebInputStream.cpp:35
std::unique_ptr< Pimpl > pimpl
Definition juce_WebInputStream.h:231
WebInputStream & withNumRedirectsToFollow(int numRedirects)
Definition juce_WebInputStream.cpp:38
WebInputStream & withCustomRequestCommand(const String &customRequestCommand)
Definition juce_WebInputStream.cpp:36
bool hasCalledConnect
Definition juce_WebInputStream.h:232
WebInputStream(const URL &url, bool addParametersToRequestBody)
Definition juce_WebInputStream.cpp:26
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
#define JUCE_API
Definition juce_StandardHeader.h:152
Definition carla_juce.cpp:31
long long int64
Definition juce_MathsFunctions.h:54
void ignoreUnused(Types &&...) noexcept
Definition juce_MathsFunctions.h:333
zoff_t request
Definition extract.c:1037
read(f, &c, 1)