proxies

PHP CURL - how to tell if the entire file requested was not fully downloaded

╄→尐↘猪︶ㄣ 提交于 2019-12-02 18:31:25
问题 I'm using CURL and a proxy to grab some xml files, occasionally only part of the XML document comes through and fails when I try to load/use the xml (simplexml_load_string). I thought something like.. if(curl_errno($ch)) { $error = curl_error($ch); // handle error } would catch this sorta error via CURL errno.. CURLE_PARTIAL_FILE (18) A file transfer was shorter or larger than expected. This happens when the server first reports an expected transfer size, and then delivers data that doesn't

Python Proxy Error With Requests Library

谁说胖子不能爱 提交于 2019-11-30 14:04:57
问题 I am trying to access the web via a proxy server in Python. I am using the requests library and I am having an issue with authenticating my proxy as the proxy I am using requires a password. proxyDict = { 'http' : 'username:mypassword@77.75.105.165', 'https' : 'username:mypassword@77.75.105.165' } r = requests.get("http://www.google.com", proxies=proxyDict) I am getting the following error: Traceback (most recent call last): File "<pyshell#13>", line 1, in <module> r = requests.get("http:/

Mocking a property of a CGLIB proxied service not working

荒凉一梦 提交于 2019-11-28 06:55:14
I'm having an issue when trying to mock a property of a service from within a Junit test: @ContextConfiguration("classpath:application-config.xml") @RunWith(SpringJUnit4ClassRunner.class) public class FooServiceTests { @Autowired private FooServiceImpl fooService; @Test public void testFoo() { String str = fooService.foo(); assertEquals("Var", str); } @Before public void mockFooDao() throws Exception { FooDao mockFooDao = Mockito.mock(FooDao.class); Mockito.when(mockFooDao.foo()).thenReturn("Var"); ReflectionTestUtils.setField(fooService, "fooDao", mockFooDao); } } Mocking fooDao has no effect

Why is my Entity Framework Code First proxy collection null and why can't I set it?

天大地大妈咪最大 提交于 2019-11-27 06:48:34
I am using DBContext and have two classes whose properties are all virtual. I can see in the debugger that I am getting a proxy object when I query the context. However, a collection property is still null when I try to add to it. I thought that the proxy would ensure that collection is initialized. Because my Poco object can be used outside of its data context, I added a check for the collection being null in the constructor and create it if necessary: public class DanceStyle { public DanceStyle() { if (DanceEvents == null) { DanceEvents = new Collection<DanceEvent>(); } } ... public virtual