Contribution pages for unregistered usernames should not show HTML 404 if there are any revisions listed on the page, possibly imported from other wikis.
@GeoffreyT2000: Please follow https://www.mediawiki.org/wiki/How_to_report_a_bug and always provide clear steps to reproduce / a testcase which will allow any other person to follow these steps (without having to interpret those steps) and see the same results.
Problems that others can reliably reproduce can get fixed faster.
For example, when I go to https://en.wikipedia.org/wiki/Special:Contributions/Pernak, contributions to User:Dan Koehl/Vyškov Zoo are listed there. The page does not appear in the history in Internet Explorer, so I suspect that an HTTP 404 code must have occurred.
The 404 status code is sent when visiting the contributions page; it just can't be seen. A modification needs to be made to the "contributionsSub" function under includes/specials/SpecialContributions.php. The condition for generating the status code needs to be something other than "!$this->including()".
@matmarex showed how to see the error code from the command-line. But I wanted to briefly explain what this means for the end-user.
While error codes are usually reserved for major errors like accessing a file that doesn't exist, any MediaWiki response can also set the internal error code flags (404, 400 and others). We do this for example when visiting a red link (index.php exists, but the article specified doesn't), or when going to an invalid action (e.g. ?action=foo). While this is mostly invisible and seemingly unimportant, it does have various real impacts that affect users:
- Error pages don't get indexed by search engines.
- Error pages either don't get cached or only cached for a short-time by our CDN infrastructure.
- In Chrome, for example, error pages are not added to your browsing history. Thus making it difficult to find it again later. (But also avoids autocompleting a url you probably don't want to visit, especially if it was a typo).
The above all apply to red links, invalid action links, and also contribution searches for user names that don't exist.
PS: Error codes can also be seen within the a browser from the developer tools or browser inspector. For example: