IPP: Accept replies without content-type
My printer doesn't include a content-type in its replies. If a content-type is present, it should be the expected one. But if the printer doesn't specify it, we can try to parse the reply and see if it makes sense. Since the reauest has a content-type, it's reasonably safe to assume the reply will match the requested content type. Change-Id: I0fce7edd7cc40d2761b683d3e4c7b5316436e298 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2962 Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This commit is contained in:
parent
33984e7b7d
commit
445f9c6c92
@ -121,10 +121,12 @@ bool IppSetupView::UpdateViewData()
|
||||
HTTP_RESPONSECODE response_code = conn.getResponseCode();
|
||||
if (response_code == HTTP_OK) {
|
||||
const char *content_type = conn.getContentType();
|
||||
if (content_type && !strncasecmp(content_type, "application/ipp", 15)) {
|
||||
if (content_type == NULL
|
||||
|| strncasecmp(content_type, "application/ipp", 15) == 0) {
|
||||
const IppContent *ipp_response = conn.getIppResponse();
|
||||
if (ipp_response->good()) {
|
||||
dir->WriteAttr(IPP_URL, B_STRING_TYPE, 0, url->Text(), strlen(url->Text()) + 1);
|
||||
dir->WriteAttr(IPP_URL, B_STRING_TYPE, 0, url->Text(),
|
||||
strlen(url->Text()) + 1);
|
||||
return true;
|
||||
} else {
|
||||
error_msg = ipp_response->getStatusMessage();
|
||||
|
@ -107,7 +107,7 @@ IppTransport::~IppTransport()
|
||||
HTTP_RESPONSECODE response_code = conn.getResponseCode();
|
||||
if (response_code == HTTP_OK) {
|
||||
const char *content_type = conn.getContentType();
|
||||
if (content_type && !strncasecmp(content_type, "application/ipp", 15)) {
|
||||
if (content_type == NULL || strncasecmp(content_type, "application/ipp", 15) == 0) {
|
||||
const IppContent *ipp_response = conn.getIppResponse();
|
||||
if (ipp_response->fail()) {
|
||||
__error = true;
|
||||
|
Loading…
Reference in New Issue
Block a user