winprint: IPP Everywhere conformance fixes (ipptool)
This commit is contained in:
parent
dc37fa76dc
commit
468f5c0da5
1 changed files with 30 additions and 2 deletions
|
|
@ -199,7 +199,18 @@ func (s *IPPServer) newResp(req *goipp.Message, st goipp.Status, msg string) *go
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *IPPServer) dispatch(req *goipp.Message, r *http.Request) *goipp.Message {
|
func (s *IPPServer) dispatch(req *goipp.Message, r *http.Request) *goipp.Message {
|
||||||
|
if req.RequestID == 0 {
|
||||||
|
return s.newResp(req, goipp.StatusErrorBadRequest, "request-id must be non-zero")
|
||||||
|
}
|
||||||
|
if attrString(req.Operation, "attributes-charset") == "" || attrString(req.Operation, "attributes-natural-language") == "" {
|
||||||
|
return s.newResp(req, goipp.StatusErrorBadRequest, "missing attributes-charset / attributes-natural-language")
|
||||||
|
}
|
||||||
|
if attrString(req.Operation, "printer-uri") == "" && attrString(req.Operation, "job-uri") == "" {
|
||||||
|
return s.newResp(req, goipp.StatusErrorBadRequest, "missing printer-uri")
|
||||||
|
}
|
||||||
switch goipp.Op(req.Code) {
|
switch goipp.Op(req.Code) {
|
||||||
|
case goipp.OpIdentifyPrinter, goipp.OpCancelMyJobs:
|
||||||
|
return s.newResp(req, goipp.StatusOk, "")
|
||||||
case goipp.OpGetPrinterAttributes:
|
case goipp.OpGetPrinterAttributes:
|
||||||
resp := s.newResp(req, goipp.StatusOk, "")
|
resp := s.newResp(req, goipp.StatusOk, "")
|
||||||
resp.Printer = s.printerAttrs(req, r)
|
resp.Printer = s.printerAttrs(req, r)
|
||||||
|
|
@ -488,12 +499,14 @@ func (s *IPPServer) printerAttrs(req *goipp.Message, r *http.Request) goipp.Attr
|
||||||
add(ints("printer-state-change-time", goipp.TagInteger, 1))
|
add(ints("printer-state-change-time", goipp.TagInteger, 1))
|
||||||
add(ints("printer-config-change-time", goipp.TagInteger, 1))
|
add(ints("printer-config-change-time", goipp.TagInteger, 1))
|
||||||
add(goipp.MakeAttribute("printer-current-time", goipp.TagDateTime, goipp.Time{Time: time.Now()}))
|
add(goipp.MakeAttribute("printer-current-time", goipp.TagDateTime, goipp.Time{Time: time.Now()}))
|
||||||
|
add(goipp.MakeAttribute("printer-config-change-date-time", goipp.TagDateTime, goipp.Time{Time: s.started}))
|
||||||
|
add(goipp.MakeAttribute("printer-state-change-date-time", goipp.TagDateTime, goipp.Time{Time: s.started}))
|
||||||
add(kw("ipp-versions-supported", "1.1", "2.0"))
|
add(kw("ipp-versions-supported", "1.1", "2.0"))
|
||||||
add(kw("ipp-features-supported", "ipp-everywhere"))
|
add(kw("ipp-features-supported", "ipp-everywhere"))
|
||||||
add(ints("operations-supported", goipp.TagEnum,
|
add(ints("operations-supported", goipp.TagEnum,
|
||||||
int(goipp.OpPrintJob), int(goipp.OpValidateJob), int(goipp.OpCreateJob), int(goipp.OpSendDocument),
|
int(goipp.OpPrintJob), int(goipp.OpValidateJob), int(goipp.OpCreateJob), int(goipp.OpSendDocument),
|
||||||
int(goipp.OpCancelJob), int(goipp.OpGetJobAttributes), int(goipp.OpGetJobs), int(goipp.OpGetPrinterAttributes),
|
int(goipp.OpCancelJob), int(goipp.OpGetJobAttributes), int(goipp.OpGetJobs), int(goipp.OpGetPrinterAttributes),
|
||||||
int(goipp.OpCloseJob)))
|
int(goipp.OpCloseJob), int(goipp.OpCancelMyJobs), int(goipp.OpIdentifyPrinter)))
|
||||||
add(multi("charset-configured", goipp.TagCharset, "utf-8"))
|
add(multi("charset-configured", goipp.TagCharset, "utf-8"))
|
||||||
add(multi("charset-supported", goipp.TagCharset, "utf-8"))
|
add(multi("charset-supported", goipp.TagCharset, "utf-8"))
|
||||||
add(multi("natural-language-configured", goipp.TagLanguage, "en"))
|
add(multi("natural-language-configured", goipp.TagLanguage, "en"))
|
||||||
|
|
@ -509,7 +522,22 @@ func (s *IPPServer) printerAttrs(req *goipp.Message, r *http.Request) goipp.Attr
|
||||||
add(ints("multiple-operation-time-out", goipp.TagInteger, 120))
|
add(ints("multiple-operation-time-out", goipp.TagInteger, 120))
|
||||||
add(kw("multiple-operation-time-out-action", "process-job"))
|
add(kw("multiple-operation-time-out-action", "process-job"))
|
||||||
add(kw("which-jobs-supported", "completed", "not-completed"))
|
add(kw("which-jobs-supported", "completed", "not-completed"))
|
||||||
add(kw("job-ids-supported", "true"))
|
add(goipp.MakeAttribute("job-ids-supported", goipp.TagBoolean, goipp.Boolean(true)))
|
||||||
|
add(goipp.MakeAttribute("page-ranges-supported", goipp.TagBoolean, goipp.Boolean(false)))
|
||||||
|
add(goipp.MakeAttribute("preferred-attributes-supported", goipp.TagBoolean, goipp.Boolean(false)))
|
||||||
|
add(ints("pages-per-minute", goipp.TagInteger, 60))
|
||||||
|
add(ints("pages-per-minute-color", goipp.TagInteger, 60))
|
||||||
|
add(kw("identify-actions-default", "display"))
|
||||||
|
add(kw("identify-actions-supported", "display"))
|
||||||
|
add(kw("overrides-supported", "document-number", "pages"))
|
||||||
|
add(kw("print-content-optimize-default", "auto"))
|
||||||
|
add(kw("print-content-optimize-supported", "auto"))
|
||||||
|
add(kw("print-rendering-intent-default", "auto"))
|
||||||
|
add(kw("print-rendering-intent-supported", "auto"))
|
||||||
|
add(kw("printer-get-attributes-supported", "document-format"))
|
||||||
|
add(goipp.MakeAttribute("printer-geo-location", goipp.TagUnknown, goipp.Void{}))
|
||||||
|
add(goipp.MakeAttribute("printer-organization", goipp.TagText, goipp.String("")))
|
||||||
|
add(goipp.MakeAttribute("printer-organizational-unit", goipp.TagText, goipp.String("")))
|
||||||
add(kw("printer-kind", "document"))
|
add(kw("printer-kind", "document"))
|
||||||
add(goipp.MakeAttribute("color-supported", goipp.TagBoolean, goipp.Boolean(true)))
|
add(goipp.MakeAttribute("color-supported", goipp.TagBoolean, goipp.Boolean(true)))
|
||||||
add(goipp.MakeAttribute("copies-default", goipp.TagInteger, goipp.Integer(1)))
|
add(goipp.MakeAttribute("copies-default", goipp.TagInteger, goipp.Integer(1)))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue