23 lines
423 B
Go
23 lines
423 B
Go
package main
|
|
|
|
import (
|
|
"io"
|
|
"ippserver/packages/ipp"
|
|
"os"
|
|
)
|
|
|
|
func handlePrintJob(r *ipp.Request, byteStream io.Reader) *ipp.Response {
|
|
|
|
a := r.GetAttribute("job-name")
|
|
//a.(nameWithoutLanguage).Value
|
|
f, err := os.Create(a.(*ipp.NameWithoutLanguage).Value())
|
|
if err != nil {
|
|
panic("fail")
|
|
}
|
|
defer f.Close()
|
|
io.Copy(f, byteStream)
|
|
response := ipp.NewResponse(ipp.SuccessfulOk, r.RequestID())
|
|
|
|
return response
|
|
}
|