@@ -139,7 +139,7 @@ static int closesocket_callback(void __attribute__((unused)) *clientp, curl_sock
139139}
140140
141141static void https_log_data (enum LogSeverity level , struct https_fetch_ctx * ctx ,
142- char * ptr , size_t size )
142+ const char * prefix , char * ptr , size_t size )
143143{
144144 const size_t width = 0x10 ;
145145
@@ -167,7 +167,7 @@ static void https_log_data(enum LogSeverity level, struct https_fetch_ctx *ctx,
167167 }
168168 }
169169
170- LOG_REQ (level , "%4.4lx: %s%s" , (long )i , hex , str );
170+ LOG_REQ (level , "%s% 4.4lx: %s%s" , prefix , (long )i , hex , str );
171171 }
172172}
173173
@@ -191,10 +191,8 @@ int https_curl_debug(CURL __attribute__((unused)) * handle, curl_infotype type,
191191 // not dumping DNS packets because of privacy
192192 case CURLINFO_DATA_OUT :
193193 case CURLINFO_DATA_IN :
194- // uncomment, to dump
195- /* DLOG_REQ("data %s", type == CURLINFO_DATA_IN ? "IN" : "OUT");
196- * https_log_data(LOG_DEBUG, ctx, data, size);
197- * return 0; */
194+ https_log_data (LOG_DEBUG , ctx , (type == CURLINFO_DATA_IN ? "< " : "> " ), data , size );
195+ return 0 ;
198196 // uninformative
199197 case CURLINFO_SSL_DATA_OUT :
200198 case CURLINFO_SSL_DATA_IN :
@@ -206,7 +204,7 @@ int https_curl_debug(CURL __attribute__((unused)) * handle, curl_infotype type,
206204
207205 // for extra debugging purpose
208206 // if (type != CURLINFO_TEXT) {
209- // https_log_data(LOG_DEBUG, ctx, data, size);
207+ // https_log_data(LOG_DEBUG, ctx, "", data, size);
210208 // }
211209
212210 // process lines one-by one
@@ -217,7 +215,7 @@ int https_curl_debug(CURL __attribute__((unused)) * handle, curl_infotype type,
217215 // skip empty string and curl info Expire
218216 if (start != NULL && (pos - start ) > 0 &&
219217 strncmp (start , "Expire" , sizeof ("Expire" ) - 1 ) != 0 ) {
220- // https_log_data(LOG_DEBUG, ctx, start, pos - start);
218+ // https_log_data(LOG_DEBUG, ctx, "", start, pos - start);
221219 DLOG_REQ ("%s%.*s" , prefix , pos - start , start );
222220 start = NULL ;
223221 }
@@ -237,10 +235,8 @@ static const char * http_version_str(const long version) {
237235 case CURL_HTTP_VERSION_2_0 : // fallthrough
238236 case CURL_HTTP_VERSION_2TLS :
239237 return "2" ;
240- #ifdef CURL_VERSION_HTTP3
241238 case CURL_HTTP_VERSION_3 :
242239 return "3" ;
243- #endif
244240 default :
245241 FLOG ("Unsupported HTTP version: %d" , version );
246242 }
@@ -257,9 +253,7 @@ static void https_set_request_version(https_client_t *client,
257253 case 2 :
258254 break ;
259255 case 3 :
260- #ifdef CURL_VERSION_HTTP3
261256 http_version_int = CURL_HTTP_VERSION_3 ;
262- #endif
263257 break ;
264258 default :
265259 FLOG_REQ ("Invalid HTTP version: %d" , client -> opt -> use_http_version );
@@ -394,7 +388,7 @@ static int https_fetch_ctx_process_response(https_client_t *client,
394388 } else {
395389 WLOG_REQ ("curl response code: %d, content length: %zu" , long_resp , ctx -> buflen );
396390 if (ctx -> buflen > 0 ) {
397- https_log_data (LOG_WARNING , ctx , ctx -> buf , ctx -> buflen );
391+ https_log_data (LOG_WARNING , ctx , "" , ctx -> buf , ctx -> buflen );
398392 }
399393 }
400394 }
0 commit comments