mirror of
https://review.haiku-os.org/haiku
synced 2025-01-19 13:01:29 +01:00
3e27f8d5a7
The switch to make BUrlResult serializable was debuted in f9e1854f198d4200f21a9cbe29fdfb0fabbe192f with the rationale is that BHttpRequest auto-redirection might cause the headers to become obsolete by the time a client process the BMessage received from BUrlProtocolDispatchingListener. With the change to BHttpRequest to not notify listeners when auto-redirection is enabled, this is no longer the case and the serialization code can go away now. This simplifies BUrlResult and its subclasses, and gain us some performance for clients using BUrlProtocolDispatchingListener as the result object no longer has to be serialized. This also change the ABI of BUrlProtocolListener::HeadersReceived to no longer passing a BUrlResult. Additionally, BUrlResult and BHttpResult now express the size of the content as an off_t, thus allowing results larger than 4 GB. Change-Id: I9dd29a8b26fdd9aa8e5bbad8d1728084f136312d Reviewed-on: https://review.haiku-os.org/c/haiku/+/3082 Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
66 lines
1.1 KiB
C++
66 lines
1.1 KiB
C++
/*
|
|
* Copyright 2010-2017 Haiku Inc. All rights reserved.
|
|
* Distributed under the terms of the MIT License.
|
|
*/
|
|
#ifndef _B_URL_RESULT_H_
|
|
#define _B_URL_RESULT_H_
|
|
|
|
|
|
#include <String.h>
|
|
|
|
|
|
#ifdef LIBNETAPI_DEPRECATED
|
|
#include <Archivable.h>
|
|
|
|
|
|
class BUrlResult: public BArchivable {
|
|
public:
|
|
BUrlResult();
|
|
BUrlResult(BMessage*);
|
|
virtual ~BUrlResult();
|
|
|
|
virtual status_t Archive(BMessage*, bool) const;
|
|
|
|
void SetContentType(BString contentType);
|
|
void SetLength(size_t length);
|
|
|
|
virtual BString ContentType() const;
|
|
virtual size_t Length() const;
|
|
|
|
static BArchivable* Instantiate(BMessage*);
|
|
|
|
private:
|
|
BString fContentType;
|
|
size_t fLength;
|
|
};
|
|
|
|
#else
|
|
|
|
namespace BPrivate {
|
|
|
|
namespace Network {
|
|
|
|
class BUrlResult {
|
|
public:
|
|
BUrlResult();
|
|
virtual ~BUrlResult();
|
|
|
|
void SetContentType(BString contentType);
|
|
void SetLength(off_t length);
|
|
|
|
virtual BString ContentType() const;
|
|
virtual off_t Length() const;
|
|
|
|
private:
|
|
BString fContentType;
|
|
off_t fLength;
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif // LIBNETAPI_DEPRECATED
|
|
|
|
#endif // _B_URL_RESULT_H_
|