http_lib.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. * Http put/get mini lib
  3. * written by L. Demailly
  4. * (c) 1998 Laurent Demailly - http://www.demailly.com/~dl/
  5. * (c) 1996 Observatoire de Paris - Meudon - France
  6. * see LICENSE for terms, conditions and DISCLAIMER OF ALL WARRANTIES
  7. *
  8. * $Id: http_lib.h,v 1.4 1998/09/23 06:14:15 dl Exp $
  9. *
  10. */
  11. /* declarations */
  12. extern char *http_server;
  13. extern int http_port;
  14. extern char *http_proxy_server;
  15. extern int http_proxy_port;
  16. /* return type */
  17. typedef enum {
  18. /* Client side errors */
  19. ERRHOST=-1, /* No such host */
  20. ERRSOCK=-2, /* Can't create socket */
  21. ERRCONN=-3, /* Can't connect to host */
  22. ERRWRHD=-4, /* Write error on socket while writing header */
  23. ERRWRDT=-5, /* Write error on socket while writing data */
  24. ERRRDHD=-6, /* Read error on socket while reading result */
  25. ERRPAHD=-7, /* Invalid answer from data server */
  26. ERRNULL=-8, /* Null data pointer */
  27. ERRNOLG=-9, /* No/Bad length in header */
  28. ERRMEM=-10, /* Can't allocate memory */
  29. ERRRDDT=-11,/* Read error while reading data */
  30. ERRURLH=-12,/* Invalid url - must start with 'http://' */
  31. ERRURLP=-13,/* Invalid port in url */
  32. /* Return code by the server */
  33. ERR400=400, /* Invalid query */
  34. ERR403=403, /* Forbidden */
  35. ERR408=408, /* Request timeout */
  36. ERR500=500, /* Server error */
  37. ERR501=501, /* Not implemented */
  38. ERR503=503, /* Service overloaded */
  39. /* Succesful results */
  40. OK0 = 0, /* successfull parse */
  41. OK201=201, /* Ressource succesfully created */
  42. OK200=200 /* Ressource succesfully read */
  43. } http_retcode;
  44. /* prototypes */
  45. #ifndef OSK
  46. http_retcode http_put(char *filename, char *data, int length,
  47. int overwrite, char *type) ;
  48. http_retcode http_get(char *filename, char **pdata,int *plength, char *typebuf);
  49. http_retcode http_parse_url(char *url, char **pfilename);
  50. http_retcode http_delete(char *filename) ;
  51. http_retcode http_head(char *filename, int *plength, char *typebuf);
  52. #endif