Beispiel #1
0
func (c *Archivelink) Get() {
	uri := c.Ctx.Request.RequestURI

	app.Debug("uri : %s", uri)

	var cmd string

	p := strings.Index(uri, "?")
	if p != -1 {
		cmd = uri[p+1:]
	}

	p = strings.IndexAny(cmd, "&#")
	if p != -1 {
		cmd = cmd[:p]
	}

	app.DebugSeparator()

	app.Debug("cmd : %s", cmd)

	if cmd != "" {
		switch cmd {
		case SERVERINFO:
			c.serverInfo()
		case PUTCERT:
			c.putCert()
		default:
			c.BadRequest(app.Translate("Unknown command : %s", cmd))
		}
	} else {
		c.BadRequest(app.Translate("Undefined SAP Archivelink command"))
	}
}
Beispiel #2
0
func (c *Archivelink) check(command string, pis *ParameterInfos) bool {
	result := false

	isSigned := false
	params := c.Ctx.Request.URL.Query()

	for param, _ := range params {
		value := params[param][0]

		if param != command {
			if param == SEC_KEY {
				isSigned = true
			} else {
				info, ok := (*pis)[param]

				if !ok {
					c.BadRequest("invalid parameter " + param)
					break
				} else {
					if (value == "") && (info.def != "") {
						params.Set(param, info.def)
						value = info.def
					}

					app.Debug("parameter %s : %s'", param, value)
				}
			}
		}
	}

	result = !isSigned

	if isSigned {
		//TODO isSigned handling
	}

	return result
}