doulezhi5326 2017-05-12 23:38
浏览 42

too long

I have an IP-camera that on trigger uploads JPG picture to my apache-php web server.

camera sends POST request with multipart data separated with boundaries, and it is ok in most cases.

but sometimes (every ~5th picture) camera sends wrong content-length (very big number, 139TB). that is some bug in camera software. $_REQUEST and $_FILES arrays are empty when this problem occurs.

except wrong content-length, everything else is fine inside request, i listen-ed it with NETCAT and parsed picture well, it was ok (14KB only)

so if i can just tell php (php.ini or something) to ignore content-length and read post vars by boundary, everything will be fine.

is there such switch for php?

update:

after analyse, it seems that in case of this camera,

 wrongContentLength is always == correctLength + 139736760975360
                              == correctLength + 0x00007f1700000000

which is maybe caused by some 32bit - 64bit mixup.

But only way to ignore the problem is manualy parsing php://input which is readable when problem ocurres ...reading boundary from getallheaders(), and parsing file-data between two of them.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 孟德尔随机化结果不一致
    • ¥20 求用stm32f103c6t6在lcd1206上显示Door is open和password:
    • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
    • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
    • ¥15 谁有desed数据集呀
    • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
    • ¥15 关于#hadoop#的问题
    • ¥15 (标签-Python|关键词-socket)
    • ¥15 keil里为什么main.c定义的函数在it.c调用不了
    • ¥50 切换TabTip键盘的输入法