[haiku-development] Services Kit API questions

  • From: Hamish Morrison <hamishm53@xxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Tue, 05 Feb 2013 17:51:59 +0000

Hi all,

Recently I've been hacking on the services kit, with the intention of
getting it cleaned up so it can be used for a network backend in the
WebKit port.

There are a couple of parts of the BUrlRequest API that are bothering me.

BUrlRequest tries to provide a protocol agnostic interface for setting
request options: BUrlRequest::SetOption(int32 option, void* value)
The option and value are passed through to the BUrlProtocolXYZ instance.
This seems a little ugly to me, and requires the user to know which
protocol was instantiated in order to set valid options. Why not just
have some setters on BUrlRequest for common options (user/pw
authentication, redirection settings, custom HTTP headers), and then
specific BUrlProtocols can use or ignore these options as appropriate?

The BUrlProtocol instance being used to handle the specifics of the
protocol is exposed to the user, which seems unnecessary as it provides
no more information than the BUrlRequest. Maybe the BUrlProtocol classes
be kept private?

BUrlProtocol currently counts both connection/processing errors and
protocol errors (e.g. HTTP 404) as request failures. This seems a little
confusing, because if a protocol error occurred there will still be a
valid UrlResult available (maybe containing an error page). Perhaps some
distinction should be made here?

Regards,
Hamish

Other related posts: