What is the maximum URL length you can pass to the Wininet function, HttpOpenRequest?

前端 未结 3 867
清歌不尽
清歌不尽 2021-01-22 00:32

What is the maximum URL length you can pass to the Wininet function, HttpOpenRequest?

3条回答
  •  北海茫月
    2021-01-22 01:07

    HttpOpenRequest does not have a maximum length but server software you are targeting will likely have a limit on your URL length.

    Apache (Server)

    My early attempts to measure the maximum URL length in web browsers bumped into a server URL length limit of approximately 4,000 characters, after which Apache produces a "413 Entity Too Large" error. I used the current up to date Apache build found in Red Hat Enterprise Linux 4. The official Apache documentation only mentions an 8,192-byte limit on an individual field in a request.

    Microsoft Internet Information Server (Server)

    The default limit is 16,384 characters (yes, Microsoft's web server accepts longer URLs than Microsoft's web browser). This is configurable.

    Perl HTTP::Daemon (Server)

    Up to 8,000 bytes will work. Those constructing web application servers with Perl's HTTP::Daemon module will encounter a 16,384 byte limit on the combined size of all HTTP request headers. This does not include POST-method form data, file uploads, etc., but it does include the URL. In practice this resulted in a 413 error when a URL was significantly longer than 8,000 characters. This limitation can be easily removed. Look for all occurrences of 16x1024 in Daemon.pm and replace them with a larger value. Of course, this does increase your exposure to denial of service attacks.

    (from Boutell.com)

提交回复
热议问题