@@ -154,7 +154,7 @@ static int on_header_complete(http_parser *parser)
154154
155155 if (!strcasecmp ("Content-Type" , name -> ptr )) {
156156 if (response -> content_type ) {
157- git_error_set (GIT_ERROR_NET ,
157+ git_error_set (GIT_ERROR_HTTP ,
158158 "multiple content-type headers" );
159159 return -1 ;
160160 }
@@ -166,14 +166,14 @@ static int on_header_complete(http_parser *parser)
166166 int64_t len ;
167167
168168 if (response -> content_length ) {
169- git_error_set (GIT_ERROR_NET ,
169+ git_error_set (GIT_ERROR_HTTP ,
170170 "multiple content-length headers" );
171171 return -1 ;
172172 }
173173
174174 if (git__strntol64 (& len , value -> ptr , value -> size ,
175175 NULL , 10 ) < 0 || len < 0 ) {
176- git_error_set (GIT_ERROR_NET ,
176+ git_error_set (GIT_ERROR_HTTP ,
177177 "invalid content-length" );
178178 return -1 ;
179179 }
@@ -196,7 +196,7 @@ static int on_header_complete(http_parser *parser)
196196 return -1 ;
197197 } else if (!strcasecmp ("Location" , name -> ptr )) {
198198 if (response -> location ) {
199- git_error_set (GIT_ERROR_NET ,
199+ git_error_set (GIT_ERROR_HTTP ,
200200 "multiple location headers" );
201201 return -1 ;
202202 }
@@ -235,7 +235,7 @@ static int on_header_field(http_parser *parser, const char *str, size_t len)
235235 break ;
236236
237237 default :
238- git_error_set (GIT_ERROR_NET ,
238+ git_error_set (GIT_ERROR_HTTP ,
239239 "header name seen at unexpected time" );
240240 return ctx -> parse_status = PARSE_STATUS_ERROR ;
241241 }
@@ -258,7 +258,7 @@ static int on_header_value(http_parser *parser, const char *str, size_t len)
258258 break ;
259259
260260 default :
261- git_error_set (GIT_ERROR_NET ,
261+ git_error_set (GIT_ERROR_HTTP ,
262262 "header value seen at unexpected time" );
263263 return ctx -> parse_status = PARSE_STATUS_ERROR ;
264264 }
@@ -348,7 +348,7 @@ static int on_headers_complete(http_parser *parser)
348348 break ;
349349
350350 default :
351- git_error_set (GIT_ERROR_NET ,
351+ git_error_set (GIT_ERROR_HTTP ,
352352 "header completion at unexpected time" );
353353 return ctx -> parse_status = PARSE_STATUS_ERROR ;
354354 }
@@ -511,14 +511,14 @@ static const char *init_auth_context(
511511 int error ;
512512
513513 if (!best_scheme_and_challenge (& scheme , & challenge , challenges , credentials )) {
514- git_error_set (GIT_ERROR_NET , "could not find appropriate mechanism for credentials" );
514+ git_error_set (GIT_ERROR_HTTP , "could not find appropriate mechanism for credentials" );
515515 return NULL ;
516516 }
517517
518518 error = scheme -> init_context (& server -> auth_context , & server -> url );
519519
520520 if (error == GIT_PASSTHROUGH ) {
521- git_error_set (GIT_ERROR_NET , "'%s' authentication is not supported" , scheme -> name );
521+ git_error_set (GIT_ERROR_HTTP , "'%s' authentication is not supported" , scheme -> name );
522522 return NULL ;
523523 }
524524
@@ -585,7 +585,7 @@ static int apply_credentials(
585585 if (auth -> connection_affinity )
586586 free_auth_context (server );
587587 } else if (!token .size ) {
588- git_error_set (GIT_ERROR_NET , "failed to respond to authentication challange" );
588+ git_error_set (GIT_ERROR_HTTP , "failed to respond to authentication challange" );
589589 error = -1 ;
590590 goto done ;
591591 }
@@ -745,7 +745,7 @@ static int check_certificate(
745745 else if (error == GIT_PASSTHROUGH )
746746 error = 0 ;
747747 else if (error && !git_error_last ())
748- git_error_set (GIT_ERROR_NET ,
748+ git_error_set (GIT_ERROR_HTTP ,
749749 "user rejected certificate for %s" , url -> host );
750750
751751 git_error_state_free (& last_error );
@@ -864,7 +864,7 @@ GIT_INLINE(int) server_create_stream(git_http_server *server)
864864 else if (strcasecmp (url -> scheme , "http" ) == 0 )
865865 return git_socket_stream_new (& server -> stream , url -> host , url -> port );
866866
867- git_error_set (GIT_ERROR_NET , "unknown http scheme '%s'" , url -> scheme );
867+ git_error_set (GIT_ERROR_HTTP , "unknown http scheme '%s'" , url -> scheme );
868868 return -1 ;
869869}
870870
@@ -920,7 +920,7 @@ static int proxy_connect(
920920 error = GIT_RETRY ;
921921 goto done ;
922922 } else if (response .status != GIT_HTTP_STATUS_OK ) {
923- git_error_set (GIT_ERROR_NET , "proxy returned unexpected status: %d" , response .status );
923+ git_error_set (GIT_ERROR_HTTP , "proxy returned unexpected status: %d" , response .status );
924924 error = -1 ;
925925 goto done ;
926926 }
@@ -1044,7 +1044,7 @@ GIT_INLINE(int) client_read(git_http_client *client)
10441044 max_len = min (max_len , INT_MAX );
10451045
10461046 if (max_len == 0 ) {
1047- git_error_set (GIT_ERROR_NET , "no room in output buffer" );
1047+ git_error_set (GIT_ERROR_HTTP , "no room in output buffer" );
10481048 return -1 ;
10491049 }
10501050
@@ -1101,12 +1101,12 @@ GIT_INLINE(int) client_read_and_parse(git_http_client *client)
11011101 http_errno = client -> parser .http_errno ;
11021102
11031103 if (parsed_len > INT_MAX ) {
1104- git_error_set (GIT_ERROR_NET , "unexpectedly large parse" );
1104+ git_error_set (GIT_ERROR_HTTP , "unexpectedly large parse" );
11051105 return -1 ;
11061106 }
11071107
11081108 if (parser -> upgrade ) {
1109- git_error_set (GIT_ERROR_NET , "server requested upgrade" );
1109+ git_error_set (GIT_ERROR_HTTP , "server requested upgrade" );
11101110 return -1 ;
11111111 }
11121112
@@ -1140,22 +1140,22 @@ GIT_INLINE(int) client_read_and_parse(git_http_client *client)
11401140
11411141 /* Most failures will be reported in http_errno */
11421142 else if (parser -> http_errno != HPE_OK ) {
1143- git_error_set (GIT_ERROR_NET , "http parser error: %s" ,
1143+ git_error_set (GIT_ERROR_HTTP , "http parser error: %s" ,
11441144 http_errno_description (http_errno ));
11451145 return -1 ;
11461146 }
11471147
11481148 /* Otherwise we should have consumed the entire buffer. */
11491149 else if (parsed_len != client -> read_buf .size ) {
1150- git_error_set (GIT_ERROR_NET ,
1150+ git_error_set (GIT_ERROR_HTTP ,
11511151 "http parser did not consume entire buffer: %s" ,
11521152 http_errno_description (http_errno ));
11531153 return -1 ;
11541154 }
11551155
11561156 /* recv returned 0, the server hung up on us */
11571157 else if (!parsed_len ) {
1158- git_error_set (GIT_ERROR_NET , "unexpected EOF" );
1158+ git_error_set (GIT_ERROR_HTTP , "unexpected EOF" );
11591159 return -1 ;
11601160 }
11611161
@@ -1281,7 +1281,7 @@ int git_http_client_send_body(
12811281 return 0 ;
12821282
12831283 if (client -> state != SENDING_BODY ) {
1284- git_error_set (GIT_ERROR_NET , "client is in invalid state" );
1284+ git_error_set (GIT_ERROR_HTTP , "client is in invalid state" );
12851285 return -1 ;
12861286 }
12871287
@@ -1317,7 +1317,7 @@ static int complete_request(git_http_client *client)
13171317 assert (client && client -> state == SENDING_BODY );
13181318
13191319 if (client -> request_body_len && client -> request_body_remain ) {
1320- git_error_set (GIT_ERROR_NET , "truncated write" );
1320+ git_error_set (GIT_ERROR_HTTP , "truncated write" );
13211321 error = -1 ;
13221322 } else if (client -> request_chunked ) {
13231323 error = stream_write (& client -> server , "0\r\n\r\n" , 5 );
@@ -1349,7 +1349,7 @@ int git_http_client_read_response(
13491349 }
13501350
13511351 if (client -> state != SENT_REQUEST ) {
1352- git_error_set (GIT_ERROR_NET , "client is in invalid state" );
1352+ git_error_set (GIT_ERROR_HTTP , "client is in invalid state" );
13531353 error = -1 ;
13541354 goto done ;
13551355 }
@@ -1392,7 +1392,7 @@ int git_http_client_read_body(
13921392 return 0 ;
13931393
13941394 if (client -> state != READING_BODY ) {
1395- git_error_set (GIT_ERROR_NET , "client is in invalid state" );
1395+ git_error_set (GIT_ERROR_HTTP , "client is in invalid state" );
13961396 return -1 ;
13971397 }
13981398
@@ -1438,7 +1438,7 @@ int git_http_client_skip_body(git_http_client *client)
14381438 return 0 ;
14391439
14401440 if (client -> state != READING_BODY ) {
1441- git_error_set (GIT_ERROR_NET , "client is in invalid state" );
1441+ git_error_set (GIT_ERROR_HTTP , "client is in invalid state" );
14421442 return -1 ;
14431443 }
14441444
@@ -1451,7 +1451,7 @@ int git_http_client_skip_body(git_http_client *client)
14511451 if (parser_context .error != HPE_OK ||
14521452 (parser_context .parse_status != PARSE_STATUS_OK &&
14531453 parser_context .parse_status != PARSE_STATUS_NO_OUTPUT )) {
1454- git_error_set (GIT_ERROR_NET ,
1454+ git_error_set (GIT_ERROR_HTTP ,
14551455 "unexpected data handled in callback" );
14561456 error = -1 ;
14571457 }
0 commit comments