@@ -82,7 +82,7 @@ static slock_t *conn_pool_lock = NULL;
8282
8383struct http_t
8484{
85- bool error ;
85+ bool err ;
8686
8787 struct conn_pool_entry * conn ;
8888 bool ssl ;
@@ -700,15 +700,15 @@ static void net_http_conn_pool_remove_expired(void)
700700 if (!entry -> in_use && FD_ISSET (entry -> fd , & fds ))
701701 {
702702 char buf [4096 ];
703- bool error = false;
703+ bool err = false;
704704#ifdef HAVE_SSL
705705 if (entry -> ssl && entry -> ssl_ctx )
706- ssl_socket_receive_all_nonblocking (entry -> ssl_ctx , & error , buf , sizeof (buf ));
706+ ssl_socket_receive_all_nonblocking (entry -> ssl_ctx , & err , buf , sizeof (buf ));
707707 else
708708#endif
709- socket_receive_all_nonblocking (entry -> fd , & error , buf , sizeof (buf ));
709+ socket_receive_all_nonblocking (entry -> fd , & err , buf , sizeof (buf ));
710710
711- if (!error )
711+ if (!err )
712712 continue ;
713713
714714 if (prev )
@@ -993,10 +993,10 @@ static bool net_http_connect(struct http_t *state)
993993 return true;
994994 }
995995 }
996- conn -> fd = -1 ; /* already closed */
996+ conn -> fd = -1 ; /* already closed */
997997 net_http_conn_pool_remove (conn );
998998 state -> conn = NULL ;
999- state -> error = true;
999+ state -> err = true;
10001000 return false;
10011001 }
10021002 else
@@ -1012,32 +1012,32 @@ static bool net_http_connect(struct http_t *state)
10121012
10131013 socket_close (conn -> fd );
10141014 }
1015- conn -> fd = -1 ; /* already closed */
1015+ conn -> fd = -1 ; /* already closed */
10161016 net_http_conn_pool_remove (conn );
10171017 state -> conn = NULL ;
1018- state -> error = true;
1018+ state -> err = true;
10191019 return false;
10201020 }
10211021}
10221022
10231023static void net_http_send_str (
10241024 struct http_t * state , const char * text , size_t text_size )
10251025{
1026- if (state -> error )
1026+ if (state -> err )
10271027 return ;
10281028#ifdef HAVE_SSL
10291029 if (state -> ssl )
10301030 {
10311031 if (!ssl_socket_send_all_blocking (
10321032 state -> conn -> ssl_ctx , text , text_size , true))
1033- state -> error = true;
1033+ state -> err = true;
10341034 }
10351035 else
10361036#endif
10371037 {
10381038 if (!socket_send_all_blocking (
10391039 state -> conn -> fd , text , text_size , true))
1040- state -> error = true;
1040+ state -> err = true;
10411041 }
10421042}
10431043
@@ -1090,7 +1090,7 @@ static bool net_http_send_request(struct http_t *state)
10901090
10911091 if (!request -> postdata && !string_is_equal (request -> method , "PUT" ))
10921092 {
1093- state -> error = true;
1093+ state -> err = true;
10941094 return true;
10951095 }
10961096
@@ -1133,7 +1133,7 @@ static bool net_http_send_request(struct http_t *state)
11331133 net_http_send_str (state , request -> postdata , request -> contentlength );
11341134
11351135 state -> request_sent = true;
1136- return state -> error ;
1136+ return state -> err ;
11371137}
11381138
11391139/**
@@ -1175,7 +1175,7 @@ static ssize_t net_http_receive_header(struct http_t *state, ssize_t newlen)
11751175 if (strncmp (response -> data , "HTTP/1." , STRLEN_CONST ("HTTP/1." ))!= 0 )
11761176 {
11771177 response -> part = P_DONE ;
1178- state -> error = true;
1178+ state -> err = true;
11791179 return -1 ;
11801180 }
11811181 response -> status = (int )strtoul (response -> data
@@ -1246,7 +1246,7 @@ static bool net_http_receive_body(struct http_t *state, ssize_t newlen)
12461246{
12471247 struct response * response = & state -> response ;
12481248
1249- if (newlen < 0 || state -> error )
1249+ if (newlen < 0 || state -> err )
12501250 {
12511251 if (response -> bodytype != T_FULL )
12521252 return false;
@@ -1412,7 +1412,7 @@ bool net_http_update(struct http_t *state, size_t* progress, size_t* total)
14121412 if (!state )
14131413 return true;
14141414
1415- if (state -> error )
1415+ if (state -> err )
14161416 return true;
14171417
14181418 if (!state -> conn )
@@ -1421,16 +1421,16 @@ bool net_http_update(struct http_t *state, size_t* progress, size_t* total)
14211421 if (!state -> conn )
14221422 {
14231423 if (!net_http_new_socket (state ))
1424- state -> error = true;
1425- return state -> error ;
1424+ state -> err = true;
1425+ return state -> err ;
14261426 }
14271427 }
14281428
14291429 if (!state -> conn -> connected )
14301430 {
14311431 if (!net_http_connect (state ))
1432- state -> error = true;
1433- return state -> error ;
1432+ state -> err = true;
1433+ return state -> err ;
14341434 }
14351435
14361436 if (!state -> request_sent )
@@ -1440,18 +1440,18 @@ bool net_http_update(struct http_t *state, size_t* progress, size_t* total)
14401440
14411441#ifdef HAVE_SSL
14421442 if (state -> ssl && state -> conn -> ssl_ctx )
1443- newlen = ssl_socket_receive_all_nonblocking (state -> conn -> ssl_ctx , & state -> error ,
1443+ newlen = ssl_socket_receive_all_nonblocking (state -> conn -> ssl_ctx , & state -> err ,
14441444 (uint8_t * )response -> data + response -> pos ,
14451445 response -> buflen - response -> pos );
14461446 else
14471447#endif
1448- newlen = socket_receive_all_nonblocking (state -> conn -> fd , & state -> error ,
1448+ newlen = socket_receive_all_nonblocking (state -> conn -> fd , & state -> err ,
14491449 (uint8_t * )response -> data + response -> pos ,
14501450 response -> buflen - response -> pos );
14511451
14521452 if (response -> part < P_BODY )
14531453 {
1454- if (newlen < 0 || state -> error )
1454+ if (newlen < 0 || state -> err )
14551455 goto error ;
14561456 newlen = net_http_receive_header (state , newlen );
14571457 }
@@ -1505,7 +1505,7 @@ bool net_http_update(struct http_t *state, size_t* progress, size_t* total)
15051505
15061506error :
15071507 net_http_conn_pool_remove (state -> conn );
1508- state -> error = true;
1508+ state -> err = true;
15091509 response -> part = P_DONE ;
15101510 response -> status = -1 ;
15111511 return true;
@@ -1534,14 +1534,14 @@ int net_http_status(struct http_t *state)
15341534 *
15351535 * @return the response headers. The returned buffer is owned by the
15361536 * caller of net_http_new; it is not freed by net_http_delete().
1537- * If the status is not 20x and accept_error is false, it returns NULL.
1537+ * If the status is not 20x and accept_err is false, it returns NULL.
15381538 **/
15391539struct string_list * net_http_headers (struct http_t * state )
15401540{
15411541 if (!state )
15421542 return NULL ;
15431543
1544- if (state -> error )
1544+ if (state -> err )
15451545 return NULL ;
15461546
15471547 return state -> response .headers ;
@@ -1554,14 +1554,14 @@ struct string_list *net_http_headers(struct http_t *state)
15541554 *
15551555 * @return the downloaded data. The returned buffer is owned by the
15561556 * HTTP handler; it's freed by net_http_delete().
1557- * If the status is not 20x and accept_error is false, it returns NULL.
1557+ * If the status is not 20x and accept_err is false, it returns NULL.
15581558 **/
1559- uint8_t * net_http_data (struct http_t * state , size_t * len , bool accept_error )
1559+ uint8_t * net_http_data (struct http_t * state , size_t * len , bool accept_err )
15601560{
15611561 if (!state )
15621562 return NULL ;
15631563
1564- if (!accept_error && (state -> error || state -> response .status < 200 || state -> response .status > 299 ))
1564+ if (!accept_err && (state -> err || state -> response .status < 200 || state -> response .status > 299 ))
15651565 {
15661566 if (len )
15671567 * len = 0 ;
@@ -1610,5 +1610,5 @@ void net_http_delete(struct http_t *state)
16101610 **/
16111611bool net_http_error (struct http_t * state )
16121612{
1613- return (state -> error || state -> response .status < 200 || state -> response .status > 299 );
1613+ return (state -> err || state -> response .status < 200 || state -> response .status > 299 );
16141614}
0 commit comments