plgd-dev / go-coap

Implementation of CoAP Server & Client in Go

Home Page:https://coap.technology

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

not get block2 option in server

lx121451 opened this issue · comments

When I send a Get Message with block2 option,but in server side Options.HasOption(message.Block2) return false。Is there anything that needs special attention?

@jkralik I think this is the relevant code:

case codes.GET, codes.DELETE:
maxSZX = fitSZX(r, message.Block2, maxSZX)
block, err := r.GetOptionUint32(message.Block2)
if err == nil {
r.Remove(message.Block2)
}
next(w, r)

Do you recall why the Block2 option is removed from the message before its passed to the next handler function? Maybe the error check is inverted?

@lx121451 Pls, why do you need block2? Thx

Do you recall why the Block2 option is removed from the message before its passed to the next handler function? Maybe the error check is inverted?

No, it's correct.

@lx121451 Pls, why do you need block2? Thx

Just for test,I'm simulating a file transfer server with separate response!

For test you can use https://github.com/plgd-dev/go-coap/blob/master/options/commonOptions.go#L278 to watch all messages that comes to server in v3.
I will close the issue, feel free to reopen it.