| [ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] | 
Procedures for connecting via HTTP
An example of using these procedures is shown as follows.
; when you will establish a connection by GET method
(define con
  (make-http-connection "http://localhost/path"))
(http-properties-set! con '((request-method . get)))
(http-connect con)
(define pp
  (open-http-input-port
    con
    (buffer-mode block)
    (make-transcoder (utf-8-codec) (eol-style crlf))))
(get-line pp)
(close-port pp)
(disconnect-http con)
; when you will establish a connection by POST method
(define con
  (make-http-connection "http://localhost/path"))
(http-properties-set! con '((request-method . post)))
(post-http-parameter  ; setting parameters
  con
  '(("test1" . "aaaaaa")
    ("test2" . "bbbbb")))
(http-connect con)
(define pp
  (open-http-input-port
    con
    (buffer-mode block)
    (make-transcoder (utf-8-codec) (eol-style crlf))))
(get-line pp)
(close-port pp)
(disconnect-http con)
creates an HTTP connection.
raises an exception when a protocol of the URL is not HTTP(S).
sets properties to the connection.
Syntax for setting properties is shown as follows.
((property-name . string) ...)
property-name is a symbol or a string shown as follows.
| request-method | an HTTP method (GET or POST) | 
| allow-user-interatction | allow-user-interatction | 
| if-modified-since | if-modified-since | 
| use-caches | use-caches | 
| chunked-streaming-mode | chunked-streaming-mode | 
| fixed-length-streaming-mode | fixed-length-streaming-mode | 
posts parameters to the connection.
Parameters must be an associative list of strings.
establishs the HTTP connection.
This procedure returns two values, the first argument is #t if establishing a connection is succeed and the second is an HTTP request code such as 400.
gets a encoding, length, content-type, date, expiration date, last modified date of the connection, respectively.
gets all header informations by the associative list.
creates an input port of the connection.
buffer-mode and transcoder specifies the R6RS buffer mode and transcoder, respectively.
If trancoder is #f, a port to be created will be a binary port.
closes the HTTP connection.
gets a file from the URL via HTTP.
| [ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | 
 
  This document was generated on August 9, 2012 using texi2html 5.0.