view PROGRAMMING_NOTES @ 9240:f1d87ab17e41

[gaim-migrate @ 10039] wing writes: While working on patch 967849, found that there are a few problems with current Content-Length handling: 1. parse_content_len uses a single sscanf on data. However, data (the response headers) would begin with the http status, not the Content-Length 2. data is not nul-terminated, but sscanf assumes a nul-terminated string. This could (though very unlikely) be unpredictable if input is malformed. 3. if gaim_url_fetch succeeds in extracting the Content-Length from the response headers, it will silently discard all the data after they have been read, because it does not keep track of whether the specified number of bytes has been read (The "else" case that corresponds to this situation is an empty block.) The attached patch corrects the above problems, though the patch is still technically not correct, since Content-Length theoretically should be matched case-insensitively. He then revised the patch and wrote: More problems, unrelated to content-length handling, have been discovered: 1. Gaim's http/1.1 support is broken; http/1.1 clients are _required_ to be able to decode the "chunked" transfer encoding, but gaim cannot do it. Since the difference between gaim's http 1.0 and 1.1 support is only to send the Host header, which is not forbidden in http 1.0, I have changed gaim's http 1.0 behaviour to also send the Host header. This is required for Yahoo Japan "avatar" support. (The server requires a Host header but sends the image in the chunked encoding, which gaim cannot decode.) 2. User-Agent should not be quoted committer: Tailor Script <tailor@pidgin.im>
author Tim Ringenbach <marv@pidgin.im>
date Wed, 09 Jun 2004 01:24:47 +0000
parents 10b5ac17fdd6
children da88e2cd5c53
line wrap: on
line source

Notes on keeping GAIM OS independant
------------------------------------

General
-------
- Use G_DIR_SEPARATOR_S and G_DIR_SEPARATOR for paths

- Use g_getenv, g_snprintf, g_vsnprintf

- Use gaim_home_dir instead of g_get_home_dir or g_getenv("HOME")

- Make sure when including win32dep.h that it is the last header to
  be included.

- Open binary files when reading or writing with 'b' mode.

  e.g: fopen("somefile", "wb");

  Not doing so will open files in windows using defaut translation mode. 
  i.e. newline -> <CR><LF>

Paths
-----

- DATADIR, LOCALEDIR & LIBDIR are defined in wingaim as functions.
  Doing the following will therefore break the windows build:

  printf("File in DATADIR is: %s\n", DATADIR G_DIR_SEPARATOR_S "pic.png");

  it should be:

  printf("File in DATADIR is: %s%s%s\n", DATADIR, G_DIR_SEPARATOR_S, "pic.png");

- When writing out paths to .gaimrc, use wgaim_escape_dirsep. This is necessary
  because the Windows dir separator '\' is being used to escape characters, when
  paths are read in from the .gaimrc file.

PLUGINS & PROTOS
----------------

- G_MODULE_EXPORT all functions which are to be accessed from outside the
  scope of its "dll" or "so". (E.G. gaim_plugin_init)

- G_MODULE_IMPORT all global variables which are located outside your
  dynamic library. (E.G. connections)

  (Not doing this will cause "Memory Access Violations" in Win32)