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 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘