Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add redirect location to exception message #28

Closed

Conversation

SimonScholz
Copy link

Hi @gmuth ,

thanks for providing this really nice library.
Today I faced an issue when I tried to print when the printer returned a 307, Temporary Redirect.

I know I could simply catch the HttpPostException and extract the header myself, which I gonna do now, but IMHO it would be convenient to have the desired location already as part of the message.

Please let me know what you think.

Copy link
Owner

@gmuth gmuth left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution!

@gmuth
Copy link
Owner

gmuth commented Sep 25, 2024

I've never seen a printer returning a redirect. What brand and model is it?

@gmuth
Copy link
Owner

gmuth commented Sep 25, 2024

hm. the build fails due to missing SONAR_TOKEN (only available in my context I guess).
I'll add your changes.

@gmuth
Copy link
Owner

gmuth commented Sep 25, 2024

manually added: db628c1

@gmuth gmuth closed this Sep 25, 2024
@SimonScholz
Copy link
Author

@gmuth
We use the following Printer: https://www.kyoceradocumentsolutions.de/de/products/printers/ECOSYSP4060DN.html

The issue with the missing SONAR_TOKEN is quite unfortunate, because I´d love to become a contributor ;)

When do you plan to release a new version to maven central? Version 3.1 is from Nov 2023 and since then a lot of commits have been done to this repository. So IMHO it´s time for a new release ;) WDYT?

@SimonScholz
Copy link
Author

Btw. the Location, which is logged now by catching the exception and reading the headers is https://192.168.247.49:443/ipp/print so the problem simply is that I tried using "ipp://$printerHost/ipp/print" by default.
So I assume I am supposed to use "ipps://$printerHost/ipp/print", right?

@gmuth
Copy link
Owner

gmuth commented Sep 26, 2024

The issue with the missing SONAR_TOKEN is quite unfortunate, because I´d love to become a contributor ;)

I understand, sorry about that. I'll look into it.

When do you plan to release a new version to maven central? Version 3.1 is from Nov 2023 and since then a lot of commits have been done to this repository. So IMHO it´s time for a new release ;) WDYT?

In fact I am going to publish a new version soon - it's really overdue.

@gmuth
Copy link
Owner

gmuth commented Sep 26, 2024

Btw. the Location, which is logged now by catching the exception and reading the headers is https://192.168.247.49:443/ipp/print so the problem simply is that I tried using "ipp://$printerHost/ipp/print" by default.
So I assume I am supposed to use "ipps://$printerHost/ipp/print", right?

Even though IPP is based on HTTP the spec does not define what a printer should do or should not do on the HTTP level. Some printers even return HTTP 400 instead of IPP status client-error-bad-request.

However for SSL/TLS RFC 8010 8.2 refers to the option to upgrade an existing socket to use TLS. So CUPS responds with "HTTP 426 Upgrade required" when sensitive information is being transmitted and no TLS is used - hence the hint "Try ipps://..." is added.

For printerURIs schemas ipp, http, ipps, https are supported by the library with the help of fun toHttpUri(ippUri: URI)

I might investigate further on this topic - e.g. look if I can request a server to upgrade to TLS from client side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants