douzhenao6515 2018-01-30 23:49
浏览 19
已采纳

GAE是否可以接受没有内容长度的帖子?

I am moving a small service, written in GO, to Google App Engine. That service receives some posts from a few buggy embedded devices that have a valid post body but don't submit a Content Length header. There is no body and Apache didn't care about this but Google App Engine returns a 411 error (as it should). I didn't catch this in development because the local server is totally fine w/o the content length header.

I'm wondering, is there a way to catch that error in my application or is that beyond my control?

Thank you for your time,

  • 写回答

1条回答 默认 最新

  • douzuan2814 2018-02-01 11:16
    关注

    Per the RCF 7230 - 3.3.3 only responses could contain a body without a Content-Length or Transfer-Encoding: chunked.

    Without such information, for a request, then message can:

    • be treated as a message with body size zero
    • or be rejected with 411 error.

    So, yes, as you said, the clients are clearly wrong on the protocol side. And you cannot do anything about that, the message is rejected before reaching your application, even if you had one way of allowing these bad message in GAE servers, any other proxy or load balancer set between these bad clients and GAE servers could also reject the messages.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看