WordPress / WordPress/Requests

Add new class to improving handling of URLs

Open
#742 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Component: Transports Type: enhancement Type: testing/chores/QA
Dominant language
PHP
Stars
3.6k
Forks
500
Avg merge
2d 21h
Merged PRs (30d)
5

Description

Both the Curl as well as the Fsockopen class contain a format_get() method which build a URL from parts.
These methods are inconsistent and handle the URL building slightly differently.

If I remember correctly, there are also other places in the Requests code where URLs are split/rebuild in various ways.

We should look into creating a class to handle this properly and consistently for all places this kind of functionality is needed in Requests.

That class should make use of the Iri class for splitting URLs and should contain a consistent way to (re)build a URL.

Separating this type of logic out to a separate class will reduce code duplication, reduce technical debt and improve the testability of the logic involved.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by examining the Curl and Fsockopen classes, especially their format_get() methods, and then inspect the Iri class and other places in Requests where URLs are split or rebuilt. Done means URL handling is centralized in a consistent class using Iri, with the duplicated logic removed and the behavior made testable.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
networking
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.