Версия для печати темы
Нажмите сюда для просмотра этой темы в оригинальном формате
Форум программистов > Java: Работа с сетью > HttpConnection протокол http/1.1 | http/1.0


Автор: Bekass 1.9.2006, 14:40
Вопрос ....
Создаю соединение 
HttpConnection conn = (HttpConnection)Connector.open(url);

задаю

conn.setRequestMethod(HttpConnection.POST);
conn.setRequestProperty("Content-type","multipart/form-data; boundary=" + boundary);
и тд....
Север на который обращаюсь поддерживает http/1.1 
В http/1.1  работоет все нормально POST принемает ...
А если задать http/1.0 (в эмуляторе)
Сервер отвечает 

413 Объект запроса слишком большой, Request Entity Too Large.

В чем же разница ,,,,????
Как совместить http 1.0  c http 1.1? smile 
                

Автор: redrick 5.9.2006, 01:01
ну как бы я стал рассуждать:
Код

10.4.14 413 Request Entity Too Large

   The server is refusing to process a request because the request
   entity is larger than the server is willing or able to process. The
   server MAY close the connection to prevent the client from continuing
   the request.

   If the condition is temporary, the server SHOULD include a Retry-
   After header field to indicate that it is temporary and after what
   time the client MAY try again.

потом:
Код

19.2 Internet Media Type multipart/byteranges

   When an HTTP 206 (Partial Content) response message includes the
   content of multiple ranges (a response to a request for multiple
   non-overlapping ranges), these are transmitted as a multipart
   message-body. The media type for this purpose is called
   "multipart/byteranges".

   The multipart/byteranges media type includes two or more parts, each
   with its own Content-Type and Content-Range fields. The required
   boundary parameter specifies the boundary string used to separate
   each body-part.

       Media Type name:         multipart
       Media subtype name:      byteranges
       Required parameters:     boundary
       Optional parameters:     none
       Encoding considerations: only "7bit", "8bit", or "binary" are
                                permitted
       Security considerations: none


   For example:

   HTTP/1.1 206 Partial Content
   Date: Wed, 15 Nov 1995 06:25:24 GMT
   Last-Modified: Wed, 15 Nov 1995 04:58:08 GMT
   Content-type: multipart/byteranges; boundary=THIS_STRING_SEPARATES

   --THIS_STRING_SEPARATES
   Content-type: application/pdf
   Content-range: bytes 500-999/8000

   ...the first range...
   --THIS_STRING_SEPARATES
   Content-type: application/pdf
   Content-range: bytes 7000-7999/8000

   ...the second range
   --THIS_STRING_SEPARATES--

      Notes:

      1) Additional CRLFs may precede the first boundary string in the
         entity.






Fielding, et al.            Standards Track                   [Page 165]
 
RFC 2616                        HTTP/1.1                       June 1999


      2) Although RFC 2046 [40] permits the boundary string to be
         quoted, some existing implementations handle a quoted boundary
         string incorrectly.

      3) A number of browsers and servers were coded to an early draft
         of the byteranges specification to use a media type of
         multipart/x-byteranges, which is almost, but not quite
         compatible with the version documented in HTTP/1.1.


отсюда вопрос: что пихаешь в boundary ?
ftp://ftp.isi.edu/in-notes/rfc2616.txt

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)