http_lib.3 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658
  1. .\" WARNING! THIS FILE WAS GENERATED AUTOMATICALLY BY c2man!
  2. .\" DO NOT EDIT! CHANGES MADE TO THIS FILE WILL BE LOST!
  3. .TH "http_lib" 3 "25 April 1996" "c2man http_lib.c"
  4. .SH "NAME"
  5. http_server,
  6. http_port,
  7. http_proxy_server,
  8. http_proxy_port,
  9. http_put,
  10. http_get,
  11. http_head,
  12. http_delete,
  13. http_parse_url \- Http data exchanges mini library.
  14. .SH "SYNOPSIS"
  15. .ft B
  16. #include "http_lib.h"
  17. .br
  18. .sp
  19. extern char *http_server;
  20. .sp
  21. extern int http_port;
  22. .sp
  23. extern char *http_proxy_server;
  24. .sp
  25. extern int http_proxy_port;
  26. .sp
  27. http_retcode http_put
  28. .br
  29. (
  30. .br
  31. char *filename,
  32. .br
  33. char *data,
  34. .br
  35. int length,
  36. .br
  37. int overwrite,
  38. .br
  39. char *type
  40. .br
  41. );
  42. .sp
  43. http_retcode http_get
  44. .br
  45. (
  46. .br
  47. char *filename,
  48. .br
  49. char **pdata,
  50. .br
  51. int *plength,
  52. .br
  53. char *typebuf
  54. .br
  55. );
  56. .sp
  57. http_retcode http_head
  58. .br
  59. (
  60. .br
  61. char *filename,
  62. .br
  63. int *plength,
  64. .br
  65. char *typebuf
  66. .br
  67. );
  68. .sp
  69. http_retcode http_delete(char *filename);
  70. .sp
  71. http_retcode http_parse_url
  72. .br
  73. (
  74. .br
  75. char *url,
  76. .br
  77. char **pfilename
  78. .br
  79. );
  80. .ft R
  81. .SH "PARAMETERS"
  82. .TP
  83. .BR "char *filename" " (http_put)"
  84. Name of the ressource to create.
  85. .TP
  86. .B "char *data"
  87. Pointer to the data to send.
  88. .TP
  89. .B "int length"
  90. Length of the data to send.
  91. .TP
  92. .B "int overwrite"
  93. Flag to request to overwrite the ressource if it
  94. was already existing.
  95. .TP
  96. .B "char *type"
  97. Type of the data, if NULL default type is used.
  98. .TP
  99. .BR "char *filename" " (http_get)"
  100. Name of the ressource to read.
  101. .TP
  102. .B "char **pdata"
  103. Address of a pointer variable which will be set
  104. to point toward allocated memory containing read data.
  105. .TP
  106. .BR "int *plength" " (http_get)"
  107. Address of integer variable which will be set to
  108. length of the read data.
  109. .TP
  110. .BR "char *typebuf" " (http_get)"
  111. Allocated buffer where the read data type is returned.
  112. If NULL, the type is not returned.
  113. .TP
  114. .BR "int *plength" " (http_head)"
  115. Address of integer variable which will be set to
  116. length of the data.
  117. .TP
  118. .BR "char *typebuf" " (http_head)"
  119. Allocated buffer where the data type is returned.
  120. If NULL, the type is not returned.
  121. .TP
  122. .B "char *url"
  123. Writeable copy of an url.
  124. .TP
  125. .B "char **pfilename"
  126. Address of a pointer that will be filled with allocated filename
  127. the pointer must be equal to NULL before calling or it will be
  128. automatically freed (free(3)).
  129. .SH "DESCRIPTION"
  130. .SS "http_server"
  131. Pointer to a mallocated string containing server name or NULL.
  132. .SS "http_port"
  133. Server port number.
  134. .SS "http_proxy_server"
  135. Pointer to proxy server name or NULL.
  136. .SS "http_proxy_port"
  137. Proxy server port number or 0.
  138. .SS "http_put"
  139. Put data on the server
  140. This function sends data to the http data server.
  141. The data will be stored under the ressource name filename.
  142. .SS "http_get"
  143. Get data from the server
  144. This function gets data from the http data server.
  145. The data is read from the ressource named filename.
  146. Address of new new allocated memory block is filled in pdata
  147. whose length is returned via plength.
  148. .SS "http_head"
  149. Request the header
  150. This function outputs the header of thehttp data server.
  151. The header is from the ressource named filename.
  152. The length and type of data is eventually returned (like for http_get(3)).
  153. .SS "http_delete"
  154. Delete data on the server
  155. This function request a DELETE on the http data server.
  156. .SS "http_parse_url"
  157. Parses an url : setting the http_server and http_port global variables
  158. and returning the filename to pass to http_get/put/...
  159. .SH "RETURNS"
  160. .SS "http_put"
  161. A negative error code or a positive code from the server.
  162. .sp
  163. Possible values for a \fBhttp_retcode\fR are as follows:
  164. .IP
  165. Client side errors.
  166. .RS 0.75in
  167. .PD 0
  168. .ft B
  169. .nr TL \w'ERRHOST'u+0.2i
  170. .ft R
  171. .TP \n(TLu
  172. \fBERRHOST\fR
  173. No such host.
  174. .TP \n(TLu
  175. \fBERRSOCK\fR
  176. Can't create socket.
  177. .TP \n(TLu
  178. \fBERRCONN\fR
  179. Can't connect to host.
  180. .TP \n(TLu
  181. \fBERRWRHD\fR
  182. Write error on socket while writing header.
  183. .TP \n(TLu
  184. \fBERRWRDT\fR
  185. Write error on socket while writing data.
  186. .TP \n(TLu
  187. \fBERRRDHD\fR
  188. Read error on socket while reading result.
  189. .TP \n(TLu
  190. \fBERRPAHD\fR
  191. Invalid answer from data server.
  192. .TP \n(TLu
  193. \fBERRNULL\fR
  194. Null data pointer.
  195. .TP \n(TLu
  196. \fBERRNOLG\fR
  197. No/Bad length in header.
  198. .TP \n(TLu
  199. \fBERRMEM\fR
  200. Can't allocate memory.
  201. .TP \n(TLu
  202. \fBERRRDDT\fR
  203. Read error while reading data.
  204. .TP \n(TLu
  205. \fBERRURLH\fR
  206. Invalid url - must start with 'http://'.
  207. .TP \n(TLu
  208. \fBERRURLP\fR
  209. Invalid port in url.
  210. .RE
  211. .PD
  212. .IP
  213. Return code by the server.
  214. .RS 0.75in
  215. .PD 0
  216. .ft B
  217. .nr TL \w'ERRHOST'u+0.2i
  218. .ft R
  219. .TP \n(TLu
  220. \fBERR400\fR
  221. Invalid query.
  222. .TP \n(TLu
  223. \fBERR403\fR
  224. Forbidden.
  225. .TP \n(TLu
  226. \fBERR408\fR
  227. Request timeout.
  228. .TP \n(TLu
  229. \fBERR500\fR
  230. Server error.
  231. .TP \n(TLu
  232. \fBERR501\fR
  233. Not implemented.
  234. .TP \n(TLu
  235. \fBERR503\fR
  236. Service overloaded.
  237. .RE
  238. .PD
  239. .IP
  240. Succesful results.
  241. .RS 0.75in
  242. .PD 0
  243. .ft B
  244. .nr TL \w'ERRHOST'u+0.2i
  245. .ft R
  246. .TP \n(TLu
  247. \fBOK0\fR
  248. Successfull parse.
  249. .TP \n(TLu
  250. \fBOK201\fR
  251. Ressource succesfully created.
  252. .TP \n(TLu
  253. \fBOK200\fR
  254. Ressource succesfully read.
  255. .RE
  256. .PD
  257. .SS "http_get"
  258. A negative error code or a positive code from the server.
  259. .sp
  260. Possible values for a \fBhttp_retcode\fR are as follows:
  261. .IP
  262. Client side errors.
  263. .RS 0.75in
  264. .PD 0
  265. .ft B
  266. .nr TL \w'ERRHOST'u+0.2i
  267. .ft R
  268. .TP \n(TLu
  269. \fBERRHOST\fR
  270. No such host.
  271. .TP \n(TLu
  272. \fBERRSOCK\fR
  273. Can't create socket.
  274. .TP \n(TLu
  275. \fBERRCONN\fR
  276. Can't connect to host.
  277. .TP \n(TLu
  278. \fBERRWRHD\fR
  279. Write error on socket while writing header.
  280. .TP \n(TLu
  281. \fBERRWRDT\fR
  282. Write error on socket while writing data.
  283. .TP \n(TLu
  284. \fBERRRDHD\fR
  285. Read error on socket while reading result.
  286. .TP \n(TLu
  287. \fBERRPAHD\fR
  288. Invalid answer from data server.
  289. .TP \n(TLu
  290. \fBERRNULL\fR
  291. Null data pointer.
  292. .TP \n(TLu
  293. \fBERRNOLG\fR
  294. No/Bad length in header.
  295. .TP \n(TLu
  296. \fBERRMEM\fR
  297. Can't allocate memory.
  298. .TP \n(TLu
  299. \fBERRRDDT\fR
  300. Read error while reading data.
  301. .TP \n(TLu
  302. \fBERRURLH\fR
  303. Invalid url - must start with 'http://'.
  304. .TP \n(TLu
  305. \fBERRURLP\fR
  306. Invalid port in url.
  307. .RE
  308. .PD
  309. .IP
  310. Return code by the server.
  311. .RS 0.75in
  312. .PD 0
  313. .ft B
  314. .nr TL \w'ERRHOST'u+0.2i
  315. .ft R
  316. .TP \n(TLu
  317. \fBERR400\fR
  318. Invalid query.
  319. .TP \n(TLu
  320. \fBERR403\fR
  321. Forbidden.
  322. .TP \n(TLu
  323. \fBERR408\fR
  324. Request timeout.
  325. .TP \n(TLu
  326. \fBERR500\fR
  327. Server error.
  328. .TP \n(TLu
  329. \fBERR501\fR
  330. Not implemented.
  331. .TP \n(TLu
  332. \fBERR503\fR
  333. Service overloaded.
  334. .RE
  335. .PD
  336. .IP
  337. Succesful results.
  338. .RS 0.75in
  339. .PD 0
  340. .ft B
  341. .nr TL \w'ERRHOST'u+0.2i
  342. .ft R
  343. .TP \n(TLu
  344. \fBOK0\fR
  345. Successfull parse.
  346. .TP \n(TLu
  347. \fBOK201\fR
  348. Ressource succesfully created.
  349. .TP \n(TLu
  350. \fBOK200\fR
  351. Ressource succesfully read.
  352. .RE
  353. .PD
  354. .SS "http_head"
  355. A negative error code or a positive code from the server.
  356. .sp
  357. Possible values for a \fBhttp_retcode\fR are as follows:
  358. .IP
  359. Client side errors.
  360. .RS 0.75in
  361. .PD 0
  362. .ft B
  363. .nr TL \w'ERRHOST'u+0.2i
  364. .ft R
  365. .TP \n(TLu
  366. \fBERRHOST\fR
  367. No such host.
  368. .TP \n(TLu
  369. \fBERRSOCK\fR
  370. Can't create socket.
  371. .TP \n(TLu
  372. \fBERRCONN\fR
  373. Can't connect to host.
  374. .TP \n(TLu
  375. \fBERRWRHD\fR
  376. Write error on socket while writing header.
  377. .TP \n(TLu
  378. \fBERRWRDT\fR
  379. Write error on socket while writing data.
  380. .TP \n(TLu
  381. \fBERRRDHD\fR
  382. Read error on socket while reading result.
  383. .TP \n(TLu
  384. \fBERRPAHD\fR
  385. Invalid answer from data server.
  386. .TP \n(TLu
  387. \fBERRNULL\fR
  388. Null data pointer.
  389. .TP \n(TLu
  390. \fBERRNOLG\fR
  391. No/Bad length in header.
  392. .TP \n(TLu
  393. \fBERRMEM\fR
  394. Can't allocate memory.
  395. .TP \n(TLu
  396. \fBERRRDDT\fR
  397. Read error while reading data.
  398. .TP \n(TLu
  399. \fBERRURLH\fR
  400. Invalid url - must start with 'http://'.
  401. .TP \n(TLu
  402. \fBERRURLP\fR
  403. Invalid port in url.
  404. .RE
  405. .PD
  406. .IP
  407. Return code by the server.
  408. .RS 0.75in
  409. .PD 0
  410. .ft B
  411. .nr TL \w'ERRHOST'u+0.2i
  412. .ft R
  413. .TP \n(TLu
  414. \fBERR400\fR
  415. Invalid query.
  416. .TP \n(TLu
  417. \fBERR403\fR
  418. Forbidden.
  419. .TP \n(TLu
  420. \fBERR408\fR
  421. Request timeout.
  422. .TP \n(TLu
  423. \fBERR500\fR
  424. Server error.
  425. .TP \n(TLu
  426. \fBERR501\fR
  427. Not implemented.
  428. .TP \n(TLu
  429. \fBERR503\fR
  430. Service overloaded.
  431. .RE
  432. .PD
  433. .IP
  434. Succesful results.
  435. .RS 0.75in
  436. .PD 0
  437. .ft B
  438. .nr TL \w'ERRHOST'u+0.2i
  439. .ft R
  440. .TP \n(TLu
  441. \fBOK0\fR
  442. Successfull parse.
  443. .TP \n(TLu
  444. \fBOK201\fR
  445. Ressource succesfully created.
  446. .TP \n(TLu
  447. \fBOK200\fR
  448. Ressource succesfully read.
  449. .RE
  450. .PD
  451. .SS "http_delete"
  452. A negative error code or a positive code from the server.
  453. .sp
  454. Possible values for a \fBhttp_retcode\fR are as follows:
  455. .IP
  456. Client side errors.
  457. .RS 0.75in
  458. .PD 0
  459. .ft B
  460. .nr TL \w'ERRHOST'u+0.2i
  461. .ft R
  462. .TP \n(TLu
  463. \fBERRHOST\fR
  464. No such host.
  465. .TP \n(TLu
  466. \fBERRSOCK\fR
  467. Can't create socket.
  468. .TP \n(TLu
  469. \fBERRCONN\fR
  470. Can't connect to host.
  471. .TP \n(TLu
  472. \fBERRWRHD\fR
  473. Write error on socket while writing header.
  474. .TP \n(TLu
  475. \fBERRWRDT\fR
  476. Write error on socket while writing data.
  477. .TP \n(TLu
  478. \fBERRRDHD\fR
  479. Read error on socket while reading result.
  480. .TP \n(TLu
  481. \fBERRPAHD\fR
  482. Invalid answer from data server.
  483. .TP \n(TLu
  484. \fBERRNULL\fR
  485. Null data pointer.
  486. .TP \n(TLu
  487. \fBERRNOLG\fR
  488. No/Bad length in header.
  489. .TP \n(TLu
  490. \fBERRMEM\fR
  491. Can't allocate memory.
  492. .TP \n(TLu
  493. \fBERRRDDT\fR
  494. Read error while reading data.
  495. .TP \n(TLu
  496. \fBERRURLH\fR
  497. Invalid url - must start with 'http://'.
  498. .TP \n(TLu
  499. \fBERRURLP\fR
  500. Invalid port in url.
  501. .RE
  502. .PD
  503. .IP
  504. Return code by the server.
  505. .RS 0.75in
  506. .PD 0
  507. .ft B
  508. .nr TL \w'ERRHOST'u+0.2i
  509. .ft R
  510. .TP \n(TLu
  511. \fBERR400\fR
  512. Invalid query.
  513. .TP \n(TLu
  514. \fBERR403\fR
  515. Forbidden.
  516. .TP \n(TLu
  517. \fBERR408\fR
  518. Request timeout.
  519. .TP \n(TLu
  520. \fBERR500\fR
  521. Server error.
  522. .TP \n(TLu
  523. \fBERR501\fR
  524. Not implemented.
  525. .TP \n(TLu
  526. \fBERR503\fR
  527. Service overloaded.
  528. .RE
  529. .PD
  530. .IP
  531. Succesful results.
  532. .RS 0.75in
  533. .PD 0
  534. .ft B
  535. .nr TL \w'ERRHOST'u+0.2i
  536. .ft R
  537. .TP \n(TLu
  538. \fBOK0\fR
  539. Successfull parse.
  540. .TP \n(TLu
  541. \fBOK201\fR
  542. Ressource succesfully created.
  543. .TP \n(TLu
  544. \fBOK200\fR
  545. Ressource succesfully read.
  546. .RE
  547. .PD
  548. .SS "http_parse_url"
  549. A negative error code or 0 if sucessfully parsed.
  550. .sp
  551. Possible values for a \fBhttp_retcode\fR are as follows:
  552. .IP
  553. Client side errors.
  554. .RS 0.75in
  555. .PD 0
  556. .ft B
  557. .nr TL \w'ERRHOST'u+0.2i
  558. .ft R
  559. .TP \n(TLu
  560. \fBERRHOST\fR
  561. No such host.
  562. .TP \n(TLu
  563. \fBERRSOCK\fR
  564. Can't create socket.
  565. .TP \n(TLu
  566. \fBERRCONN\fR
  567. Can't connect to host.
  568. .TP \n(TLu
  569. \fBERRWRHD\fR
  570. Write error on socket while writing header.
  571. .TP \n(TLu
  572. \fBERRWRDT\fR
  573. Write error on socket while writing data.
  574. .TP \n(TLu
  575. \fBERRRDHD\fR
  576. Read error on socket while reading result.
  577. .TP \n(TLu
  578. \fBERRPAHD\fR
  579. Invalid answer from data server.
  580. .TP \n(TLu
  581. \fBERRNULL\fR
  582. Null data pointer.
  583. .TP \n(TLu
  584. \fBERRNOLG\fR
  585. No/Bad length in header.
  586. .TP \n(TLu
  587. \fBERRMEM\fR
  588. Can't allocate memory.
  589. .TP \n(TLu
  590. \fBERRRDDT\fR
  591. Read error while reading data.
  592. .TP \n(TLu
  593. \fBERRURLH\fR
  594. Invalid url - must start with 'http://'.
  595. .TP \n(TLu
  596. \fBERRURLP\fR
  597. Invalid port in url.
  598. .RE
  599. .PD
  600. .IP
  601. Return code by the server.
  602. .RS 0.75in
  603. .PD 0
  604. .ft B
  605. .nr TL \w'ERRHOST'u+0.2i
  606. .ft R
  607. .TP \n(TLu
  608. \fBERR400\fR
  609. Invalid query.
  610. .TP \n(TLu
  611. \fBERR403\fR
  612. Forbidden.
  613. .TP \n(TLu
  614. \fBERR408\fR
  615. Request timeout.
  616. .TP \n(TLu
  617. \fBERR500\fR
  618. Server error.
  619. .TP \n(TLu
  620. \fBERR501\fR
  621. Not implemented.
  622. .TP \n(TLu
  623. \fBERR503\fR
  624. Service overloaded.
  625. .RE
  626. .PD
  627. .IP
  628. Succesful results.
  629. .RS 0.75in
  630. .PD 0
  631. .ft B
  632. .nr TL \w'ERRHOST'u+0.2i
  633. .ft R
  634. .TP \n(TLu
  635. \fBOK0\fR
  636. Successfull parse.
  637. .TP \n(TLu
  638. \fBOK201\fR
  639. Ressource succesfully created.
  640. .TP \n(TLu
  641. \fBOK200\fR
  642. Ressource succesfully read.
  643. .RE
  644. .PD
  645. .SH "LIMITATIONS"
  646. .SS "http_put"
  647. Filename is truncated to first 256 characters
  648. and type to 64.
  649. .SS "http_get"
  650. Filename is truncated to first 256 characters.
  651. .SS "http_head"
  652. Filename is truncated to first 256 characters.
  653. .SS "http_delete"
  654. Filename is truncated to first 256 characters.