**** Post for FREE via your newsreader at post.usenet.com ****
Please help me to put some content on apache + DAV server, whas wrong? -
-
import socket, os, stat
-
-
file=open('/home/nikola/somefile','rb')
-
lenght=os.fstat(file.fileno())[stat.ST_SIZE]
-
print lenght
-
-
headers={}
-
headers['Host']='localhost'
-
headers['Authorization']='Basic bmlrb2xhOnRlc3Q='
-
headers['Accept-Encoding']='identity'
-
headers['Content-Type']='application/octet-stream'
-
headers['Content-Encoding']='None'
-
headers['Content-Lenght']=lenght
-
-
-
data = '%s %s %s\r\n' %('PUT', '/dav/test1','HTTP/1.1')
-
for header, value in headers.items():
-
data += '%s: %s\r\n'%(header,value)
-
-
data += '\r\n'
-
-
sock=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-
sock.connect(('localhost', 80))
-
sock.send(data)
-
sock.send(file.read()) #doesnt work why?
-
response=sock.recv(2000)
-
print response
-
sock.close()
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
*** Usenet.com - The #1 Usenet Newsgroup Service on The Planet! *** http://www.usenet.com
Unlimited Download - 19 Seperate Servers - 90,000 groups - Uncensored
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 3 1409
Nikola Bjelicic wrote: **** Post for FREE via your newsreader at post.usenet.com ****
Please help me to put some content on apache + DAV server, whas wrong?
- import socket, os, stat
- file=open('/home/nikola/somefile','rb')
- lenght=os.fstat(file.fileno())[stat.ST_SIZE]
- print lenght
- headers={}
- headers['Host']='localhost'
- headers['Authorization']='Basic bmlrb2xhOnRlc3Q='
- headers['Accept-Encoding']='identity'
- headers['Content-Type']='application/octet-stream'
- headers['Content-Encoding']='None'
- headers['Content-Lenght']=lenght
- data = '%s %s %s\r\n' %('PUT', '/dav/test1','HTTP/1.1')
- for header, value in headers.items():
- data += '%s: %s\r\n'%(header,value)
- data += '\r\n'
- sock=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- sock.connect(('localhost', 80))
- sock.send(data)
- sock.send(file.read()) #doesnt work why?
- response=sock.recv(2000)
- print response
- sock.close()
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= *** Usenet.com - The #1 Usenet Newsgroup Service on The Planet! *** http://www.usenet.com Unlimited Download - 19 Seperate Servers - 90,000 groups - Uncensored -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Do you _really_ want to do this by hand with sockets? I would recommend
trying httplib: http://www.python.org/doc/current/li...-examples.html
Jeremy Jones
**** Post for FREE via your newsreader at post.usenet.com ****
Jeremy Jones wrote: Do you _really_ want to do this by hand with sockets? I would recommend trying httplib:
http://www.python.org/doc/current/li...-examples.html
Jeremy Jones
I would really like to post file-like object which is presumably large. I
need this for connection tracking like with urlgrabber, but for POST and
PUT requests.
Nikola Bjelicic
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
*** Usenet.com - The #1 Usenet Newsgroup Service on The Planet! *** http://www.usenet.com
Unlimited Download - 19 Seperate Servers - 90,000 groups - Uncensored
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> lenght=os.fstat (file.fileno())[stat.ST_SIZE] print lenght
headers['Content-Lenght']=lenght
I am not experienced with webDav, but perhaps you are trying to spell
"length". I believe the name of the header matters in this case.
- Josiah This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Johannes Eble |
last post by:
Hello Python community,
I am trying the echo-client and echo-server examples in Chapter 10,
"Programming Python" by Mark Lutz.
It is probably the most simple sockets sample: A socket server just
echoing the socket clients' requests.
The program works so far. I first start the server in one dos box,
then the client in another dos box on...
|
by: zoran |
last post by:
Hi, I have a simple TCP server client in .net and for some reason the
Accept() function in the Server part never gets called and never
returns a new socket. This thing has been driving me nuts for days,
here is the code please help if you can (the two machines that I am
trying to connect are on a LAN Ethernet):
Client()
{
Socket...
|
by: jm |
last post by:
Easy probably, please read on. I know some of you have commented
already about some of my socket question. I appreciate that.
I have a Form1:
static void Main()
{
Application.Run(new Form1());
clsListening.AsynchronousSocketListener.StartListening();
|
by: Daniel Sélen Secches |
last post by:
I found a good class to do a simple FTP.
Very good....
I'm posting it with the message, i hope it helps someone
==============================================================
Imports System.Net
|
by: Josema |
last post by:
Hi,
Im newbie in Sockets, and im trying to make an application to listen from a
port, and another to send bytes to this port...
I'm using asyncronous sockets, and i have the most of the code done, but i
dont know doesnt work.
//*******************************************
//here the server application
| |
by: Vitali Gontsharuk |
last post by:
Hi!
I have a problem programming a simple client-server game, which is
called pingpong ;-)
The final program will first be started as a server (nr. 2) and then as
a client. The client then sends the message "Ping" to the server, which
reads it and answers with a "Pong".
The game is really simple and the coding should be also very simple!...
|
by: SpreadTooThin |
last post by:
client:
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("192.168.1.101", 8080))
print 'Connected'
s.send('ABCD')
buffer = s.recv(4)
print buffer
s.send('exit')
|
by: =?Utf-8?B?UmFqbmk=?= |
last post by:
Dear William Stacey,
I have written a server code using the Windows Socket API's. Wherein I have
created the socket and bound it to a particular IP address and port number.
Later I have made the socket in non-blocking mode by using the proper socket
option ( i.e. SO_RCVTIMEO). After which with the use of recv() I am trying to
get into the...
|
by: fredszky |
last post by:
Hello
I am very new to perl, however i managed to make this server/client work with udp, now i would like to do the same thing but with TCP/IP, what must i do?
Server:
#!perl -w
# Server Program
use IO::Socket::INET;
print ">> Server Program <<\n";
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |