Curl doesn't recognize expires value in cookie correctly

前端 未结 3 703
梦毁少年i
梦毁少年i 2021-01-19 10:33

I\'m trying to perfom a log-in on pinterest.com with curl. I got the following request-response-flow:

  1. GET-Request the login form and scrape hidden fields (csr
3条回答
  •  遇见更好的自我
    2021-01-19 11:08

    You are experiencing an issue on your computer because of the limits of 32 bit signed integer values.

    The server sets a cookie with the Max-Age of 1334675004 seconds in the future.

    Max-Age=1334675004
    

    You posted your question here @ 2012-04-10 15:13:24Z. That is a UNIX timestamp of 1334070804. If you add 1334675004 to it and you take a 32 bit integer limit of 2147483647 into account while having an integer roundtrip, you'll get: -1626221485:

      1334070804
    + 1334675004
    ------------
     -1626221485
    

    As the numbers show, it looks like that the server did misunderstood the Max-Age attribute, if you substract each values from each other there is a circa delta of 7 days in seconds (604200 = ~6.99 days, the difference is because the cookie was set earlier than you posted your question here). However Max-Age is the delta of seconds, not the absolut UNIX timestamp.

    Try to raise PHP_INT_MAX with your PHP version, or compile against 64 bit, this should prevent negative numbers. However, the max-age calculation is still broken with the server. You might want to contact pinterest.com and report the problem.

提交回复
热议问题