File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4587,15 +4587,12 @@ static CURLcode req_assign_url_authority(struct httpreq *req, CURLU *url)
45874587 if (result )
45884588 goto out ;
45894589 }
4590- req -> authority = strdup (curlx_dyn_ptr (& buf ));
4591- if (!req -> authority )
4592- goto out ;
4593- result = CURLE_OK ;
4594-
4590+ req -> authority = curlx_dyn_ptr (& buf );
45954591out :
45964592 free (host );
45974593 free (port );
4598- curlx_dyn_free (& buf );
4594+ if (result )
4595+ curlx_dyn_free (& buf );
45994596 return result ;
46004597}
46014598
@@ -4609,41 +4606,32 @@ static CURLcode req_assign_url_path(struct httpreq *req, CURLU *url)
46094606 path = query = NULL ;
46104607 curlx_dyn_init (& buf , DYN_HTTP_REQUEST );
46114608
4612- uc = curl_url_get (url , CURLUPART_PATH , & path , CURLU_PATH_AS_IS );
4609+ uc = curl_url_get (url , CURLUPART_PATH , & path , 0 );
46134610 if (uc )
46144611 goto out ;
46154612 uc = curl_url_get (url , CURLUPART_QUERY , & query , 0 );
46164613 if (uc && uc != CURLUE_NO_QUERY )
46174614 goto out ;
46184615
4619- if (!path && !query ) {
4620- req -> path = NULL ;
4621- }
4622- else if (path && !query ) {
4616+ if (!query ) {
46234617 req -> path = path ;
46244618 path = NULL ;
46254619 }
46264620 else {
4627- if (path ) {
4628- result = curlx_dyn_add (& buf , path );
4629- if (result )
4630- goto out ;
4631- }
4632- if (query ) {
4621+ result = curlx_dyn_add (& buf , path );
4622+ if (!result )
46334623 result = curlx_dyn_addf (& buf , "?%s" , query );
4634- if (result )
4635- goto out ;
4636- }
4637- req -> path = strdup (curlx_dyn_ptr (& buf ));
4638- if (!req -> path )
4624+ if (result )
46394625 goto out ;
4626+ req -> path = curlx_dyn_ptr (& buf );
46404627 }
46414628 result = CURLE_OK ;
46424629
46434630out :
46444631 free (path );
46454632 free (query );
4646- curlx_dyn_free (& buf );
4633+ if (result )
4634+ curlx_dyn_free (& buf );
46474635 return result ;
46484636}
46494637
You can’t perform that action at this time.
0 commit comments