File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed
Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -183,18 +183,22 @@ static int gen_request(
183183{
184184 http_subtransport * t = OWNING_SUBTRANSPORT (s );
185185 const char * path = t -> server .url .path ? t -> server .url .path : "/" ;
186+ const char * service_url = s -> service_url ;
186187 size_t i ;
188+ /* If path already ends in /, remove the leading slash from service_url */
189+ if ((git__suffixcmp (path , "/" ) == 0 ) && (git__prefixcmp (service_url , "/" ) == 0 ))
190+ service_url ++ ;
187191
188192 if (t -> proxy_opts .type == GIT_PROXY_SPECIFIED )
189193 git_buf_printf (buf , "%s %s://%s:%s%s%s HTTP/1.1\r\n" ,
190194 s -> verb ,
191195 t -> server .url .scheme ,
192196 t -> server .url .host ,
193197 t -> server .url .port ,
194- path , s -> service_url );
198+ path , service_url );
195199 else
196200 git_buf_printf (buf , "%s %s%s HTTP/1.1\r\n" ,
197- s -> verb , path , s -> service_url );
201+ s -> verb , path , service_url );
198202
199203 git_buf_puts (buf , "User-Agent: " );
200204 git_http__user_agent (buf );
Original file line number Diff line number Diff line change @@ -373,11 +373,15 @@ static int winhttp_stream_connect(winhttp_stream *s)
373373 int default_connect_timeout = DEFAULT_CONNECT_TIMEOUT ;
374374 DWORD autologon_policy = WINHTTP_AUTOLOGON_SECURITY_LEVEL_HIGH ;
375375
376+ const char * service_url = s -> service_url ;
376377 size_t i ;
377378 const git_proxy_options * proxy_opts ;
378379
380+ /* If path already ends in /, remove the leading slash from service_url */
381+ if ((git__suffixcmp (t -> server .url .path , "/" ) == 0 ) && (git__prefixcmp (service_url , "/" ) == 0 ))
382+ service_url ++ ;
379383 /* Prepare URL */
380- git_buf_printf (& buf , "%s%s" , t -> server .url .path , s -> service_url );
384+ git_buf_printf (& buf , "%s%s" , t -> server .url .path , service_url );
381385
382386 if (git_buf_oom (& buf ))
383387 return -1 ;
You can’t perform that action at this time.
0 commit comments