Feature request: URL class needs enhancements


#1

I have a some feature requests for the URL class.  Some of this is briefly touched upon by other people in the forum on some old posts from a few years ago:

  • basic auth support (username/password)
  • user-agent string

For web services which return JSON or XML, providing authentication and possibly custom user-agent strings is often required.

Some more advanced features for the URL class include the PUT and DELETE verbs.  I needed this tonight to interface to HighriseHQ [1] which uses all 4 verbs -- GET, POST, PUT, DELETE.

However, while typing up this message I re-read the doxygen block for URL::createInputStream() and it looks like I can use that to customize URL and add basic auth and user agent strings myself.  Will try it out.

[1] API is described here: https://github.com/basecamp/highrise-api


#2

Spent a bit of time tonight trying to figure out the URL class and why it wouldn't download XML and HTTP files.

The API I'm connecting to is sending back a "301 moved" and redirecting the JUCE WebInputStream to a https:// URL.

While the handler for 3xx status codes in createConnection() in juce_linux_Network.cpp lines #337-339 seems to hint that http://, https:// and ftp:// are handled, the code in decomposeURL() on line #470 returns a silent error for anything other than http://.

In the end, even though Wireshark was showing me a 301 status code was returned, URL::createInputStream() via decomposeURL() was returning a status code of zero, which led me on this wild goose chase.

In the end, I'm not surprised, I've worked a lot with OpenSSL on various platforms in the past, and it can be a pain to integrate into other libraries on platforms like Windows.  But if URL in JUCE doesn't support HTTPS, please add a note in the doxygen output for future users.

Thanks for everything, Jules.  I'm not blocked, I'll look at wget or curl and call into that instead to download what I need.


#3

Are you looking at an old version?

We did recently add curl support for linux - search for JUCE_USE_CURL or look in juce_curl_Network.cpp


#4

I'm on v3.2.0-146-ga760a1f.  While I'm personally developing on Linux, my customer runs on Windows.

Now I do see JUCE_USE_CURL; didn't know about it last night.  That comment you have about https/ssl in juce_core.h just before JUCE_USE_CURL...just place something like that into the URL class.