WordPress / WordPress/Requests

Redirect error when server returns invalid Location HTTP header

Open
#229 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Component: Core
Dominant language
PHP
Stars
3.6k
Forks
500
Avg merge
2d 21h
Merged PRs (30d)
5

Description

The header is as follows:

HTTP/1.1 301 Moved Permanently
Server: nginx/1.10.1
Date: Mon, 15 Aug 2016 09:14:49 GMT
Content-Type: text/html; charset=UTF-8
Content-Length: 0
Connection: keep-alive
X-Powered-By: PHP/5.6.20
Location: index.html

so the $location here is 'index.html' and then throws Requests_Exception with message 'Only HTTP requests are handled.'

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 at library/Requests.php around line 706, where the Location header is processed, and reproduce the response with the shown 301 header. Trace the redirect handling and add coverage for this relative Location value; done means the redirect no longer raises the “Only HTTP requests are handled” exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
api, networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.