curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

CURLUPART_PATH not inserting leading slash

From: Pedro Henrique via curl-library <>
Date: Thu, 8 Jun 2023 00:27:10 +0000

Before anything, I should say I'm running libcurl 7.88.1
With that said, the docs say
> If a path is set in the URL without a leading slash, a slash will be inserted automatically when this URL is read from the handle.

but the code below results in 400 Bad Request due to the lack of the forward slash.
So is it a bug or not?

#include "curl/curl.h"

int main( void )
        curl_global_init( CURL_GLOBAL_DEFAULT );

        CURLU *curlu = curl_url();

        curl_url_set( curlu, CURLUPART_URL, "", 0 );
        curl_url_set( curlu, CURLUPART_PATH, "get", 0 );

        CURL *curl = curl_easy_init();
        curl_easy_setopt( curl, CURLOPT_VERBOSE, 1L );
        curl_easy_setopt( curl, CURLOPT_CURLU, curlu );
        curl_easy_perform( curl );

        curl_url_cleanup( curlu );
Received on 2023-06-08