@@ -37,6 +37,9 @@ static const char *receive_pack_service_url = "/git-receive-pack";
3737static const char * get_verb = "GET" ;
3838static const char * post_verb = "POST" ;
3939
40+ #define AUTH_HEADER_SERVER "Authorization"
41+ #define AUTH_HEADER_PROXY "Proxy-Authorization"
42+
4043#define SERVER_TYPE_REMOTE "remote"
4144#define SERVER_TYPE_PROXY "proxy"
4245
@@ -179,7 +182,10 @@ static int auth_context_match(
179182 return 0 ;
180183}
181184
182- static int apply_credentials (git_buf * buf , http_server * server )
185+ static int apply_credentials (
186+ git_buf * buf ,
187+ http_server * server ,
188+ const char * header_name )
183189{
184190 git_cred * cred = server -> cred ;
185191 git_http_auth_context * context ;
@@ -205,7 +211,7 @@ static int apply_credentials(git_buf *buf, http_server *server)
205211 if (!context )
206212 return 0 ;
207213
208- return context -> next_token (buf , context , cred );
214+ return context -> next_token (buf , context , header_name , cred );
209215}
210216
211217static int gen_request (
@@ -253,8 +259,9 @@ static int gen_request(
253259 git_buf_printf (buf , "%s\r\n" , t -> owner -> custom_headers .strings [i ]);
254260 }
255261
256- /* Apply credentials to the request */
257- if (apply_credentials (buf , & t -> server ) < 0 )
262+ /* Apply proxy and server credentials to the request */
263+ if (apply_credentials (buf , & t -> proxy , AUTH_HEADER_PROXY ) < 0 ||
264+ apply_credentials (buf , & t -> server , AUTH_HEADER_SERVER ) < 0 )
258265 return -1 ;
259266
260267 git_buf_puts (buf , "\r\n" );
0 commit comments