Skip to content

urldata cleanups - #22604

Closed
icing wants to merge 2 commits into
curl:masterfrom
icing:urldata-cleanup
Closed

icing wants to merge 2 commits into
curl:masterfrom
icing:urldata-cleanup

Conversation

@icing

@icing icing commented Aug 17, 2026

Copy link
Copy Markdown
Contributor
  • sockindex: int -> int8_t
  • move connectdata members around for fun and profit
  • remove data->state.current_speed as unused
  • remove data->state.trailers_bytes_sent as unsed
  • remove data->state.trailers_buf as unsed

The sockindex type change spread a little.

- sockindex: int -> int8_t
- move connectdata members around for fun and profit
- remove data->state.current_speed as unused
- remove data->state.trailers_bytes_sent as unsed
- remove data->state.trailers_buf as unsed

The sockindex type change spread a little.
@icing
icing marked this pull request as ready for review August 17, 2026 11:23
@icing
icing requested a review from bagder August 17, 2026 11:23
@bagder
bagder requested a lite review from Copilot August 17, 2026 11:27
Comment thread lib/ws.c Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR performs internal urldata/connection housekeeping by shrinking the socket-index type to int8_t, reorganizing connectdata/UrlState members, and removing a few unused UrlState fields. It also updates several call sites and logging to align with these internal structure changes.

Changes:

  • Change many internal APIs and struct members from int to int8_t for sockindex / send+recv indices.
  • Reorder struct connectdata and struct UrlState members; replace keepalive tracking with lastupkeep and extend timestamp bookkeeping.
  • Remove unused data->state.current_speed, data->state.trailers_bytes_sent, and data->state.trailers_buf, plus related initializations.

Reviewed changes

Copilot reviewed 34 out of 34 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
lib/ws.c Header comment edit (currently introduces a broken URL).
lib/vtls/vtls.h Update internal TLS function prototypes to int8_t sockindex.
lib/vtls/vtls.c Adjust TLS implementation signatures to int8_t sockindex.
lib/vtls/vtls_int.h Update vtls internal function pointer/prototypes to int8_t sockindex.
lib/vtls/openssl.c Update OpenSSL vtls callback signature to int8_t sockindex.
lib/vssh/libssh2.c Use int8_t sockindex from Curl_conn_sockindex().
lib/vssh/libssh.c Update internal SSH helpers to int8_t sockindex.
lib/vdns/cf-dns.h Update DNS cfilter APIs to int8_t sockindex.
lib/vdns/cf-dns.c Update DNS cfilter implementation signatures/usages to int8_t sockindex.
lib/urldata.h Reorder connectdata/UrlState; change send/recv typedefs and indices to int8_t; remove unused UrlState trailer fields.
lib/url.c Remove state.current_speed init; adjust conn init timestamps; use int8_t loop index for cfilter cleanup.
lib/transfer.h Update transfer setup APIs to int8_t sockindex.
lib/transfer.c Update transfer setup implementation to int8_t send/recv indices.
lib/pingpong.h Update pingpong read response API to int8_t sockindex.
lib/pingpong.c Update pingpong read implementation signature to int8_t sockindex.
lib/openldap.c Update LDAP recv callback signature to int8_t sockindex.
lib/multi.c Update connection completion logging to include host+port (currently with a varargs type mismatch).
lib/http2.h Update HTTP/2 upgrade API to int8_t sockindex.
lib/http2.c Update HTTP/2 filter/upgrade implementation signatures to int8_t sockindex.
lib/ftp.c Update FTP read-response signature to int8_t sockindex.
lib/easy.c Adjust curl_easy_reset() state initialization to match removed fields/order.
lib/connect.h Update connection/shutdown/origin APIs to int8_t sockindex.
lib/connect.c Update connection/shutdown/origin implementations to int8_t sockindex; update upkeep timestamp field used.
lib/conncache.c Update idle/health/upkeep timestamp tracking (lastchecked, lastupkeep, lastused).
lib/cfilters.h Update cfilter API surface (sockindex types, Curl_conn_sockindex() return type).
lib/cfilters.c Update cfilter implementations to use int8_t sockindex.
lib/cf-socket.h Update socket cfilter APIs to int8_t sockindex.
lib/cf-socket.c Update socket cfilter implementations to int8_t sockindex.
lib/cf-setup.h Update setup cfilter API to int8_t sockindex.
lib/cf-setup.c Update setup cfilter implementations to int8_t sockindex.
lib/cf-recvbuf.h Update recvbuf cfilter API to int8_t sockindex.
lib/cf-recvbuf.c Update recvbuf cfilter implementations to int8_t sockindex.
lib/cf-https-connect.h Update HTTPS-CONNECT cfilter API to int8_t sockindex.
lib/cf-https-connect.c Update HTTPS-CONNECT cfilter implementations to int8_t sockindex.
Suppressed comments (2)

lib/multi.c:665

  • This printf-style call uses "%u" but passes conn->origin->port (uint16_t), which is promoted to int in varargs on typical platforms. That type mismatch is undefined behavior. Cast the port to unsigned int (or adjust the format) before passing it.
               conn->origin->user_hostname, conn->origin->port);

lib/multi.c:675

  • This printf-style call uses "%u" but passes conn->origin->port (uint16_t), which is promoted to int in varargs on typical platforms. That type mismatch is undefined behavior. Cast the port to unsigned int (or adjust the format) before passing it.
            conn->origin->port);

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread lib/ws.c Outdated
Comment thread lib/multi.c
(I need a cat this this excuse to work)
@bagder bagder closed this in c437d28 Aug 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants