hplip tools use localhost in HTTP request when addressing printer over network

Bug #2032676 reported by Erik Devriendt
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
HPLIP
New
Undecided
Unassigned

Bug Description

HPLIP 3.23.5
Printer: OfficeJet Pro 9010 All-in-one, connected on local network.
OS: Linux Mint 21.2

HPLIP tools such as hp-info send HTTP GET requests to the printer but the HTTP header contains a Host:localhost line, which is refused by the EWS of the printer. It returns 403 Forbidden.

My device URI: hp:/net/HP_OfficeJet_Pro_9010_series?ip=192.168.0.219

The failing requests:
GET /DevMgmt/ConsumableConfigDyn.xml HTTP/1.1
Accept: text/plain
Host:localhost
User-Agent:hplip

and

GET /DevMgmt/MediaHandlingDyn.xml HTTP/1.1
Accept: text/plain
Host:localhost
User-Agent:hplip

and

GET /DevMgmt/ProductStatusDyn.xml HTTP/1.1
Accept: text/plain
Host:localhost
User-Agent:hplip

The HPLIP Status service then erroneously reports the state of the printer as Busy, powered down or unplugged. No Supplies info was shown either.

I was able to correct the software for my printer by editing the /usr/share/hplip/base/device.py file. See the attachment.
In essence the correction consists of replacing the fixed string 'localhost' by the value of the http_host field of the device object.

I replaced all occurrences of localhost, but I might have replaced too many of them. I leave that to you to judge.
Although the comment above the methods indicate a "hp:/usb/..." uri, these methods get also called for "hp:/net/..." uris.

Revision history for this message
Erik Devriendt (erik-devriendt) wrote :
Revision history for this message
brian_p (claremont102) wrote (last edit ):

Your detailed report seems to indicate a deficiency in
HPLIP. We assume you can still print and scan.

What is the connection method to the printer?

Revision history for this message
Erik Devriendt (erik-devriendt) wrote :

Yes, I can still print and scan, using the CUPS subsystem.
In CUPS I see two printers:
1. implicitclass://HP_OfficeJet_Pro_9010_series_5FE742/
2. hp:/net/HP_OfficeJet_Pro_9010_series?ip=192.168.0.219

I usually print using printer 1. because I see a lot of pauses when printing with printer 2.

I'm not sure that I understand your question regarding the connection method.
I now the printer supports LPD protocol on port 515, IPP on port 631 and jetdirect on port 9100.
But I did not yet figure out what CUPS is using in case of the hp:/net/... URI.

Revision history for this message
Erik Devriendt (erik-devriendt) wrote :

And there is of course some SNMP communication for printer status.

Revision history for this message
brian_p (claremont102) wrote :

> 1. implicitclass://HP_OfficeJet_Pro_9010_series_5FE742/

This is a driverless URI. Linux Mint 21.2 is focused on providing
a user with a driverless printing system; that is, a system that
does not need vendor (HPLIP) drivers.

The EWS should be accessible with

  http://192.168.0.219

and should display supply levels.

I am unable to offer an explanation for your observations.

Revision history for this message
Erik Devriendt (erik-devriendt) wrote :

@brian_p: the implicitclass URI is not the subject of this issue. It is the hp://net/... URI processing that is the issue.

Note that similar corrections already took place in the libsane-hpaio.so library somewhere between 3.21.12 and 3.23.5.

Revision history for this message
Ivan Prokudin (iprok83) wrote :

I confirm the issue with hplip 3.23.12 and HP LaserJet Pro MFP M428fdn on Gentoo Linux.

Device URI: hp:/net/HP_LaserJet_Pro_M428f-M429f?ip=192.168.21.36

I have temporary fixed it by changing hostname of the printer (in its settings) to localhost.

Revision history for this message
Ivan Prokudin (iprok83) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.