The information in this article applies to:
SYMPTOMS
There are four known bugs with HttpSendRequest API:
For example, if you call the API in the following way:
the following request is sent to the server:
The correct request is:
NOTE: In the above transcript, \r\n is a Carriage Return\Line Feed symbol. RESOLUTION
You can use one of the following workarounds:
Problem 1Make sure that the lpOptional buffer is either smaller then 32 bytes or larger then 150 bytes. If you need to send a buffer smaller then 32 bytes, allocate a buffer larger than 150 bytes and zero-pad it. Make sure that the server component that reads the data, usually as part of the POST request, can correctly handle zero padding.Problem 2Start the lpOptional buffer with \r\n, as in the following sample:
NOTE: When you do this, the Content-Length that is sent is now two bytes larger than the content that you intended to send. Because HttpSendRequest always appends an extra \r\n after the content, server applications see this additional \r\n as part of the content. In the previous example, the Content-Length header is 20 (the length of the string "\r\nBuffer Starts Here"), but the buffer read by the server is the "Buffer Starts Here\r\n". Some server applications may not work properly with the additional \r\n. Problem 3Header corruption in HttpSendRequest is due to the problem in HttpAddRequestHeaders(). Therefore calling HttpAddRequestHeaders() to add headers does not work; corrupted headers will be added to the request. There is no workaround for this issue. It is not possible to add a custom header to a request that includes a body. Though the following may appear as a workaround, it should still not be used. Due to problem 2, you can start at the beginning of the data with headers, as in the following sample:
Because the original request headers are separated by only a single \r\n pair, the server still treats "Content-Type: text/html" as part of the HTTP request headers. Please note that starting request body with header changes the Content-Length header that is calculated by Windows CE. In this case Content-Length will include the length of headers. A correctly written server application handling POSTs (that is, CGIs) that read amount of data specified in Content-Length will not work with such requests. The server application will block because the body of the request is smaller than specified in the Content-Length header. NOTE: Due to the issue above, it is not possible to invoke an Active Server Pages (ASP) script with the POST method. Simulating programmatic form submission requires adding a custom header: Content-Type: application/x-www- form-urlencoded, that is not possible. Problem 4If it's necessary to use IP address in the application, use WinSock API gethostbyaddr to convert it to host name. Use this host name in InternetConnect. Code similar to this converts IP address in dotted decimal notation to the host name:
STATUS
Microsoft has confirmed these bugs in the Microsoft products listed at the
beginning of this article. These problems have been corrected in Microsoft
Windows CE, versions 2.1 and 2.11.
REFERENCESQ194953 INFO: Facts About WinInet API Support on Windows CE OS (c) Microsoft Corporation 1998, All Rights Reserved. Contributions by Leon Braginski, Microsoft Corporation. Additional query words:
Keywords : kbVC500 kbWinCE200bug kbWinCE210fix kbfix |
Last Reviewed: January 26, 2000 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |