Sometimes the translated page is incomplete. The top portion of the page will be returned but the bottom is missing (this usually breaks things). Sometimes the page is blank.

After digging into the problem, it appears that the entire page is returned from google, but parts are lost in the "Prepare Content" area of the process (where the content is split into an array by \r\n). The code assumes that the page will always be contained in element 1 of the resulting array, but sometimes it is actually split into multiple elements.

The core of the issue is that the \r\n characters that are split on are HTTP/1.1 Chunk indicators. Since the actual request to google translate is specified as HTTP/1.1, the webserver assumes that the application making the request supports Chunked Transfers (as per 3.6.1 of the RFC - http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.6.1).

The solution is to either:
1. Implement Chunk Transfer support
2. Change the request to HTTP/1.0

As a quick solution, a move to HTTP/1.0 is provided in the attached patch file. This changes the request itself to HTTP/1.0 and also removed the "prepare content" area of the processing that converts the return into an array and sets $content to element1.

CommentFileSizeAuthor
#1 302.png2.84 KBdrutube
http_1.0.patch1.14 KBBrett Haranin
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

drutube’s picture

FileSize
2.84 KB

Thanks Brett,

That patch almost fixed this module for me. I had to apply this patch http://drupal.org/node/229073 to the 5x.1.3 version and then apply your patch to get it working. The only problem I'm having now is that it is giving me a 302 redirect when the pages first load or when one first comes to the site. Other than that its working well. Your patch fixed the last major problem in that it was managing the pages when returning the translated version

Thanks allot for the patch.

drutube’s picture

I should have noted that they are both your patches. To be clear I applied the first patch for the redirection issue to achieve any functionality at all. I then applied this patch to fix the page managling problem. The final issue -- new -- is the redirtion notice when the page first loads. Note it doesn't reoccur after the intial load ... presumably because once redirection occurs it doesnt need to keep giving the notice. I don't really know.

apaderno’s picture

Issue summary: View changes
Status: Needs review » Closed (outdated)

I am closing this issue, since Drupal 5 and Drupal 6 are now not supported.